Browse Source

查询功能

hzj18279462576@163.com 3 years ago
parent
commit
f9b9bdd60e
1 changed files with 40 additions and 21 deletions
  1. 40 21
      admin/src/views/staff/index.vue

+ 40 - 21
admin/src/views/staff/index.vue

@@ -14,7 +14,7 @@
             >
             >
               <i slot="prefix" class="el-input__icon el-icon-search"></i>
               <i slot="prefix" class="el-input__icon el-icon-search"></i>
             </el-input>
             </el-input>
-            <el-button>查询</el-button>
+            <el-button @click="inquire">查询</el-button>
           </div>
           </div>
           <div class="export" @click="addStaff">添加员工</div>
           <div class="export" @click="addStaff">添加员工</div>
           <el-dialog
           <el-dialog
@@ -282,64 +282,65 @@ export default {
   data() {
   data() {
     return {
     return {
       data: [],
       data: [],
+      //总数据
       tableData: [
       tableData: [
         {
         {
-          phone: 13602320232,
+          phone: 13611110232,
           staff: "刘德华",
           staff: "刘德华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "刘德华",
+          phone: 13620220232,
+          staff: "刘",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "德华",
+          phone: 1363636320232,
+          staff: "德华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "刘德华",
+          phone: 1344540232,
+          staff: "华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "刘德",
+          phone: 1360468880232,
+          staff: "刘德",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "",
+          phone: 13602220232,
+          staff: "德",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "刘华",
+          phone: 1360888832,
+          staff: "刘华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
-          staff: "刘德华",
+          phone: 13655550232,
+          staff: "华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
+          phone: 13605656232,
           staff: "刘德华",
           staff: "刘德华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
+          phone: 13464520232,
           staff: "刘德华",
           staff: "刘德华",
           position: "歌星",
           position: "歌星",
         },
         },
         {
         {
-          phone: 13602320232,
+          phone: 1365650232,
           staff: "刘德华",
           staff: "刘德华",
           position: "歌星",
           position: "歌星",
         },
         },
       ],
       ],
-
+      Tdata: [],
       options: [
       options: [
         {
         {
           value: "选项1",
           value: "选项1",
@@ -364,7 +365,7 @@ export default {
       ],
       ],
 
 
       state: "",
       state: "",
-      value: "",
+      value: "", //请输入手机号码或员工姓名
       value1: "",
       value1: "",
       value2: "",
       value2: "",
       dialogVisible: false,
       dialogVisible: false,
@@ -386,6 +387,7 @@ export default {
       "el-pagination__jump"
       "el-pagination__jump"
     )[0].childNodes[0].nodeValue = "跳转到";
     )[0].childNodes[0].nodeValue = "跳转到";
     this.handleCurrentChange(1);
     this.handleCurrentChange(1);
+    this.Tdata = this.tableData;
   },
   },
   methods: {
   methods: {
     allRead($event, index) {
     allRead($event, index) {
@@ -416,6 +418,23 @@ export default {
       this.dialogVisible = false;
       this.dialogVisible = false;
     },
     },
 
 
+    inquire() {
+      this.tableData = this.Tdata;
+      let data = [];
+      this.tableData.filter((item) => {
+        if (
+          item.phone.toString().includes(this.value) ||
+          item.staff.includes(this.value)
+        ) {
+          data.push(item);
+          this.tableData = data;
+        }
+      });
+      if (this.value == "") {
+        this.tableData = this.Tdata;
+      }
+    },
+
     // 添加员工
     // 添加员工
     addStaff() {
     addStaff() {
       this.addStaffShow = true;
       this.addStaffShow = true;