|
@@ -26,9 +26,49 @@
|
|
|
<div class="bottom-tabs-box" @mousedown="setDivHeight($event, 175, scroll, 0)">
|
|
|
<DvBorderBox8 class="dv_border_8 p-5px" :dur="5" :style="{ height: `${scroll.y + 128}px` }">
|
|
|
<a-tabs class="tabs-box" v-model:activeKey="activeKey">
|
|
|
- <a-tab-pane key="1" tab="瓦斯管道监测"> <GasPipeTable :deviceType="deviceType" :dataSource="[]" :scroll="scroll" /> </a-tab-pane>
|
|
|
+ <a-tab-pane key="1" tab="瓦斯管道监测">
|
|
|
+ <GasPipeTable :scroll="scroll" @locate="goLocation($event)" />
|
|
|
+ </a-tab-pane>
|
|
|
<!-- <a-tab-pane key="2" tab="瓦斯网络解算" disabled> 1212312312313321 </a-tab-pane> -->
|
|
|
- <a-tab-pane key="3" tab="管道阀门监控"> <GasPipeTable :deviceType="deviceType" :dataSource="[]" :scroll="scroll" /> </a-tab-pane>
|
|
|
+ <a-tab-pane key="3" tab="管道阀门监控">
|
|
|
+ <MonitorTable
|
|
|
+ ref="monitorTable"
|
|
|
+ columnsType="gasvalve_monitor"
|
|
|
+ :dataSource="dataSource"
|
|
|
+ design-scope="device_monitor"
|
|
|
+ :isShowActionColumn="true"
|
|
|
+ :isShowSelect="false"
|
|
|
+ title="设备监测"
|
|
|
+ :scroll="{ y: scroll.y - 30 }"
|
|
|
+ >
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="{
|
|
|
+ label: '定位',
|
|
|
+ onClick: goLocation.bind(null, record),
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #filterCell="{ column, record }">
|
|
|
+ <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
|
|
|
+ {{ record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
|
|
|
+ >
|
|
|
+ <template v-else-if="column.dataIndex === 'warnLevel'">
|
|
|
+ <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
|
|
|
+ <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
|
|
|
+ <a-tag v-else color="green">正常</a-tag>
|
|
|
+ </template>
|
|
|
+ <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
|
|
|
+ record.netStatus == '0' ? '断开' : '连接'
|
|
|
+ }}</a-tag>
|
|
|
+ </template>
|
|
|
+ </MonitorTable>
|
|
|
+ </a-tab-pane>
|
|
|
</a-tabs>
|
|
|
</DvBorderBox8>
|
|
|
</div>
|
|
@@ -39,16 +79,73 @@
|
|
|
<script setup lang="ts">
|
|
|
import CustomHeader from '/@/components/vent/customHeader.vue';
|
|
|
import { setDivHeight } from '/@/utils/event';
|
|
|
- import { ref } from 'vue';
|
|
|
+ import { onMounted, ref } from 'vue';
|
|
|
import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
|
|
|
import ModuleCommon from '../../home/configurable/components/ModuleCommon.vue';
|
|
|
import { moduleConfigs } from './gasPipeNet.data';
|
|
|
import GasPipeTable from '../../monitorManager/comment/GasPipeTable.vue';
|
|
|
+ import MonitorTable from '../../monitorManager/comment/MonitorTable.vue';
|
|
|
import VentModal from '/@/components/vent/micro/ventModal.vue';
|
|
|
+ import { getTableList, list } from './gasPipeNet.api';
|
|
|
+ import { get } from 'lodash-es';
|
|
|
+ import { getActions } from '/@/qiankun/state';
|
|
|
+ import { TableAction } from '/@/components/Table';
|
|
|
+
|
|
|
+ type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
|
|
|
|
|
|
const scroll = ref<{ x: true; y: number }>({ x: true, y: 202 });
|
|
|
const activeKey = ref('1');
|
|
|
- const deviceType = 'gaspipe';
|
|
|
+
|
|
|
+ const dataSource = ref<any[]>([]);
|
|
|
+
|
|
|
+ // 查询关联设备列表
|
|
|
+ async function getDataSource() {
|
|
|
+ const data = await list({ devicetype: 'gasvalve', pagetype: 'normal' });
|
|
|
+ dataSource.value = get(data, 'msgTxt[0].datalist', []).map((e) => {
|
|
|
+ return {
|
|
|
+ ...e,
|
|
|
+ ...e.readData,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ async function getDeviceList(systemID) {
|
|
|
+ const res = await list({ devicetype: 'sys', systemID, type: 'all' });
|
|
|
+
|
|
|
+ const result = res.msgTxt;
|
|
|
+ const deviceArr: DeviceType[] = [];
|
|
|
+ result.forEach((item) => {
|
|
|
+ const data = item['datalist'].forEach((data: any) => {
|
|
|
+ const readData = data.readData;
|
|
|
+ Object.assign(data, readData);
|
|
|
+ });
|
|
|
+ if (item.type != 'sys') {
|
|
|
+ deviceArr.unshift({
|
|
|
+ deviceType: item.type,
|
|
|
+ deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
|
|
|
+ datalist: data,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dataSource.value = deviceArr;
|
|
|
+ }
|
|
|
+
|
|
|
+ async function getSysDataSource() {
|
|
|
+ const res = await getTableList({ strtype: 'sys_gaspipenet', pagetype: 'normal' });
|
|
|
+
|
|
|
+ getDeviceList(get(res, 'records[0].id', ''));
|
|
|
+ }
|
|
|
+
|
|
|
+ const actions = getActions();
|
|
|
+ function goLocation(record) {
|
|
|
+ // debugger;
|
|
|
+ actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null });
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getSysDataSource();
|
|
|
+ getDataSource();
|
|
|
+ });
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|