From 9637a6f13b459141c2c82a4a793ad891e2a4d644 Mon Sep 17 00:00:00 2001 From: zhaohy <1695786511@qq.com> Date: Wed, 24 Jul 2024 15:13:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=20=20=E8=83=BD=E6=BA=90=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=20=20=E5=AF=B9=E6=8E=A5=20=E8=83=BD=E7=A2=B3?= =?UTF-8?q?=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/alarmManagement/energyAlarm.ts | 8 ++--- .../energyAlarm/configureEnergyAlarms.vue | 4 +-- .../energyAlarm/editConfigureEnergyAlarm.vue | 14 +++++---- .../alarmSettings/energyAlarm/editeEnergyAlarm.vue | 28 ++++++++++++------ .../equipmentAlarm/configureDeviceAlarms.vue | 10 +++---- .../equipmentAlarm/editConfigureDeviceAlarm.vue | 26 ++++++++++------- .../equipmentAlarm/editeEquipmentAlarm.vue | 34 +++++++++++++++------- .../src/view/alarmManagement/energyAlarm/look.vue | 4 ++- .../view/alarmManagement/energyAlarm/status.vue | 22 +++++++------- .../view/alarmManagement/energyAlarm/ts/config.ts | 2 +- 10 files changed, 93 insertions(+), 59 deletions(-) diff --git a/hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts b/hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts index eecda98..2593816 100644 --- a/hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts +++ b/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 } diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue index 8527afb..8ff8e1e 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue +++ b/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', }; diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue index 1cec04d..d5f1fad 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue +++ b/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" /> @@ -54,7 +55,8 @@ infoObject.dataSources && infoObject.dataSources[1] === 1 ? 'deviceName' : 'pointName', - value: 'id', + value: + infoObject.dataSources && infoObject.dataSources[1] === 1 ? 'deviceInfoCode' : 'id', }" /> @@ -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]; diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue index c9973a4..4fca329 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue +++ b/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" /> - + placeholder="请输入间隔时长"> + + { + if (infoObject.value.alarmFrequency === 2 && !infoObject.value.intervalDurationUnit) { + infoObject.value.intervalDurationUnit = 1; + } + }; //表单数据 const infoObject = ref({ alarmTitle: null, diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue index e1a334f..cdf021e 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue +++ b/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; diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue index 4ff4b42..cd66023 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue +++ b/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" /> @@ -40,9 +41,9 @@ @change="selectDeviceType" placeholder="请选择设备类型" /> - + @@ -64,7 +65,7 @@ allow-clear placeholder="请选择设备点位" style="width: 100%" - :disabled="!infoObject?.deviceId" + :disabled="!infoObject?.deviceInfoCode" :options="devicePointData" :filter-option="filterDevicePoint" /> @@ -118,6 +119,7 @@
{ - 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 }], }; diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue index b2c1e72..5bef45f 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue +++ b/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" /> - + placeholder="请输入间隔时长"> + + { + 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('请输入正确的间隔时长'); diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue index 5971f79..884fa63 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue @@ -37,7 +37,9 @@
{{ infoObject.alarmTitle }}
{{ infoObject.abnormalDescription }} - {{ infoObject.deviceInfo }} + + {{ infoObject.monitoringPoints }} + {{ infoObject.alarmRepetitions }} diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue index 147beea..0ee7b22 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue +++ b/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, diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts index a534849..890cebd 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts @@ -36,7 +36,7 @@ const tableKeyMap = [ }, { title: '监测点位', - dataIndex: 'deviceInfo', + dataIndex: 'monitoringPoints', }, { title: '更新时间',