seimin 2 lat temu
rodzic
commit
466ee7d0ac

Plik diff jest za duży
+ 241 - 0
src/custom/seiminSearch.vue


+ 9 - 0
src/router/index.js

@@ -26,6 +26,7 @@ import Solved from './../views/solved.vue' //已解决页面
26 26
 import Closed from './../views/closed.vue' //已关闭页面
27 27
 import WaitConfirm from './../views/waitConfirm.vue' //待审核页面
28 28
 import ScanResult from './../views/scanResult.vue' //扫一扫结果页面
29
+import SearchDept from './../views/searchDept.vue' //搜索页面
29 30
 Vue.use(Router)
30 31
 
31 32
 export default new Router({
@@ -233,6 +234,14 @@ export default new Router({
233 234
     },
234 235
   },
235 236
   {
237
+    path: '/searchDept',
238
+    name: 'SearchDept',
239
+    component: SearchDept,
240
+    meta: {
241
+      allowBack: false
242
+    },
243
+  },
244
+  {
236 245
     path: '*',
237 246
     hidden: true,
238 247
     redirect: {

+ 3 - 3
src/views/incidentList.vue

@@ -229,7 +229,7 @@ export default {
229 229
       searchState: 0,
230 230
       type: "all",
231 231
       isToday: "",
232
-      sum: 10,
232
+      sum: 1000,
233 233
       idx: 0,
234 234
       stateClass: "",
235 235
       loadShow: true
@@ -427,7 +427,7 @@ export default {
427 427
       this.loadShow = true;
428 428
       this.items = [];
429 429
       this.idx = 0;
430
-      this.sum = 10;
430
+      this.sum = 1000;
431 431
       this.getData();
432 432
     },
433 433
     toIncidentDetails(data) {
@@ -529,7 +529,7 @@ export default {
529 529
     onPullingDown() {
530 530
       var that = this;
531 531
       that.idx = 0;
532
-      that.sum = 10;
532
+      that.sum = 1000;
533 533
       setTimeout(() => {
534 534
         that.getData();
535 535
       }, 1000);

+ 58 - 215
src/views/newIncident.vue

@@ -27,14 +27,11 @@
27 27
     >
28 28
       <cube-form-group>
29 29
         <cube-form-item
30
-          :field="fields[24]"
31
-          class="btn_plcaeholde"
32
-        ></cube-form-item>
33
-        <cube-form-item
34 30
           :field="fields[20]"
35 31
           v-if="valConfig == 2"
36 32
           class="btn_plcaeholde btn_local"
37 33
         >
34
+          <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
38 35
           <input
39 36
             type="text"
40 37
             class="inp_local"
@@ -45,20 +42,6 @@
45 42
           />
46 43
         </cube-form-item>
47 44
         <cube-form-item
48
-          :field="fields[25]"
49
-          v-if="valConfig == 2"
50
-          class="btn_plcaeholde btn_local"
51
-        >
52
-          <input
53
-            type="text"
54
-            class="inp_local"
55
-            placeholder="请输入报修人"
56
-            v-model="userInpVal"
57
-            @input="changeUserList()"
58
-            @click="showUserPicker()"
59
-          />
60
-        </cube-form-item>
61
-        <cube-form-item
62 45
           v-if="valConfig == 1"
63 46
           :field="fields[0]"
64 47
         ></cube-form-item>
@@ -335,9 +318,8 @@ const solution = {
335 318
 export default {
336 319
   data() {
337 320
     return {
338
-      selectDeptIndex:[0],
339
-      selectUserIndex:[0],
340 321
       validity: {},
322
+
341 323
       valid: undefined,
342 324
       action: {
343 325
         target:
@@ -367,27 +349,22 @@ export default {
367 349
       incidentTitle: "", //事件主题
368 350
       referenceInfo: {}, //引用信息
369 351
       placeSelectData: [], //区域地点下拉框选项
370
-      // inpLocalVal: "", //故障地点输入框
352
+      inpLocalVal: "", //故障地点输入框
371 353
       faultLocationList: [], //区域地点拼接下拉框选项
372 354
       deptInpVal: "", //报修科室输入框
373 355
       deptList: [], //报修科室下拉选项
374 356
       deptRes: "", //下拉框科室信息
375
-      userInpVal: "", //报修人输入框
376
-      userList: [], //报修人下拉选项
377
-      userRes: "", //下拉框报修人信息
378 357
       model: {
379 358
         contactsInformation: "",
380 359
         placeValue: [],
381 360
         address: "", //故障地点
382 361
         requester: "", //报修科室
383
-        requesterUser: "", //报修人
384 362
         houseNumber: "", //详细地址
385 363
         description: "", //事件描述
386 364
         // bxcode: "",
387 365
         assetId: "", //资产
388 366
         category: [],
389 367
         source: "", //事件来源
390
-        branch: "", //院区
391 368
         title: "", //事件主题
392 369
         priority: "", //优先级
393 370
         emergency: "", //紧急度
@@ -400,7 +377,7 @@ export default {
400 377
         candidateGroups: "", //处理组
401 378
         solutionType: [], //知识库类型
402 379
         handleUserOrGroup: false, //处理人or处理组
403
-        room: "", //房间号
380
+        room: "" //房间号
404 381
       },
405 382
       selectedCategoryTxt: "", //事件分类选中展示
406 383
       selectedPlaceTxt: "", //区域地点选中展示
@@ -408,7 +385,6 @@ export default {
408 385
       promptingConent: "",
409 386
       promptingStatus: "",
410 387
       order: 1, //处理方式  1:直接处理,2:派单
411
-      branchArr: [], //院区数组
412 388
       sourceArr: [], //事件来源数组
413 389
       priorityArr: [], //优先级数组
414 390
       emergencyArr: [], //紧急度数组
@@ -718,7 +694,7 @@ export default {
718 694
           modelKey: "requester",
719 695
           label: "报修科室:",
720 696
           props: {
721
-            options: [],
697
+            options: this.requesterList,
722 698
             title: "请选择报修科室",
723 699
             placeholder: "请选择报修科室"
724 700
           },
@@ -760,42 +736,7 @@ export default {
760 736
           rules: {
761 737
             required: false
762 738
           }
763
-        },
764
-        {
765
-          type: "select",
766
-          modelKey: "branch",
767
-          label: "院区:",
768
-          props: {
769
-            options: this.branchArr,
770
-            title: "请选择院区",
771
-            placeholder: "请选择院区"
772
-          },
773
-          events: {
774
-            change: (value, index, text) => {
775
-              console.log(value, index, text);
776
-              console.log(this.model);
777
-              if (this.valConfig == 2) {
778
-                this.getDept();
779
-              }
780
-            }
781
-          },
782
-          rules: {
783
-            required: true
784
-          }
785
-        },
786
-        {
787
-          type: "select",
788
-          modelKey: "requesterUser",
789
-          label: "报修人:",
790
-          props: {
791
-            options: [],
792
-            title: "请选择报修人",
793
-            placeholder: "请选择报修人"
794
-          },
795
-          rules: {
796
-            required: false
797
-          }
798
-        },
739
+        }
799 740
       ]
800 741
     };
801 742
   },
@@ -884,31 +825,6 @@ export default {
884 825
           that.fields[5].props.options = that.sourceArr;
885 826
         });
886 827
     },
887
-    // 获取院区
888
-    getBranch() {
889
-      this.$http
890
-        .post("service/user/data/fetchDataList/branch", {"idx":0,"sum":100})
891
-        .then((res) => {
892
-          if(res.data.status == 200){
893
-            res.data.list.forEach((v) => {
894
-              this.branchArr.push({
895
-                text: v.hosName,
896
-                value: v.id
897
-              });
898
-            });
899
-            this.fields[24].props.options = this.branchArr;
900
-            if(this.loginUser.duty){
901
-              this.model.branch = this.loginUser.duty.branch;
902
-            }else if(this.loginUser.branch){
903
-              this.model.branch = this.loginUser.branch.id;
904
-            }
905
-            // 获取报修科室
906
-            // if (this.valConfig == 2) {
907
-            //   this.getDept();
908
-            // }
909
-          }
910
-        });
911
-    },
912 828
     // 获取优先级
913 829
     getPriority() {
914 830
       var that = this;
@@ -997,7 +913,6 @@ export default {
997 913
             });
998 914
           });
999 915
           that.fields[12].props.options = that.closecodeArr;
1000
-          that.model.closecode = 1572;//设计如此,默认“完全解决”
1001 916
         });
1002 917
     },
1003 918
     // 获取处理人
@@ -1214,19 +1129,19 @@ export default {
1214 1129
             that.$route.params.abnormal;
1215 1130
         }
1216 1131
       } else {
1217
-        // that.name = that.loginUser.name;
1218
-        // that.model.contactsInformation = that.loginUser.phone;
1219
-        // that.model.contacts = that.loginUser.name;
1220
-        // that.model.houseNumber = that.loginUser.houseNumber;
1132
+        that.name = that.loginUser.name;
1133
+        that.model.contactsInformation = that.loginUser.phone;
1134
+        that.model.contacts = that.loginUser.name;
1135
+        that.model.houseNumber = that.loginUser.houseNumber;
1136
+      }
1137
+      if (that.loginUser.place && that.loginUser.place.length) {
1138
+        if (that.loginUser.place.id) {
1139
+          if (that.loginUser.place.area) {
1140
+            that.model.placeValue[0] = that.loginUser.place.area.id;
1141
+          }
1142
+          that.model.placeValue[1] = that.loginUser.place.id;
1143
+        }
1221 1144
       }
1222
-      // if (that.loginUser.place && that.loginUser.place.length) {
1223
-      //   if (that.loginUser.place.id) {
1224
-      //     if (that.loginUser.place.area) {
1225
-      //       that.model.placeValue[0] = that.loginUser.place.area.id;
1226
-      //     }
1227
-      //     that.model.placeValue[1] = that.loginUser.place.id;
1228
-      //   }
1229
-      // }
1230 1145
 
1231 1146
       if (localStorage.getItem("model")) {
1232 1147
         that.model = JSON.parse(localStorage.getItem("model"));
@@ -1749,38 +1664,25 @@ export default {
1749 1664
     },
1750 1665
     // 报修科室
1751 1666
     showDeptPicker() {
1752
-      this.deptList = [];
1753 1667
       this.deptPicker.show();
1754
-      this.getDept(true);
1755
-    },
1756
-    // 报修人
1757
-    showUserPicker() {
1758
-      this.userList = [];
1759
-      this.userPicker.show();
1760
-      this.getUser(true);
1761 1668
     },
1762 1669
     // 选中报修科室
1763 1670
     selectDeptHandler(selectedVal, selectedIndex, selectedTxt) {
1764 1671
       console.log(selectedVal, selectedIndex, selectedTxt);
1765
-      this.deptInpVal = selectedTxt[0];
1766
-      this.selectDeptIndex = selectedIndex;
1767
-      if(!selectedVal[0]){
1768
-        return;
1769
-      }
1770
-      let index = selectedIndex[0].toString();
1771
-      this.model.requester = this.deptRes[index];
1772
-      console.log(this.deptRes[index]);
1773
-      // this.inpLocalVal = this.model.address = this.deptRes[index].place
1774
-      //   .area
1775
-      //   ? this.deptRes[index].place.area.area
1776
-      //     ? this.deptRes[index].place.place
1777
-      //       ? this.deptRes[index].place.area.area +
1778
-      //         this.deptRes[index].place.place
1779
-      //       : this.deptRes[index].place.area.area
1780
-      //     : this.deptRes[index].place.area
1781
-      //   : this.deptRes[index].place.place;
1782
-      if (this.deptRes[index].phone) {
1783
-        this.model.contactsInformation = this.deptRes[index].phone;
1672
+      this.deptInpVal = selectedTxt;
1673
+      this.model.requester = this.deptRes[selectedIndex];
1674
+      console.log(this.deptRes[selectedIndex]);
1675
+      this.inpLocalVal = this.model.address = this.deptRes[selectedIndex].place
1676
+        .area
1677
+        ? this.deptRes[selectedIndex].place.area.area
1678
+          ? this.deptRes[selectedIndex].place.place
1679
+            ? this.deptRes[selectedIndex].place.area.area +
1680
+              this.deptRes[selectedIndex].place.place
1681
+            : this.deptRes[selectedIndex].place.area.area
1682
+          : this.deptRes[selectedIndex].place.area
1683
+        : this.deptRes[selectedIndex].place.place;
1684
+      if (this.deptRes[selectedIndex].phone) {
1685
+        this.model.contactsInformation = this.deptRes[selectedIndex].phone;
1784 1686
       }
1785 1687
       // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
1786 1688
       // var place = {
@@ -1804,30 +1706,6 @@ export default {
1804 1706
       // };
1805 1707
       // localStorage.setItem("place", JSON.stringify(place));
1806 1708
     },
1807
-    // 选中报修人
1808
-    selectUserHandler(selectedVal, selectedIndex, selectedTxt) {
1809
-      console.log(selectedVal, selectedIndex, selectedTxt);
1810
-      this.userInpVal = selectedTxt[0];
1811
-      this.selectUserIndex = selectedIndex;
1812
-      if(!selectedVal[0]){
1813
-        return;
1814
-      }
1815
-      let index = selectedIndex[0].toString();
1816
-      this.model.requesterUser = this.userRes[index];
1817
-      console.log(this.userRes[index]);
1818
-      if (this.userRes[index].phone) {
1819
-        this.model.contactsInformation = this.userRes[index].phone;
1820
-      }
1821
-    },
1822
-    // 取消选中报修人
1823
-    cancelUserHandler() {
1824
-      if (this.model.requesterUser) {
1825
-        this.userInpVal = this.model.requesterUser.name + '('+ this.model.requesterUser.account +')';
1826
-      } else if (!this.model.requesterUser) {
1827
-        this.userInpVal = "";
1828
-        this.model.requesterUser = "";
1829
-      }
1830
-    },
1831 1709
     getAreaData() {
1832 1710
       this.$http
1833 1711
         .post("service/user/data/fetchDataList/area", {
@@ -1934,85 +1812,47 @@ export default {
1934 1812
       }, 600);
1935 1813
     },
1936 1814
     // 报修科室
1937
-    getDept(isFirst) {
1815
+    getDept(type) {
1816
+      var that = this;
1938 1817
       this.$http
1939 1818
         .post("service/user/data/fetchDataList/department", {
1940 1819
           idx: 0,
1941
-          sum: 1000,
1942
-          department: {
1943
-            branch: this.model.branch,
1944
-            selectType:"pinyin_qs",
1945
-            dept: isFirst ? '': (this.deptInpVal || "")
1946
-          }
1820
+          sum: 50,
1821
+          department: { dept: that.deptInpVal || "" }
1947 1822
         })
1948
-        .then((res) => {
1823
+        .then(function(res) {
1949 1824
           var data = res.data.list;
1950
-          this.deptRes = res.data.list;
1951
-          this.deptList = [];
1952
-          for (var i = 0; i < data.length; i++) {
1953
-            this.deptList.push({
1954
-              text: data[i].dept,
1955
-              value: data[i].id
1956
-            });
1957
-          }
1958
-          console.log(this.deptList)
1959
-          this.deptPicker.setData(this.deptList, isFirst?this.selectDeptIndex:[0])
1960
-        });
1961
-    },
1962
-    // 报修人
1963
-    getUser(isFirst) {
1964
-      this.$http
1965
-        .post("service/user/data/fetchDataList/requester", {
1966
-          idx: 0,
1967
-          sum: 1000,
1968
-          requester: {
1969
-            searchKey: isFirst ? '': (this.userInpVal || "")
1825
+          if (type == 1) {
1826
+            that.deptList.length = 0;
1827
+            that.$set(that.deptList, true, []);
1828
+            that.deptList;
1970 1829
           }
1971
-        })
1972
-        .then((res) => {
1973
-          var data = res.data.list;
1974
-          this.userRes = res.data.list;
1975
-          this.userList = [];
1830
+          that.deptRes = res.data.list;
1976 1831
           for (var i = 0; i < data.length; i++) {
1977
-            this.userList.push({
1978
-              text: data[i].name + '('+ data[i].account +')',
1832
+            that.deptList.push({
1833
+              text: data[i].dept,
1979 1834
               value: data[i].id
1980 1835
             });
1981 1836
           }
1982
-          console.log(this.userList)
1983
-          this.userPicker.setData(this.userList, isFirst?this.selectUserIndex:[0])
1837
+
1838
+          that.deptPicker = that.$createCascadePicker({
1839
+            title: "报修科室选择",
1840
+            data: that.deptList,
1841
+            onSelect: that.selectDeptHandler,
1842
+            onCancel: that.cancelDeptHandler
1843
+          });
1984 1844
         });
1985 1845
     },
1986 1846
     changeDeptList() {
1987 1847
       var that = this;
1988 1848
       clearTimeout(that.timer);
1989 1849
       that.timer = setTimeout(() => {
1990
-        this.getDept();
1991
-      }, 600);
1992
-    },
1993
-    changeUserList() {
1994
-      clearTimeout(this.timer);
1995
-      this.timer = setTimeout(() => {
1996
-        this.getUser();
1850
+        this.getDept(1);
1997 1851
       }, 600);
1998 1852
     }
1999 1853
   },
2000 1854
   created() {
2001 1855
     console.log(this.$route.params.data);
2002
-    this.deptPicker = this.$createCascadePicker({
2003
-      title: "报修科室选择",
2004
-      data: this.deptList,
2005
-      onSelect: this.selectDeptHandler,
2006
-      onCancel: this.cancelDeptHandler
2007
-    });
2008
-    this.userPicker = this.$createCascadePicker({
2009
-      title: "报修人选择",
2010
-      data: this.userList,
2011
-      onSelect: this.selectUserHandler,
2012
-      onCancel: this.cancelUserHandler
2013
-    });
2014
-    //获取院区
2015
-    this.getBranch();
2016 1856
     //获取事件来源
2017 1857
     this.getSource();
2018 1858
     // 优先级
@@ -2039,6 +1879,9 @@ export default {
2039 1879
     this.getPlaceData();
2040 1880
     // 获取故障地点
2041 1881
     // this.getFaultLocation();
1882
+    if (this.valConfig == 2) {
1883
+      this.getDept();
1884
+    }
2042 1885
   },
2043 1886
   beforeRouteLeave(to, from, next) {
2044 1887
     console.log(to);
@@ -2082,9 +1925,9 @@ export default {
2082 1925
   border: none;
2083 1926
 }
2084 1927
 
2085
-/* .btn_local {
2086
-  z-index: 101;
2087
-} */
1928
+.btn_local {
1929
+  /* z-index: 101; */
1930
+}
2088 1931
 .inp_local {
2089 1932
   outline: none;
2090 1933
   width: 100%;

+ 390 - 0
src/views/searchDept.vue

@@ -0,0 +1,390 @@
1
+<template>
2
+  <div class="content">
3
+    <div class="search-box">
4
+      <seiminSearch class="mSearch-input-box" :mode="2" button="inside" placeholder="输入关键字"
5
+        @search="doSearch(false)" @input="changeInp" @confirm="doSearch(false)" v-model="keyword"></seiminSearch>
6
+    </div>
7
+    <div class="search-keyword">
8
+      <cube-scroll class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
9
+        <block v-for="(row, index) in keywordList" :key="index">
10
+          <div class="keyword-entry" hover-class="keyword-entry-tap">
11
+            <div class="keyword-text" @tap.stop="doSearch(keywordList[index].keyword)">
12
+              <rich-text :nodes="row.htmlStr"></rich-text>
13
+            </div>
14
+            <div class="keyword-img" @tap.stop="doSearch(keywordList[index].keyword)">
15
+              <image src="/static/HM-search/back.png"></image>
16
+            </div>
17
+          </div>
18
+        </block>
19
+      </cube-scroll>
20
+      <cube-scroll class="keyword-box" v-show="!isShowKeywordList" scroll-y>
21
+        <div class="keyword-block" v-if="oldKeywordList.length > 0">
22
+          <div class="keyword-list-header">
23
+            <div>历史搜索</div>
24
+            <div>
25
+              <image @tap="oldDelete" src="/static/HM-search/delete.png"></image>
26
+            </div>
27
+          </div>
28
+          <div class="keyword">
29
+            <div v-for="(keyword, index) in oldKeywordList" @tap="changeInp(keyword)" :key="index">{{ keyword }}
30
+            </div>
31
+          </div>
32
+        </div>
33
+      </cube-scroll>
34
+    </div>
35
+    <!-- <seiminModel ref="seiminModel"></seiminModel> -->
36
+  </div>
37
+</template>
38
+
39
+<script>
40
+import seiminSearch from '../custom/seiminSearch.vue'
41
+export default {
42
+  components:{
43
+    seiminSearch
44
+  },
45
+  data() {
46
+    return {
47
+      reFresh: '',
48
+      keyword: "",
49
+      oldKeywordList: [],
50
+      keywordList: [],
51
+      isShowKeywordList: false,
52
+      deptList: [],
53
+      timer: null, //定时器
54
+      searchText: "", //搜索文本
55
+      searchData: [], //搜索结果
56
+    };
57
+  },
58
+  beforeDestroy() {
59
+    if (this.timer) {
60
+      clearTimeout(this.timer);
61
+      this.timer = null;
62
+    }
63
+  },
64
+  mounted() {
65
+    this.init();
66
+  },
67
+  methods: {
68
+    // ...mapMutations('other', [
69
+    //   "changeSearchDeptResult",
70
+    //   "changeSeiminModel",
71
+    //   "changeSearchDeptResultList",
72
+    // ]),
73
+    // ...mapMutations("login", ["changeLoginInfo"]),
74
+    init() {
75
+      this.loadOldKeyword();
76
+    },
77
+    //加载历史搜索,自动读取本地Storage
78
+    loadOldKeyword() {
79
+      this.oldKeywordList = JSON.parse(localStorage.getItem('OldKeys'));
80
+    },
81
+    //防抖搜索
82
+    changeInp(event) {
83
+      this.searchText = event;
84
+      clearTimeout(this.timer);
85
+      this.timer = setTimeout(() => {
86
+        this.inputChange(event);
87
+      }, 500);
88
+    },
89
+    //监听输入
90
+    inputChange(event) {
91
+      //兼容引入组件时传入参数情况
92
+      var keyword = event.detail ? event.detail.value : event;
93
+      if (!keyword) {
94
+        this.keywordList = [];
95
+        this.isShowKeywordList = false;
96
+        return;
97
+      }
98
+      this.keyword = keyword;
99
+      this.isShowKeywordList = true;
100
+      let postData = {
101
+        idx: 0,
102
+        sum: 20,
103
+        department: {},
104
+      };
105
+      this.toast = this.$createToast({
106
+        time: 0,
107
+        mask: true,
108
+        txt: "正在加载中",
109
+      });
110
+      this.toast.show();
111
+      reqFetchDataList("data", "department", postData).then((res) => {
112
+        this.toast.hide();
113
+        if (res.status == 200) {
114
+          this.searchData.push({
115
+            name: keyword,
116
+            list: res.list || [],
117
+          });
118
+          let searchText = this.searchText.detail ?
119
+            this.searchText.detail.value :
120
+            this.searchText;
121
+          let index = this.searchData.findIndex(
122
+            (item) => item.name === searchText
123
+          );
124
+          this.deptList = index >= 0 ? this.searchData[index].list : [];
125
+          this.keywordList = this.drawCorrelativeKeyword(
126
+            this.deptList,
127
+            keyword
128
+          );
129
+        } else {
130
+          this.$refs.seiminModel.show({
131
+            skin: "toast",
132
+            icon: "error",
133
+            content: res.msg || "获取数据失败",
134
+          });
135
+          throw new Error(res.msg || "获取数据失败");
136
+        }
137
+      });
138
+    },
139
+    //高亮关键字
140
+    drawCorrelativeKeyword(keywords, keyword) {
141
+      var len = keywords.length,
142
+        keywordArr = [];
143
+      for (var i = 0; i < len; i++) {
144
+        var row = keywords[i];
145
+        //定义高亮#9f9f9f
146
+        var html = "";
147
+        if (this.deptDisplay == 1) {
148
+          // 科室名称
149
+          html = row.dept.replace(
150
+            keyword,
151
+            "<span style='color: #9f9f9f;'>" + keyword + "</span>"
152
+          );
153
+        } else if (this.deptDisplay == 2) {
154
+          // 科室别称
155
+          html = row.deptalias.replace(
156
+            keyword,
157
+            "<span style='color: #9f9f9f;'>" + keyword + "</span>"
158
+          );
159
+        }
160
+        html = "<div>" + html + "</div>";
161
+        var tmpObj = {
162
+          keyword: this.deptDisplay == 1 ? row.dept : row.deptalias,
163
+          htmlStr: html,
164
+        };
165
+        keywordArr.push(tmpObj);
166
+      }
167
+      return keywordArr;
168
+    },
169
+    //清除历史搜索
170
+    oldDelete() {
171
+      this.$createDialog({
172
+        type: 'confirm',
173
+        icon: 'cubeic-alert',
174
+        title: '提示',
175
+        content: '确定清除历史搜索记录?',
176
+        confirmBtn: {
177
+          text: '确定',
178
+          active: true,
179
+          disabled: false,
180
+          href: 'javascript:;'
181
+        },
182
+        cancelBtn: {
183
+          text: '取消',
184
+          active: false,
185
+          disabled: false,
186
+          href: 'javascript:;'
187
+        },
188
+        onConfirm: () => {
189
+          this.oldKeywordList = [];
190
+          localStorage.removeItem('OldKeys');
191
+        },
192
+        onCancel: () => {}
193
+      }).show()
194
+    },
195
+    //执行搜索
196
+    doSearch(keyword) {
197
+      keyword = keyword === false ? this.keyword : keyword;
198
+      this.keyword = keyword;
199
+      this.saveKeyword(keyword); //保存为历史
200
+      let arr = this.deptList.filter((item) => {
201
+        return this.deptDisplay == 1 ?
202
+          item.dept === keyword :
203
+          item.deptalias === keyword;
204
+      });
205
+      if (arr.length) {
206
+        this.changeSearchDeptResult(arr[0]);
207
+      }
208
+    },
209
+    //保存关键字到历史记录
210
+    saveKeyword(keyword) {
211
+      var OldKeys = JSON.parse(localStorage.getItem('OldKeys'));
212
+      if(OldKeys){
213
+        var findIndex = OldKeys.indexOf(keyword);
214
+        if (findIndex == -1) {
215
+          OldKeys.unshift(keyword);
216
+        } else {
217
+          OldKeys.splice(findIndex, 1);
218
+          OldKeys.unshift(keyword);
219
+        }
220
+        //最多10个纪录
221
+        OldKeys.length > 10 && OldKeys.pop();
222
+        localStorage.setItem('OldKeys',JSON.stringify(OldKeys))
223
+        this.oldKeywordList = OldKeys; //更新历史搜索
224
+      }else{
225
+        OldKeys = [keyword];
226
+        localStorage.setItem('OldKeys',JSON.stringify(OldKeys))
227
+        this.oldKeywordList = OldKeys; //更新历史搜索
228
+      }
229
+    },
230
+  },
231
+};
232
+</script>
233
+<style lang="less" scoped>
234
+  view {
235
+    display: block;
236
+  }
237
+
238
+  .search-box {
239
+    background-color: rgb(242, 242, 242);
240
+    padding: 15upx 2.5%;
241
+    display: flex;
242
+    justify-content: space-between;
243
+    position: sticky;
244
+    top: 0;
245
+  }
246
+
247
+  .search-box .mSearch-input-box {
248
+    width: 100%;
249
+  }
250
+
251
+  .search-box .input-box {
252
+    width: 85%;
253
+    flex-shrink: 1;
254
+    display: flex;
255
+    justify-content: center;
256
+    align-items: center;
257
+  }
258
+
259
+  .search-box .search-btn {
260
+    width: 15%;
261
+    margin: 0 0 0 2%;
262
+    display: flex;
263
+    justify-content: center;
264
+    align-items: center;
265
+    flex-shrink: 0;
266
+    font-size: 28upx;
267
+    color: #fff;
268
+    background: linear-gradient(to right, #ff9801, #ff570a);
269
+    border-radius: 60upx;
270
+  }
271
+
272
+  .search-box .input-box>input {
273
+    width: 100%;
274
+    height: 60upx;
275
+    font-size: 32upx;
276
+    border: 0;
277
+    border-radius: 60upx;
278
+    -webkit-appearance: none;
279
+    -moz-appearance: none;
280
+    appearance: none;
281
+    padding: 0 3%;
282
+    margin: 0;
283
+    background-color: #ffffff;
284
+  }
285
+
286
+  .placeholder-class {
287
+    color: #9e9e9e;
288
+  }
289
+
290
+  .search-keyword {
291
+    width: 100%;
292
+    background-color: rgb(242, 242, 242);
293
+  }
294
+
295
+  .keyword-list-box {
296
+    height: calc(100vh - 110upx);
297
+    padding-top: 10upx;
298
+    border-radius: 20upx 20upx 0 0;
299
+    background-color: #fff;
300
+  }
301
+
302
+  .keyword-entry-tap {
303
+    background-color: #eee;
304
+  }
305
+
306
+  .keyword-entry {
307
+    width: 94%;
308
+    height: 80upx;
309
+    margin: 0 3%;
310
+    font-size: 30upx;
311
+    color: #333;
312
+    display: flex;
313
+    justify-content: space-between;
314
+    align-items: center;
315
+    border-bottom: solid 1upx #e7e7e7;
316
+  }
317
+
318
+  .keyword-entry image {
319
+    width: 60upx;
320
+    height: 60upx;
321
+  }
322
+
323
+  .keyword-entry .keyword-text,
324
+  .keyword-entry .keyword-img {
325
+    height: 80upx;
326
+    display: flex;
327
+    align-items: center;
328
+  }
329
+
330
+  .keyword-entry .keyword-text {
331
+    width: 90%;
332
+  }
333
+
334
+  .keyword-entry .keyword-img {
335
+    width: 10%;
336
+    justify-content: center;
337
+  }
338
+
339
+  .keyword-box {
340
+    height: calc(100vh - 110upx);
341
+    border-radius: 20upx 20upx 0 0;
342
+    background-color: #fff;
343
+  }
344
+
345
+  .keyword-box .keyword-block {
346
+    padding: 10upx 0;
347
+  }
348
+
349
+  .keyword-box .keyword-block .keyword-list-header {
350
+    width: 94%;
351
+    padding: 10upx 3%;
352
+    font-size: 27upx;
353
+    color: #333;
354
+    display: flex;
355
+    justify-content: space-between;
356
+  }
357
+
358
+  .keyword-box .keyword-block .keyword-list-header image {
359
+    width: 40upx;
360
+    height: 40upx;
361
+  }
362
+
363
+  .keyword-box .keyword-block .keyword {
364
+    width: 94%;
365
+    padding: 3px 3%;
366
+    display: flex;
367
+    flex-flow: wrap;
368
+    justify-content: flex-start;
369
+  }
370
+
371
+  .keyword-box .keyword-block .hide-hot-tis {
372
+    display: flex;
373
+    justify-content: center;
374
+    font-size: 28upx;
375
+    color: #6b6b6b;
376
+  }
377
+
378
+  .keyword-box .keyword-block .keyword>view {
379
+    display: flex;
380
+    justify-content: center;
381
+    align-items: center;
382
+    border-radius: 60upx;
383
+    padding: 0 20upx;
384
+    margin: 10upx 20upx 10upx 0;
385
+    height: 60upx;
386
+    font-size: 28upx;
387
+    background-color: rgb(242, 242, 242);
388
+    color: #6b6b6b;
389
+  }
390
+</style>