From fc4b038e2e5fdde792b1e78133468103d09e6fa3 Mon Sep 17 00:00:00 2001 From: zhaohy <1695786511@qq.com> Date: Mon, 22 Jul 2024 14:31:02 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=97=B6=20=E9=80=BB=E8=BE=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipmentAlarm/editeEquipmentAlarm.vue | 96 +++++++++++++++++----- .../view/alarmManagement/alarmSettings/index.vue | 8 +- 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue index 9ecbbd8..b2c1e72 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue @@ -12,6 +12,20 @@ + + + + + + - - - - - - { - if (monitorTime && monitorTime > 0) { + if (Number.isInteger(monitorTime) && monitorTime > 0) { cbfn(); } else { cbfn('请输入正确的监测时长'); @@ -199,10 +209,9 @@ intervalDuration: [ { required: true, - message: '请输入正确的间隔时长', trigger: 'change', - validator: (rules: any, monitorTime: any, cbfn: any) => { - if (monitorTime && monitorTime > 0) { + validator: (rules: any, intervalDuration: any, cbfn: any) => { + if (Number.isInteger(intervalDuration) && intervalDuration > 0) { cbfn(); } else { cbfn('请输入正确的间隔时长'); @@ -213,10 +222,9 @@ repetitions: [ { required: true, - message: '请输入正确的重复次数', trigger: 'change', validator: (rules: any, repetitions: any, cbfn: any) => { - if (repetitions && repetitions > 0) { + if (Number.isInteger(repetitions) && repetitions > 0) { cbfn(); } else { cbfn('请输入正确的重复次数'); @@ -242,6 +250,50 @@ const btnClick = () => { //表单校验 formRef.value.validate().then(() => { + // 告警频率重复时 都换成分钟 比较 监测时长 和 间隔时长 重复次数 * 间隔 <= 监测 + if (infoObject.value.alarmFrequency === 2) { + // 监测时长 + let monitorTime = 0; + switch (infoObject.value.monitorTimeUnit) { + case 1: + monitorTime = Number(infoObject.value.monitorTime) * 1; + break; + case 2: + monitorTime = Number(infoObject.value.monitorTime) * 60; + break; + case 3: + monitorTime = Number(infoObject.value.monitorTime) * 60 * 24; + break; + } + // 间隔时长 + let intervalTime = 0; + switch (infoObject.value.intervalDurationUnit) { + case 1: + intervalTime = + Number(infoObject.value.intervalDuration) * 1 * Number(infoObject.value.repetitions); + break; + case 2: + intervalTime = + Number(infoObject.value.intervalDuration) * 60 * Number(infoObject.value.repetitions); + break; + case 3: + intervalTime = + Number(infoObject.value.intervalDuration) * + 60 * + 24 * + Number(infoObject.value.repetitions); + break; + } + if (intervalTime > monitorTime) { + NsMessage.error( + '间隔时长超过了告警监测周期的最大值。请设置1分钟到' + + infoObject.value.monitorTime + + ['分', '小时', '天'][infoObject.value.monitorTimeUnit - 1] + + '之间的间隔时长', + ); + return; + } + } //调用接口 let data = { ...infoObject.value }; data.createWorkOrder = Number(data.createWorkOrder); diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue index 2cce3b9..ba6760b 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue @@ -59,14 +59,14 @@ @@ -112,14 +112,14 @@