liuxiaolong
2019-05-06 3e0536f508aad49f743e7bfabca34e3980a1b6e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
<template>
  <div class="d-flex align-items-stretch flex-grow-1 pr">
    <!-- 左侧条件区 start -->
    <!-- 侧边栏按钮 start -->
    <div
      class="toggleOpen-btn bg-dark"
      :class="!isOpenTree?'isShow':''"
      v-if="!isOpenTree"
      style="z-index:9999"
    >
      <b-button variant="link" class="tree-btn" @click="isOpenTree = !isOpenTree;setWidthShort()">
        <i class="ion ion-md-swap f20 text-white"></i>
      </b-button>
    </div>
    <!-- 侧边栏按钮 end -->
    <div
      class="bg-white home-sidenav border-right"
      :class="isOpenTree?'w-20':'w-0'"
      style="height: 88.2vh;overflow-x:auto"
    >
      <div class="pl-2 pr-2" style="min-width:360px">
        <!-- 组织集合 start -->
        <org-tree
          ref="tree"
          :isSearch="true"
          @currentNode="_currentNode"
          @removeNode="_removeNode"
          :isOpen="isOpenColony"
          @toggleOpen="isOpenTree = !isOpenTree;setWidthLong()"
        />
        <!-- 组织集合 end -->
      </div>
    </div>
    <!-- 左侧条件区 edn -->
    <!-- 右侧内容区 start -->
    <div class="flex-grow-1" :class="isOpenTree?'w-80':''">
      <!-- 右侧 标题 start -->
      <div class="py-3 bg-white border-bottom mb-4 clearfix">
        <div class="row">
          <div class="col-md-2 d-flex">
            <div
              class="table-switch-btn active"
              :class="tabType==='map'?'active':''"
              @click="tabType='map';handleSearch()"
              v-show="tabType==='table'"
            >
              <i class="fas fa-map"></i>
            </div>
            <div
              class="table-switch-btn active"
              :class="tabType==='table'?'active':''"
              @click="tabType='table';handleSearch()"
              v-show="tabType==='map'"
            >
              <i class="oi d-block oi-list-rich" style="font-size:26px;padding-left:6px"></i>
            </div>
            <!-- 警报列表 alarm -->
            <alarm-list-model
              :tabType="tabType"
              @check-compare-all="tabType='table';tableType='compareList';checkAlarm()"
              @checkModel="checkModel"
              @check-device="checkMapDevice"
              @remove-check-device="removeCheckMapDevice"
              @click-alarm="checkAlarm"
            />
          </div>
          <div class="col-md-10 clearfix row">
            <!-- 库类别 select -->
            <div class="col-md-2 col-sm-3">
              <selectTypeLibrary
                ref="selectTypeLibrary"
                @submitData="(data)=>{recordData=JSON.parse(JSON.stringify(data));handleSearch()}"
              />
            </div>
            <!-- 全部分析 select -->
            <div class="col-md-2 col-sm-3">
              <selectKeyword
                ref="selectKeyword"
                :isDataBase="recordData.dataBaseList && !!recordData.dataBaseList.length||recordData.recordType=== 'other'"
                @submitData="(data)=>{sdkData=JSON.parse(JSON.stringify(data));handleSearch()}"
              />
            </div>
            <!-- 检索关键字 select -->
            <!-- 日期选择框 -->
            <div class="col-md-4 col-sm-8">
              <el-date-picker
                style="width:100%"
                v-model="dateTime"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetimerange"
                align="right"
                unlink-panels
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :clearable="false"
                @change="setDataTimeVal"
                :picker-options="pickerOptions"
                :default-time="dateset"
              ></el-date-picker>
            </div>
            <!-- 检索框-->
            <div class="col-lg-3 col-md-2 col-sm-8">
              <upload-drag
                ref="uploadDrag"
                limitTypes=".jpg,.png,.jpeg,.gif"
                limitSize
                uploadBtntext="以图搜图"
                uploadBtnIcon
                @showSearchImgList="searchImgList"
                @updateThreshold="updateThreshold"
                :isDrag="true"
                :page="1"
                :length="20"
                :tableType="tableType"
                :dateTime="dateTime"
                :threshold="threshold"
              >
                <el-input
                  placeholder="青年/黑发"
                  autocomplete="off"
                  width="100%"
                  v-model="searchName"
                  clearable
                  @keyup.enter.native="handleSearch"
                >
                  <i
                    slot="suffix"
                    class="el-input__icon fas fa-camera"
                    @click="searchImg"
                    style="font-size: 20px;color:#999;cursor:pointer"
                  ></i>
                </el-input>
              </upload-drag>
            </div>
            <div class="col-lg-1 col-md-2 col-sm-4">
              <b-btn variant="primary" class="mr10" @click="handleSearch">搜索</b-btn>
            </div>
          </div>
        </div>
        <!-- <div>
          <b-btn variant="primary" class="btn-circle">
            <span class="fas fa-lock"></span>
            <span class="fas fa-lock-open"></span>
          </b-btn>
        </div>-->
      </div>
      <!-- 右侧 标题 end -->
      <div class="container-p-x">
        <div class="row bg-white pb-2 px-2 border overflow-auto">
          <div class="col-md-12 col-lg-12">
            <!-- 集群按钮 非集群按钮 start -->
            <!-- <div v-if="tabType!=='map'" class="d-flex">
              <div
                variant="link"
                :class="['table-type-btns',tableType === 'commonList'?'active':'']"
                @click="tableType='commonList'"
              >commonList</div>
              <div class="flex-vertical-center px-3">
                <span class="text-light">|</span>
              </div>
              <div
                variant="link"
                :class="['table-type-btns',tableType === 'compareList'?'active':'']"
                @click="tableType='compareList'"
              >compareList</div>
              <div class="flex-vertical-center px-3">
                <span class="text-light">|</span>
              </div>
              <div
                variant="link"
                :class="['table-type-btns',tableType === 'mapList'?'active':'']"
                @click="tableType='mapList'"
              >mapList</div>
            </div>-->
            <!-- 集群按钮 非集群按钮 end -->
            <!-- 条件控制条 start -->
            <div :class="['shrink',isShowBar?'':'']">
              <div class="shrink-btn" @click="isShowBar=!isShowBar">
                <span class="ion ion-ios-arrow-up" v-if="isShowBar"></span>
                <span class="ion ion-ios-arrow-down" v-else></span>
              </div>
            </div>
 
            <div class="pb-2" v-if="isShowBar">
              <select-bar
                :data="selectBarList"
                @to-clear="clearCondition"
                @to-clear-all="clearConditionAll"
              />
            </div>
            <!-- 条件控制条 end -->
            <div :style="`height: ${isShowBar?'71vh':'74.5vh'};overflow: auto;`">
              <view-map ref="mapDevice" v-if="tabType==='map'" :content="mapModel2params"/>
              <common-list ref="commonList" v-show="tabType==='table' && tableType==='commonList'"/>
              <compare-list
                ref="compareList"
                v-show="tabType==='table' && tableType==='compareList'"
              ></compare-list>
              <map-list ref="mapList" v-show="tabType==='table' && tableType==='mapList'"/>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 右侧内容区 end -->
    <siliderModel
      :BigPicParam="BigPic"
      :accompanyPersonParam="accompanyPerson"
      :parentData="childrenData"
      ref="model1"
    ></siliderModel>
    <sdkTypeModel ref="sdkTypeModelForCommon"></sdkTypeModel>
  </div>
