riku
2024-09-09 dc4ba8076aebd30f33282121a414262b4d4919f4
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
<template>
  <FYTable @search="onSearch" :pagination="true" ref="tableRef">
    <template #options>
      <!-- 区县 -->
      <FYOptionLocation
        :allOption="false"
        :level="3"
        :checkStrictly="false"
        v-model:value="formSearch.locations"
      ></FYOptionLocation>
      <!-- 场景类型 -->
      <FYOptionScene
        :allOption="false"
        :type="2"
        v-model:value="formSearch.scenetype"
      ></FYOptionScene>
      <FYOptionTime :initValue="false" type="month" v-model:value="formSearch.time"></FYOptionTime>
    </template>
    <template #buttons> </template>
 
    <template #options-expand>
      <el-form :inline="true">
        <CompQuickSet @quick-set="setOptions"></CompQuickSet>
      </el-form>
    </template>
 
    <template #table-column> 
      <el-table-column prop="sceneName" :show-overflow-tooltip="true" label="名称">
      </el-table-column>
    </template>
  </FYTable>
</template>
<script setup>
/**
 * 监测设备和场景匹配记录管理
 */
import dayjs from 'dayjs';
import { ref, reactive, computed, getCurrentInstance } from 'vue';
import userMapApi from '@/api/fysp/userMapApi';
import CompQuickSet from '@/views/fysp/evaluation/components/CompQuickSet.vue';
 
const { $fm } = getCurrentInstance().appContext.config.globalProperties;
 
const tableRef = ref();
const formSearch = reactive({
  locations: {},
  scenetype: {},
  time: dayjs().add(-1, 'M').date(1).toDate()
});
 
const area = computed(() => {
  return {
    provincecode: formSearch.locations.pCode,
    provincename: formSearch.locations.pName,
    citycode: formSearch.locations.cCode,
    cityname: formSearch.locations.cName,
    districtcode: formSearch.locations.dCode,
    districtname: formSearch.locations.dName,
    towncode: formSearch.locations.tCode,
    townname: formSearch.locations.tName,
    starttime: $fm.formatYMDH(formSearch.time),
    scensetypeid: formSearch.scenetype.value,
    online: true,
    // 此处数据来源固定为飞羽监管系统
    sourceType: 2
  };
});
 
function onSearch(page, func) {
  userMapApi.fetchDeviceMap(area.value).then((res) => {
    func({ data: res.data });
  });
}
 
function setOptions(param) {
  formSearch.locations = param.locations;
  formSearch.scenetype = param.scenetype;
  // formSearch.sourceType = param.sourceType;
  tableRef.value.onSearch();
}
</script>