From b7968858014ab02aa91e52e63c2a266963d3a8f9 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 24 八月 2023 18:06:22 +0800
Subject: [PATCH] 4807 4812)

---
 src/views/sales/contractManage/AddContractManageDialog.vue |  189 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 120 insertions(+), 69 deletions(-)

diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index c6926a3..df7a5ea 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -25,14 +25,18 @@
                   <div class="custom-name">
                     <el-autocomplete
                       v-model="editConfig.infomation.client_name"
-                      :fetch-suggestions="querySearchAsync"
+                      :fetch-suggestions="
+                        (queryString, callback) => {
+                          querySearchAsync(queryString, callback, 'client')
+                        }
+                      "
                       value-key="name"
-                      @select="handleSelectClient"
+                      @select="handleSelectClient('client', $event)"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick">
+                    <div class="common-select-btn" @click="selClientClick('client')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
-                    <div class="common-select-btn" @click="clearupClient">
+                    <div class="common-select-btn" @click="clearupClient('client')">
                       <i class="el-icon-edit-outline" title="娓呴櫎"></i>
                     </div>
                   </div>
@@ -44,9 +48,9 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="璐熻矗浜�" prop="member_id">
+                <el-form-item label="璐熻矗浜�" prop="memberId">
                   <el-select
-                    v-model="editConfig.infomation.member_id"
+                    v-model="editConfig.infomation.memberId"
                     placeholder="璇烽�夋嫨"
                     size="mini"
                     style="width: 63%"
@@ -57,10 +61,10 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍚堝悓鐘舵��" prop="status_id">
+                <el-form-item label="鍚堝悓鐘舵��" prop="statusId">
                   <div class="common-select">
                     <el-select
-                      v-model="editConfig.infomation.status_id"
+                      v-model="editConfig.infomation.statusId"
                       placeholder="璇烽�夋嫨"
                       class="common-select-sel"
                       size="mini"
@@ -68,23 +72,36 @@
                       <el-option v-for="item in statusOptions" :key="item.id" :label="item.name" :value="item.id">
                       </el-option>
                     </el-select>
-                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+                    <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
                   </div>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="閿�鍞姤浠峰崟" prop="quotation_id">
+                <el-form-item label="閿�鍞姤浠峰崟" prop="quotation_number">
                   <div class="custom-name">
-                    <el-input v-model="editConfig.infomation.quotation_id"></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-autocomplete
+                      v-model="editConfig.infomation.quotation_number"
+                      :fetch-suggestions="
+                        (queryString, callback) => {
+                          querySearchAsync(queryString, callback, 'quotation')
+                        }
+                      "
+                      value-key="number"
+                      @select="handleSelectClient('quotation', $event)"
+                    ></el-autocomplete>
+                    <div class="common-select-btn" @click="selClientClick('quotation')">
+                      <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+                    </div>
+                    <div class="common-select-btn" @click="clearupClient('quotation')">
+                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+                    </div>
                   </div>
                 </el-form-item>
               </el-col>
             </el-row>
           </div>
           <!-- 闄勪欢淇℃伅 -->
-          <div v-if="isUnflod" class="basic-info-title">闄勪欢淇℃伅</div>
+          <!-- <div v-if="isUnflod" class="basic-info-title">闄勪欢淇℃伅</div>
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
@@ -109,13 +126,13 @@
                 </el-form-item>
               </el-col>
             </el-row>
-          </div>
+          </div> -->
           <!-- 灞曞紑鏀惰捣 -->
-          <div v-if="editConfig.title === '鏂板缓'" class="unflod-collapse" @click="unflodCollapseClick">
+          <!-- <div v-if="editConfig.title === '鏂板缓'" class="unflod-collapse" @click="unflodCollapseClick">
             <div>{{ unflodCollapseStr }}</div>
             <div v-if="isUnflod"><i class="el-icon-arrow-up"></i></div>
             <div v-else><i class="el-icon-arrow-down"></i></div>
-          </div>
+          </div> -->
           <!-- 閫夋嫨瀹℃壒娴佺▼ -->
           <!-- <div class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div>
           <div class="basic-info-view">
@@ -168,6 +185,12 @@
         :edit-common-config="editSelectClientConfig"
         @selClient="selClient"
       />
+      <!-- 鎶ヤ环鍗� -->
+      <SelectCommonDialog
+        v-if="editSelCommonConfig.editVisible"
+        :edit-common-config="editSelCommonConfig"
+        @selClient="selClient"
+      />
     </el-dialog>
   </div>
 </template>
@@ -176,6 +199,7 @@
 import { getAllData } from "@/api/client/client"
 import { getAddContract, getUpdateContract } from "@/api/sales/contractManage"
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
+import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 export default {
   name: "AddContractManageDialog",
   props: {
@@ -190,10 +214,13 @@
       }
     }
   },
