|
|
@ -27,7 +27,10 @@ |
|
|
|
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数"> |
|
|
|
<ns-input-number v-model:value="infoObject.repetitions" placeholder="请输入重复次数" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item v-if="infoObject.alarmFrequency === 2" name="intervalDuration" label="间隔时长"> |
|
|
|
<a-form-item |
|
|
|
v-if="infoObject.alarmFrequency === 2 || infoObject.alarmFrequency === 3" |
|
|
|
name="intervalDuration" |
|
|
|
label="间隔时长"> |
|
|
|
<ns-input-number |
|
|
|
style="width: 100%" |
|
|
|
v-model:value="infoObject.intervalDuration" |
|
|
@ -164,7 +167,10 @@ |
|
|
|
}; |
|
|
|
// 间隔单位 默认值 |
|
|
|
const handleChangeAlarmFrequency = () => { |
|
|
|
if (infoObject.value.alarmFrequency === 2 && !infoObject.value.intervalDurationUnit) { |
|
|
|
if ( |
|
|
|
(infoObject.value.alarmFrequency === 2 || infoObject.value.alarmFrequency === 3) && |
|
|
|
!infoObject.value.intervalDurationUnit |
|
|
|
) { |
|
|
|
infoObject.value.intervalDurationUnit = 1; |
|
|
|
} |
|
|
|
}; |
|
|
@ -250,8 +256,8 @@ |
|
|
|
const btnClick = () => { |
|
|
|
//表单校验 |
|
|
|
formRef.value.validate().then(() => { |
|
|
|
// 告警频率重复时 都换成分钟 比较 监测时长 和 间隔时长 重复次数 * 间隔 <= 监测 |
|
|
|
if (infoObject.value.alarmFrequency === 2) { |
|
|
|
// 告警频率重复时 都换成分钟 比较 监测时长 和 间隔时长 重复次数 * 间隔 <= 监测 是累计时 重复次数是1 |
|
|
|
if (infoObject.value.alarmFrequency === 2 || infoObject.value.alarmFrequency === 3) { |
|
|
|
// 监测时长 |
|
|
|
let monitorTime = 0; |
|
|
|
switch (infoObject.value.monitorTimeUnit) { |
|
|
@ -270,18 +276,22 @@ |
|
|
|
switch (infoObject.value.intervalDurationUnit) { |
|
|
|
case 1: |
|
|
|
intervalTime = |
|
|
|
Number(infoObject.value.intervalDuration) * 1 * Number(infoObject.value.repetitions); |
|
|
|
Number(infoObject.value.intervalDuration) * |
|
|
|
1 * |
|
|
|
Number(infoObject.value.repetitions ? infoObject.value.repetitions : 1); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
intervalTime = |
|
|
|
Number(infoObject.value.intervalDuration) * 60 * Number(infoObject.value.repetitions); |
|
|
|
Number(infoObject.value.intervalDuration) * |
|
|
|
60 * |
|
|
|
Number(infoObject.value.repetitions ? infoObject.value.repetitions : 1); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
intervalTime = |
|
|
|
Number(infoObject.value.intervalDuration) * |
|
|
|
60 * |
|
|
|
24 * |
|
|
|
Number(infoObject.value.repetitions); |
|
|
|
Number(infoObject.value.repetitions ? infoObject.value.repetitions : 1); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (intervalTime > monitorTime) { |
|
|
@ -297,11 +307,13 @@ |
|
|
|
//调用接口 |
|
|
|
let data = { ...infoObject.value }; |
|
|
|
data.createWorkOrder = Number(data.createWorkOrder); |
|
|
|
if (data.alarmFrequency !== 2) { |
|
|
|
if (data.alarmFrequency === 1) { |
|
|
|
data.repetitions = null; |
|
|
|
data.intervalDuration = null; |
|
|
|
data.intervalDurationUnit = null; |
|
|
|
} |
|
|
|
console.log(data, '数据'); |
|
|
|
|
|
|
|
if (!data.orgId) { |
|
|
|
data.orgId = orgId.value; |
|
|
|
} |
|
|
|