From 8191562f28c525373941af4638c30c8f8e74c245 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 16 八月 2023 12:12:10 +0800
Subject: [PATCH] bug修复

---
 src/views/other/commonDialog/SelectContactDialog.vue |   95 +++++++++++++++++++++++++++++++----------------
 1 files changed, 62 insertions(+), 33 deletions(-)

diff --git a/src/views/other/commonDialog/SelectContactDialog.vue b/src/views/other/commonDialog/SelectContactDialog.vue
index 17a89be..cc8f874 100644
--- a/src/views/other/commonDialog/SelectContactDialog.vue
+++ b/src/views/other/commonDialog/SelectContactDialog.vue
@@ -10,7 +10,7 @@
     >
       <div class="bg-view">
         <div class="query-bg">
-          <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select">
+          <!-- <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select">
             <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨" disabled>
               <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option>
               <el-option label="鑱旂郴浜哄鍚�" value="2"></el-option>
@@ -42,7 +42,26 @@
           <div slot="empty">
             <el-empty :image-size="100"></el-empty>
           </div>
-        </el-table>
+        </el-table> -->
+          <SearchCommonView
+            ref="searchCommonView"
+            :search-options="searchOptions"
+            @searchClick="searchClick"
+            @resetClick="resetClick"
+          />
+          <div class="btn">
+            <!-- <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button>
+            <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> -->
+          </div>
+        </div>
+        <TableCommonView
+          ref="tableListRef"
+          v-loading="loading"
+          :table-list="tableList"
+          :select-box="false"
+          @selContactsClick="selNameClick"
+        >
+        </TableCommonView>
         <div slot="footer" class="dialog-footer">
           <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div>
         </div>
@@ -62,11 +81,7 @@
         return {
           editVisible: false,
           title: "",
-          infomation: {
-            name: "",
-            color: "",
-            setDefault: ""
-          }
+          infomation: {}
         }
       }
     }
@@ -79,22 +94,45 @@
       editConfig: this.editCommonConfig,
       queryInput: "",
       select: "1",
-      tableData: [],
+      tableList: [],
       searchSelOptions: [],
-      loading: false
+      loading: false,
+      search_map: {}
     }
   },
   created() {
+    this.setTable()
     this.getData()
   },
   methods: {
+    setTable() {
+      this.tableList = {
+        tableInfomation: [],
+        tableColumn: [
+          { label: "鑱旂郴浜哄鍚�", prop: "name", isContactClick: true }, // 鑱旂郴浜哄鍚�
+          { label: "鑱旂郴浜虹紪鍙�", prop: "number" }, // 鑱旂郴浜虹紪鍙�
+          { label: "瀹㈡埛鍚嶇О", prop: "client_name" }, // 瀹㈡埛鍚嶇О
+          { label: "鎵嬫満", prop: "phone" } // 鎵嬫満鍙风爜
+        ]
+      }
+      this.searchOptions = []
+      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
+        const label = this.tableList.tableColumn[i].label
+        const value = this.tableList.tableColumn[i].prop
+        this.searchOptions.push({ value: value, label: label })
+      }
+    },
     handleClose() {
       this.editConfig.editVisible = false
     },
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true
-      await getContactList()
+      await getContactList({
+        search_map: this.search_map,
+        page: 0,
+        pageSize: 0
+      })
         .then((res) => {
           console.log(res)
           if (res.code === 200) {
@@ -105,18 +143,18 @@
                   client_name: item.Client.name
                 }
               })
-              this.tableData = list.slice(0, 5) || []
+              this.tableList.tableInfomation = list.slice(0, 5) || []
             } else {
-              this.tableData = []
+              this.tableList.tableInfomation = []
             }
           } else {
-            this.tableData = []
+            this.tableList.tableInfomation = []
           }
           this.loading = false
         })
         .catch((err) => {
           console.log(err)
-          this.tableData = []
+          this.tableList.tableInfomation = []
           this.loading = false
         })
     },
@@ -124,26 +162,17 @@
       this.editConfig.editVisible = false
       this.$emit("selClient", row, "contact")
     },
-    // 鏃堕棿鏄剧ず
-    dateFormat(fmt, date) {
-      let ret = ""
-      date = new Date(date)
-      const opt = {
-        "Y+": date.getFullYear().toString(), // 骞�
-        "m+": (date.getMonth() + 1).toString(), // 鏈�
-        "d+": date.getDate().toString(), // 鏃�
-        "H+": date.getHours().toString(), // 鏃�
-        "M+": date.getMinutes().toString(), // 鍒�
-        "S+": date.getSeconds().toString() // 绉�
-        // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆
+    // 鎼滅储
+    searchClick(val, content) {
+      console.log(val, content)
+      this.search_map = {
+        [val.value]: content
       }
-      for (let k in opt) {
-        ret = new RegExp("(" + k + ")").exec(fmt)
-        if (ret) {
-          fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"))
-        }
-      }
-      return fmt
+      this.getData()
+    },
+    resetClick() {
+      this.search_map = {}
+      this.getData()
     }
   }
 }

--
Gitblit v1.8.0