From 1fc6fb99de36cc345e23f8ca5a6cbb9bc1828c07 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期一, 04 九月 2023 13:50:23 +0800 Subject: [PATCH] 11 --- src/views/project/travelexpenseapply/travelexpensedetail/index.vue | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 215 insertions(+), 22 deletions(-) diff --git a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue index 8f943b0..95d53df 100644 --- a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue +++ b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue @@ -216,6 +216,7 @@ :data="rbDetails" ref="table" border + max-height="400" highlight-current-row :summary-method="getSummaries" show-summary @@ -658,6 +659,7 @@ <el-table :data="rbPayees" border + max-height="400" highlight-current-row :summary-method="getSummaries" show-summary @@ -916,7 +918,14 @@ </div> </div> - <el-dialog :title="pdftitle" :visible.sync="pdfVisible" width="50%"> + <el-dialog + v-dialogDrags + :modal="false" + :close-on-click-modal="false" + :title="pdftitle" + :visible.sync="pdfVisible" + width="60%" + > <div class="pdfimg"> <div class="box-pdf"> <div> @@ -925,7 +934,9 @@ class="upload-demo" :action="uploadFileUrl" :file-list="fileListto" + :show-file-list="false" multiple + drag :limit="20" :headers="headers" :on-success=" @@ -939,22 +950,59 @@ :on-remove="remove" accept="image/*,.pdf" > - <el-button - :disabled="operationType == 'detail'" - size="small" - type="primary" - >涓婁紶</el-button - > + <i class="el-icon-upload"></i> + <div class="el-upload__text"> + 灏嗙エ鎹嫋鍒版澶勶紝鎴� + <em + ><el-button + :disabled="operationType == 'detail'" + size="small" + type="primary" + >鐐瑰嚮涓婁紶</el-button + ></em + > + </div> </el-upload> + <el-table + :data="fileListto" + @row-click="downFile" + style="width: 100%" + > + <el-table-column + prop="name" + :show-overflow-tooltip="true" + label="鍚嶇О" + > + <template slot-scope="scope"> + <i style="color:#409EFF" class=" el-icon-s-order" />{{ + scope.row.name + }} + </template> + </el-table-column> + + <el-table-column + prop="name" + width="180" + :show-overflow-tooltip="true" + label="鍔熻兘" + > + <template slot-scope="scope"> + <el-button + type="primary" + size="mini" + @click.native.prevent="deletedowfile(scope.row)" + >鍒犻櫎</el-button + > + <el-button + type="primary" + size="mini" + @click.native.prevent="moveupdowfile(scope.row)" + >涓婄Щ</el-button + > + </template> + </el-table-column> + </el-table> </div> - <!-- <div - class="pdftit" - @click="pdffn(item)" - v-for="item in fileList" - :key="item.name" - > - {{ item.name }} - </div> --> </div> <div v-if="this.previewpdf" class="pdfimgmin"> @@ -971,6 +1019,21 @@ </div> <div v-else class="pdfimgmins">{{ hintitle }}</div> </div> + </el-dialog> + <el-dialog title="鎻愮ず" :visible.sync="Savereminder" width="30%"> + <el-alert + :title=" + '鎮ㄥ凡娣诲姞' + + totalquantity + + '鏉℃暟鎹紝涓洪槻姝㈡暟鎹涪澶辨槸鍚︽彁浜や繚瀛樺啀缁х画娣诲姞銆�' + " + type="warning" + > + </el-alert> + <span slot="footer" class="dialog-footer"> + <el-button @click="unsave">鍙� 娑�</el-button> + <el-button type="primary" @click="Savenow">纭� 瀹�</el-button> + </span> </el-dialog> </div> </template> @@ -1014,6 +1077,7 @@ import { getSubsidy } from "@/api/project/travelcity"; import { listReportname, listUser } from "@/api/project/organization"; import { getToken } from "@/utils/auth"; +import debounce from "lodash/debounce"; export default { components: { Treeselect, @@ -1057,6 +1121,9 @@ label: "" }, pdfimgsrcList: [], + Savereminder: false, //鎻愰啋淇濆瓨寮规 + Reminderquantity: 0, //鎻愰啋鏁伴噺 + totalquantity: 0, //鎬绘暟閲� hintitle: "閫変腑宸︿晶宸蹭笂浼犳枃浠堕瑙堟煡鐪�", atpresent: "", @@ -1283,9 +1350,12 @@ this.fileListto = this.rbDetails[index].annexfilesList; console.log(this.fileListto); this.pdfimg = this.Networkheader + "/prod-api" + this.fileListto[0].url; - console.log(this.pdfimg); this.pdfimgsrcList = []; - this.pdfimgsrcList.push(this.pdfimg); + this.fileListto.forEach(item => { + this.pdfimgsrcList.push(this.Networkheader + "/prod-api" + item.url); + }); + console.log(this.pdfimgsrcList); + console.log(this.pdfimg); } else { this.fileListto = []; this.pdfimg = ""; @@ -1306,8 +1376,8 @@ this.previewpdf = true; if (item.url) { this.pdfimg = this.Networkheader + "/prod-api" + item.url; - this.pdfimgsrcList = []; - this.pdfimgsrcList.push(this.pdfimg); + // this.pdfimgsrcList = []; + // this.pdfimgsrcList.push(this.pdfimg); console.log(this.pdfimg); } else { this.pdfimg = this.Networkheader + "/prod-api" + item.response.url; @@ -1317,6 +1387,23 @@ this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮"); this.previewpdf = false; } + }, + getIndexInArray(arr, obj) { + return arr.indexOf(obj); + }, + // 鐐瑰嚮鍒犻櫎 + deletedowfile(row) { + console.log(this.fileListto); + console.log(row); + const index = this.getIndexInArray(this.fileListto, row); + this.fileList = this.fileListto.splice(index, 1); + console.log(index); + }, + // 鐐瑰嚮涓婄Щ + moveupdowfile(row) { + const index = this.getIndexInArray(this.fileListto, row); + const item = this.fileListto.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓� + this.fileListto.splice(index - 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣� }, /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */ @@ -1944,7 +2031,7 @@ }, /** 鎻愪氦淇濆瓨鎸夐挳 */ - submitForm() { + submitForm: debounce(function(data) { this.$refs["form"].validate(valid => { if (valid) { // idisabled=true; @@ -2095,7 +2182,7 @@ } } }); - }, + }, 500), /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { @@ -2128,6 +2215,100 @@ this.exportLoading = false; }) .catch(() => {}); + }, + // 鍙栨秷鎻愰啋 + unsave() { + this.Savereminder = false; + this.Reminderquantity = 0; + }, + // 鎺ュ彈鎻愰啋绔嬪埢淇濆瓨 + Savenow() { + this.Savereminder = false; + this.Reminderquantity = 0; + this.totalquantity = 0; + this.$refs["form"].validate(valid => { + if (valid) { + //绁ㄦ嵁鏂囦欢澶勭悊 + let list = this.fileListto; + console.log(list); + + //鏍¢獙璇锋閲戦鍚堣鏄惁绛変簬鎶ラ攢鍗曢噾棰� + if ( + this.form.amountrequested != + this.rbPayees.reduce( + (amount, item) => amount + Number(item.amount), + 0.0 + ) + ) { + this.$message({ + message: + "鎶ラ攢璇锋琛ㄤ腑鍚堣閲戦涓嶇瓑浜庢姤閿�鍗曠殑鎶ラ攢閲戦锛岃鏇存鍚庡啀淇濆瓨锛�", + type: "warning" + }); + return; + } + + const rbDetails = [...this.rbDetails]; + const rbPayees = [...this.rbPayees]; + if (this.form.id != null) { + console.log(this.form); + updateReimbursement(this.form); + // .then(res => { + //淇濆瓨鏄庣粏 + for (let i = 0; i < rbDetails.length; i++) { + if (rbDetails[i].rbid != null) { + updateReimbursementdetail(rbDetails[i]); + } else { + //rbid鍏宠仈涓昏〃Id + rbDetails[i].rbid = this.form.id; + addReimbursementdetail(rbDetails[i]); + } + } + + //淇濆瓨璐︽埛 + for (let i = 0; i < rbPayees.length; i++) { + if (rbPayees[i].rbid != null) { + updateReimbursementpayee(rbPayees[i]); + } else { + //rbid鍏宠仈涓昏〃Id + rbPayees[i].rbid = this.form.id; + addReimbursementpayee(rbPayees[i]); + } + } + + this.$modal.msgSuccess("淇敼鎶ラ攢鍗曚繚瀛樻垚鍔�!"); + + // this.getList(); + // }) + // .catch(err => { + // this.$modal.msgError("淇敼鎶ラ攢鍗曚繚瀛樺け璐ワ紒"); + // }); + } else { + this.form.recordstatus = -1; + addReimbursement(this.form) + .then(response => { + //淇濆瓨鏄庣粏 + for (let i = 0; i < rbDetails.length; i++) { + //rbid鍏宠仈涓昏〃Id + rbDetails[i].rbid = response.data; + addReimbursementdetail(rbDetails[i]); + } + + //淇濆瓨璐﹀彿 + for (let i = 0; i < rbPayees.length; i++) { + //rbid鍏宠仈涓昏〃Id + rbPayees[i].rbid = response.data; + addReimbursementpayee(rbPayees[i]); + } + + this.$modal.msgSuccess("鏂板鎶ラ攢鍗曚繚瀛樻垚鍔�!"); + }) + .catch(err => { + this.$modal.msgError("鏂板鎶ラ攢鍗曚繚瀛樺け璐ワ紒"); + }); + } + } + }); }, //鏂板涓�琛� @@ -2172,11 +2353,17 @@ personname: null, destination: null }; + // if (this.Reminderquantity >= 5) { + // this.Savereminder = true; + // return; + // } if (rowIndex == undefined || rowIndex == null || rowIndex < 0) { this.rbDetails.push(rowData); } else { this.rbDetails.splice(rowIndex + 1, 0, rowData); } + this.Reminderquantity++; + this.totalquantity++; for (let i = 0; i < this.rbDetails.length; i++) { this.rbDetails[i].orderno = i + 1; } @@ -2195,11 +2382,17 @@ personname: null, amount: null }; + // if (this.Reminderquantity >= 5) { + // this.Savereminder = true; + // return; + // } if (rowIndex == undefined || rowIndex == null || rowIndex <= 0) { this.rbPayees.push(rowData); } else { this.rbPayees.splice(rowIndex + 1, 0, rowData); } + this.Reminderquantity++; + this.totalquantity++; for (let i = 0; i < this.rbPayees.length; i++) { this.rbPayees[i].orderno = i + 1; } @@ -2596,7 +2789,7 @@ height: 600px; .box-pdf { - width: 200px; + width: 400px; padding-top: 20px; margin-right: 30px; border: 1px solid #dcdfe6; -- Gitblit v1.9.3