From 13646595f3a8cb6c27a20f287c23a7649cbdff05 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 11 十月 2023 16:05:59 +0800
Subject: [PATCH] 销售线索+客户管理+联系人页面的跟进弹框编码规则获取问题更改+销售发票编码input修改为编码规则

---
 src/views/client/client/AddClientManageDialog.vue |  145 +++++++++++++++++++++++++++++++----------------
 1 files changed, 95 insertions(+), 50 deletions(-)

diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue
index 628f4c3..abb9144 100644
--- a/src/views/client/client/AddClientManageDialog.vue
+++ b/src/views/client/client/AddClientManageDialog.vue
@@ -13,7 +13,7 @@
         :model="editConfig.infomation"
         :rules="rules"
         label-position="right"
-        label-width="308px"
+        label-width="130px"
         size="mini"
         style="height: 60vh; overflow-x: hidden"
       >
@@ -24,17 +24,32 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
+                <el-form-item label="瀹㈡埛缂栧彿" prop="number">
+                  <WordInput
+                    v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
+                    :codenumer="codenumer"
+                    :sum="sum"
+                    :disabled="editConfig.infomation.id || isIdDisabled"
+                    :inputValue="inputValue"
+                    @codeList="codeList"
+                  />
+                  <span v-else-if="method == 0" style="color: #f56c6c"
+                    >璇蜂紭鍏堥厤缃紪鐮佽鑼�
+                    <el-button type="text"  @click="numberClick">
+                        閰嶇疆瑙勮寖
+                      </el-button
+                    ></span
+                  >
+                  <span  v-else>鑷姩鐢熸垚</span>
+                </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-house" title="宸ュ晢鏌ヨ"></i></div> -->
-                    <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div>
+                    <!-- <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div> -->
                   </div>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="瀹㈡埛缂栧彿" prop="number">
-                  <el-input v-model="editConfig.infomation.number"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -59,7 +74,7 @@
                     v-model="editConfig.infomation.member_id"
                     placeholder="璇烽�夋嫨"
                     size="mini"
-                    style="width: 63%"
+                    style="width: 100%"
                   >
                     <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                     </el-option>
@@ -106,7 +121,7 @@
                     v-model="editConfig.infomation.client_level_id"
                     placeholder="璇烽�夋嫨"
                     size="mini"
-                    style="width: 63%"
+                    style="width: 100%"
                   >
                     <el-option v-for="item in importantLevelOptions" :key="item.id" :label="item.name" :value="item.id">
                     </el-option>
@@ -133,6 +148,7 @@
                     value-format="yyyy-MM-dd"
                     type="date"
                     placeholder="閫夋嫨鏃ユ湡"
+                    style="width: 100%"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -144,6 +160,7 @@
                     value-format="yyyy-MM-dd"
                     type="date"
                     placeholder="閫夋嫨鏃ユ湡"
+                    style="width: 100%"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -218,6 +235,7 @@
                     value-format="yyyy-MM-dd HH:mm:ss"
                     type="datetime"
                     placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+                    style="width: 100%"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -490,10 +508,12 @@
 </template>
 
 <script>
-import { getAllData, getAddClient, getUpdateClient } from "@/api/client/client"
+import { getAllData, getAddClient, getUpdateClient, checkNameClient } from "@/api/client/client"
 import { getCityList } from "@/api/common/address"
