index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="scene-box">
  4. <customHeader :fieldNames="calcFieldNames" :options="options" @change="getSelectRow" :optionValue="optionValue">瓦斯抽采泵监测系统</customHeader>
  5. <div class="center-container">
  6. <template v-if="activeKey == 'deviceMonitor'">
  7. <GasPumpMonitor :deviceId="optionValue" />
  8. </template>
  9. <template v-if="activeKey == 'monitorChart'">
  10. <GasMonitorChart :deviceId="optionValue" />
  11. </template>
  12. <div v-else class="history-group">
  13. <div class="device-button-group" v-if="deviceList.length > 0 && activeKey !== 'faultRecord'">
  14. <div
  15. class="device-button"
  16. :class="{ 'device-active': deviceActive == device.deviceType }"
  17. v-for="(device, index) in deviceList"
  18. :key="index"
  19. @click="deviceChange(index)"
  20. >{{ device.deviceName }}</div
  21. >
  22. </div>
  23. <div class="history-container">
  24. <HistoryTable
  25. v-if="activeKey == 'history' && isRefresh"
  26. ref="historyTable"
  27. class="vent-margin-t-20"
  28. :deviceId="optionValue"
  29. :device-type="deviceType"
  30. />
  31. </div>
  32. </div>
  33. </div>
  34. <BottomMenu :navList="navList" @change="changeActive" />
  35. </div>
  36. </template>
  37. <script lang="ts" setup>
  38. import { ref, onMounted, computed } from 'vue';
  39. import customHeader from '/@/components/vent/customHeader.vue';
  40. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  41. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  42. import HistoryTable from '../../monitorManager/comment/HistoryTable.vue';
  43. import { navList } from './gasPumpMonitor.data';
  44. import GasPumpMonitor from './components/monitor.vue';
  45. import GasMonitorChart from './components/monitorChart.vue';
  46. const activeKey = ref('deviceMonitor');
  47. const { options, optionValue, deviceType, isRefresh, deviceActive, deviceList, getSelectRow, getSysDataSource, deviceChange } =
  48. useSystemSelect('sys_surface_caimei');
  49. function changeActive(activeValue) {
  50. activeKey.value = activeValue;
  51. }
  52. // 在监测图表模块展示时,返回空以隐藏 CustomHeader 中的选择框
  53. const calcFieldNames = computed(() => {
  54. if (activeKey.value === 'monitorChart') {
  55. return undefined;
  56. }
  57. return { label: 'systemname', value: 'id', options: 'children' };
  58. });
  59. onMounted(async () => {
  60. await getSysDataSource();
  61. });
  62. </script>
  63. <style lang="less" scoped>
  64. @import '../../comment/less/systemMonitor.less';
  65. @ventSpace: zxm;
  66. </style>