From d4f4c52402b91cb8e17c1845da71c5e39662fde0 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 03 一月 2024 15:28:06 +0800
Subject: [PATCH] 销售报价单列表页增加统计内容及接口联调、添加报价单天天客户名称及对应限制功能

---
 src/views/sales/contractManage/AddContractManageDialog.vue |  116 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 90 insertions(+), 26 deletions(-)

diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index 712268d..7e825ac 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -22,8 +22,20 @@
             <el-row>
               <el-col :span="12">
                 <el-form-item label="鍗曟嵁缂栧彿" prop="number">
-                  <!-- <el-input v-model="editConfig.infomation.number" style="width: 100%"></el-input> -->
-                  <WordInput
+                  <el-input
+                    v-if="
+                      editConfig.title == '缂栬緫' ||
+                      (editConfig.title == '鏂板缓' && codenumer && (explain != '' || isIdDisabled))
+                    "
+                    :disabled="editConfig.title == '缂栬緫'"
+                    v-model="editConfig.infomation.number"
+                    placeholder="璇疯緭鍏ョ紪鐮�"
+                  >
+                  </el-input>
+                  <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c"
+                    >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
+                  >
+                  <!-- <WordInput
                     v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
                     :codenumer="codenumer"
                     :sum="sum"
@@ -34,15 +46,13 @@
                   <span v-else-if="method == 0" style="color: #f56c6c"
                     >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
                   >
-                  <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span>
+                  <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span> -->
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍚堝悓鍚嶇О" prop="name">
+                <el-form-item label="鍚堝悓鍚嶇О" prop="contractName">
                   <div class="custom-name">
-                    <el-input v-model="editConfig.infomation.name"></el-input>
-                    <!-- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> -->
-                    <!-- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> -->
+                    <el-input v-model="editConfig.infomation.contractName"></el-input>
                   </div>
                 </el-form-item>
               </el-col>
@@ -116,18 +126,36 @@
                       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')"
                     >
                       <i class="el-icon-remove-outline" title="娓呴櫎"></i>
                     </div>
                   </div>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鍙戣揣鏃ユ湡" prop="sendTime">
+                  <el-date-picker
+                    v-model="editConfig.infomation.sendTime"
+                    value-format="yyyy-MM-dd"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    style="width: 100%"
+                  >
+                  </el-date-picker>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -232,7 +260,8 @@
 import { getAddContract, getUpdateContract } from "@/api/sales/contractManage"
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
-import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
+import codeMixin from "@/components/makepager/mixin/codeMixin"
+import { getQuotationList } from "@/api/sales/quotation"
 export default {
   name: "AddContractManageDialog",
   mixins: [codeMixin],
@@ -252,19 +281,21 @@
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    quotationList() {
-      return this.$store.state.getClientName.quotationList
     }
+    // quotationList() {
+    //   return this.$store.state.getClientName.quotationList
+    // }
   },
   data() {
     return {
       dialogWidth: "50%",
       editConfig: this.editCommonConfig,
       rules: {
-        number: [{ required: true, validator: this.checkCode, trigger: "blur" }],
+        number: [{ required: true, validator: this.validateCheckCode, trigger: ["blur", "change"] }],
         client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
-        member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
+        memberId: [{ required: true, validator: this.validateMemberId, trigger: "change" }],
+        contractName: [{ required: true, message: "璇疯緭鍏ュ悎鍚屽悕绉�", trigger: "blur" }],
+        quotation_number: [{ required: true, message: "璇烽�夋嫨閿�鍞姤浠峰崟", trigger: "change" }]
       },
       memberOptions: [],
       statusOptions: [], // 鍚堝悓鐘舵��
@@ -282,12 +313,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 +350,14 @@
       getAllData()
         .then((res) => {
           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, "memberId", item.id)
+              }
+            })
+          }
           this.statusOptions = res.data.serviceContractStatus
         })
         .catch((err) => {
@@ -324,9 +368,7 @@
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          console.log(this.editConfig.infomation)
           const params = this.saveParams()
-          console.log(params)
           if (this.editConfig.title === "鏂板缓") {
             getAddContract(params).then((res) => {
               console.log(res)
@@ -357,7 +399,7 @@
       console.log(data)
       let params = {
         id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
-        name: data.name || "",
+        contractName: data.contractName || "",
         client_id: this.clientId || 0,
         file: "",
         member_id: data.memberId || 0,
@@ -365,12 +407,27 @@
         quotation_id: this.quotationId || 0,
         status_id: data.statusId || 0,
         codeStandID: data.ID,
-        codeRule: this.codeRule
+        sendTime: data.sendTime || ""
       }
       return params
     },
     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) {
@@ -397,6 +454,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
@@ -409,6 +468,7 @@
       } else if (value === "quotation") {
         this.editSelCommonConfig.title = "鎶ヤ环鍗�"
         this.editSelCommonConfig.editVisible = true
+        this.editSelCommonConfig.clientId = this.clientId
         this.editSelCommonConfig.tableInfomation = [...this.quotationList]
       }
     },
@@ -418,6 +478,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
@@ -427,9 +489,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
@@ -449,12 +513,12 @@
         this.isUnflod = true
       }
     },
-    // 璁㈠崟缂栫爜鍗曠嫭鏍¢獙
-    checkCode(rule, value, callback) {
-      if (this.editConfig.infomation.number && this.editConfig.infomation.number.length > 0) {
+    // 璐熻矗浜鸿嚜瀹氫箟鏍¢獙瑙勫垯
+    validateMemberId(rule, value, callback) {
+      if (this.editConfig.infomation?.memberId > 0) {
         callback()
       } else {
-        callback(new Error("璇疯緭鍏ュ崟鎹紪鍙�"))
+        callback(new Error("璇烽�夋嫨璐熻矗浜�"))
       }
     }
   }

--
Gitblit v1.8.0