From a63d71177a2899b01da37e5bfc2d498bec5f80be Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 17 十月 2023 15:10:13 +0800
Subject: [PATCH] Merge branch 'dev' of http://192.168.5.5:10010/r/web/crm-web into zhengwenfeng/modify-style

---
 src/views/sales/contractManage/AddContractManageDialog.vue |   64 +++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index 8c670d2..7585886 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -27,7 +27,7 @@
                     v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
                     :codenumer="codenumer"
                     :sum="sum"
-                    :disabled="editConfig.infomation.id || isIdDisabled"
+                    :disabled="editConfig.title !== '鏂板缓' || isIdDisabled"
                     :inputValue="inputValue"
                     @codeList="codeList"
                   />
@@ -35,6 +35,13 @@
                     >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
                   >
                   <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鍚堝悓鍚嶇О" prop="contractName">
+                  <div class="custom-name">
+                    <el-input v-model="editConfig.infomation.contractName"></el-input>
+                  </div>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -107,12 +114,18 @@
                       value-key="number"
                       @select="handleSelectClient('quotation', $event)"
                       style="width: 100%"
+                      placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О"
+                      :disabled="isAddQuatation"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick('quotation')">
+                    <div v-if="!isAddQuatation" class="common-select-btn" @click="selClientClick('quotation')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
                     <div
-                      v-if="editConfig.infomation.quotation_number && editConfig.infomation.quotation_number.length > 0"
+                      v-if="
+                        editConfig.infomation.quotation_number &&
+                        editConfig.infomation.quotation_number.length > 0 &&
+                        !isAddQuatation
+                      "
                       class="common-select-btn"
                       @click="clearupClient('quotation')"
                     >
@@ -224,6 +237,7 @@
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
+import { getQuotationList } from "@/api/sales/quotation"
 export default {
   name: "AddContractManageDialog",
   mixins: [codeMixin],
@@ -243,10 +257,10 @@
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    quotationList() {
-      return this.$store.state.getClientName.quotationList
     }
+    // quotationList() {
+    //   return this.$store.state.getClientName.quotationList
+    // }
   },
   data() {
     return {
@@ -255,7 +269,8 @@
       rules: {
         number: [{ required: true, validator: this.checkCode, trigger: "blur" }],
         client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
-        member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
+        member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+        contractName: [{ required: true, message: "璇疯緭鍏ュ悎鍚屽悕绉�", trigger: "blur" }]
       },
       memberOptions: [],
       statusOptions: [], // 鍚堝悓鐘舵��
@@ -273,12 +288,17 @@
         infomation: {}
       },
       clientId: this.editCommonConfig.infomation.clientId,
-      quotationId: this.editCommonConfig.infomation.quotationId
+      quotationId: this.editCommonConfig.infomation.quotationId,
+      isAddQuatation: true,
+      quotationList: []
     }
   },
   created() {
     this.$store.dispatch("geClient")
-    this.$store.dispatch("geQuotation")
+    // this.$store.dispatch("geQuotation")
+    if (this.editConfig.title !== "鏂板缓") {
+      this.isAddQuatation = false
+    }
     this.getCommonData()
     this.formInfo()
   },
@@ -314,6 +334,7 @@
     // 淇濆瓨
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
+        this.validateFormNumber()
         if (valid) {
           console.log(this.editConfig.infomation)
           const params = this.saveParams()
@@ -348,6 +369,7 @@
       console.log(data)
       let params = {
         id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
+        contractName: data.contractName || "",
         client_id: this.clientId || 0,
         file: "",
         member_id: data.memberId || 0,
@@ -361,6 +383,21 @@
     },
     handleClose() {
       this.editConfig.visible = false
+    },
+    // 鑾峰彇鎶ヤ环鍗�
+    getQuotation(id) {
+      getQuotationList({
+        page: 0,
+        pageSize: 0,
+        search_map: {
+          client_id: id
+        }
+      }).then((res) => {
+        if (res.code == 200) {
+          console.log(res)
+          this.quotationList = res.data.list
+        }
+      })
     },
     // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
     querySearchAsync(queryString, cb, value) {
@@ -387,6 +424,8 @@
       if (value === "client") {
         this.editConfig.infomation.client_name = item.name
         this.clientId = item.id
+        this.isAddQuatation = false
+        this.getQuotation(item.id)
       } else if (value === "quotation") {
         this.editConfig.infomation.quotation_number = item.number
         this.quotationId = item.id
@@ -399,6 +438,7 @@
       } else if (value === "quotation") {
         this.editSelCommonConfig.title = "鎶ヤ环鍗�"
         this.editSelCommonConfig.editVisible = true
+        this.editSelCommonConfig.clientId = this.clientId
         this.editSelCommonConfig.tableInfomation = [...this.quotationList]
       }
     },
@@ -408,6 +448,8 @@
       if (value === "client") {
         this.editConfig.infomation.client_name = row.name
         this.clientId = row.id
+        this.isAddQuatation = false
+        this.getQuotation(row.id)
       } else if (value === "quotation") {
         this.editConfig.infomation.quotation_number = row.number
         this.quotationId = row.id
@@ -417,9 +459,11 @@
     clearupClient(value) {
       console.log(value)
       if (value === "client") {
-        console.log("ss88888")
         this.editConfig.infomation.client_name = ""
         this.clientId = 0
+        this.isAddQuatation = true
+        this.editConfig.infomation.quotation_number = ""
+        this.quotationId = 0
       } else if (value === "quotation") {
         this.editConfig.infomation.quotation_number = ""
         this.quotationId = 0

--
Gitblit v1.8.0