From a63d71177a2899b01da37e5bfc2d498bec5f80be Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 17 十月 2023 15:10:13 +0800
Subject: [PATCH] Merge branch 'dev' of http://192.168.5.5:10010/r/web/crm-web into zhengwenfeng/modify-style

---
 src/views/sales/subOrder/AddSubOrderDialog.vue |   51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/src/views/sales/subOrder/AddSubOrderDialog.vue b/src/views/sales/subOrder/AddSubOrderDialog.vue
index 3acc1ed..55628d2 100644
--- a/src/views/sales/subOrder/AddSubOrderDialog.vue
+++ b/src/views/sales/subOrder/AddSubOrderDialog.vue
@@ -78,14 +78,17 @@
                       "
                       value-key="number"
                       @select="handleSelectClient('master', $event)"
+                      placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О"
+                      :disabled="isAddMaster"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick('master')">
+                    <div v-if="!isAddMaster" class="common-select-btn" @click="selClientClick('master')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
                     <div
                       v-if="
                         editConfig.infomation.master_order_number &&
-                        editConfig.infomation.master_order_number.length > 0
+                        editConfig.infomation.master_order_number.length > 0 &&
+                        !isAddMaster
                       "
                       class="common-select-btn"
                       @click="clearupClient('master')"
@@ -189,6 +192,7 @@
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 import WordInput from "@/components/wordInput.vue"
 import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
+import { getMasterOrderList } from "@/api/sales/masterOrder"
 
 export default {
   name: "SubOrderDialog",
@@ -209,10 +213,10 @@
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    masterOrderList() {
-      return this.$store.state.getClientName.masterOrderList
     }
+    // masterOrderList() {
+    //   return this.$store.state.getClientName.masterOrderList
+    // }
   },
   data() {
     return {
@@ -221,6 +225,7 @@
       editConfig: this.editCommonConfig,
       rules: {
         number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+        master_order_number: [{ required: true, message: "璇烽�夋嫨鎴栧垱寤洪攢鍞�诲崟", trigger: "blur" }],
         client_name: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
         memberId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
       },
@@ -258,12 +263,14 @@
       tableData: [],
       productId: 1,
       addProductArr: [],
-      objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞瓙鍗曠紪鐮�", codeStandID: "" }
+      objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞瓙鍗曠紪鐮�", codeStandID: "" },
+      isAddMaster: true,
+      masterOrderList: []
     }
   },
   created() {
     this.$store.dispatch("geClient")
-    this.$store.dispatch("geMaster")
+    // this.$store.dispatch("geMaster")
     this.setTableForm()
     this.getCommonData()
     this.formInfo()
@@ -319,6 +326,7 @@
     // 淇濆瓨
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
+        this.validateFormNumber()
         if (valid) {
           console.log(this.editConfig.infomation)
           for (let i = 0; i < this.tableData.length; i++) {
@@ -377,6 +385,20 @@
     handleClose() {
       this.editConfig.visible = false
     },
+    // 鑾峰彇閿�鍞�诲崟
+    getMasterList(id) {
+      getMasterOrderList({
+        page: 0,
+        pageSize: 0,
+        search_map: {
+          client_id: id
+        }
+      }).then((res) => {
+        if (res.code == 200) {
+          this.masterOrderList = res.data.list
+        }
+      })
+    },
     // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
     querySearchAsync(queryString, cb, value) {
       var restaurants = []
@@ -401,9 +423,15 @@
     handleSelectClient(value, item) {
       if (value === "client") {
         this.clientId = item.id
+        this.isAddMaster = false
+        this.getMasterList(item.id)
+        this.editConfig.infomation.master_order_number = ""
+        this.masterId = 0
       } else if (value === "master") {
+        this.editConfig.infomation.master_order_number = item.number
         this.masterId = item.id
       }
+      this.refresh()
     },
     selClientClick(value) {
       if (value == "client") {
@@ -411,15 +439,19 @@
       } else if (value == "master") {
         this.editSelectMasterConfig.title = "閿�鍞�诲崟"
         this.editSelectMasterConfig.editVisible = true
+        this.editSelectMasterConfig.clientId = this.clientId
         this.editSelectMasterConfig.tableInfomation = [...this.masterOrderList]
       }
     },
     selClient(row, value) {
-      console.log(row)
       if (value == "client") {
         this.editConfig.infomation.client_name = row.name
         this.editConfig.infomation.client_id = row.id
         this.clientId = row.id
+        this.isAddMaster = false
+        this.getMasterList(row.id)
+        this.editConfig.infomation.master_order_number = ""
+        this.masterId = 0
       } else if (value == "master") {
         this.editConfig.infomation.master_order_number = row.number
         this.masterId = row.id
@@ -432,6 +464,9 @@
         this.editConfig.infomation.client_name = ""
         this.editConfig.infomation.client_id = 0
         this.clientId = 0
+        this.isAddMaster = true
+        this.editConfig.infomation.master_order_number = ""
+        this.masterId = 0
       } else if (value == "master") {
         this.editConfig.infomation.master_order_number = ""
         this.masterId = 0

--
Gitblit v1.8.0