</template>
<script>
import { DatePicker, Input, Button } from 'element-ui'
import orgTree from './OrgTree'
import ViewMap from '../Map/Map'
import selectKeyword from './HomeSelect/selectKeyword'
import selectTypeLibrary from './HomeSelect/selectTypeLibrary'
import selectBar from './HomeSelect/selectBar'
import alarmListModel from './AlarmListModel/index'
import uploadDrag from '@/components/upload/uploadDragByPan'
import commonList from '../../pages/Home/components/searchList/commonList'
import compareList from '../../pages/Home/components/searchList/compareList'
import mapList from '../../pages/Home/components/searchList/mapList'
import siliderModel from './components/model/siliderModel'
import { findLikerPics } from '../../server/searchImg.js'
import sdkTypeModel from './components/model/sdkTypeModel'
 
let allMinDate = ''
export default {
  name: 'home',
  metaInfo: {
    title: '首页'
  },
  components: {
    sdkTypeModel,
    siliderModel,
    commonList,
    compareList,
    mapList,
    elButton: Button,
    elInput: Input,
    elDatePicker: DatePicker,
    orgTree,
    uploadDrag,
    selectTypeLibrary,
    selectKeyword,
    ViewMap: ViewMap,
    selectBar,
    alarmListModel,
    findLikerPics
  },
  data() {
    return {
      dateset: ['00:00:00', '23:59:59'],
      mapParam: {},
      leftMap: [],
      pickerOptions: {
        disabledDate(time) {
          const nowDate = new Date()
          nowDate.setHours(0)
          nowDate.setMinutes(0)
          nowDate.setSeconds(0)
          nowDate.setMilliseconds(0)
          const dayEndTime = nowDate.getTime() + 3600 * 1000 * 24 - 1
          if (allMinDate) {
            return (
              time.getTime() > dayEndTime ||
              time > new Date(allMinDate.getTime() + 3600 * 1000 * 24 * 90) ||
              time < new Date(allMinDate.getTime() - 3600 * 1000 * 24 * 90)
            )
          }
          return time.getTime() > dayEndTime
        },
        onPick({ maxDate, minDate }) {
          allMinDate = minDate
        },
        shortcuts: [
          {
            text: '最近一周',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              const nowDate = new Date()
              nowDate.setHours(0)
              nowDate.setMinutes(0)
              nowDate.setSeconds(0)
              nowDate.setMilliseconds(0)
              start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 6)
              end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1)
              // start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              const nowDate = new Date()
              nowDate.setHours(0)
              nowDate.setMinutes(0)
              nowDate.setSeconds(0)
              nowDate.setMilliseconds(0)
              start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 30)
              end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1)
              // start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              const nowDate = new Date()
              nowDate.setHours(0)
              nowDate.setMinutes(0)
              nowDate.setSeconds(0)
              nowDate.setMilliseconds(0)
              start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 90)
              end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1)
              // start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end])
            }
          }
        ]
      },
      userInfo: this.$store.getters.basicUserInfo,
      isShowBar: false,
      tabType: 'map', // table , map
      tableType: 'commonList', // commonList 通用 compareList 比较 mapList
      isOpenTree: true,
      treeData: [],
      currentItem: {
        type: 'areaTree',
        node: { id: '0', type: 'MENU', name: '平台设备' }
      },
      /* 检索条件 */
      // 记录
      recordData: {
        valNames: ['全部记录'],
        dataBaseList: [],
        recordType: '',
        data: null
      },
      // 分析
      sdkData: {
        valNames: ['全部分析'],
        sdkType: [],
        data: null
      },
      // 日期
      dateTime: [],
      // 关键字
      content: '', // 后台
      searchName: '', // 前台自用
      isOpenColony: false,
 
      // 弹窗使用
      BigPic: {},
      accompanyPerson: {},
      childrenData: {},
      // 搜图对比阈值
      threshold: 60,
      /** mapModel2用 */
      mapModel2params: {}
    }
  },
  watch: {},
  computed: {
    orgId() {
      return this.$store.getters.basicUserInfo.orgId
    },
    userId() {
      return this.$store.getters.basicUserInfo.id
    },
    selectBarList() {
      const list = [
        {
          title: '记录',
          type: 'selectTypeLibrary',
          value:
            this.recordData && this.recordData.valNames
              ? this.recordData.valNames.join('/')
              : '全部记录'
        },
        {
          title: '分析',
          type: 'selectKeyword',
          value:
            this.sdkData && this.sdkData.valNames
              ? this.sdkData.valNames.join('/')
              : '全部分析'
        },
        {
          title: '关键词',
          type: 'search',
          value: this.content
        }
      ]
      return list
    }
  },
  methods: {
    setWidthLong() {
      this.$refs.compareList.setWidthLong()
    },
    setWidthShort() {
      this.$refs.compareList.setWidthShort()
    },
    checkModel(data) {
      console.log(data, 'data')
      const BigPicjson = {
        videoNum: data.videoNum,
        picDate: data.picDate,
        videoIp: data.videoIp,
        indeviceid: data.indeviceid,
        imgKey: data.imgKey
      }
      this.BigPic = { ...BigPicjson }
      console.log(this.BigPic, '大图参数')
      const accompanyPersonjson = {
        videoReqNum: data.videoReqNum,
        picDate: data.picDate,
        personId: data.personId,
        Id: data.Id
      }
      this.accompanyPerson = { ...accompanyPersonjson }
      this.childrenData = { ...data }
      if (data.sdkType === '1' || data.sdkType === '人脸') {
        this.$refs.model1.showModel(BigPicjson)
      } else {
        this.$refs.sdkTypeModelForCommon.showModel(BigPicjson, data.picSmUrl)
      }
      // this.$refs.model1.showModel(BigPicjson)
    },
    setDataTimeVal(val) {
      this.setSear(this.dateTime[0], this.dateTime[1])
      if (val === null) {
        this.$toast({
          type: 'error',
          message: '抱歉,检索必须选择时间,已经为您重置近一个月的时间'
        })
        // 日期插件赋值
        this.dateTime = this.getDateInit()
      }
    },
    setSear(start, end) {
      let json = {
        startDate: this.$moment(start).format('YYYY-MM-DD HH:mm:ss'),
        endDate: this.$moment(end).format('YYYY-MM-DD HH:mm:ss')
      }
      localStorage.setItem('sear', JSON.stringify(json))
    },
    getDateInit() {
      // 要求 默认一个月
      const end = new Date()
      const start = new Date()
      const nowDate = new Date()
      nowDate.setHours(0)
      nowDate.setMinutes(0)
      nowDate.setSeconds(0)
      nowDate.setMilliseconds(0)
      start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 30)
      end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1)
      // 霍文博添加 尔松需要的时间参数写入h5本地存储
      let jsonstr = localStorage.getItem('searParams')
 
      if (jsonstr && this.$route.query && this.$route.query.loginedInfo) {
        let json = JSON.parse(jsonstr)
        return [json.startDate, json.endDate]
      }
      this.setSear(start, end)
      // let json = {
      //   startDate: this.$moment(start).format('YYYY-MM-DD HH:mm:ss'),
      //   endDate: this.$moment(end).format('YYYY-MM-DD HH:mm:ss')
      // }
      // localStorage.setItem('sear', JSON.stringify(json))
      /// //////////////////////////////////////////////////////////////
      return [
        this.$moment(start).format('YYYY-MM-DD HH:mm:ss'),
        this.$moment(end).format('YYYY-MM-DD HH:mm:ss')
      ]
    },
    // * 获取组织树
    getOrgDevice(data) {
      return new Promise((resolve, reject) => {
        if (!data) {
          reject(new Error('递归函数传入参数存在问题!!!'))
        }
        const list = []
        const _recursionFn = data => {
          for (let item of data) {
            if (item.type !== 'MENU' && item.type > 2) {
              // resolve(item)
              list.push(item)
            } else if (item.child) {
              _recursionFn(item.child)
            }
          }
        }
        _recursionFn(data)
        resolve(list)
      })
    },
    async getIndeviceid({ type = 'areaTree', node }) {
      if (node.id === 0) {
        // 查询某种全部直接返回
        return {
          cluId: type,
          indeviceid: []
        }
      }
      let list = await this.getOrgDevice([node])
      list = list.map(item => item.id)
      return {
        cluId: '',
        indeviceid: list
      }
    },
    /* 搜索框 */
    async handleSearch() {
      /* 检索框 实际赋值 */
      this.content = this.searchName
      localStorage.setItem('searParams', localStorage.getItem('sear'))
 
      /* 你们需要的值 */
      console.log(
        this.tabType,
        'tabType',
        this.currentItem,
        '左侧树返回值',
        this.recordData,
        '记录',
        this.sdkData,
        '分析',
        this.dateTime,
        '时间',
        this.content,
        '检索条件'
      )
      let indeviceids = await this.getIndeviceid(this.currentItem)
      let params = {
        currentItem: this.currentItem,
        recordData: this.recordData,
        sdkData: this.sdkData,
        dateTime: this.dateTime,
        content: this.content,
        indeviceid: indeviceids || { indeviceid: [] }
      }
      this.mapModel2params = params
      // 判定展示哪个列表形式
      if (
        this.recordData.recordType !== '' ||
        this.recordData.dataBaseList.length > 0
      ) {
        this.tableType = 'compareList'
      } else {
        this.tableType = 'commonList'
      }
      // 判定完毕
      if (this.tabType === 'map') {
        if (window.pathSimplifierIns) {
          window.pathSimplifierIns.setData([
            {
              name: '轨迹',
              path: []
            }
          ])
        }
        console.log(params, '调用地图查询')
        this.$nextTick(() => {
          this.$refs.mapDevice &&
            this.$refs.mapDevice.findDeviceByParams(params)
        })
      } else if (this.tableType === 'commonList') {
        // 公共list
        console.log(params, '调用列入表前的参数--公共list')
        this.$refs.commonList && this.$refs.commonList.getList(params)
        // this.$refs.viewTableLocal && this.$refs.viewTableLocal._initData()
      } else if (this.tableType === 'compareList') {
        // 比较list
        console.log(params, '调用列入表前的参数--比较list')
        this.$refs.compareList &&
          this.$refs.compareList.getList({ tableType: 'ALL', ...params })
      }
    },
    searchImgList(res) {
      if (res.result.esList.length === 0) {
        this.$toast({
          type: 'error',
          message: '没有查到符合相似值的人员数据'
        })
      }
      if (this.tabType === 'map') {
        this.$refs.mapDevice && this.$refs.mapDevice.drawline(res)
      } else if (this.tabType === 'table') {
        this.$refs.mapList && this.$refs.mapList.getList(res)
        this.tableType = 'mapList'
      }
    },
    updateThreshold(res) {
      this.threshold = res
      console.log('阈值为' + this.threshold)
    },
    searchImg() {
      console.log(this.$refs.uploadDrag, 'this.$refs.uploadDrag')
      // 当选择以图搜图按钮时先把地图打开的信息窗口关闭
      if (this.$refs.mapDevice) {
        this.$refs.mapDevice.$refs.aMap.textInfoWindow.close()
      }
      this.$refs.uploadDrag && this.$refs.uploadDrag.uploadStart()
      // .click()
    },
    /* 平台设备操作 */
    // 点击树
    _currentNode(data) {
      this.currentItem = data
      /* 点击后立即执行检索 */
      this.handleSearch()
 
      // if (data && data.id !== '0') {
      //   let params = {
      //     currentItem: this.currentItem,
      //     recordData: this.recordData,
      //     sdkData: this.sdkData,
      //     dateTime: this.dateTime,
      //     content: this.content
      //   }
      //   this.$refs.mapDevice && this.$refs.mapDevice.findDeviceByParams(params)
      // }
      console.log(data, 'node---平台设备操作')
    },
    _removeNode(data) {
      this.currentItem = data
      /* 点击后立即执行检索 */
      this.handleSearch()
      console.log(data, 'tree----触发清空')
      this.$refs.mapDevice && this.$refs.mapDevice.cancelActive()
    },
    /* 检索条操作 */
    clearCondition({ type }) {
      if (type.indexOf('selectTypeLibrary') !== -1) {
        this.$refs.selectTypeLibrary && this.$refs.selectTypeLibrary.init()
      }
      if (type.indexOf('selectKeyword') !== -1) {
        this.$refs.selectKeyword && this.$refs.selectKeyword.init()
      }
      if (type.indexOf('search') !== -1) {
        this.searchName = ''
        this.content = ''
      }
      // 清除条件后进行检索
      this.handleSearch()
    },
    clearConditionAll() {
      this.clearCondition({
        type: ['selectTypeLibrary', 'selectKeyword', 'search']
      })
    },
    /* 图片检索 start */
    async sotu(json) {
      console.log(json, 'sotu参数')
      // this.tableType = 'mapList'
      // this.tabType = 'table'
      let res = await findLikerPics(json)
      console.log(res, 'sotu结果')
      // this.tabType = 'table'
      // this.tableType = 'mapList'
      res.data['index'] = 0
      const realSmallPath = []
      realSmallPath.push({ path: json.path })
      res.data['smallPhotoPath'] = realSmallPath
      res.data['param'] = json
      this.$refs.mapList && this.$refs.mapList.getList({ result: res.data })
      this.$router.replace('')
      this.tabType = 'table'
      this.tableType = 'mapList'
    },
    /* 图片检索 end */
    // 跳转函数初始化
    routeInit() {
      console.log(this.$route.query, 'this.$route.query')
      if (this.$route.query) {
        console.log(this.$route.query, 'this.$route.query')
        if (
          this.$route.query.tabType &&
          ['map', 'table'].includes(this.$route.query.tabType)
        ) {
          this.tabType = this.$route.query.tabType
          if (this.tabType === 'map') {
            let searParams = JSON.parse(localStorage.getItem('searParams'))
            this.$set(searParams, 'liker', this.threshold)
            console.log(this.$refs.mapDevice, 'searParams')
            setTimeout(() => {
              this.$refs.mapDevice.reciveParams(searParams)
              // 霍文博添加,为了保证用户点击刷新按钮,回到地图初始页
              this.$router.replace('')
            }, 100)
          }
        }
        if (
          this.$route.query.tableType &&
          ['commonList', 'compareList', 'mapList'].includes(
            this.$route.query.tableType
          )
        ) {
          // this.tableType = 'mapList'
          // this.tabType = 'table'
          // 修改以图搜图的相似度的比分
          this.threshold = parseInt(this.$route.query.liker)
          if (this.$route.query.tableType === 'mapList') {
            let json = {
              liker: this.threshold,
              path: this.$route.query.urlPath,
              page: 1,
              length: 40,
              startDate: this.dateTime[0], // new Date(this.$route.query.startDate).format('yyyy-MM-dd HH:mm:ss'),
              endDate: this.dateTime[1] // new Date(this.$route.query.endDate).format('yyyy-MM-dd HH:mm:ss')
            }
            this.sotu(json)
          }
        }
        if (this.$route.query.isSearch) {
          this.handleSearch()
        }
      }
    },
    // 报警列表点击回调
    checkMapDevice(data) {
      this.$refs.mapDevice && this.$refs.mapDevice.cancelActive()
      this.$refs.mapDevice &&
        this.$refs.mapDevice.setActiveAlarm({
          id: data && data.videoReqNum ? data.videoReqNum : ''
        })
    },
    removeCheckMapDevice() {
      this.$refs.mapDevice && this.$refs.mapDevice.cancelActive()
    },
    checkAlarm() {
      // 列表模式下触发查询警报列表
      this.$refs.selectTypeLibrary &&
        this.$refs.selectTypeLibrary.setSelect({
          name: '报警记录',
          value: 'alarm'
        })
      this.handleSearch()
    }
  },
  created() {
    // 日期插件赋值
    this.dateTime = this.getDateInit()
    let fenshu = localStorage.getItem('threshold')
    if (fenshu) {
      this.threshold = parseInt(fenshu)
    } else {
      localStorage.setItem('threshold', 60)
    }
    this.routeInit()
    // localStorage.setItem('threshold', 60)
  },
  mounted() {
    // this.handleSearch()
  }
}
</script>
<style lang="scss" >
.ui-icon-lg {
  font-size: 30px;
  width: 60px;
  height: 60px;
  line-height: 60px !important;
}
.home-sidenav {
  transition: all 0.5s;
  overflow: hidden;
}
.w-20 {
  width: 20%;
}
.w-80 {
  width: 80%;
}
.w-0 {
  width: 0%;
}
.toggleOpen-btn {
  border-radius: 5px;
  position: absolute;
  left: -8px;
  top: 3.5rem;
  transition: all 2s;
  opacity: 0;
}
.toggleOpen-btn.isShow {
  opacity: 1;
}
 
.table-switch-btn {
  height: 40px;
  width: 50px;
  line-height: 30px;
  font-size: 30px;
  padding: 5px 8px;
  color: #ccc;
  cursor: pointer;
  &.active {
    color: #35bde7;
  }
}
.bg-grid {
  background: #ccc;
}
.btn-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  text-align: center;
  padding: 0;
}
.shrink {
  padding: 2px 0;
  text-align: center;
  .shrink-btn {
    width: 200px;
    height: 10px;
    line-height: 5px;
    text-align: center;
    margin: 0 auto;
    border-radius: 5px;
    cursor: pointer;
    transition: all 1s;
    background: #ccc;
    /* 抑制选中 */
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    span {
      margin-top: -4px;
      color: #fff;
      font-size: 15px;
    }
  }
  &:hover .shrink-btn {
    background: #35bde7;
  }
}
</style>