fix:逻辑调整 添加判断 字段显示
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'interval'">
|
<template v-if="column.dataIndex === 'interval'">
|
||||||
{{
|
{{
|
||||||
record.intervalDuration && record.alarmFrequency.value === 2
|
record.intervalDuration &&
|
||||||
|
(record.alarmFrequency.value === 2 || record.alarmFrequency.value === 3)
|
||||||
? record.intervalDuration + '' + record.intervalDurationUnit.label
|
? record.intervalDuration + '' + record.intervalDurationUnit.label
|
||||||
: '-'
|
: '-'
|
||||||
}}
|
}}
|
||||||
|
@@ -127,7 +127,7 @@ export const equipmentAlarmTableConfig = (
|
|||||||
obj.intervalDurationUnit = data.intervalDurationUnit.value;
|
obj.intervalDurationUnit = data.intervalDurationUnit.value;
|
||||||
}
|
}
|
||||||
obj.createWorkOrder = obj.createWorkOrder + '';
|
obj.createWorkOrder = obj.createWorkOrder + '';
|
||||||
if (obj.alarmFrequency !== 2) {
|
if (obj.alarmFrequency === 1) {
|
||||||
obj.repetitions = null;
|
obj.repetitions = null;
|
||||||
obj.intervalDuration = null;
|
obj.intervalDuration = null;
|
||||||
obj.intervalDurationUnit = null;
|
obj.intervalDurationUnit = null;
|
||||||
|
Reference in New Issue
Block a user