fix:修改设备告警 能源告警字段 对接 能碳告警
This commit is contained in:
@@ -194,7 +194,7 @@
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
title: '启用状态',
|
||||
dataIndex: 'enableRules',
|
||||
},
|
||||
],
|
||||
@@ -288,7 +288,7 @@
|
||||
},
|
||||
],
|
||||
},
|
||||
params: { equipmentAlarmId: value.id },
|
||||
params: { energyConsumptionAlarmId: value.id },
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
|
@@ -25,6 +25,7 @@
|
||||
label: 'orgName',
|
||||
value: 'orgId',
|
||||
}"
|
||||
:disabled="true"
|
||||
tree-node-filter-prop="orgName" />
|
||||
</a-form-item>
|
||||
<a-form-item label="数据来源" name="dataSources">
|
||||
@@ -54,7 +55,8 @@
|
||||
infoObject.dataSources && infoObject.dataSources[1] === 1
|
||||
? 'deviceName'
|
||||
: 'pointName',
|
||||
value: 'id',
|
||||
value:
|
||||
infoObject.dataSources && infoObject.dataSources[1] === 1 ? 'deviceInfoCode' : 'id',
|
||||
}" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用规则">
|
||||
@@ -139,8 +141,6 @@
|
||||
import { http } from '/nerv-lib/util';
|
||||
import { dict } from '/@/api';
|
||||
|
||||
// import type { Rule } from 'ant-design-vue/es/form';
|
||||
|
||||
const visible = ref(false);
|
||||
//父级数据
|
||||
const energyAlarm = ref({});
|
||||
@@ -311,6 +311,10 @@
|
||||
infoObject.value.dataSourcesType,
|
||||
infoObject.value.dataSourcesWay,
|
||||
];
|
||||
//设备节点
|
||||
if (infoObject.value.dataSourcesWay === 2) {
|
||||
infoObject.value.deviceNode = Number(infoObject.value.deviceNode);
|
||||
}
|
||||
delete infoObject.value.dataSourcesType;
|
||||
delete infoObject.value.dataSourcesWay;
|
||||
infoObject.value.comparisonType = infoObject.value.comparisonType.split(',');
|
||||
@@ -348,8 +352,8 @@
|
||||
enableRules: 0,
|
||||
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
|
||||
};
|
||||
infoObject.value.site = orgId.value;
|
||||
}
|
||||
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
//表单 判断规格
|
||||
@@ -391,7 +395,7 @@
|
||||
//处理数据
|
||||
let data = { ...infoObject.value };
|
||||
//关联能耗告警id
|
||||
data.equipmentAlarmId = energyAlarm.value.id;
|
||||
data.energyConsumptionAlarmId = energyAlarm.value.id;
|
||||
data.errorCode = energyAlarm.value.errorCode;
|
||||
data.dataSourcesType = data.dataSources[0];
|
||||
data.dataSourcesWay = data.dataSources[1];
|
||||
|
@@ -18,22 +18,26 @@
|
||||
placeholder="请选择告警频率"
|
||||
style="width: 100%"
|
||||
allowClear
|
||||
:options="alarmFrequencyData" />
|
||||
:options="alarmFrequencyData"
|
||||
@change="handleChangeAlarmFrequency" />
|
||||
</a-form-item>
|
||||
<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="间隔时长">
|
||||
<ns-input-number
|
||||
style="width: 60%"
|
||||
style="width: 100%"
|
||||
v-model:value="infoObject.intervalDuration"
|
||||
placeholder="请输入间隔时长" />
|
||||
<a-select
|
||||
v-model:value="infoObject.intervalDurationUnit"
|
||||
placeholder="请选择间隔时长单位"
|
||||
style="width: 40%"
|
||||
allowClear
|
||||
:options="intervalDurationUnitData" />
|
||||
placeholder="请输入间隔时长">
|
||||
<template #addonAfter>
|
||||
<a-select
|
||||
v-model:value="infoObject.intervalDurationUnit"
|
||||
placeholder="请选择间隔时长单位"
|
||||
style="width: 80px"
|
||||
allowClear
|
||||
:options="intervalDurationUnitData" />
|
||||
</template>
|
||||
</ns-input-number>
|
||||
</a-form-item>
|
||||
<a-form-item label="优先级" name="priority">
|
||||
<a-select
|
||||
@@ -77,6 +81,12 @@
|
||||
import { energyAlarms } from '/@/api/alarmManagement/alarmSettings/energyAlarm';
|
||||
|
||||
const visible = ref(false);
|
||||
// 间隔单位 默认值
|
||||
const handleChangeAlarmFrequency = () => {
|
||||
if (infoObject.value.alarmFrequency === 2 && !infoObject.value.intervalDurationUnit) {
|
||||
infoObject.value.intervalDurationUnit = 1;
|
||||
}
|
||||
};
|
||||
//表单数据
|
||||
const infoObject = ref({
|
||||
alarmTitle: null,
|
||||
|
@@ -171,7 +171,7 @@
|
||||
dataIndex: 'abnormalDescription',
|
||||
},
|
||||
{
|
||||
title: '启用通知',
|
||||
title: '启用状态',
|
||||
dataIndex: 'enableRules',
|
||||
},
|
||||
],
|
||||
@@ -205,7 +205,7 @@
|
||||
title: value.errorCode,
|
||||
schemas: [
|
||||
{
|
||||
field: 'deviceId',
|
||||
field: 'deviceInfoCode',
|
||||
label: '设备名称',
|
||||
component: 'nsSelectApi',
|
||||
componentProps: {
|
||||
@@ -219,7 +219,7 @@
|
||||
placeholder: '请选择设备名称',
|
||||
resultField: 'data.records',
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
valueField: 'deviceInfoCode',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
@@ -232,7 +232,7 @@
|
||||
label: '设备点位',
|
||||
component: 'nsSelectApi',
|
||||
dynamicParams: {
|
||||
id: 'deviceId', //帮定上级联动数据
|
||||
deviceCode: 'deviceInfoCode', //帮定上级联动数据
|
||||
},
|
||||
componentProps: {
|
||||
api: device.queryDevicePoint,
|
||||
@@ -241,7 +241,7 @@
|
||||
placeholder: '请选择设备点位',
|
||||
labelField: 'code',
|
||||
valueField: 'id',
|
||||
dependency: 'deviceId',
|
||||
dependency: 'deviceInfoCode',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) => {
|
||||
return option.code.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
value: 'orgId',
|
||||
}"
|
||||
:tree-data="siteDataTree"
|
||||
:disabled="true"
|
||||
tree-node-filter-prop="orgName" />
|
||||
</a-form-item>
|
||||
<a-form-item label="设备类型" name="deviceType">
|
||||
@@ -40,9 +41,9 @@
|
||||
@change="selectDeviceType"
|
||||
placeholder="请选择设备类型" />
|
||||
</a-form-item>
|
||||
<a-form-item label="设备名称" name="deviceId">
|
||||
<a-form-item label="设备名称" name="deviceInfoCode">
|
||||
<a-select
|
||||
v-model:value="infoObject.deviceId"
|
||||
v-model:value="infoObject.deviceInfoCode"
|
||||
:disabled="!(infoObject && infoObject.deviceType && infoObject.deviceType.length > 0)"
|
||||
style="width: 100%"
|
||||
:autoClearSearchValue="true"
|
||||
@@ -50,7 +51,7 @@
|
||||
@change="selectDevice"
|
||||
placeholder="请选择设备名称">
|
||||
<template v-for="(item, index) in deviceNameTreeData" :key="index">
|
||||
<a-select-option :value="item.id">
|
||||
<a-select-option :value="item.deviceInfoCode">
|
||||
{{ item.deviceName }}
|
||||
</a-select-option>
|
||||
</template>
|
||||
@@ -64,7 +65,7 @@
|
||||
allow-clear
|
||||
placeholder="请选择设备点位"
|
||||
style="width: 100%"
|
||||
:disabled="!infoObject?.deviceId"
|
||||
:disabled="!infoObject?.deviceInfoCode"
|
||||
:options="devicePointData"
|
||||
:filter-option="filterDevicePoint" />
|
||||
</a-form-item>
|
||||
@@ -118,6 +119,7 @@
|
||||
<a-input
|
||||
style="width: 65px; margin-left: 6px"
|
||||
type="number"
|
||||
status="error"
|
||||
v-model:value="infoObject.alarmList[index - 1].num" />
|
||||
<div
|
||||
style="width: 70px; align-items: center; cursor: pointer"
|
||||
@@ -168,7 +170,7 @@
|
||||
deviceType: [],
|
||||
devicePoint: null,
|
||||
valueType: null,
|
||||
deviceId: null,
|
||||
deviceInfoCode: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ logic: null, num: null, isDelete: 0 }],
|
||||
});
|
||||
@@ -188,7 +190,7 @@
|
||||
let deviceNameTreeData = ref([]);
|
||||
//选择设备类型方法
|
||||
const selectDeviceType = (value: any, selectedOptions: any) => {
|
||||
infoObject.value.deviceId = null;
|
||||
infoObject.value.deviceInfoCode = null;
|
||||
if (selectedOptions && selectedOptions.length > 0) {
|
||||
//获取该类型设备
|
||||
getDevicePage({
|
||||
@@ -201,7 +203,7 @@
|
||||
};
|
||||
//选择设备方法
|
||||
const selectDevice = () => {
|
||||
getDevicePoint({ id: infoObject.value.deviceId });
|
||||
getDevicePoint({ deviceCode: infoObject.value.deviceInfoCode });
|
||||
};
|
||||
//获取设备列表
|
||||
const getDevicePage = (value: any) => {
|
||||
@@ -325,7 +327,7 @@
|
||||
let selectDevice = ref([Number(infoObject.value.deviceType)]);
|
||||
findNodeById(deviceTypeTreeData.value, Number(infoObject.value.deviceType));
|
||||
//获取设备点位
|
||||
getDevicePoint({ id: infoObject.value.deviceId });
|
||||
getDevicePoint({ deviceCode: infoObject.value.deviceInfoCode });
|
||||
// 回显 选择设备类型
|
||||
findParentIds(
|
||||
deviceTypeTreeData.value,
|
||||
@@ -360,10 +362,11 @@
|
||||
deviceType: [],
|
||||
devicePoint: null,
|
||||
valueType: null,
|
||||
deviceId: null,
|
||||
deviceInfoCode: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ logic: null, num: null, isDelete: 0 }],
|
||||
};
|
||||
infoObject.value.site = orgId.value;
|
||||
}
|
||||
|
||||
visible.value = !visible.value;
|
||||
@@ -373,7 +376,7 @@
|
||||
site: [{ required: true, message: '请选择站点', trigger: 'change' }],
|
||||
deviceType: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
||||
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
|
||||
deviceId: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
|
||||
deviceInfoCode: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
|
||||
devicePoint: [{ required: true, message: '请选择设备点位', trigger: 'change' }],
|
||||
valueType: [{ required: true, message: '请选择取值类型', trigger: 'change' }],
|
||||
ruleType: [{ required: true, message: '请选择规则类型', trigger: 'change' }],
|
||||
@@ -396,6 +399,7 @@
|
||||
};
|
||||
// 确认按钮
|
||||
const btnClick = () => {
|
||||
infoObject.value.devicePoint = 1;
|
||||
infoObject.value.alarmList.forEach((item) => {
|
||||
if (item.logic === null || item.num === null) {
|
||||
return;
|
||||
@@ -459,7 +463,7 @@
|
||||
deviceType: [],
|
||||
devicePoint: null,
|
||||
valueType: null,
|
||||
deviceId: null,
|
||||
deviceInfoCode: null,
|
||||
enableRules: 0,
|
||||
alarmList: [{ logic: null, num: null, isDelete: 0 }],
|
||||
};
|
||||
|
@@ -32,22 +32,26 @@
|
||||
placeholder="请选择告警频率"
|
||||
style="width: 100%"
|
||||
allowClear
|
||||
:options="alarmFrequencyData" />
|
||||
:options="alarmFrequencyData"
|
||||
@change="handleChangeAlarmFrequency" />
|
||||
</a-form-item>
|
||||
<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="间隔时长">
|
||||
<ns-input-number
|
||||
style="width: 60%"
|
||||
style="width: 100%"
|
||||
v-model:value="infoObject.intervalDuration"
|
||||
placeholder="请输入间隔时长" />
|
||||
<a-select
|
||||
v-model:value="infoObject.intervalDurationUnit"
|
||||
placeholder="请选择间隔时长单位"
|
||||
style="width: 40%"
|
||||
allowClear
|
||||
:options="intervalDurationUnitData" />
|
||||
placeholder="请输入间隔时长">
|
||||
<template #addonAfter>
|
||||
<a-select
|
||||
v-model:value="infoObject.intervalDurationUnit"
|
||||
placeholder="请选择间隔时长单位"
|
||||
style="width: 80px"
|
||||
allowClear
|
||||
:options="intervalDurationUnitData" />
|
||||
</template>
|
||||
</ns-input-number>
|
||||
</a-form-item>
|
||||
<a-form-item label="优先级" name="priority">
|
||||
<a-select
|
||||
@@ -176,6 +180,12 @@
|
||||
}
|
||||
visible.value = !visible.value;
|
||||
};
|
||||
// 间隔单位 默认值
|
||||
const handleChangeAlarmFrequency = () => {
|
||||
if (infoObject.value.alarmFrequency === 2 && !infoObject.value.intervalDurationUnit) {
|
||||
infoObject.value.intervalDurationUnit = 1;
|
||||
}
|
||||
};
|
||||
//表单 判断规格
|
||||
const rules = {
|
||||
alarmTitle: [
|
||||
@@ -211,7 +221,11 @@
|
||||
required: true,
|
||||
trigger: 'change',
|
||||
validator: (rules: any, intervalDuration: any, cbfn: any) => {
|
||||
if (Number.isInteger(intervalDuration) && intervalDuration > 0) {
|
||||
if (
|
||||
Number.isInteger(intervalDuration) &&
|
||||
intervalDuration > 0 &&
|
||||
infoObject.value.intervalDurationUnit
|
||||
) {
|
||||
cbfn();
|
||||
} else {
|
||||
cbfn('请输入正确的间隔时长');
|
||||
|
@@ -37,7 +37,9 @@
|
||||
<div style="color: #2778ff">{{ infoObject.alarmTitle }}</div>
|
||||
{{ infoObject.abnormalDescription }}</a-descriptions-item
|
||||
>
|
||||
<a-descriptions-item label="设备信息"> {{ infoObject.deviceInfo }} </a-descriptions-item>
|
||||
<a-descriptions-item label="监测点位">
|
||||
{{ infoObject.monitoringPoints }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="重复次数">
|
||||
{{ infoObject.alarmRepetitions }}
|
||||
</a-descriptions-item>
|
||||
|
@@ -64,7 +64,7 @@
|
||||
const visible = ref(false);
|
||||
const showEdit = ref(true);
|
||||
const infoObject = ref({});
|
||||
const equipmentAlarm = ref({});
|
||||
const energyAlarm = ref({});
|
||||
const stateOptions = ref();
|
||||
const logList = ref([]);
|
||||
const config = ref({
|
||||
@@ -73,19 +73,19 @@
|
||||
});
|
||||
const handleClose = () => {
|
||||
showEdit.value = true;
|
||||
equipmentAlarm.value = {};
|
||||
energyAlarm.value = {};
|
||||
infoObject.value = {};
|
||||
visible.value = false;
|
||||
};
|
||||
const btnClick = () => {
|
||||
delete infoObject.value.createTime;
|
||||
infoObject.value.alarmEquipmentLogId = equipmentAlarm.value.id;
|
||||
if (equipmentAlarm.value.createWorkOrder === 0) {
|
||||
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id;
|
||||
if (energyAlarm.value.createWorkOrder === 0) {
|
||||
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
NsMessage.success('操作成功');
|
||||
showEdit.value = true;
|
||||
equipmentAlarm.value = {};
|
||||
energyAlarm.value = {};
|
||||
infoObject.value = {};
|
||||
visible.value = false;
|
||||
emit('logAdd', null);
|
||||
@@ -96,14 +96,14 @@
|
||||
//修改状态
|
||||
const changeShowEdit = () => {
|
||||
// 未生成工单
|
||||
if (equipmentAlarm.value.createWorkOrder === 0) {
|
||||
if (energyAlarm.value.createWorkOrder === 0) {
|
||||
showEdit.value = !showEdit.value;
|
||||
}
|
||||
};
|
||||
const toggle = async (data) => {
|
||||
equipmentAlarm.value = { ...data };
|
||||
energyAlarm.value = { ...data };
|
||||
visible.value = true;
|
||||
if (equipmentAlarm.value.createWorkOrder === 1) {
|
||||
if (energyAlarm.value.createWorkOrder === 1) {
|
||||
stateOptions.value = [
|
||||
{ value: 1, label: '待处理' },
|
||||
{ value: 2, label: '处理中' },
|
||||
@@ -121,8 +121,8 @@
|
||||
}
|
||||
console.log(data, 'data');
|
||||
await http
|
||||
.post(energyAlarmApi.getSelectAlarmEquipmentLogStatusProcess, {
|
||||
alarmEquipmentLogId: data.id,
|
||||
.post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, {
|
||||
alarmEnergyConsumptionLogId: data.id,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.msg === 'success') {
|
||||
@@ -149,7 +149,7 @@
|
||||
infoObject,
|
||||
changeShowEdit,
|
||||
showEdit,
|
||||
equipmentAlarm,
|
||||
energyAlarm,
|
||||
stateOptions,
|
||||
btnClick,
|
||||
visible,
|
||||
|
@@ -36,7 +36,7 @@ const tableKeyMap = [
|
||||
},
|
||||
{
|
||||
title: '监测点位',
|
||||
dataIndex: 'deviceInfo',
|
||||
dataIndex: 'monitoringPoints',
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
|
Reference in New Issue
Block a user