-  components: { SelectClientDialog },
+  components: { SelectClientDialog, SelectCommonDialog },
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
+    },
+    quotationList() {
+      return this.$store.state.getClientName.quotationList
     }
   },
   data() {
@@ -213,11 +240,19 @@
         editVisible: false,
         title: "",
         infomation: {}
-      }
+      },
+      editSelCommonConfig: {
+        editVisible: false,
+        title: "",
+        infomation: {}
+      },
+      clientId: this.editCommonConfig.infomation.clientId,
+      quotationId: this.editCommonConfig.infomation.quotationId
     }
   },
   created() {
     this.$store.dispatch("geClient")
+    this.$store.dispatch("geQuotation")
     this.getCommonData()
   },
   methods: {
@@ -239,37 +274,23 @@
           const params = this.saveParams()
           console.log(params)
           if (this.editConfig.title === "鏂板缓") {
-            getAddContract(params)
-              .then((res) => {
-                console.log(res)
-                this.editConfig.visible = false
-                if (res.code === 200) {
-                  this.$message({
-                    message: "娣诲姞鎴愬姛",
-                    type: "success"
-                  })
-                  this.$parent.getData()
-                }
-              })
-              .catch((err) => {
-                console.log(err)
-              })
+            getAddContract(params).then((res) => {
+              console.log(res)
+              this.editConfig.visible = false
+              if (res.code === 200) {
+                this.$message.success("娣诲姞鎴愬姛")
+                this.$parent.getData()
+              }
+            })
           } else {
-            getUpdateContract(params)
-              .then((res) => {
-                console.log(res)
-                this.editConfig.visible = false
-                if (res.code === 200) {
-                  this.$message({
-                    message: "缂栬緫鎴愬姛",
-                    type: "success"
-                  })
-                  this.$parent.getData()
-                }
-              })
-              .catch((err) => {
-                console.log(err)
-              })
+            getUpdateContract(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")
@@ -281,12 +302,12 @@
       let data = this.editConfig.infomation
       let params = {
         id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
-        client_id: parseInt(data.client_id) || 0,
+        client_id: this.clientId || 0,
         file: "",
-        member_id: data.member_id || 0,
+        member_id: data.memberId || 0,
         number: data.number || "",
-        quotation_id: data.quotation_id || 0,
-        status_id: data.status_id || 0
+        quotation_id: this.quotationId || 0,
+        status_id: data.statusId || 0
       }
       return params
     },
@@ -294,31 +315,61 @@
       this.editConfig.visible = false
     },
     // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
-    querySearchAsync(queryString, cb) {
-      var restaurants = this.clientList
-      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
+    querySearchAsync(queryString, cb, value) {
+      var restaurants = []
+      if (value === "client") {
+        restaurants = this.clientList
+      } else if (value === "quotation") {
+        restaurants = this.quotationList
+      }
+      var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants
       cb(results)
     },
-    createStateFilter(queryString) {
+    createStateFilter(queryString, value) {
       return (state) => {
-        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+        if (value === "contract" || value === "quotation") {
+          return state.number.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+        } else {
+          return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+        }
       }
     },
-    handleSelectClient(item) {
-      this.editConfig.infomation.client_id = item.id
+    handleSelectClient(value, item) {
+      console.log(value)
+      if (value === "client") {
+        this.clientId = item.id
+      } else if (value === "quotation") {
+        this.quotationId = item.id
+      }
     },
-    selClientClick() {
-      this.editSelectClientConfig.editVisible = true
+    selClientClick(value) {
+      if (value === "client") {
+        this.editSelectClientConfig.editVisible = true
+      } else if (value === "quotation") {
+        this.editSelCommonConfig.title = "鎶ヤ环鍗�"
+        this.editSelCommonConfig.editVisible = true
+        this.editSelCommonConfig.tableInfomation = [...this.quotationList]
+      }
     },
-    selClient(row) {
-      console.log(row)
-      this.editConfig.infomation.client_name = row.name
-      this.editConfig.infomation.client_id = row.id
+    selClient(row, value) {
+      console.log(value)
+      if (value === "client") {
+        this.editConfig.infomation.client_name = row.name
+        this.clientId = row.id
+      } else if (value === "quotation") {
+        this.editConfig.infomation.quotation_number = row.number
+        this.quotationId = row.id
+      }
     },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
-    clearupClient() {
-      this.editConfig.infomation.client_name = ""
-      this.editConfig.infomation.client_id = 0
+    clearupClient(value) {
+      if (value === "client") {
+        this.editConfig.infomation.client_name = ""
+        this.clientId = 0
+      } else if (value === "quotation") {
+        this.editConfig.infomation.quotation_number = ""
+        this.quotationId = 0
+      }
     },
     // 娣诲姞闄勪欢
     addAnnexClick() {},

--
Gitblit v1.8.0