From fb3da04f2244f66545462dcaaa63c0b5a4684976 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 28 二月 2024 15:38:22 +0800 Subject: [PATCH] 新增销售机会-产品管理-添加、上传、编辑产品数据处理 --- src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue | 50 +++++++++++++++++++++++++++++++++++--------------- 1 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue index 62d4db1..b9a4fec 100644 --- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue +++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue @@ -767,11 +767,11 @@ saveClick(formName) { this.$refs[formName].validate((valid) => { if (valid) { - const hasProduct = this.tableData.every((ele) => !!ele.name) - if (!hasProduct) { - this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") - return - } + // const hasProduct = this.tableData.every((ele) => !!ele.name) + // if (!hasProduct) { + // this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") + // return + // } const params = this.saveParams() console.log(params) @@ -810,6 +810,12 @@ }, saveParams() { let data = this.editConfig.infomation + let products = [] + this.tableData.map((item) => { + if (item.number.length > 0) { + products.push(item) + } + }) let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, advantages: data.advantages || "", @@ -847,7 +853,7 @@ detail_address: data.detail_address || "", codeStandID: data.ID, - products: this.tableData + products: products } return params }, @@ -981,8 +987,9 @@ } this.productTableList = { tableData: this.tableData, + isReturn: true, tableColumn: [ - { label: "#", prop: "productId", width: 40 }, + // { label: "#", prop: "productId", width: 40 }, { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true }, { label: "浜у搧缂栧彿", prop: "number" }, { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, @@ -993,9 +1000,9 @@ }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { - this.productId = row.productId + // this.productId = row.productId this.tableData.map((item) => { - if (item.productId === row.productId) { + if (item.number === row.number) { item[prop] = val } }) @@ -1016,13 +1023,26 @@ // this.showSummary.show = true }, // 鏂板鏂瑰紡淇敼 - getSelectArray(val) { - if (val.length > 0) { - val.map((item, index) => { - item.productId = this.tableData.length + index + 1 - }) + getSelectArray(val, index) { + // if (val.length > 0) { + // val.map((item, index) => { + // item.productId = this.tableData.length + index + 1 + // }) + // } + // this.tableData = this.tableData.concat(val) + // this.productTableList.tableData = this.tableData + // this.showSummary.show = true + if (this.tableData.length == 1 && this.tableData[0].number.length == 0) { + this.tableData = [] } - this.tableData = this.tableData.concat(val) + if (index < this.tableData.length) { + this.tableData.splice(index, 1) + val.map((item, ind) => { + this.tableData.splice(index + ind, 0, item) + }) + } else { + this.tableData = this.tableData.concat(val) + } this.productTableList.tableData = this.tableData this.showSummary.show = true }, -- Gitblit v1.8.0