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 @@