From ebddc02611b0373c1d5bfa342bd781fb5eb82009 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 01 八月 2023 14:23:31 +0800
Subject: [PATCH] 侧边栏样式机销售明细单增加销售机会选择弹窗

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

diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index 2e1baa7..c6926a3 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -21,11 +21,20 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="瀹㈡埛鍚嶇О" prop="client_id">
+                <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name">
                   <div class="custom-name">
-                    <el-input v-model="editConfig.infomation.client_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.client_name"
+                      :fetch-suggestions="querySearchAsync"
+                      value-key="name"
+                      @select="handleSelectClient"
+                    ></el-autocomplete>
+                    <div class="common-select-btn" @click="selClientClick">
+                      <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+                    </div>
+                    <div class="common-select-btn" @click="clearupClient">
+                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+                    </div>
                   </div>
                 </el-form-item>
               </el-col>
@@ -153,6 +162,12 @@
         <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button>
         <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
       </div>
+      <!-- 閫夋嫨瀹㈡埛 -->
+      <SelectClientDialog
+        v-if="editSelectClientConfig.editVisible"
+        :edit-common-config="editSelectClientConfig"
+        @selClient="selClient"
+      />
     </el-dialog>
   </div>
 </template>
@@ -160,6 +175,7 @@
 <script>
 import { getAllData } from "@/api/client/client"
 import { getAddContract, getUpdateContract } from "@/api/sales/contractManage"
+import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 export default {
   name: "AddContractManageDialog",
   props: {
@@ -174,8 +190,12 @@
       }
     }
   },
-  components: {},
-  computed: {},
+  components: { SelectClientDialog },
+  computed: {
+    clientList() {
+      return this.$store.state.getClientName.clientList
+    }
+  },
   data() {
     return {
       dialogWidth: "80%",
@@ -185,18 +205,19 @@
         member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
       },
       memberOptions: [],
-      statusOptions: [
-        { id: "1", name: "寰呭鎵�" },
-        { id: "2", name: "瀹℃壒涓�" },
-        { id: "3", name: "宸插鎵�" },
-        { id: "4", name: "宸插綊妗�" }
-      ], // 鍚堝悓鐘舵��
+      statusOptions: [], // 鍚堝悓鐘舵��
       approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
       unflodCollapseStr: "鏀惰捣",
-      isUnflod: true
+      isUnflod: true,
+      editSelectClientConfig: {
+        editVisible: false,
+        title: "",
+        infomation: {}
+      }
     }
   },
   created() {
+    this.$store.dispatch("geClient")
     this.getCommonData()
   },
   methods: {
@@ -204,6 +225,7 @@
       getAllData()
         .then((res) => {
           this.memberOptions = res.data.member
+          this.statusOptions = res.data.serviceContractStatus
         })
         .catch((err) => {
           console.log(err)
@@ -271,6 +293,33 @@
     handleClose() {
       this.editConfig.visible = false
     },
+    // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
+    querySearchAsync(queryString, cb) {
+      var restaurants = this.clientList
+      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
+      cb(results)
+    },
+    createStateFilter(queryString) {
+      return (state) => {
+        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+      }
+    },
+    handleSelectClient(item) {
+      this.editConfig.infomation.client_id = item.id
+    },
+    selClientClick() {
+      this.editSelectClientConfig.editVisible = true
+    },
+    selClient(row) {
+      console.log(row)
+      this.editConfig.infomation.client_name = row.name
+      this.editConfig.infomation.client_id = row.id
+    },
+    // 娓呴櫎宸查�夋嫨鐢ㄦ埛
+    clearupClient() {
+      this.editConfig.infomation.client_name = ""
+      this.editConfig.infomation.client_id = 0
+    },
     // 娣诲姞闄勪欢
     addAnnexClick() {},
     // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
@@ -305,7 +354,8 @@
     .basic-info-view {
       margin-top: 10px;
       padding-right: 40px;
-      .custom-name {
+      .custom-name,
+      .common-select {
         display: flex;
         .common-select-btn {
           margin-left: 5px;
@@ -313,14 +363,8 @@
         }
       }
       .common-select {
-        display: flex;
         .common-select-sel {
           width: 270px;
-        }
-        .common-select-btn {
-          margin-left: 5px;
-          font-size: 16px;
-          cursor: pointer;
         }
       }
     }

--
Gitblit v1.8.0