From 6be75d9f734ca3cfe1056fbe2b5556b7cf142cf9 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 28 二月 2024 14:51:43 +0800
Subject: [PATCH] 销售明细单 选择了销售报价单之后带出对应的产品列表,切换或者清空操作的时候清空产品管理,并修改

---
 src/views/sales/quotation/AddQuotationDialog.vue       |    5 +++++
 src/components/makepager/CommonFormTableView.vue       |   21 ++++++++++++++++-----
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue |    7 ++++---
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 6cffcd6..1bf5fa7 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -296,15 +296,26 @@
     if (!this.selectBox) {
       this.getProductList()
     }
-    this.tableList = this.productTableList
-    if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
-      this.isRecalculate = false
-    } else {
-      this.isRecalculate = true
+    this.getTableInfo()
+  },
+  watch:{
+    "productTableList": {
+      handler() {
+        this.getTableInfo()
+      },
+      immediate: true
     }
   },
   computed: {},
   methods: {
+    getTableInfo(){
+      this.tableList = this.productTableList
+      if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
+        this.isRecalculate = false
+      } else {
+        this.isRecalculate = true
+      }
+    },
     // 浜у搧鍚嶇О
     async getProductList() {
       await getProductList({
diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue
index 4ab4bcd..543a115 100644
--- a/src/views/sales/quotation/AddQuotationDialog.vue
+++ b/src/views/sales/quotation/AddQuotationDialog.vue
@@ -617,6 +617,8 @@
         this.getSaleChanceList(item)
       } else if (value === "chance") {
         this.saleChanceId = item.id
+        this.productTableList.tableData = item.products?item.products:[]
+        this.tableData = item.products?item.products:[]
       } else {
         this.contactId = item.id
       }
@@ -642,6 +644,7 @@
         this.clientId = row.client.id
         this.saleChanceId = row.id
         this.productTableList.tableData = row.products?row.products:[]
+        this.tableData = row.products?row.products:[]
       } else {
         this.editConfig.infomation.client_name = row.name
         this.clientId = row.id
@@ -661,6 +664,8 @@
         this.editConfig.infomation.contact_name = ""
         this.contactId = 0
       }
+      this.productTableList.tableData = []
+      this.tableData = []
       this.refresh()
     },
     // 閿�鍞満浼氬垪琛�
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index 53e1390..290677e 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -920,8 +920,8 @@
         this.subbillId = item.id
         this.editConfig.infomation.subbill_name = item.number
       } else if (value === "quotation") {
-        // this.productTableList.tableData = item.products
-        // this.tableData = item.products
+        this.productTableList.tableData = item.products
+        this.tableData = item.products
         this.editConfig.infomation.quotation_number = item.number
         this.quotationId = item.id
       }
@@ -978,7 +978,7 @@
         this.subbillId = row.id
       } else if (value === "quotation") {
         this.productTableList.tableData = row.products
-        // this.tableData = row.products
+        this.tableData = row.products
         this.editConfig.infomation.quotation_number = row.number
         //鍙嶅悜 瀹㈡埛鍚嶇О
         this.editConfig.infomation.client_name = row.client.name
@@ -1014,6 +1014,7 @@
         this.quotationId = 0
       }
       this.productTableList.tableData = []
+      this.tableData = []
     },
     // 娣诲姞闄勪欢
     addAnnexClick() {},

--
Gitblit v1.8.0