index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="gas-pipe-net">
  4. <CustomHeader> 瓦斯管网监控系统 </CustomHeader>
  5. <div style="width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0">
  6. <VentModal />
  7. </div>
  8. <ModuleCommon
  9. v-for="cfg in moduleConfigs"
  10. :key="cfg.deviceType"
  11. :show-style="cfg.showStyle"
  12. :module-data="cfg.moduleData"
  13. :module-name="cfg.moduleName"
  14. :device-type="cfg.deviceType"
  15. :data="pumpDataSource"
  16. :visible="true"
  17. :style="{ zIndex: 1 }"
  18. />
  19. <div class="scene-box">
  20. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 175, scroll, 0)">
  21. <DvBorderBox8 class="dv_border_8 p-5px" :dur="5" :style="{ height: `${scroll.y + 128}px` }">
  22. <a-tabs class="tabs-box" v-model:activeKey="activeKey">
  23. <a-tab-pane key="1" tab="瓦斯管道监测">
  24. <GasPipeTable :scroll="scroll" @locate="goLocation($event)" />
  25. </a-tab-pane>
  26. <!-- <a-tab-pane key="2" tab="瓦斯网络解算" disabled> 1212312312313321 </a-tab-pane> -->
  27. <a-tab-pane key="2" tab="管道阀门监控">
  28. <MonitorTable
  29. columnsType="gasvalve_monitor"
  30. :dataSource="gasValveDataSource"
  31. design-scope="device_monitor"
  32. :isShowActionColumn="true"
  33. :isShowSelect="false"
  34. title="设备监测"
  35. :scroll="{ y: scroll.y - 30 }"
  36. >
  37. <template #action="{ record }">
  38. <TableAction
  39. :actions="[
  40. {
  41. label: '控制',
  42. onClick: () => controlHandler(record),
  43. },
  44. {
  45. label: '定位',
  46. onClick: goLocation.bind(null, record),
  47. },
  48. ]"
  49. />
  50. </template>
  51. <template #filterCell="{ column, record }">
  52. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
  53. {{ record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
  54. >
  55. <template v-else-if="column.dataIndex === 'warnLevel'">
  56. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  57. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  58. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  59. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  60. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  61. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  62. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  63. <a-tag v-else color="green">正常</a-tag>
  64. </template>
  65. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  66. record.netStatus == '0' ? '断开' : '连接'
  67. }}</a-tag>
  68. </template>
  69. </MonitorTable>
  70. </a-tab-pane>
  71. </a-tabs>
  72. </DvBorderBox8>
  73. </div>
  74. </div>
  75. <BasicModal @register="registerModal" @ok="submitHandler">
  76. <BasicForm @register="registerForm" />
  77. </BasicModal>
  78. </div>
  79. </template>
  80. <script setup lang="ts">
  81. import CustomHeader from '/@/components/vent/customHeader.vue';
  82. import { setDivHeight } from '/@/utils/event';
  83. import { onMounted, ref, nextTick } from 'vue';
  84. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  85. import ModuleCommon from '../../home/configurable/components/ModuleCommon.vue';
  86. import { moduleConfigs } from './gasPipeNet.data';
  87. import GasPipeTable from '../../monitorManager/comment/GasPipeTable.vue';
  88. import MonitorTable from '../../monitorManager/comment/MonitorTable.vue';
  89. import VentModal from '/@/components/vent/micro/ventModal.vue';
  90. import { getTableList, list } from './gasPipeNet.api';
  91. import { get } from 'lodash-es';
  92. import { getActions } from '/@/qiankun/state';
  93. import { TableAction } from '/@/components/Table';
  94. import { BasicModal, useModal } from '/@/components/Modal';
  95. import { BasicForm, useForm } from '/@/components/Form';
  96. import { message } from 'ant-design-vue';
  97. const scroll = ref<{ x: true; y: number }>({ x: true, y: 202 });
  98. const activeKey = ref('1');
  99. const pumpDataSource = ref<any[]>([]);
  100. const gasValveDataSource = ref<any[]>([]);
  101. async function getSysDataSource() {
  102. const res = await getTableList({ strtype: 'sys_gaspipenet', pagetype: 'normal' });
  103. const { deviceInfo } = await list({ devicetype: 'sys', systemID: get(res, 'records[0].id', ''), type: 'all' });
  104. pumpDataSource.value = get(deviceInfo, 'pump', { datalist: [] });
  105. gasValveDataSource.value = get(deviceInfo, 'gasvalve.datalist', []).map((e) => {
  106. return Object.assign(e, e.readData);
  107. });
  108. }
  109. const actions = getActions();
  110. function goLocation(record) {
  111. // debugger;
  112. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null });
  113. }
  114. const [registerModal, { openModal, closeModal }] = useModal();
  115. const [registerForm, { setFieldsValue, validate }] = useForm({
  116. showActionButtonGroup: false,
  117. schemas: [
  118. {
  119. label: '开度',
  120. component: 'Input',
  121. field: 'degree',
  122. },
  123. {
  124. label: '密码',
  125. component: 'InputPassword',
  126. field: 'pwd',
  127. required: true,
  128. },
  129. ],
  130. });
  131. function submitHandler() {
  132. validate().then((val) => {
  133. message.success('VAL:' + JSON.stringify(val));
  134. closeModal();
  135. });
  136. }
  137. function controlHandler(record) {
  138. openModal();
  139. nextTick(() => {
  140. setFieldsValue(record);
  141. });
  142. }
  143. onMounted(() => {
  144. getSysDataSource();
  145. });
  146. </script>
  147. <style scoped lang="less">
  148. @import '/@/design/theme.less';
  149. @import '/@/design/vent/modal.less';
  150. // @{theme-deepblue} {
  151. // .gas-pipe-net {
  152. // }
  153. // }
  154. .gas-pipe-net {
  155. width: 100%;
  156. height: 100%;
  157. }
  158. </style>