济菏高速业务端

151 lines
4.0 KiB

<template>
1 year ago
<div class="CommandDispatch" :style="{ '--row': row }">
<component
:is="key"
v-for="(_, key) in gridAreaMap"
:key="key"
:ref="key"
:style="{ gridArea: gridAreaMap[key] }"
@fullHeight="(opacityKey) => handleFullHeight(key, opacityKey)"
/>
</div>
</template>
<script>
import request from "@/utils/request";
1 year ago
const files = require.context("./Cards", true, /[^/]+\/index\.vue$/);
const components = files.keys().reduce((components, key) => {
components[key.match(/[^/]+/g)[1]] = files(key).default;
return components;
}, {});
const originGridArea = {
EventInformation: "1 / 1 / span 9 / 1", // 事件信息(左1)
DispatchLiaison: "10 / 1 / span 9 / 2", // 调度联络(左2)
TrafficControl: "19 / 1 / span 7 / 2", //交通管制(右3)
CrowdnessIndicatorRankings: "1 / 2 / span 11 / 2", //地图 / 拥挤指数排名情况(中1)
DisposalProcess: "12 / 2 / span 14 / 2", //处置过程(中2)
RealTimeVideo: "1 / 3 / span 7 / 3", //实时视频(右1)
ReleaseInformation: "8 / 3 / span 7 / 3", //信息发布(右2)
DeviceControl: "15 / 3 / span 11 / 3", //设备管控(右3)
// DisposalPlan: "17 / 1 / span 9 / 2", //处置预案(作废)
1 year ago
};
export default {
1 year ago
name: "CommandDispatch",
components: {
...components,
},
props: {
detailId: {
type: [String, Number],
default: '96b9918efc01488cb22fa1d9d3236dfd',
1 year ago
},
},
provide() {
return {
provideData: this.provideData,
1 year ago
};
},
data() {
return {
gridAreaMap: {
1 year ago
...originGridArea,
},
row: 24,
provideData: {
1 year ago
detail: null,
},
};
},
created() {
this.getDetail();
},
methods: {
getDetail() {
// 指挥调度 - 只有交通事件没有感知事件,感知事件完成后自动转为交通事件
request({
url: `/dc/system/event/${this.detailId}`,
method: "GET",
})
.then((result) => {
if (result.code != 200) return;
console.log(result.data)
1 year ago
this.provideData.detail = result.data;
if(['设备设施隐患','非法上路','施工建设','服务区异常'].includes(result.data.eventName)){
const gridArea = {...originGridArea}
// 第一列变化
gridArea['DispatchLiaison'] = '10 / 1 / span 16 / 2'
delete gridArea.TrafficControl;
if(['设备设施隐患','非法上路'].includes(result.data.eventName)){
// 第三列变化
gridArea['RealTimeVideo'] = '1 / 3 / span 13 / 3'
delete gridArea.ReleaseInformation;
}
this.gridAreaMap = gridArea;
}
})
1 year ago
.catch((err) => {});
},
handleFullHeight(key, opacityKey) {
if (this.gridAreaMap[key] !== originGridArea[key]) {
this.gridAreaMap[key] = originGridArea[key];
if (this.$refs[opacityKey]?.[0]) {
this.$refs[opacityKey][0].$el.style.opacity = 1;
this.$refs[opacityKey][0].$el.style.pointerEvents = "auto";
1 year ago
}
} else {
let index = 0;
if (this.$refs[opacityKey]?.[0]) {
this.$refs[opacityKey][0].$el.style.opacity = 0;
this.$refs[opacityKey][0].$el.style.pointerEvents = "none";
1 year ago
}
1 year ago
this.gridAreaMap[key] = originGridArea[key].replace(
/[0-9]+/g,
(num) => {
try {
return { 0: "1", 2: this.row + 1 }[index] || num;
} catch (error) {
} finally {
index++;
}
}
1 year ago
);
}
1 year ago
},
},
};
</script>
1 year ago
<style lang="scss" scoped>
.CommandDispatch {
padding: 24px 12px 21px 12px;
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-template-rows: repeat(var(--row), 1fr);
gap: 18px;
1 year ago
> div {
transition: all 0.18s linear;
}
::v-deep {
.title-button {
border-radius: 65px;
font-size: 12px;
}
.special-button {
border-radius: 3px !important;
padding: 3px;
height: 26px;
}
}
}
</style>