+import codeMixin from "@/views/client/followupRecords/mixin/codeMixin";
 export default {
   name: "AddClientManageDialog",
+  mixins: [codeMixin],
   props: {
     editClientManageConfig: {
       type: Object,
@@ -515,10 +535,16 @@
   },
   data() {
     return {
-      dialogWidth: "80%",
+      dialogWidth: "50%",
       editConfig: this.editClientManageConfig,
       rules: {
-        name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
+        name: [
+          { required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" },
+          {
+            validator: this.checkNameClient,
+            trigger: "blur"
+          }
+        ],
         client_status_id: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鐘舵��", trigger: "change" }],
         member_id: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }],
         approvalOpinion: [{ required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: "blur" }],
@@ -554,7 +580,8 @@
       provinceOptions: [], // 鐪佷唤
       cityOptions: [], // 鍩庡競
       regionOptions: [], // 鍖哄煙
-      approvalWorkflowOptions: [] // 瀹℃壒娴佺▼
+      approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
+      clientName: this.editClientManageConfig.infomation.name
     }
   },
   created() {
@@ -562,8 +589,27 @@
       this.getCityList(this.editConfig.infomation.province_id, "edit")
     }
     this.getCommonData()
+    this.formInfo();
+  },
+  watch:{
+    'editClientManageConfig.visible'(val){
+      if(val){
+        this.formInfo()
+      }
+    },
+    'editClientManageConfig.infomation.codeStandID'(){
+      this.formInfo()
+    }
   },
   methods: {
+    formInfo(){
+      this.objCode.type='瀹㈡埛缂栫爜'
+      this.objCode.codeStandID = ''
+      if(this.editConfig.infomation.codeStandID){
+        this.objCode.codeStandID = this.editConfig.infomation.codeStandID;
+      }
+      this.getRCodeStandardList();
+    }, 
     getCommonData() {
       this.editConfig.infomation.country_id = 1
       this.editConfig.infomation.province_id =
@@ -603,43 +649,29 @@
           const params = this.saveParams()
           console.log(params)
           if (this.editConfig.title === "鏂板缓") {
-            getAddClient(params)
-              .then((res) => {
-                console.log(res)
-                this.editConfig.visible = false
-                if (res.code === 200) {
-                  this.$message({
-                    message: "娣诲姞鎴愬姛",
-                    type: "success"
-                  })
-                  if (this.editConfig.isSalesOpportunity) {
-                    this.$emit("salesOpportunityClick", this.editConfig.infomation)
-                  } else if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) {
-                    this.$parent.handleClose()
-                  } else {
-                    this.$parent.getData()
-                  }
-                }
-              })
-              .catch((err) => {
-                console.log(err)
-              })
-          } else {
-            getUpdateClient(params)
-              .then((res) => {
-                console.log(res)
-                this.editConfig.visible = false
-                if (res.code === 200) {
-                  this.$message({
-                    message: "缂栬緫鎴愬姛",
-                    type: "success"
-                  })
+            getAddClient(params).then((res) => {
+              console.log(res)
+              this.editConfig.visible = false
+              if (res.code === 200) {
+                this.$message.success("娣诲姞鎴愬姛")
+                if (this.editConfig.isSalesOpportunity) {
+                  this.$emit("salesOpportunityClick", this.editConfig.infomation)
+                } else if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) {
+                  this.$parent.handleClose()
+                } else {
                   this.$parent.getData()
                 }
-              })
-              .catch((err) => {
-                console.log(err)
-              })
+              }
+            })
+          } else {
+            getUpdateClient(params).then((res) => {
+              console.log(res)
+              this.editConfig.visible = false
+              if (res.code === 200) {
+                this.$message.success("缂栬緫鎴愬姛")
+                this.$parent.getData()
+              }
+            })
           }
         } else {
           console.log("error submit")
@@ -691,7 +723,10 @@
         remark: data.remark || "",
         representative: data.representative || "",
         service_member_id: data.service_member_id || 0,
-        sales_leads_id: data.sales_leads_id || 0
+        sales_leads_id: data.sales_leads_id || 0,
+        contact_id: data.contact_id || 0,
+        codeStandID:data.ID,
+        codeRule:this.codeRule,
       }
       return params
     },
@@ -719,6 +754,16 @@
           }
         }
       })
+    },
+    // 鏌ラ噸
+    async checkNameClient(rule, value, callback) {
+      if (this.editConfig.title === "鏂板缓" || this.clientName !== this.editConfig.infomation.name) {
+        await checkNameClient({ name: value }).then((res) => {
+          if (res.data.code === 700001) {
+            return callback(new Error("瀹㈡埛鍚嶇О閲嶅"))
+          }
+        })
+      }
     }
   }
 }
@@ -752,7 +797,7 @@
         }
         .common-select {
           .common-select-sel {
-            width: 270px;
+            width: 100%;
           }
         }
       }

--
Gitblit v1.8.0