From de7a0ab88a6c82e3e413c4dca30e1893d9d7fcd5 Mon Sep 17 00:00:00 2001
From: zhaohy <1695786511@qq.com>
Date: Thu, 11 Jul 2024 16:45:42 +0800
Subject: [PATCH] =?UTF-8?q?add:=E9=85=8D=E7=BD=AE=E8=AE=BE=E5=A4=87?=
=?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=20?=
=?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=91=8A=E8=AD=A6=E9=85=8D=E7=BD=AE=20?=
=?UTF-8?q?=E9=87=8C=E9=9D=A2=E7=9A=84=E6=95=B0=E6=8D=AE=E6=9D=A5=E6=BA=90?=
=?UTF-8?q?=20=E8=AE=BE=E5=A4=87=E8=8A=82=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/alarmSettings/deviceAlarms.ts | 6 +-
.../energyAlarm/configureEnergyAlarms.vue | 54 ++--
.../energyAlarm/editConfigureEnergyAlarm.vue | 342 +++++++++++----------
.../alarmSettings/energyAlarm/editeEnergyAlarm.vue | 50 +--
.../equipmentAlarm/configureDeviceAlarms.vue | 121 +++++---
.../equipmentAlarm/editConfigureDeviceAlarm.vue | 254 ++++++++-------
.../equipmentAlarm/editeEquipmentAlarm.vue | 20 +-
.../view/alarmManagement/alarmSettings/index.vue | 89 ++++--
.../alarmSettings/notificationManagement/index.vue | 246 +++++++++++++++
.../alarmSettings/ts/equipmentAlarmConfig.ts | 6 +-
.../ts/notificationManagementConfig.ts | 4 +-
11 files changed, 790 insertions(+), 402 deletions(-)
create mode 100644 hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
diff --git a/hx-ai-intelligent/src/api/alarmSettings/deviceAlarms.ts b/hx-ai-intelligent/src/api/alarmSettings/deviceAlarms.ts
index b659c51..b78f725 100644
--- a/hx-ai-intelligent/src/api/alarmSettings/deviceAlarms.ts
+++ b/hx-ai-intelligent/src/api/alarmSettings/deviceAlarms.ts
@@ -1,5 +1,9 @@
export enum deviceAlarms {
getTableList = '/carbon-smart/api/AlarmEquipment/selectAlarmEquipment', //设备告警分页
- addOrUpNewData = '/carbon-smart/api/AlarmEquipment/creatOrUpdate', //设备告警添加 修海
+ addOrUpNewData = '/carbon-smart/api/AlarmEquipment/creatOrUpdate', //设备告警添加 修改
del = '/carbon-smart/api/AlarmEquipment/delete', //设备告警删除
+ configGetTableList = '/carbon-smart/api/AlarmEquipmentRule/selectAlarmEquipmentRule', //配置设备告警分页
+ configAddOrUpNewData = '/carbon-smart/api/AlarmEquipmentRule/creatOrUpdate', //配置设备告警添加 修改
+ configFindById = '/carbon-smart/api/AlarmEquipmentRule/findById', //配置设备告警 查询详情
+ configDel = '/carbon-smart/api/AlarmEquipmentRule/delete', //配置设备告警删除
}
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 a7521da..c43df72 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue
@@ -31,18 +31,23 @@
import editConfigureEnergyAlarm from './editConfigureEnergyAlarm.vue';
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
+ import { device } from '/@/api/deviceManage';
export default {
components: { editConfigureEnergyAlarm },
setup() {
- //设备告警数据
- const configureDeviceAlarmsData = ref({});
+ //能源告警配置
+ const configureEnergyAlarmsData = ref({});
const show = ref(false);
const tableConfig = ref({});
const mainRef = ref({});
const editConfigureEnergyAlarms = ref({});
const mockData = ref(data.listData);
+ //组织树
+ const orgId = ref('');
+ const result = JSON.parse(sessionStorage.getItem('ORGID')!);
+ orgId.value = result;
const clickSwitch = (data: any) => {
NsModal.confirm({
title: '启用状态',
@@ -71,7 +76,7 @@
a.click();
};
const setconfigureDeviceAlarmsData = (value: any) => {
- configureDeviceAlarmsData.value = value;
+ configureEnergyAlarmsData.value = value;
show.value = true;
tableConfig.value = {
title: '告警规则',
@@ -83,7 +88,7 @@
name: 'RoleTypeAdd',
type: 'primary',
handle: () => {
- editConfigureEnergyAlarms.value.toggle();
+ editConfigureEnergyAlarms.value.toggle(null, configureEnergyAlarmsData.value.va);
},
},
{
@@ -172,7 +177,7 @@
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
- editConfigureEnergyAlarms.value.toggle(data);
+ editConfigureEnergyAlarms.value.toggle(data, configureEnergyAlarmsData.value);
},
},
{
@@ -190,29 +195,37 @@
title: value.errorCode,
schemas: [
{
- field: 'provider',
+ field: 'deviceName',
label: '设备名称',
- component: 'NsInput',
+ component: 'nsSelectApi',
componentProps: {
- placeholder: '请输入设备名称',
+ api: device.queryDevicePage,
+ params: {
+ orgId: orgId.value,
+ pageNum: 1,
+ pageSize: 99,
+ },
+ placeholder: '请选择设备名称',
+ resultField: 'data.records',
+ labelField: 'deviceName',
+ valueField: 'id',
+ autoAddLink: true, //默认添加联动
},
},
{
- field: 'provider',
+ field: 'devicePoint',
label: '设备点位',
component: 'nsSelectApi',
+ dynamicParams: {
+ id: 'deviceName', //帮定上级联动数据
+ },
componentProps: {
- api: '/api/community/objs/DictItem',
- params: {
- pageSize: 100,
- code: 'MZ',
- },
- placeholder: '请选择设备点位',
+ api: device.queryDevicePoint,
resultField: 'data',
- labelField: 'dictName',
- valueField: 'dictValue',
- immediate: true,
- autoSelectFirst: false,
+ placeholder: '请选择设备点位',
+ labelField: 'code',
+ valueField: 'id',
+ dependency: 'deviceName',
},
},
{
@@ -249,10 +262,11 @@
};
};
return {
- configureDeviceAlarmsData,
+ configureEnergyAlarmsData,
show,
clickSwitch,
doWnload,
+ orgId,
tableConfig,
editConfigureEnergyAlarms,
setconfigureDeviceAlarmsData,
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 f9732ff..4e2b02c 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
@@ -6,6 +6,7 @@
:footer-style="{ textAlign: 'right' }"
:ok="btnClick"
:cancel="handleClose"
+ @close="handleClose"
placement="right">
@@ -18,41 +19,54 @@
placeholder="请选择站点"
allow-clear
tree-default-expand-all
- :tree-data="zdTreeData"
- tree-node-filter-prop="label">
-
-
-
+ :tree-data="siteDataTree"
+ :field-names="{
+ children: 'linkList',
+ label: 'orgName',
+ value: 'orgId',
+ }"
+ tree-node-filter-prop="orgName" />
-
+
+ :tree-data="jdTreeData"
+ :field-names="{
+ children: 'children',
+ label: infoObject.sbtype && infoObject.sbtype[1] === 1 ? 'deviceName' : 'pointName',
+ value: 'id',
+ }"
+ @select="selectJdDeviceChange" />
-
+
+ 'blue-background': infoObject.enableRules === 1 ? true : false,
+ 'grey-background': infoObject.enableRules === 1 ? false : true,
+ }"
+ @click="clickSwitch" />
-
+
或 (or)
-
+
+ :options="deviceTypeTreeData"
+ :showSearch="false"
+ placeholder="请选择对比类型" />
@@ -93,8 +108,8 @@
请选择正确的逻辑{{ index }} 或 输入正确的数值{{ index }}
@@ -114,121 +129,88 @@
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 e6aeebd..7670079 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
@@ -2,11 +2,12 @@
+ placement="right"
+ @close="handleClose">
应用规则:
@@ -67,6 +68,13 @@
required: true,
message: '告警标题不能为空',
trigger: 'change',
+ validator: (rules: any, alarmTitle: any, cbfn: any) => {
+ if (alarmTitle && alarmTitle.trim() !== '') {
+ cbfn();
+ } else {
+ cbfn('告警标题不能为空');
+ }
+ },
},
],
componentProps: {
@@ -207,7 +215,11 @@
formRef.value.triggerSubmit().then(() => {
//调用接口
http.post(deviceAlarms.addOrUpNewData, infoObject.value).then(() => {
- NsMessage.success('操作成功');
+ if (infoObject.value.id) {
+ NsMessage.success('告警编辑成功');
+ } else {
+ NsMessage.success('告警创建成功');
+ }
visible.value = false;
emit('editObject', null);
});
@@ -216,9 +228,7 @@
const handleClose = () => {
// 清楚校验错误信息
formRef.value.formElRef.clearValidate();
- console.log(infoObject.value);
visible.value = false;
- NsMessage.success('操作成功');
};
defineExpose({
toggle,
diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
index 3bc198c..aa1285a 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
@@ -1,6 +1,6 @@
-
+
@@ -11,11 +11,14 @@
'blue-background': record.enableRules === 1 ? true : false,
'grey-background': record.enableRules === 1 ? false : true,
}"
- @change="clickSwitch({ enableRules: record.enableRules, record: record })" />
+ @change="
+ clickSwitch({ type: 1, enableRules: record.enableRules, record: record })
+ " />
+
+ @change="
+ clickSwitch({ type: 2, enableRules: record.enableRules, record: record })
+ " />
{{
record?.monitorTime && record?.monitorTimeUnit
- ? record?.monitorTime + record?.monitorTimeUnit
+ ? record?.monitorTime + '' + record?.monitorTimeUnit
: '-'
}}
@@ -45,7 +50,7 @@
返回
@@ -68,19 +73,21 @@
'blue-background': record.enableRules === 1 ? true : false,
'grey-background': record.enableRules === 1 ? false : true,
}"
- @click="clickSwitch({ enableRules: record.enableRules, record: record })" />
+ @click="
+ clickSwitch({ type: 2, enableRules: record.enableRules, record: record })
+ " />
返回
-
+
@@ -96,6 +103,7 @@
import { NsMessage, NsModal } from '/nerv-lib/component';
import editeEquipmentAlarm from './equipmentAlarm/editeEquipmentAlarm.vue';
import editeEnergyAlarm from './energyAlarm/editeEnergyAlarm.vue';
+ import notificationManagement from './notificationManagement/index.vue';
import configureEnergyAlarms from './energyAlarm/configureEnergyAlarms.vue';
import configureDeviceAlarms from './equipmentAlarm/configureDeviceAlarms.vue';
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
@@ -107,6 +115,7 @@
editeEquipmentAlarm,
configureDeviceAlarms,
configureEnergyAlarms,
+ notificationManagement,
editeEnergyAlarm,
},
setup() {
@@ -114,12 +123,13 @@
const mainRefEquipmentAlarm = ref();
const mainEnergyAlarmConfig = ref();
const editEquipmentAlarm = ref();
+ const notificationManagements = ref();
const editeEnergyAlarm = ref();
const configureDeviceAlarms = ref();
const configureEnergyAlarms = ref();
const equipmentAlarm = ref(true);
const energyAlarm = ref(true);
- const notificationConfig = notificationtableConfig(null, mainEnergyAlarmConfig, null);
+ const notificationConfig = notificationtableConfig(notificationManagements);
//能源告警配置
const energyAlarmConfig = energyAlarmConfigs(
editeEnergyAlarm,
@@ -134,9 +144,6 @@
equipmentAlarm,
configureDeviceAlarms,
);
- const callback = (key: any) => {
- console.log(key);
- };
//返回设备告警
const backequipmentAlarm = () => {
equipmentAlarm.value = !equipmentAlarm.value;
@@ -147,38 +154,68 @@
configureEnergyAlarms.value.show = false;
};
const clickSwitch = (data: any) => {
- console.log(data.record.enableRules === 1 ? '关闭' : '启用');
NsModal.confirm({
title: '启用状态',
icon: createVNode(ExclamationCircleOutlined),
content: '确定' + (data.record.enableRules === 1 ? '关闭' : '启用') + '吗?',
onOk: () => {
- http
- .post(deviceAlarms.addOrUpNewData, {
- id: data.record.id,
- enableRules: data.record.enableRules === 1 ? 0 : 1,
- })
- .then(() => {
- NsMessage.success('操作成功');
- mainRefEquipmentAlarm.value?.nsTableRef.reload();
- });
+ if (data.type === 1) {
+ //通知方式
+ http
+ .post(deviceAlarms.addOrUpNewData, {
+ id: data.record.id,
+ enableRules: data.record.enableRules === 1 ? 0 : 1,
+ })
+ .then(() => {
+ NsMessage.success('操作成功');
+ mainRef.value?.nsTableRef.reload();
+ });
+ }
+ //设备告警
+ if (data.type === 2) {
+ http
+ .post(deviceAlarms.addOrUpNewData, {
+ id: data.record.id,
+ enableRules: data.record.enableRules === 1 ? 0 : 1,
+ })
+ .then(() => {
+ NsMessage.success('操作成功');
+ mainRefEquipmentAlarm.value?.nsTableRef.reload();
+ });
+ }
+ //能源告警
+ if (data.type === 3) {
+ http
+ .post(deviceAlarms.addOrUpNewData, {
+ id: data.record.id,
+ enableRules: data.record.enableRules === 1 ? 0 : 1,
+ })
+ .then(() => {
+ NsMessage.success('操作成功');
+ mainEnergyAlarmConfig.value?.nsTableRef.reload();
+ });
+ }
},
});
};
- // 编辑或添加成功 刷新列表
+ // 设备告警 编辑或添加成功 刷新列表
const editObject = () => {
mainRefEquipmentAlarm.value?.nsTableRef.reload();
- // console.log(newList.value.formFinish, '数据');
+ };
+ // 能源告警 编辑或添加成功 刷新列表
+ const editeEnergyAlarmInfo = () => {
+ mainEnergyAlarmConfig.value?.nsTableRef.reload();
};
return {
- callback,
notificationConfig,
energyAlarmConfig,
equipmentAlarmConfig,
editObject,
+ editeEnergyAlarm,
clickSwitch,
editEquipmentAlarm,
- editeEnergyAlarm,
+ notificationManagements,
+ editeEnergyAlarmInfo,
configureDeviceAlarms,
configureEnergyAlarms,
equipmentAlarm,
diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
new file mode 100644
index 0000000..a7754f5
--- /dev/null
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts
index 955ecf9..5bcee5e 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts
@@ -123,7 +123,7 @@ export const equipmentAlarmTableConfig = (
confirm: true,
handle: (data: any) => {
http.post(deviceAlarms.del, { id: data.id }).then(() => {
- NsMessage.success('操作成功');
+ NsMessage.success('告警删除成功');
mainRefEquipmentAlarm.value?.nsTableRef.reload();
});
},
@@ -139,6 +139,7 @@ export const equipmentAlarmTableConfig = (
component: 'NsSelect',
componentProps: {
placeholder: '请选择告警优先级',
+ allowClear: true,
options: [
{
label: '紧急',
@@ -160,6 +161,7 @@ export const equipmentAlarmTableConfig = (
label: '告警标题',
component: 'NsInput',
componentProps: {
+ allowClear: true,
placeholder: '请输入告警标题关键字',
},
},
@@ -168,6 +170,7 @@ export const equipmentAlarmTableConfig = (
label: '错误码',
component: 'NsInput',
componentProps: {
+ allowClear: true,
placeholder: '请输入错误码关键字',
},
},
@@ -177,6 +180,7 @@ export const equipmentAlarmTableConfig = (
component: 'NsSelect',
componentProps: {
placeholder: '请选择启用状态',
+ allowClear: true,
options: [
{
label: '启用',
diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts
index 725e1e3..62bbf63 100644
--- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts
+++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts
@@ -41,7 +41,7 @@ const tableKeyMap = [
},
];
const mockData = ref(data.listData);
-export const notificationtableConfig = (el) => {
+export const notificationtableConfig = (notificationManagements: any) => {
return {
title: '告警规则',
// api: '/carbon_emission/device/getDeviceList',
@@ -57,7 +57,7 @@ export const notificationtableConfig = (el) => {
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
- console.log(data, '联系方式');
+ notificationManagements.value.toggle(data);
},
},
],