From 0f43183f986f0ed314647687c73da5a4493d2611 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 16 十月 2023 20:36:15 +0800
Subject: [PATCH] bug修复(5219 5233)

---
 src/views/client/client/AddClientManageDialog.vue |  160 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 107 insertions(+), 53 deletions(-)

diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue
index 25552c5..2da6bda 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="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>
+                <el-form-item label="瀹㈡埛缂栧彿" prop="number">
+                  <WordInput
+                    v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
+                    :codenumer="codenumer"
+                    :sum="sum"
+                    :disabled="this.editConfig.title !== '鏂板缓'|| 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="number">
-                  <el-input v-model="editConfig.infomation.number"></el-input>
+                <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>
                 </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,12 +535,19 @@
   },
   data() {
     return {
-      dialogWidth: "80%",
+      dialogWidth: "50%",
       editConfig: this.editClientManageConfig,
       rules: {
-        name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
+        number: [{ 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" }],
+        member_id: [{ required: false, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }],
         approvalOpinion: [{ required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: "blur" }],
         contact_phone: [
           { required: false, message: "", trigger: "blur" },
@@ -528,6 +555,14 @@
           {
             pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
             message: "璇疯緭鍏ユ纭殑鎵嬫満鍙�",
+            trigger: "blur"
+          }
+        ],
+        contact_email: [
+          { required: false, message: "", trigger: "blur" },
+          {
+            pattern: /^[a-zA-Z0-9_\\.]+@[a-zA-Z0-9-]+[\\.a-zA-Z]+$/,
+            message: "璇疯緭鍏ユ纭殑閭鏍煎紡",
             trigger: "blur"
           }
         ]
@@ -546,7 +581,8 @@
       provinceOptions: [], // 鐪佷唤
       cityOptions: [], // 鍩庡競
       regionOptions: [], // 鍖哄煙
-      approvalWorkflowOptions: [] // 瀹℃壒娴佺▼
+      approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
+      clientName: this.editClientManageConfig.infomation.name
     }
   },
   created() {
@@ -554,8 +590,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 =
@@ -595,43 +650,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")
@@ -683,7 +724,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
     },
@@ -711,6 +755,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("瀹㈡埛鍚嶇О閲嶅"))
+          }
+        })
+      }
     }
   }
 }
@@ -744,7 +798,7 @@
         }
         .common-select {
           .common-select-sel {
-            width: 270px;
+            width: 100%;
           }
         }
       }

--
Gitblit v1.8.0