|
@@ -12,7 +12,7 @@
|
|
|
v-for="(item, index) in gasMonitor"
|
|
|
:key="index"
|
|
|
class="w-100% mb-5px"
|
|
|
- :value="get(dataSource, item.code)"
|
|
|
+ :value="get(workFaceData, item.code)"
|
|
|
:label="item.title"
|
|
|
labelWidth="200px"
|
|
|
/>
|
|
@@ -24,7 +24,7 @@
|
|
|
<div>工作面基础信息</div>
|
|
|
</template>
|
|
|
<template #container>
|
|
|
- <CustomChart :chart-config="gasUnitBarOption" :chart-data="mockData" height="280px" />
|
|
|
+ <CustomChart :chart-config="gasUnitBarOption" :chart-data="gasUnitDataSource" height="280px" />
|
|
|
</template>
|
|
|
</ventBox1>
|
|
|
</div>
|
|
@@ -41,7 +41,7 @@
|
|
|
v-for="(item, index) in gasPumpValve"
|
|
|
:key="index"
|
|
|
class="w-100% mb-5px"
|
|
|
- :value="get(dataSource, item.code)"
|
|
|
+ :value="get(workFaceData, item.code)"
|
|
|
:label="item.title"
|
|
|
labelWidth="200px"
|
|
|
/>
|
|
@@ -52,7 +52,7 @@
|
|
|
<div>工作面基础信息</div>
|
|
|
</template>
|
|
|
<template #container>
|
|
|
- <CustomChart :chart-config="gasUnitPieOption" :chart-data="mockPieData" height="280px" />
|
|
|
+ <CustomChart :chart-config="gasUnitPieOption" :chart-data="gasUnitDataSource" height="280px" />
|
|
|
</template>
|
|
|
</ventBox1>
|
|
|
</div>
|
|
@@ -62,37 +62,39 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, onMounted } from 'vue';
|
|
|
+ import { ref, onMounted, watch } from 'vue';
|
|
|
import ventBox1 from '/@/components/vent/ventBox1.vue';
|
|
|
import CustomBadges from './customHeader.vue';
|
|
|
import { gasMonitor, headerBadges, gasPumpValve, gasUnitBarOption, mockData, gasUnitPieOption, mockPieData } from '../gasAssessment.data';
|
|
|
import ListItem from '@/views/vent/gas/components/list/listItem.vue';
|
|
|
import { get } from '@/utils/ventutil';
|
|
|
import CustomChart from '@/views/vent/home/configurable/components/detail/CustomChart.vue';
|
|
|
+ type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
|
|
|
+ const props = defineProps({
|
|
|
+ dataSource: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {},
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
const loading = ref(false);
|
|
|
- const dataSource = ref({});
|
|
|
+ const gasUnitDataSource = ref<DeviceType>(); // 抽采单元监测数据
|
|
|
+ const workFaceData = ref<any>({}); // 工作面基础数据
|
|
|
|
|
|
- // // https获取监测数据
|
|
|
- let timer: null | NodeJS.Timeout = null;
|
|
|
- function getMonitor(flag?) {
|
|
|
- if (Object.prototype.toString.call(timer) === '[object Null]') {
|
|
|
- timer = setTimeout(
|
|
|
- async () => {
|
|
|
- if (timer) {
|
|
|
- timer = null;
|
|
|
- }
|
|
|
- await getMonitor();
|
|
|
- // loading.value = false;
|
|
|
- },
|
|
|
- flag ? 0 : 1000
|
|
|
- );
|
|
|
+ watch(
|
|
|
+ () => props.dataSource,
|
|
|
+ (newValue: DeviceType[]) => {
|
|
|
+ if (newValue && newValue.length > 0) {
|
|
|
+ gasUnitDataSource.value = newValue.find((item) => item.deviceType.startsWith('unit'));
|
|
|
+ const workFaceDataSorce = newValue.find((item) => item.deviceType === 'sys');
|
|
|
+ if (workFaceDataSorce) {
|
|
|
+ workFaceData.value = workFaceDataSorce.datalist[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ );
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- timer = null;
|
|
|
- await getMonitor(true);
|
|
|
loading.value = true;
|
|
|
});
|
|
|
</script>
|