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