From c5d68d050a5fb84f2e60a34409809fb0b08466c5 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 28 二月 2024 15:22:13 +0800
Subject: [PATCH] 跟进记录模块 如果客户名称有值查询对应的销售机会列表,如果没有查询所有销售机会的逻辑

---
 src/views/client/followupRecords/AddFollowupRecordsDialog.vue |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue
index 1fbdcef..92575c0 100644
--- a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue
+++ b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue
@@ -167,6 +167,7 @@
               <el-col v-if="isUnflod" :span="12">
                 <el-form-item label="閿�鍞満浼�" prop="sale_chance_name">
                   <div class="custom-name">
+                    <!-- :disabled="isChance" -->
                     <el-autocomplete
                       v-model="editConfig.infomation.sale_chance_name"
                       :fetch-suggestions="
@@ -177,17 +178,17 @@
                       value-key="name"
                       @select="handleSelectClient('chance', $event)"
                       style="width: 100%"
-                      placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О"
-                      :disabled="isChance"
+                      placeholder="璇烽�夋嫨閿�鍞満浼�"
                     ></el-autocomplete>
-                    <div v-if="!isChance" class="common-select-btn" @click="selClientClick('chance')">
+                    <!-- v-if="!isChance" -->
+                    <div  class="common-select-btn" @click="selClientClick('chance')">
                       <i class="el-icon-circle-plus-outline"></i>
                     </div>
+                    <!-- &&!isChance -->
                     <div
                       v-if="
                         editConfig.infomation.sale_chance_name &&
-                        editConfig.infomation.sale_chance_name.length > 0 &&
-                        !isChance
+                        editConfig.infomation.sale_chance_name.length > 0 
                       "
                       class="common-select-btn"
                       @click="clearupClient('chance')"
@@ -404,7 +405,7 @@
       editConfig: this.editContactsConfig,
       rules: {
         number: [{ required: true, validator: this.validateCheckCode, trigger: ["blur", "change"] }],
-        member_id: [{ required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" }],
+        member_id: [{ required: true, validator: this.validateMemberId, trigger: "change" }],
         record: [{ required: true, message: "璇疯緭鍏ヨ窡杩涜褰�", trigger: "blur" }],
         client_name: [{ required: true, validator: this.checkClient, trigger: "change" }],
         contact_name: [{ required: true, message: "璇烽�夋嫨鑱旂郴浜哄鍚�", trigger: "change" }],
@@ -463,6 +464,10 @@
     }
   },
   created() {
+    this.getChanceList(this.editConfig.infomation.client_id)
+    if(this.editContactsConfig.title==="缂栬緫"){
+      this.isChance=false
+    }
     this.$store.dispatch("geClient")
     this.getCommonData()
     this.getContactInfoList()
@@ -493,6 +498,15 @@
         console.log(res)
         this.clientStatusOptions = res.data.client_status
         this.memberOptions = res.data.member
+        if (this.editConfig.title === "鏂板缓") {
+          let username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
+          this.memberOptions.map((item) => {
+            if (item.username == username) {
+              this.$set(this.editConfig.infomation, "member_id", item.id)
+            }
+          })
+        }
+
         // this.dataProcess()
       })
     },
@@ -674,6 +688,7 @@
         this.editSelectContactConfig.clientId = this.clientId || 0
         this.editSelectContactConfig.editVisible = true
       } else if (value === "chance") {
+        this.editSelectChanceConfig.clientId = this.clientId
         this.editSelectChanceConfig.editVisible = true
       } else {
         this.editSelectLeadConfig.editVisible = true
@@ -690,15 +705,17 @@
         this.editSelectContactConfig.search_map.client_id = row.id
         this.editSelectChanceConfig.search_map.client_id = row.id
         this.editSelectLeadConfig.search_map.name = row.name
-        this.getContactList(row)
-        this.getSalesLeadsList(row)
         this.clientId = row.id
         this.editConfig.infomation.client_name = row.name
         this.isChance = false
+        this.getContactList(row)
+        this.getSalesLeadsList(row)
         this.getChanceList(row.id)
       } else if (value === "chance") {
         this.editConfig.infomation.sale_chance_name = row.name
         this.saleChanceId = row.id
+        this.editConfig.infomation.client_name = row.client.name
+        this.clientId = row.client.id
       } else {
         this.editConfig.infomation.sales_leads_name = row.name
         this.saleLeadId = row.id
@@ -749,7 +766,15 @@
       }
     },
     // 闃绘鍙偣鍑讳簨浠�
-    stopClick() {}
+    stopClick() {},
+    // 閿�鍞礋璐d汉鑷畾涔夋牎楠岃鍒�
+    validateMemberId(rule, value, callback) {
+      if (this.editConfig.infomation?.member_id > 0) {
+        callback()
+      } else {
+        callback(new Error("璇疯緭鍏ヨ礋璐d汉"))
+      }
+    }
   }
 }
 </script>

--
Gitblit v1.8.0