From f69afc7461e1c2d92a935c0228b77388637de2e4 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 22 十二月 2023 11:25:31 +0800 Subject: [PATCH] 明细单添加编辑接口+编辑产品列表赋值逻辑修改+查看时限制操作的方法逻辑修改+毛利毛利率计算给列表赋值 --- src/components/makepager/CommonFormTableView.vue | 25 +++++++----- src/views/sales/salesDetails/AddSalesDetailsDialog.vue | 36 ++++++++++-------- src/views/sales/salesDetails/index.vue | 12 +++--- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index d8ecea7..1b9765c 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -133,13 +133,7 @@ ></el-input-number> </el-form-item> <span v-else> - <template v-if="pageName=='quotation'&&item.prop=='profit'"> - {{ (scope.row.price&&scope.row.cost)?Number(scope.row.price)-Number(scope.row.cost):'' }} - </template> - <template v-if="pageName=='quotation'&&item.prop=='margin'"> - {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2):'' }} - </template> - <template v-else> + <template> {{ scope.row[item.prop] }} </template> </span> @@ -168,7 +162,7 @@ <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span> </template> </el-table-column> - <el-table-column label="鎿嶄綔" width="40" align="center"> + <el-table-column label="鎿嶄綔" width="40" v-if="!detailEnter" align="center"> <template slot-scope="scope"> <el-button type="text" @@ -421,10 +415,21 @@ /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; if (!reg2.test(value)||value==0) { this.$message.error("鎴愭湰鍗曚环闇�瑕佸~鍐欏ぇ浜�0鐨�2浣嶅皬鏁帮紒") + return true; } this.$forceUpdate() } - this.$emit("inputContent", val, prop, row) + if(this.pageName=='quotation'){ + if(prop=='price'||prop=='cost'){ + if(scope.row.price&&scope.row.cost){ + let profit=Number(scope.row.price)-Number(scope.row.cost) + scope.row.profit=profit+''; + let margin=((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2) + scope.row.margin=margin+''; + } + } + } + this.$emit("inputContent", val, prop, row,scope) }, // 娓呯┖ empty() { @@ -435,7 +440,7 @@ deleteClick(scope){ this.tableList.tableData.splice(scope.$index,1) this.$forceUpdate(); - this.$message.success('鍒犻櫎闄ゆ垚鍔燂紒') + this.$message.success('鍒犻櫎鎴愬姛锛�') this.$emit("deleteClick",scope) }, // 閲嶇畻 diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue index 83c70a2..c729843 100644 --- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue +++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue @@ -405,6 +405,8 @@ <!-- :detail-enter="true" --> <CommonFormTableView ref="commonFormTableView" + :detail-enter="isView?true:false" + :selectBox="false" :show-summary="showSummary" pageName="quotation" :isOperate="((autoCodeHeadersObj.bjd=='yes'&&editConfig.infomation.quotation_number)||autoCodeHeadersObj.bjd!='yes')?true:false" @@ -597,7 +599,6 @@ quotationId: this.editCommonConfig.infomation.quotationId, tableData: [], isView: this.editCommonConfig.title === "鏌ョ湅", - selectBox: this.editCommonConfig.title !== "鏌ョ湅", thatMember: {} } }, @@ -772,21 +773,21 @@ console.log(res) this.quotationList = res.data.list if (value === "鍏ㄩ儴浜у搧") { - this.quotationList.map((item) => { - if (item.id === this.editConfig.infomation.quotationId) { - this.tableData = item.products - this.tableData.map((item, index) => { - item.productId = index + 1 - this.tableData.forEach((key) => { - if (item.number === key.number) { - item.amount = key.amount - item.id = key.id - } - }) - }) - this.productTableList.tableData = this.tableData - } - }) + // this.quotationList.map((item) => { + // if (item.id === this.editConfig.infomation.quotationId) { + + // this.tableData.map((item, index) => { + // item.productId = index + 1 + // this.tableData.forEach((key) => { + // if (item.number === key.number) { + // item.amount = key.amount + // item.id = key.id + // } + // }) + // }) + + // } + // }) } } }) @@ -956,6 +957,9 @@ ] } else { this.tableData = this.editConfig.infomation.products + this.tableData.map((item, index) => { + item.productId = index + 1 + }) this.getQuotation(this.editConfig.infomation.saleChanceId, "鍏ㄩ儴浜у搧") } // let productData = this.quotationList.products diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue index da26a37..7f6b45f 100644 --- a/src/views/sales/salesDetails/index.vue +++ b/src/views/sales/salesDetails/index.vue @@ -511,16 +511,16 @@ }, // 鏌ョ湅 缂栬緫 handleClick(row, title) { - console.log(row, title) - this.editConfig.visible = true + let params = JSON.parse(JSON.stringify(row)); this.editConfig.title = title this.editConfig.infomation = { - ...row, + ...params, currency: "浜烘皯甯�", - sale_chance_name: row.saleChance.name, - deliverType: row.deliverType === 0 ? "" : row.deliverType, - quotation_number: row.quotation.number + sale_chance_name: params.saleChance.name, + deliverType: params.deliverType === 0 ? "" : params.deliverType, + quotation_number: params.quotation.number } + this.editConfig.visible = true }, // 纭鎻愪氦 async submitClick(row) { -- Gitblit v1.8.0