From e4736baa78e81f2094ce18937bdbf66427a356f4 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 11 十月 2023 19:37:27 +0800
Subject: [PATCH] 新建合同管理和新建联系人必填优化

---
 src/views/client/contacts/AddContactsDialog.vue            |   51 +++++++++++++------------
 src/views/sales/contractManage/AddContractManageDialog.vue |   11 +++++
 2 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/src/views/client/contacts/AddContactsDialog.vue b/src/views/client/contacts/AddContactsDialog.vue
index f0ff288..155b037 100644
--- a/src/views/client/contacts/AddContactsDialog.vue
+++ b/src/views/client/contacts/AddContactsDialog.vue
@@ -26,7 +26,7 @@
               <el-col :span="12" v-if="isUnflod">
                 <el-form-item label="鑱旂郴浜虹紪鍙�" prop="number">
                   <WordInput
-                    v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
+                    v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
                     :codenumer="codenumer"
                     :sum="sum"
                     :disabled="editConfig.infomation.id || isIdDisabled"
@@ -34,13 +34,9 @@
                     @codeList="codeList"
                   />
                   <span v-else-if="method == 0" style="color: #f56c6c"
-                    >璇蜂紭鍏堥厤缃紪鐮佽鑼�
-                    <el-button type="text"  @click="numberClick">
-                        閰嶇疆瑙勮寖
-                      </el-button
-                    ></span
+                    >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
                   >
-                  <span  v-else>鑷姩鐢熸垚</span>
+                  <span v-else>鑷姩鐢熸垚</span>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -88,7 +84,12 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item v-if="isUnflod" label="閿�鍞礋璐d汉" prop="member_id">
-                  <el-select v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini" style="width: 100%">
+                  <el-select
+                    v-model="editConfig.infomation.member_id"
+                    placeholder="璇烽�夋嫨"
+                    size="mini"
+                    style="width: 100%"
+                  >
                     <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                     </el-option>
                   </el-select>
@@ -271,7 +272,7 @@
 import { getAllData } from "@/api/client/client"
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 import { getCityList } from "@/api/common/address"
-import codeMixin from "@/views/client/followupRecords/mixin/codeMixin";
+import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
 export default {
   name: "AddContactsDialog",
   mixins: [codeMixin],
@@ -300,7 +301,7 @@
       rules: {
         name: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
         number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-        client_name:[{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
+        client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "blur" }],
         member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
         phone: [
           { required: false, message: "", trigger: "blur" },
@@ -351,27 +352,27 @@
       this.getCityList(this.editConfig.infomation.province_id, "edit")
     }
     this.getCommonData()
-    this.formInfo();
+    this.formInfo()
   },
-  watch:{
-    'editContactsConfig.visible'(val){
-      if(val){
+  watch: {
+    "editContactsConfig.visible"(val) {
+      if (val) {
         this.formInfo()
       }
     },
-    'editContactsConfig.infomation.codeStandID'(){
+    "editContactsConfig.infomation.codeStandID"() {
       this.formInfo()
     }
   },
   methods: {
-    formInfo(){
-      this.objCode.type='鑱旂郴浜虹紪鐮�'
-      this.objCode.codeStandID = ''
-      if(this.editConfig.infomation.codeStandID){
-        this.objCode.codeStandID = this.editConfig.infomation.codeStandID;
+    formInfo() {
+      this.objCode.type = "鑱旂郴浜虹紪鐮�"
+      this.objCode.codeStandID = ""
+      if (this.editConfig.infomation.codeStandID) {
+        this.objCode.codeStandID = this.editConfig.infomation.codeStandID
       }
-      this.getRCodeStandardList();
-    }, 
+      this.getRCodeStandardList()
+    },
     getCommonData() {
       this.editConfig.infomation.country_id = 1
       this.editConfig.infomation.province_id =
@@ -452,8 +453,8 @@
         province_id: data.province_id || 0,
         region_id: data.region_id || 0,
         wechat: data.wechat || "",
-        codeStandID:data.ID,
-        codeRule:this.codeRule,
+        codeStandID: data.ID,
+        codeRule: this.codeRule
       }
       return params
     },
@@ -550,7 +551,7 @@
         }
         .common-select {
           .common-select-sel {
-            width:100%;
+            width: 100%;
           }
         }
       }
diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index 8d023ab..9904a50 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -253,7 +253,7 @@
       dialogWidth: "50%",
       editConfig: this.editCommonConfig,
       rules: {
-        number: [{ required: true, message: "璇疯緭鍏ュ崟鎹紪鍙�", trigger: "blur" }],
+        number: [{ required: true, validator: this.checkCode, trigger: "blur" }],
         client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
         member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
       },
@@ -345,6 +345,7 @@
     },
     saveParams() {
       let data = this.editConfig.infomation
+      console.log(data)
       let params = {
         id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
         client_id: this.clientId || 0,
@@ -437,6 +438,14 @@
         this.unflodCollapseStr = "鏀惰捣"
         this.isUnflod = true
       }
+    },
+    // 璁㈠崟缂栫爜鍗曠嫭鏍¢獙
+    checkCode(rule, value, callback) {
+      if (this.editConfig.infomation.number && this.editConfig.infomation.number.length > 0) {
+        callback()
+      } else {
+        callback(new Error("璇疯緭鍏ュ崟鎹紪鍙�"))
+      }
     }
   }
 }

--
Gitblit v1.8.0