From 1f4bc9f584c07a0958747657b7353ccbd1d56b41 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 16 八月 2023 17:39:00 +0800 Subject: [PATCH] bug修复及销售子单产品管理相关 --- src/views/sales/quotation/AddQuotationDialog.vue | 154 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 96 insertions(+), 58 deletions(-) diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue index fe4a0a6..da372c4 100644 --- a/src/views/sales/quotation/AddQuotationDialog.vue +++ b/src/views/sales/quotation/AddQuotationDialog.vue @@ -185,7 +185,7 @@ </el-row> </div> --> <!-- 浜у搧绠$悊 --> - <!-- <div class="basic-info-title" style="display: flex"> + <div class="basic-info-title" style="display: flex"> 浜у搧绠$悊 <div style="margin-left: 400px"> 甯佺 @@ -196,8 +196,13 @@ </div> </div> <div class="product-view"> - <CommonFormTableView :show-summary="showSummary" :product-table-list="productTableList" /> - </div> --> + <CommonFormTableView + :show-summary="showSummary" + :product-table-list="productTableList" + @inputContent="inputContent" + @addProductClick="addProductClick" + /> + </div> <!-- 閫夋嫨瀹℃壒娴佺▼ --> <!-- <div class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div> <div class="basic-info-view"> @@ -267,7 +272,7 @@ </template> <script> -// import CommonFormTableView from "@/components/makepager/CommonFormTableView" +import CommonFormTableView from "@/components/makepager/CommonFormTableView" import { getAllData } from "@/api/client/client" import { getAddQuotation, getUpdateQuotation } from "@/api/sales/quotation" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" @@ -287,7 +292,7 @@ } } }, - components: { SelectClientDialog, SelectContactDialog, SelectChanceDialog }, + components: { SelectClientDialog, SelectContactDialog, SelectChanceDialog, CommonFormTableView }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight @@ -320,7 +325,7 @@ showSummary: { show: true, total: true, - sumProp: ["other1", "other2", "other3", "other4"], + sumProp: ["Amount", "Unit", "other3"], mergeNumber: 3 }, editSelectClientConfig: { @@ -340,7 +345,11 @@ }, clientId: this.editCommonConfig.infomation.client_id, contactId: this.editCommonConfig.infomation.contact_id, - saleChanceId: this.editCommonConfig.infomation.sale_chance_id + saleChanceId: this.editCommonConfig.infomation.sale_chance_id, + tableData: [], + productId: 1, + addProductArr: [], + isProductName: false } }, created() { @@ -369,45 +378,45 @@ } }) }, + productNameValidate() { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].Name === "") { + this.isProductName = true + return + } else { + this.isProductName = false + } + } + }, // 淇濆瓨 saveClick(formName) { + this.productNameValidate() this.$refs[formName].validate((valid) => { if (valid) { - console.log(this.editConfig.infomation) - const params = this.saveParams() - console.log(params) - if (this.editConfig.title === "鏂板缓") { - getAddQuotation(params) - .then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message({ - message: "娣诲姞鎴愬姛", - type: "success" - }) - this.$parent.getData() - } - }) - .catch((err) => { - console.log(err) - }) + console.log(this.isProductName) + if (this.isProductName) { + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") } else { - getUpdateQuotation(params) - .then((res) => { + const params = this.saveParams() + console.log(params) + if (this.editConfig.title === "鏂板缓") { + getAddQuotation(params).then((res) => { console.log(res) this.editConfig.visible = false if (res.code === 200) { - this.$message({ - message: "缂栬緫鎴愬姛", - type: "success" - }) + this.$message.success("娣诲姞鎴愬姛") this.$parent.getData() } }) - .catch((err) => { - console.log(err) + } else { + getUpdateQuotation(params).then((res) => { + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getData() + } }) + } } } else { console.log("error submit") @@ -427,7 +436,8 @@ number: data.number || "", quotation_status_id: data.quotation_status_id || 0, sale_chance_id: this.saleChanceId || 0, - validity_date: data.validity_date || "" + validity_date: data.validity_date || "", + products: this.tableData } return params }, @@ -502,36 +512,64 @@ // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡 setFormatClick() {}, setTableForm() { - this.productTableList = { - tableData: [ + if (this.editConfig.title === "鏂板缓") { + this.tableData = [ { - id: "1", - productName: "涓婃捣鏈夐檺鍏徃", - other0: "ZDYBD03-1", - other1: "12", - other2: "5.00", - other4: "3.00", - other3: "2.00" + id: 1, + Amount: 0, + IsSale: true, + MaterialMode: "", + MinInventory: 0, + Name: "", + Number: "", + PurchaseType: "", + SalePrice: 0, + Unit: "" } - ], + ] + } else { + this.tableData = this.editConfig.infomation.products + } + this.productTableList = { + tableData: this.tableData, tableColumn: [ { label: "#", prop: "id", width: 40 }, - { label: "鍚◣鍗曚环", prop: "other9", input: true }, - { label: "浜у搧鍚嶇О", prop: "productName", input: true, isRequird: true }, - { label: "浜у搧缂栧彿", prop: "other0" }, - { label: "鏁伴噺", prop: "other1", input: true, isRequird: true }, - { label: "鎶樻墸鐜�(%)", prop: "other6", input: true }, - { label: "涓嶅惈绋庡崟浠�", prop: "other7", input: true }, - { label: "鎶樻墸棰�", prop: "other2" }, - { label: "绋�(閿�鍞�)", prop: "other7", input: true }, - { label: "瀹為檯鍚◣鍗曚环", prop: "other3" }, - { label: "涓嶅惈绋庨噾棰�", prop: "other4" }, + { label: "浜у搧鍚嶇О", prop: "Name", input: true, isRequird: true }, + { label: "浜у搧缂栧彿", prop: "Number" }, + { label: "鏁伴噺", prop: "Amount", input: true, isRequird: true }, + { label: "閿�鍞崟浠�", prop: "Unit", input: true }, { label: "浠风◣鍚堣", prop: "other3", input: true }, - { label: "鎻忚堪", prop: "other8" }, - { label: "婧愬崟绫诲瀷", prop: "other5" }, - { label: "婧愬崟", prop: "other6" } + { label: "鎻忚堪", prop: "other8" } ] } + }, + // 浜у搧鍒楄〃杈撳叆 + inputContent(val, prop, row) { + console.log("aaaaaaaa") + console.log(val, prop) + this.productId = row.id + this.tableData.map((item) => { + if (item.id === row.id) { + item[prop] = val + } + }) + console.log(this.tableData) + }, + // 浜у搧鏂板 + addProductClick() { + this.productId++ + this.tableData.push({ + id: this.productId, + Amount: 0, + IsSale: true, + MaterialMode: "", + MinInventory: 0, + Name: "", + Number: "", + PurchaseType: "", + SalePrice: 0, + Unit: "" + }) } } } -- Gitblit v1.8.0