Browse Source

fix:修改设备告警 能源告警字段 对接 能碳告警

temp
zhaohy 4 months ago
parent
commit
9637a6f13b
  1. 8
      hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts
  2. 4
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue
  3. 14
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
  4. 28
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue
  5. 10
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue
  6. 26
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue
  7. 34
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
  8. 4
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue
  9. 22
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue
  10. 2
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts

8
hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts

@ -1,6 +1,6 @@
export enum energyAlarmApi {
getTableList = '/carbon-smart/api/AlarmEquipmentLog/selectAlarmEquipmentLog', //设备告警 列表
getCodeList = '/carbon-smart/api/AlarmEquipmentLog/selectErrorCodeList', //设备告警 列表
getSelectAlarmEquipmentLogStatusProcess = '/carbon-smart/api/AlarmEquipmentLogStatusProcess/selectAlarmEquipmentLogStatusProcess', //设备告警 状态 没有创建工单log接口
noCreatOrUpdateLog = '/carbon-smart/api/AlarmEquipmentLogStatusProcess/creatOrUpdate', //设备告警 状态 没有创建工单 添加 修改状态log
getTableList = '/carbon-smart/api/AlarmEnergyConsumptionLog/selectAlarmEnergyConsumptionLog', //能碳告警 列表
getCodeList = '/carbon-smart/api/AlarmEnergyConsumptionLog/selectErrorCodeList ', //能碳告警 列表
getSelectAlarmEnergyConsumptionLogStatusProcess = '/carbon-smart/api/AlarmEnergyConsumptionLogStatusProcess/selectAlarmEnergyConsumptionLogStatusProcess', //能碳告警 状态 没有创建工单log接口
noCreatOrUpdateLog = '/carbon-smart/api/AlarmEnergyConsumptionLogStatusProcess/creatOrUpdate', //能碳告警 状态 没有创建工单 添加 修改状态log
}

4
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue

@ -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',
};

14
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue

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

28
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue

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

10
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue

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

26
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue

@ -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 }],
};

34
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue

@ -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('请输入正确的间隔时长');

4
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue

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

22
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue

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

2
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts

@ -36,7 +36,7 @@ const tableKeyMap = [
},
{
title: '监测点位',
dataIndex: 'deviceInfo',
dataIndex: 'monitoringPoints',
},
{
title: '更新时间',

Loading…
Cancel
Save