From 33836e44d74759010d8e79f3cc702186c4bdf4ea Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 17 十月 2023 11:22:56 +0800
Subject: [PATCH] bug修复(5235 5236)

---
 src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
index 5e5f9aa..14316e5 100644
--- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
+++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
@@ -93,12 +93,18 @@
                       "
                       value-key="name"
                       @select="handleSelectClient('contact', $event)"
+                      placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О"
+                      :disabled="isContact"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick('contact')">
+                    <div v-if="!isContact" class="common-select-btn" @click="selClientClick('contact')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
                     <div
-                      v-if="editConfig.infomation.contact_name && editConfig.infomation.contact_name.length > 0"
+                      v-if="
+                        editConfig.infomation.contact_name &&
+                        editConfig.infomation.contact_name.length > 0 &&
+                        !isContact
+                      "
                       class="common-select-btn"
                       @click="clearupClient('contact')"
                     >
@@ -572,6 +578,7 @@
 import { getCityList } from "@/api/common/address"
 import WordInput from "@/components/wordInput.vue"
 import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
+import { getContactList } from "@/api/client/contacts"
 export default {
   name: "AddSalesOpportunityDialog",
   mixins: [codeMixin],
@@ -594,9 +601,6 @@
     },
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    contactNamelist() {
-      return this.$store.state.getClientName.contactNamelist
     }
   },
   data() {
@@ -640,17 +644,22 @@
       restaurants: [],
       clientId: this.editCommonConfig.infomation.client_id,
       contactId: this.editCommonConfig.infomation.contact_id,
-      objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞満浼氱紪鐮�", codeStandID: "" }
+      objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞満浼氱紪鐮�", codeStandID: "" },
+      isContact: true,
+      contactNamelist: []
     }
   },
   created() {
     this.$store.dispatch("geClient")
-    this.$store.dispatch("geContact")
     if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) {
       this.getCityList(this.editConfig.infomation.province_id, "edit")
     }
     this.getCommonData()
     this.formInfo()
+    if (this.editConfig.title === '缂栬緫'){
+      this.isContact = false
+      this.getContactList(this.editConfig.infomation.contact_id)
+    }
   },
   watch: {
     "editConfig.visible"(val) {
@@ -777,6 +786,19 @@
       }
       return params
     },
+    // 鑾峰彇鑱旂郴浜哄垪琛�
+    getContactList(id) {
+      getContactList({
+        clientId: id,
+        page: 0,
+        pageSize: 0,
+        search_map: {}
+      }).then((res) => {
+        if (res.code == 200) {
+          this.contactNamelist = res.data.list
+        }
+      })
+    },
     // 閫夋嫨鐢ㄦ埛鐩稿叧鏂规硶
     querySearchAsync(queryString, cb, value) {
       var restaurants = []
@@ -796,6 +818,8 @@
     handleSelectClient(value, item) {
       if (value === "client") {
         this.clientId = item.id
+        this.isContact = false
+        this.getContactList(item.id)
       } else if (value === "contact") {
         this.contactId = item.id
       }
@@ -811,6 +835,8 @@
       if (value === "contact") {
         this.editConfig.infomation.contact_name = row.name
         this.contactId = row.id
+        this.isContact = false
+        this.getContactList(row.id)
       } else if (value === "client") {
         this.editConfig.infomation.client_name = row.name
         this.clientId = row.id
@@ -832,6 +858,9 @@
       if (value === "client") {
         this.editConfig.infomation.client_name = ""
         this.clientId = 0
+        this.isContact = true
+        this.editConfig.infomation.contact_name = ""
+        this.contactId = 0
       } else if (value === "contact") {
         this.editConfig.infomation.contact_name = ""
         this.contactId = 0
@@ -848,9 +877,8 @@
     },
     async getCityList(val, value) {
       await getCityList({ province_id: val }).then((res) => {
-        console.log(res)
-        if (res.data.code === 200) {
-          this.cityOptions = res.data.data.list
+        if (res.code === 200) {
+          this.cityOptions = res.data.list
           if (value === "sel") {
             this.editConfig.infomation.city_id = ""
           }

--
Gitblit v1.8.0