|
|
@@ -3,9 +3,7 @@
|
|
|
<div class="company-home">
|
|
|
<div class="border">
|
|
|
<customHeader @open-history="goToHistory">矿井全域皮带巷三级防灭火系统</customHeader>
|
|
|
- <!-- <div class="test" style="width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0"> -->
|
|
|
<SubApp />
|
|
|
- <!-- </div> -->
|
|
|
<div class="box-container">
|
|
|
<template v-if="showHistory">
|
|
|
<History />
|
|
|
@@ -22,10 +20,10 @@
|
|
|
:data="data"
|
|
|
:visible="true"
|
|
|
@clickItem="handleItemClick"
|
|
|
+ :active-id="currentSelectedId"
|
|
|
/>
|
|
|
</template>
|
|
|
</div>
|
|
|
- <!-- 巷道模型组件 -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -38,316 +36,104 @@ import ModuleCommon from './components/ModuleCommon.vue';
|
|
|
import SubApp from '/@/components/vent/micro/createSubApp.vue';
|
|
|
import History from './components/detail/history.vue';
|
|
|
import { getDataHome } from './configurable.api';
|
|
|
+
|
|
|
const { configs, devicesTypes, fetchConfigs } = useInitConfigs();
|
|
|
const { updateEnhancedConfigs, updateData, data } = useInitPage('矿井全域皮带巷三级防灭火系统');
|
|
|
-const readData = ref({
|
|
|
- monitor_alert: [
|
|
|
- {
|
|
|
- sysId: '2028657172566073300',
|
|
|
- devJSONAarry: [
|
|
|
- {
|
|
|
- name: '光纤测温',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'CO传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '烟雾传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '火焰传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'HCl传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '微震测声传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '温度传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '多参数传感器',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- ],
|
|
|
- sysName: '东翼胶带运输大巷',
|
|
|
- },
|
|
|
- {
|
|
|
- sysId: '2028657172566073301',
|
|
|
- devJSONAarry: [
|
|
|
- {
|
|
|
- name: '光纤测温',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'CO传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '烟雾传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '火焰传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'HCl传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '微震测声传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '温度传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '多参数传感器',
|
|
|
- value: 103,
|
|
|
- },
|
|
|
- ],
|
|
|
- sysName: '1101胶带运输顺槽',
|
|
|
- },
|
|
|
- ],
|
|
|
- spray_control: [
|
|
|
- {
|
|
|
- systemName: '东翼胶带运输大巷',
|
|
|
- sysId: '2028657172566073300',
|
|
|
- sysList: [
|
|
|
- {
|
|
|
- netstatus: '1',
|
|
|
- deviceStatus: '1',
|
|
|
- plsy: '1#区域 1.4MPa',
|
|
|
- kzms: '手动',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- sysId: '2028657172566073301',
|
|
|
- systemName: '1101胶带运输顺槽',
|
|
|
- sysList: [
|
|
|
- {
|
|
|
- netstatus: '1',
|
|
|
- deviceStatus: '1',
|
|
|
- plsy: '1#区域 1.4MPa',
|
|
|
- kzms: '自动',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- gate_control: [
|
|
|
- {
|
|
|
- sysId: '2028657172566073300',
|
|
|
- systemName: '东翼胶带运输大巷',
|
|
|
- gateArray: [
|
|
|
- {
|
|
|
- rearGateOpen: '0',
|
|
|
- positon: '风门1',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '五盘区402辅运大巷风门',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '风门3',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '0',
|
|
|
- positon: '风门4',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '0',
|
|
|
- positon: '风门5',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '风门6',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- sysId: '2028657172566073301',
|
|
|
- systemName: '1101胶带运输顺槽',
|
|
|
- gateArray: [
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '风门1#',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '五盘区402辅运大巷风门',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '0',
|
|
|
- positon: '风门3#',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '风门4#',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '0',
|
|
|
- positon: '风门5#',
|
|
|
- frontGateOpen: '1',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- rearGateOpen: '1',
|
|
|
- positon: '风门6#',
|
|
|
- frontGateOpen: '0',
|
|
|
- status: 1,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- risk_evaluator: [
|
|
|
- {
|
|
|
- sys_id: '2028657172566073300',
|
|
|
- systemname: '东翼胶带运输大巷',
|
|
|
- alarm_level: 103,
|
|
|
- },
|
|
|
- {
|
|
|
- sys_id: '2028657172566073301',
|
|
|
- systemname: '1101胶带运输顺槽',
|
|
|
- alarm_level: null,
|
|
|
- },
|
|
|
- {
|
|
|
- sys_id: '2028657172566073302',
|
|
|
- systemname: '1102辅运顺槽',
|
|
|
- alarm_level: null,
|
|
|
- },
|
|
|
- ],
|
|
|
-});
|
|
|
-// function refresh() {
|
|
|
-// fetchConfigs('Leather').then(() => {
|
|
|
-// configs.value = testBeltLaneFire;
|
|
|
-// Promise.resolve(
|
|
|
-// getDataHome({
|
|
|
-// dataList: configs.value
|
|
|
-// .filter((e) => e.deviceType)
|
|
|
-// .map((e) => e.deviceType)
|
|
|
-// .join(','),
|
|
|
-// })
|
|
|
-// ).then((res: any) => {
|
|
|
-// res.spray_control = [
|
|
|
-// {
|
|
|
-// systemName: '东翼胶带运输大巷',
|
|
|
-// sysId: 2028657172566073300,
|
|
|
-// sysList: [
|
|
|
-// {
|
|
|
-// netstatus: '1',
|
|
|
-// deviceStatus: '1',
|
|
|
-// plsy: '1#区域 1.4MPa',
|
|
|
-// kzms: '手动',
|
|
|
-// },
|
|
|
-// ],
|
|
|
-// },
|
|
|
-// {
|
|
|
-// sysId: 2028657172566073301,
|
|
|
-// systemName: '1101胶带运输顺槽',
|
|
|
-// sysList: [
|
|
|
-// {
|
|
|
-// netstatus: '1',
|
|
|
-// deviceStatus: '1',
|
|
|
-// plqy: '2#区域',
|
|
|
-// plsy: '1.6MPa',
|
|
|
-// kzms: '自动',
|
|
|
-// },
|
|
|
-// ],
|
|
|
-// },
|
|
|
-// ];
|
|
|
-// updateData(res);
|
|
|
-// });
|
|
|
-// updateEnhancedConfigs(configs.value);
|
|
|
-// });
|
|
|
-// }
|
|
|
+
|
|
|
+const currentSelectedId = ref<string | number>('');
|
|
|
+
|
|
|
let timer = null;
|
|
|
const showHistory = ref(false);
|
|
|
-const handleItemClick = (data) => {
|
|
|
- const clickId = data.id;
|
|
|
+// 接收子组件上报的点击事件,更新全局选中状态
|
|
|
+const handleItemClick = (item) => {
|
|
|
+ const clickId = item.id;
|
|
|
if (!clickId) return;
|
|
|
- filterDataById(clickId);
|
|
|
+ currentSelectedId.value = clickId;
|
|
|
+ console.log('爷组件已更新选中ID:', clickId);
|
|
|
};
|
|
|
function goToHistory() {
|
|
|
showHistory.value = !showHistory.value;
|
|
|
}
|
|
|
-// 抽离公共筛选方法,初始化 + 点击共用
|
|
|
-const filterDataById = (clickId: string | number) => {
|
|
|
- const source = readData.value;
|
|
|
- const monitor = source.monitor_alert.find((item) => String(item.sysId) === String(clickId));
|
|
|
- const spray = source.spray_control.find((item) => String(item.sysId) === String(clickId));
|
|
|
- const gate = source.gate_control.find((item) => String(item.sysId) === String(clickId));
|
|
|
|
|
|
- const newData = {
|
|
|
- ...data.value,
|
|
|
+// 数据筛选
|
|
|
+const filterDataById = (sourceData, clickId: string | number) => {
|
|
|
+ if (!sourceData || !clickId) return sourceData;
|
|
|
+ const id = String(clickId);
|
|
|
+ const monitor = sourceData.monitor_alert?.find((item) => String(item.sysId) === id);
|
|
|
+ const spray = sourceData.spray_control?.find((item) => String(item.sysId) === id);
|
|
|
+ const gate = sourceData.gate_control?.find((item) => String(item.sysId) === id);
|
|
|
+ return {
|
|
|
+ ...sourceData,
|
|
|
monitor_alert: monitor ? [monitor] : [],
|
|
|
spray_control: spray ? [spray] : [],
|
|
|
gate_control: gate ? [gate] : [],
|
|
|
- risk_evaluator: source.risk_evaluator,
|
|
|
};
|
|
|
- updateData(newData);
|
|
|
};
|
|
|
|
|
|
+// ==============================
|
|
|
+// 🔥 修复:正常拉取config,但不覆盖!保证 dataList 正常传参
|
|
|
+// ==============================
|
|
|
function refresh() {
|
|
|
fetchConfigs('belt').then(() => {
|
|
|
- configs.value = testBeltLaneFire;
|
|
|
- const firstId = readData.value.monitor_alert?.[0]?.sysId;
|
|
|
- if (firstId) {
|
|
|
- filterDataById(firstId);
|
|
|
- } else {
|
|
|
- Promise.resolve(readData).then(updateData);
|
|
|
+ // 🔥 关键:只有为空时才赋值,不重复覆盖!
|
|
|
+ if (!configs.value || configs.value.length === 0) {
|
|
|
+ configs.value = testBeltLaneFire;
|
|
|
}
|
|
|
+
|
|
|
+ const dataListStr = configs.value
|
|
|
+ .filter((e) => e.deviceType)
|
|
|
+ .map((e) => e.deviceType)
|
|
|
+ .join(',');
|
|
|
+
|
|
|
+ getDataHome({ dataList: dataListStr }).then((res: any) => {
|
|
|
+ res.spray_control = [
|
|
|
+ {
|
|
|
+ systemName: '东翼胶带运输大巷',
|
|
|
+ sysId: '2028657172566073346',
|
|
|
+ sysList: [{ netstatus: '1', deviceStatus: '1', plsy: '1#区域 1.4MPa', kzms: '手动' }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sysId: '2046500718274756609',
|
|
|
+ systemName: '1101胶带运输顺槽',
|
|
|
+ sysList: [{ netstatus: '1', deviceStatus: '1', plqy: '2#区域', plsy: '1.6MPa', kzms: '自动' }],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ let showData = res;
|
|
|
+
|
|
|
+ // 只要用户选过,就永远保持选中,绝不自动切走
|
|
|
+ if (currentSelectedId.value) {
|
|
|
+ showData = filterDataById(res, currentSelectedId.value);
|
|
|
+ }
|
|
|
+ // 从未选过 → 默认第一个
|
|
|
+ else {
|
|
|
+ const firstId = res.monitor_alert?.[0]?.sysId;
|
|
|
+ if (firstId) {
|
|
|
+ currentSelectedId.value = firstId;
|
|
|
+ showData = filterDataById(res, firstId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ updateData(showData);
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
-// function initInterval() {
|
|
|
-// if (timer) clearInterval(timer);
|
|
|
-// timer = setInterval(() => {
|
|
|
-// refresh();
|
|
|
-// }, 5000);
|
|
|
-// }
|
|
|
+// 轮询
|
|
|
+function initInterval() {
|
|
|
+ if (timer) clearInterval(timer);
|
|
|
+ timer = setInterval(() => {
|
|
|
+ refresh();
|
|
|
+ }, 5000);
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
refresh();
|
|
|
- // initInterval();
|
|
|
+ initInterval();
|
|
|
});
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
|
- if (timer) {
|
|
|
- clearInterval(timer);
|
|
|
- timer = null;
|
|
|
- }
|
|
|
+ clearInterval(timer);
|
|
|
+ timer = null;
|
|
|
});
|
|
|
</script>
|
|
|
-
|
|
|
<style lang="less" scoped>
|
|
|
.spray-wrapper {
|
|
|
width: 100%;
|
|
|
@@ -387,4 +173,4 @@ onUnmounted(() => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|