循环播放音乐逻辑调整,一键误报前关闭所有弹框
This commit is contained in:
parent
1f6955e4a2
commit
1ae91da1cd
@ -92,11 +92,10 @@ import {
|
||||
} from 'src/api/AlertMock';
|
||||
import { queryAlarmInfoById } from 'src/api/DecisionInfo';
|
||||
|
||||
const props = defineProps({
|
||||
alarmMeaasge: {
|
||||
type: Object,
|
||||
},
|
||||
});
|
||||
const props = defineProps<{
|
||||
alarmMeaasge?: AlarmInfo;
|
||||
onHandle?: (id: string, close?: boolean) => void;
|
||||
}>();
|
||||
|
||||
let bgColor = ref('');
|
||||
const dialogWidth = window.screen.width * 0.5;
|
||||
@ -160,6 +159,9 @@ function submitChooseType() {
|
||||
showFaultType.value = true;
|
||||
searchByTipType().then(() => {
|
||||
lineNetStore.alarmInfoListTable?.requestServerInteraction();
|
||||
if (props.alarmMeaasge == undefined && props.onHandle) {
|
||||
props.onHandle(messageUse.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -169,6 +171,9 @@ function falsePositives() {
|
||||
showDialog.value = false;
|
||||
recordFailAlarmInfoById([+messageUse.id]).then(() => {
|
||||
lineNetStore.alarmInfoListTable?.requestServerInteraction();
|
||||
if (props.alarmMeaasge == undefined && props.onHandle) {
|
||||
props.onHandle(messageUse.id, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,22 @@ watch(
|
||||
(val) => {
|
||||
if (val.length) {
|
||||
const alarmType = val[0].alert_type;
|
||||
alarm(alarmType);
|
||||
alarm(alarmType, val[0].id);
|
||||
playAlarmMusic(alarmType);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => lineNetStore.closeAllAlarmInfoDialog,
|
||||
(val) => {
|
||||
if (val) {
|
||||
lineNetStore.closeAllAlarmInfoDialog = false;
|
||||
closeAllDialog();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function playAlarmMusic(type: number) {
|
||||
for (let i = 0; i < dialogInstance.length; i++) {
|
||||
if (dialogInstance[i].show == false) {
|
||||
@ -80,7 +90,11 @@ function timingPlayAlarmMusic(dialog: DialogChainObject) {
|
||||
clearTimeout(dialogInstance[timerIndex].timer);
|
||||
dialogInstance[timerIndex].timer = setTimeout(() => {
|
||||
for (let i = 0; i < dialogInstance.length; i++) {
|
||||
if (dialogInstance[i].show && dialogInstance[i].dialog == dialog) {
|
||||
if (
|
||||
dialogInstance[i].show &&
|
||||
!dialogInstance[i].hasHandle &&
|
||||
dialogInstance[i].dialog == dialog
|
||||
) {
|
||||
playAlarmMusic(dialogInstance[i].alarmType);
|
||||
timingPlayAlarmMusic(dialog);
|
||||
}
|
||||
@ -93,10 +107,27 @@ const dialogInstance: {
|
||||
show: boolean;
|
||||
alarmType: number;
|
||||
timer: string | number | NodeJS.Timeout | undefined;
|
||||
id: string;
|
||||
hasHandle: boolean;
|
||||
}[] = [];
|
||||
function alarm(alarmType: number) {
|
||||
function alarm(alarmType: number, id: string) {
|
||||
const dialogInstanceItem = $q
|
||||
.dialog({ component: alarmInfoDialog })
|
||||
.dialog({
|
||||
component: alarmInfoDialog,
|
||||
componentProps: {
|
||||
onHandle: (id: string, close?: boolean) => {
|
||||
for (let i = 0; i < dialogInstance.length; i++) {
|
||||
if (dialogInstance[i].id == id) {
|
||||
dialogInstance[i].hasHandle = true;
|
||||
if (close !== undefined) {
|
||||
dialogInstance[i].show = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
.onCancel(() => {
|
||||
const index = dialogInstance.findIndex(
|
||||
(item) => item.dialog == dialogInstanceItem
|
||||
@ -109,11 +140,13 @@ function alarm(alarmType: number) {
|
||||
show: true,
|
||||
alarmType,
|
||||
timer,
|
||||
hasHandle: false,
|
||||
id,
|
||||
});
|
||||
timingPlayAlarmMusic(dialogInstanceItem);
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
function closeAllDialog() {
|
||||
if (dialogInstance.length) {
|
||||
dialogInstance.forEach((item) => {
|
||||
clearTimeout(item.timer);
|
||||
@ -122,5 +155,8 @@ onUnmounted(() => {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
onUnmounted(() => {
|
||||
closeAllDialog();
|
||||
});
|
||||
</script>
|
||||
|
@ -363,6 +363,7 @@ watch(
|
||||
);
|
||||
|
||||
function batchHandle() {
|
||||
lineNetStore.closeAllAlarmInfoDialog = true;
|
||||
const params = selected.value.map((item) => item.id);
|
||||
$q.dialog({
|
||||
message: `已选择${params.length}条数据,确定一键误报吗?`,
|
||||
|
@ -27,6 +27,7 @@ export const useLineNetStore = defineStore('lineNet', {
|
||||
untreatedMap: new Map(), // 未处理的报警
|
||||
alarmInfoListTable: undefined as QTable | undefined,
|
||||
playAble: false, //是否允许播放音乐
|
||||
closeAllAlarmInfoDialog: false,
|
||||
}),
|
||||
getters: {
|
||||
untreatedNum: (state) => {
|
||||
|
Loading…
Reference in New Issue
Block a user