From b4b3cb3641ecdf56cdfdf3532e5acf4af46fbe48 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期二, 12 十二月 2023 18:33:45 +0800 Subject: [PATCH] 新增出入库明细页面,添加无权限展示页面,接口调整 --- src/views/overview/AddOverviewDialog.vue | 136 ++++++++++++++++++++++++++------------------ 1 files changed, 80 insertions(+), 56 deletions(-) diff --git a/src/views/overview/AddOverviewDialog.vue b/src/views/overview/AddOverviewDialog.vue index c6b7a82..9226689 100644 --- a/src/views/overview/AddOverviewDialog.vue +++ b/src/views/overview/AddOverviewDialog.vue @@ -6,7 +6,7 @@ <div slot="title" class="dialog-header"> <span>{{ editCommonConfig.title === "鏌ョ湅" ? editCommonConfig.title : editCommonConfig.title + addName }}</span> <div class="header_btns"> - <span class="btn" @click="btnPrint"> + <span class="btn" :style="{cursor:thatCursor,color:thatColor}" @click="btnPrint" :disabled="true"> <i class="el-icon-printer"></i> <span>鎵撳嵃</span> </span> @@ -183,13 +183,13 @@ </div> <!-- 鐗╂祦淇℃伅 --> <div v-if="activeName === 'two' && this.workType === 2"> - <el-form :rules="rules" ref="shipmentsInfo" label-position="right" :model="shipmentsInfo" label-width="120px" size="mini" + <el-form :rules="rules2" ref="shipmentsInfo" label-position="right" :model="editConfig.infomation" label-width="120px" size="mini" style="margin-top: 20px;"> <el-col :span="12"> <el-form-item label="鎵胯繍鍟�"> <el-select size="mini" :disabled="!showFooter" v-model="editConfig.infomation.logisticCompanyId" placeholder="璇烽�夋嫨" style="width: 90%;"> - <el-option v-for="item in shipmentsInfo.carrier" :key="item.id" :label="item.name" :value="item.id"> + <el-option v-for="item in editConfig.infomation.carrier" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> @@ -257,7 +257,7 @@ <!-- 灏� --> <div slot="footer" class="dialog-footer"> <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> - <el-button type="primary" size="small" @click="saveClick('form','shipmentsInfo')" :disabled="!showFooter">淇濆瓨</el-button> + <el-button type="primary" size="small" @click="saveClick" :disabled="!showFooter">淇濆瓨</el-button> <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> </div> </el-dialog> @@ -317,8 +317,10 @@ toLocationId: [{ required: true, message: "璇烽�夋嫨浠撳簱浣嶇疆", trigger: "change" }], fromLocationId: [{ required: true, message: "璇烽�夋嫨婧愪綅缃�", trigger: "change" }], operationTypeId: [{ required: true, message: "璇烽�夋嫨鍏ュ簱绫诲瀷", trigger: "change" }], - receiverPhone: [ - {required: true, message: "璇疯緭鍏ユ墜鏈哄彿", trigger: "change" }, + }, + rules2:{ + receiverPhone: [ + // {required: true, message: "璇疯緭鍏ユ墜鏈哄彿", trigger: "change" }, { pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, @@ -326,8 +328,7 @@ trigger: ["blur",'change' ], }, ] - - }, + }, companyOptions: [], // 鍏徃 supplierOptions: [],//渚涘簲鍟� clientOptions: [],//瀹㈡埛 @@ -359,10 +360,13 @@ waybillNumber: '', weight: 0, logisticWeight: 0, + receiverPhone:'' }, showCancel: false, // 鍙栨秷鏄惁鍙互鏄剧ず list: [], - pdfParams:{} + pdfParams:{}, + thatCursor:this.workType===3?"no-drop":'pointer', + thatColor:this.workType===3?'#ccc':'#000' } }, created() { @@ -531,40 +535,56 @@ async getLogisticCompanyList() { await getLogisticCompanyList().then((res) => { if (res.code === 200) { - this.shipmentsInfo.carrier = res.data + this.editConfig.infomation.carrier = res.data } }) }, // 淇濆瓨 - saveClick(formName,shipmentsInfo) { - this.$refs[formName,shipmentsInfo].validate((valid) => { - if (valid) { - for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].productName.length === 0) { - this.isNoProduct = true - break - } else { - this.isNoProduct = false - } - } - if (this.isNoProduct) { - this.$message.error("璇锋坊鍔犳槑缁嗚鎴栭�夋嫨浜у搧涓嶈兘涓虹┖") + saveClick() { + let validArr=[] + if(this.workType === 2){ + console.log("鍑哄簱") + validArr=[this.$refs.form.validate(),this.$refs.shipmentsInfo.validate()] + }else{ + console.log("鍏ュ簱") + validArr=[this.$refs.form.validate()] + } + console.log(validArr,"xxx") + Promise.all(validArr) + .then((results) => { + console.log(results,"鎵ц鎴愬姛") + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].productName.length === 0) { + this.isNoProduct = true + break } else { - let requestUrl = this.editConfig.title === "鏂板缓" ? addOperation : updateOperation - let params = this.saveParams() - requestUrl({ - ...params - }).then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛") - this.$parent.getData() - } - }) + this.isNoProduct = false } } + if (this.isNoProduct) { + this.$message.error("璇锋坊鍔犳槑缁嗚鎴栭�夋嫨浜у搧涓嶈兘涓虹┖") + } else { + let requestUrl = this.editConfig.title === "鏂板缓" ? addOperation : updateOperation + let params = this.saveParams() + requestUrl({ + ...params + }).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + if(this.editConfig.title === "鏂板缓"){ + this.$message.success("娣诲姞鎴愬姛") + }else { + this.$message.success("缂栬緫鎴愬姛") + } + this.$parent.getData() + } + }) + } }) + .catch((error) => { + console.error('琛ㄥ崟鏍¢獙鏈�氳繃:', error); + }); }, saveParams() { let data = this.editConfig.infomation @@ -801,29 +821,32 @@ }, //鎵撳嵃 async btnPrint() { - localStorage.removeItem('pdfParams'); - try { - let res = await printReceipts(this.editCommonConfig.infomation.id); - console.log(res); - if (res.code === 200) { - console.log(this.editConfig.infomation.baseOperationType,"绫诲瀷") - let pdfParams = { - url: res.data, - baseOperationType: this.editConfig.infomation.baseOperationType || undefined, - cutAfterWidth: this.editConfig.infomation.baseOperationType === 2 ? 50.8 : 53.3 - }; - var { href } = this.$router.resolve({ - path: '/overview/previewExcel', - query:{ - ...pdfParams - } - - }); - window.open(href, '_blank'); + if(this.workType!==3){ + localStorage.removeItem('pdfParams'); + try { + let res = await printReceipts(this.editCommonConfig.infomation.id); + console.log(res); + if (res.code === 200) { + console.log(this.editConfig.infomation.baseOperationType,"绫诲瀷") + let pdfParams = { + url: res.data, + baseOperationType: this.editConfig.infomation.baseOperationType || undefined, + cutAfterWidth: this.editConfig.infomation.baseOperationType === 2 ? 50.8 : 53.3 + }; + var { href } = this.$router.resolve({ + path: '/overview/previewExcel', + query:{ + ...pdfParams + } + + }); + window.open(href, '_blank'); + } + } catch (error) { + console.error(error); } - } catch (error) { - console.error(error); } + } } } @@ -847,6 +870,7 @@ .btn:nth-of-type(2) { cursor: no-drop; + color:#ccc; } } } -- Gitblit v1.8.0