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 |   71 +++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
index 45378e9..14316e5 100644
--- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
+++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
@@ -46,6 +46,15 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
+                <el-form-item label="鏈轰細鍚嶇О" prop="name">
+                  <div class="custom-name">
+                    <el-input v-model="editConfig.infomation.name"></el-input>
+                    <!-- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> -->
+                    <!-- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> -->
+                  </div>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
                 <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name" ref="clientName">
                   <div class="custom-name">
                     <el-autocomplete
@@ -71,15 +80,7 @@
                   </div>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
-                <el-form-item label="鏈轰細鍚嶇О" prop="name">
-                  <div class="custom-name">
-                    <el-input v-model="editConfig.infomation.name"></el-input>
-                    <!-- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> -->
-                    <!-- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> -->
-                  </div>
-                </el-form-item>
-              </el-col>
+
               <el-col :span="12">
                 <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name">
                   <div class="custom-name">
@@ -92,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')"
                     >
@@ -107,7 +114,7 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍟嗘満鏉ユ簮" prop="sales_sources_id">
+                <el-form-item label="鏈轰細鏉ユ簮" prop="sales_sources_id">
                   <div class="common-select">
                     <el-select
                       v-model="editConfig.infomation.sales_sources_id"
@@ -129,7 +136,7 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍟嗘満绫诲瀷" prop="sale_type_id">
+                <el-form-item label="鏈轰細绫诲瀷" prop="sale_type_id">
                   <div class="common-select">
                     <el-select
                       v-model="editConfig.infomation.sale_type_id"
@@ -571,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],
@@ -593,9 +601,6 @@
     },
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    contactNamelist() {
-      return this.$store.state.getClientName.contactNamelist
     }
   },
   data() {
@@ -639,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) {
@@ -776,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 = []
@@ -795,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
       }
@@ -810,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
@@ -831,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
@@ -847,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