|
@@ -16,6 +16,7 @@ import {
|
|
getDeviceGroupList,
|
|
getDeviceGroupList,
|
|
getDeviceListSimple,
|
|
getDeviceListSimple,
|
|
getGroupRegions,
|
|
getGroupRegions,
|
|
|
|
+ getMonitorPointAlarmHistory,
|
|
getMonitorPointInfo,
|
|
getMonitorPointInfo,
|
|
getPageList,
|
|
getPageList,
|
|
getRegionsPointsData,
|
|
getRegionsPointsData,
|
|
@@ -40,6 +41,7 @@ import type { Meta2dData } from '@meta2d/core';
|
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
|
import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
|
|
import type { DefaultOptionType, SelectValue } from 'ant-design-vue/es/select';
|
|
import type {
|
|
import type {
|
|
|
|
+ AlarmHistoryItem,
|
|
DeviceGroup,
|
|
DeviceGroup,
|
|
DeviceGroupItem,
|
|
DeviceGroupItem,
|
|
DeviceParams,
|
|
DeviceParams,
|
|
@@ -61,6 +63,7 @@ interface TimeList {
|
|
time: string;
|
|
time: string;
|
|
integral: boolean;
|
|
integral: boolean;
|
|
index: number;
|
|
index: number;
|
|
|
|
+ backgroundShow: boolean;
|
|
}
|
|
}
|
|
|
|
|
|
const envMonitorListRef = useTemplateRef('envMonitorList');
|
|
const envMonitorListRef = useTemplateRef('envMonitorList');
|
|
@@ -99,6 +102,7 @@ const timeList = ref<TimeList[]>([]);
|
|
const timeLineIndex = ref<number>(0);
|
|
const timeLineIndex = ref<number>(0);
|
|
const monitoringPointList = ref<MonitoringPointData[]>([]);
|
|
const monitoringPointList = ref<MonitoringPointData[]>([]);
|
|
const chooseTime = ref<string>();
|
|
const chooseTime = ref<string>();
|
|
|
|
+const alarmHistoryList = ref<AlarmHistoryItem[]>([]);
|
|
|
|
|
|
const envMonitorStyle = ref<EnvMonitorStyle>({
|
|
const envMonitorStyle = ref<EnvMonitorStyle>({
|
|
background: `url(${envMonitorBgc})`,
|
|
background: `url(${envMonitorBgc})`,
|
|
@@ -532,6 +536,7 @@ const generateTimeArray = async () => {
|
|
time: timeStr,
|
|
time: timeStr,
|
|
integral: minute === 0, // 分钟为0时标记为整点
|
|
integral: minute === 0, // 分钟为0时标记为整点
|
|
index: index++,
|
|
index: index++,
|
|
|
|
+ backgroundShow: false,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -547,6 +552,44 @@ const generateTimeArray = async () => {
|
|
}, 50); // 增加短延迟
|
|
}, 50); // 增加短延迟
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// 时间字符串转分钟数(支持带日期和不带日期)
|
|
|
|
+function parseTimeToMinutes(timeStr: string): number {
|
|
|
|
+ if (!timeStr.trim()) return 24 * 60; // 空字符串视为次日0点
|
|
|
|
+ const timePart = timeStr.includes(' ') ? timeStr.split(' ')[1] : timeStr;
|
|
|
|
+ const [hours, minutes] = timePart.split(':').slice(0, 2).map(Number);
|
|
|
|
+ return hours * 60 + minutes;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const getAlarmHistoryList = () => {
|
|
|
|
+ handleRequest(async () => {
|
|
|
|
+ if (gradeTwo.value) {
|
|
|
|
+ alarmHistoryList.value = await getMonitorPointAlarmHistory(gradeTwo.value);
|
|
|
|
+ if (alarmHistoryList.value.length) {
|
|
|
|
+ // 核心逻辑
|
|
|
|
+ for (const bItem of alarmHistoryList.value) {
|
|
|
|
+ const triggerStart = parseTimeToMinutes(bItem.triggerTime);
|
|
|
|
+ const recoverEnd = parseTimeToMinutes(bItem.recoverTime);
|
|
|
|
+
|
|
|
|
+ for (const aItem of timeList.value) {
|
|
|
|
+ const aStart = parseTimeToMinutes(aItem.time);
|
|
|
|
+ const aEnd = aStart + 12;
|
|
|
|
+
|
|
|
|
+ // 区间重叠判断(左闭右开)
|
|
|
|
+ const isOverlap = triggerStart < aEnd && recoverEnd >= aStart;
|
|
|
|
+
|
|
|
|
+ // 特殊处理:当recoverTime为空时,触发时间后的所有区间
|
|
|
|
+ const isInfiniteMode = !bItem.recoverTime.trim() && aStart >= triggerStart;
|
|
|
|
+
|
|
|
|
+ if (isOverlap || isInfiniteMode) {
|
|
|
|
+ aItem.backgroundShow = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
// 返回当前
|
|
// 返回当前
|
|
const returnCurrently = () => {
|
|
const returnCurrently = () => {
|
|
bs?.refresh();
|
|
bs?.refresh();
|
|
@@ -643,6 +686,7 @@ watch(
|
|
() => gradeTwo.value,
|
|
() => gradeTwo.value,
|
|
(count) => {
|
|
(count) => {
|
|
if (count) {
|
|
if (count) {
|
|
|
|
+ getAlarmHistoryList();
|
|
getRegionsPointsList(count);
|
|
getRegionsPointsList(count);
|
|
obtainRegionsPointsData(count);
|
|
obtainRegionsPointsData(count);
|
|
getGroupRegionsList();
|
|
getGroupRegionsList();
|
|
@@ -780,8 +824,7 @@ const copyAreaCanvas = () => {
|
|
<div> </div>
|
|
<div> </div>
|
|
|
|
|
|
<div v-for="item in timeList" :key="item.time">
|
|
<div v-for="item in timeList" :key="item.time">
|
|
- <!-- :class="item.index === timeLineIndex ? 'background-alarm' : 'background-default'" -->
|
|
|
|
- <AFlex align="flex-end" class="background-default">
|
|
|
|
|
|
+ <AFlex align="flex-end" :class="item.backgroundShow ? 'background-alarm' : 'background-default'">
|
|
<AFlex :vertical="true">
|
|
<AFlex :vertical="true">
|
|
<div v-if="item.integral" class="time-style">{{ item.time }}</div>
|
|
<div v-if="item.integral" class="time-style">{{ item.time }}</div>
|
|
<div @click="addTimeLine(item)">
|
|
<div @click="addTimeLine(item)">
|