diff --git a/hx-ai-intelligent/src/router/alarmManagement.ts b/hx-ai-intelligent/src/router/alarmManagement.ts index 02aee50..fde362d 100644 --- a/hx-ai-intelligent/src/router/alarmManagement.ts +++ b/hx-ai-intelligent/src/router/alarmManagement.ts @@ -43,6 +43,25 @@ const alarmManagement = { }, ], }, + // { + // path: 'gatewayAlarm', + // name: 'GatewayAlarm', + // meta: { title: '网关告警', hideChildren: true, icon: 'gaojingguanli' }, + // component: Base, + // redirect: { name: 'GatewayAlarmIndex' }, + // children: [ + // { + // path: 'index', + // name: 'GatewayAlarmIndex', + // component: () => import('/@/view/alarmManagement/gatewayAlarm/index.vue'), + // meta: { + // title: '网关告警', + // keepAlive: false, + // // backApi: [], + // }, + // }, + // ], + // }, { path: 'alarmSettings', name: 'AlarmSettings', 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 1b57ddd..c90e467 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue @@ -204,7 +204,7 @@ title: value.errorCode, schemas: [ { - field: 'deviceName', + field: 'deviceId', label: '设备名称', component: 'nsSelectApi', componentProps: { @@ -231,7 +231,7 @@ label: '设备点位', component: 'nsSelectApi', dynamicParams: { - id: 'deviceName', //帮定上级联动数据 + id: 'deviceId', //帮定上级联动数据 }, componentProps: { api: device.queryDevicePoint, @@ -240,7 +240,7 @@ placeholder: '请选择设备点位', labelField: 'code', valueField: 'id', - dependency: 'deviceName', + dependency: 'deviceId', 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 200bb87..8d50e75 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue @@ -40,9 +40,9 @@ @change="selectDeviceType" placeholder="请选择设备类型" /> - + @@ -167,7 +167,7 @@ deviceType: [], devicePoint: null, valueType: null, - deviceName: null, + deviceId: null, enableRules: 0, alarmList: [{ logic: null, num: null, isDelete: 0 }], }); @@ -197,7 +197,7 @@ }; //选择设备方法 const selectDevice = () => { - getDevicePoint({ id: infoObject.value.deviceName }); + getDevicePoint({ id: infoObject.value.deviceId }); }; //获取设备列表 const getDevicePage = (value: any) => { @@ -258,16 +258,21 @@ const emit = defineEmits(['editObject']); // 定义一个递归函数来查找每一级的id 设备类型回显 层级方法 - function findParentIds(tree: any, targetId: number, result: any) { + function findParentIds(tree: any[], targetId: number, result: number[]): boolean { for (let item of tree) { if (item.children && item.children.length > 0) { if (item.children.some((child: any) => child.id === targetId)) { result.unshift(item.id); // 将当前节点的id添加到结果数组的最前面 - findParentIds(tree, item.id, result); // 递归查找父级节点的id - break; // 找到后可以退出循环 + return true; // 表示找到了目标节点的父节点 + } + // 递归查找当前节点的子节点 + if (findParentIds(item.children, targetId, result)) { + result.unshift(item.id); // 递归返回后,将当前节点的id添加到结果数组的最前面 + return true; } } } + return false; // 没有找到目标节点 } // 递归 获取当前 选择的设备类型 对象 用来获取设备列表 const findNodeById = (nodes: any, id: any) => { @@ -305,7 +310,6 @@ siteDataTree.value = res.data.linkList; } }); - //判断 是新增 还是修改 if (value) { //获取详情接口 @@ -316,9 +320,13 @@ let selectDevice = ref([Number(infoObject.value.deviceType)]); findNodeById(deviceTypeTreeData.value, Number(infoObject.value.deviceType)); //获取设备点位 - getDevicePoint({ id: infoObject.value.deviceName }); + getDevicePoint({ id: infoObject.value.deviceId }); // 回显 选择设备类型 - findParentIds(deviceTypeTreeData.value, infoObject.value.deviceType, selectDevice.value); + findParentIds( + deviceTypeTreeData.value, + Number(infoObject.value.deviceType), + selectDevice.value, + ); //枚举 需要重新赋值 if ( infoObject.value.hxAlarmRuleLogicList && @@ -344,7 +352,7 @@ deviceType: [], devicePoint: null, valueType: null, - deviceName: null, + deviceId: null, enableRules: 0, alarmList: [{ logic: null, num: null, isDelete: 0 }], }; @@ -357,7 +365,7 @@ site: [{ required: true, message: '请选择站点', trigger: 'change' }], deviceType: [{ required: true, message: '请选择设备类型', trigger: 'change' }], enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }], - deviceName: [{ required: true, message: '请选择设备名称', trigger: 'change' }], + deviceId: [{ required: true, message: '请选择设备名称', trigger: 'change' }], devicePoint: [{ required: true, message: '请选择设备点位', trigger: 'change' }], valueType: [{ required: true, message: '请选择取值类型', trigger: 'change' }], ruleType: [{ required: true, message: '请选择规则类型', trigger: 'change' }], diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue new file mode 100644 index 0000000..a8e00cc --- /dev/null +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue @@ -0,0 +1,29 @@ + + diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue new file mode 100644 index 0000000..1def5cc --- /dev/null +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue @@ -0,0 +1,234 @@ + + + diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/notificationManagementMock.json b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/notificationManagementMock.json new file mode 100644 index 0000000..6f442ed --- /dev/null +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/notificationManagementMock.json @@ -0,0 +1,108 @@ +{ + "listData":[ + { + "id": "d4", + "isDel": "0", + "officesId": "84", + "deviceCode": "37430200143", + "deviceName": "地听测试电表", + "category": "1", + "type": "1001", + "energyCount": "1", + "serialNumber": "69", + "pidCode": null, + "brand": "", + "types": "", + "manufacturer": "elit non in", + "contacts": "ad reprehenderit", + "phonenumber": "34", + "position": "in esse commodo1", + "activeState": "1", + "measurementDirection": "1", + "deviceMagnification": 62, + "deviceAccuracy": "89", + "frequency": "anim consequat irure", + "standardFrequency": "ut elit", + "deviceHead": "pariatur ex velit", + "constructor": "84566", + "voltageType": "cillum aliquip reprehenderit", + "pt": 61, + "ct": 64, + "communicationProtocol": "cupidatat nisi ea ad", + "ip": "", + "port": "", + "com": "", + "slaveAddress": "", + "dlt": "", + "conversionIdentifier": "48", + "multiplicationAdjustment": "1", + "accessMethod": "1", + "replacementFrequency": "0", + "dataDetail": "sit", + "insertTime": null, + "children": null, + "devicePointList": null, + "insertUser": null, + "priority": "1", + "alarmTitle": "电压异常告警", + "errorCode": "A001", + "monitorTime":"1", + "repetitions":"1", + "monitorTimeUnit": "分", + "enableRules": "1", + "isUse":true + } , { + "id": "d5", + "isDel": "0", + "officesId": "84", + "deviceCode": "37430200143", + "deviceName": "地听测试电表", + "category": "1", + "type": "1001", + "energyCount": "1", + "serialNumber": "69", + "pidCode": null, + "brand": "", + "types": "", + "manufacturer": "elit non in", + "contacts": "ad reprehenderit", + "phonenumber": "34", + "position": "in esse commodo2", + "activeState": "1", + "measurementDirection": "1", + "deviceMagnification": 62, + "deviceAccuracy": "89", + "frequency": "anim consequat irure", + "standardFrequency": "ut elit", + "deviceHead": "pariatur ex velit", + "constructor": "84566", + "voltageType": "cillum aliquip reprehenderit", + "pt": 61, + "ct": 64, + "communicationProtocol": "cupidatat nisi ea ad", + "ip": "", + "port": "", + "com": "", + "slaveAddress": "", + "dlt": "", + "conversionIdentifier": "48", + "multiplicationAdjustment": "1", + "accessMethod": "1", + "replacementFrequency": "0", + "dataDetail": "sit", + "insertTime": null, + "children": null, + "devicePointList": null, + "insertUser": null, + "priority": "1", + "alarmTitle": "电压异常告警", + "errorCode": "A001", + "monitorTime":"1", + "repetitions":"1", + "monitorTimeUnit": "分", + "enableRules": "0", + "isUse":true + } + ] + +} \ No newline at end of file diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue new file mode 100644 index 0000000..c6e1687 --- /dev/null +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue @@ -0,0 +1,124 @@ + + + diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts new file mode 100644 index 0000000..03ca249 --- /dev/null +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts @@ -0,0 +1,158 @@ +import { dateUtil } from '/nerv-lib/util/date-util'; +import data from '../notificationManagementMock.json'; +import { http } from '/nerv-lib/util'; +import { ref } from 'vue'; +const tableKeyMap = [ + { + title: '序号', + dataIndex: 'address', + customRender: (text: any) => { + return text.index + 1; + }, + }, + { + title: '告警编号', + dataIndex: 'id', + }, + { + title: '告警描述', + dataIndex: 'deviceCode', + }, + { + title: '优先级', + dataIndex: 'deviceName', + }, + { + title: '状态', + dataIndex: 'position', + }, + { + title: '错误码', + dataIndex: 'position', + textEllipsis: true, + }, + { + title: '设备信息', + dataIndex: 'position', + }, + { + title: '更新时间', + dataIndex: 'enableRules', + }, + { + title: '断网时长', + dataIndex: 'enableRules', + }, +]; +const mockData = ref(data.listData); +export const notificationtableConfig = (look: any, status: any) => { + return { + title: '告警记录', + // api: '/carbon_emission/device/getDeviceList', + value: mockData.value, + headerActions: [{}], + columns: tableKeyMap, + // rowSelection: null, 选择按钮 + columnActions: { + title: '操作', + actions: [ + { + label: '详情', + name: 'FeedBackDetail', + dynamicParams: ['uuid', 'appealType'], + handle: (data: any) => { + console.log(look.value); + look.value.toggle(data); + }, + }, + { + label: '状态', + name: 'FeedBackDetail', + dynamicParams: ['uuid', 'appealType'], + handle: (data: any) => { + status.value.toggle(data); + }, + }, + ], + }, + + formConfig: { + schemas: [ + { + field: 'name', + label: '告警类型', + component: 'NsSelect', + defaultValue: '2', + componentProps: { + placeholder: '请选择告警优先级', + disabled: true, + options: [ + { + label: '紧急', + value: '1', + }, + { + label: '重要', + value: '2', + }, + { + label: '一般', + value: '3', + }, + ], + }, + }, + { + field: 'provider', + label: '状态', + component: 'NsSelect', + componentProps: { + placeholder: '请选择状态', + options: [ + { + label: '待处理', + value: '1', + }, + { + label: '处理中', + value: '2', + }, + { + label: '已完成', + value: '3', + }, + { + label: '超时', + value: '4', + }, + { + label: '关闭', + value: '5', + }, + ], + }, + }, + { + field: 'provider', + label: '错误码', + component: 'NsInput', + componentProps: { + placeholder: '请输入告警错误码', + }, + }, + { + field: 'createTime', + label: '生产日期', + component: 'NsRangePicker', + fieldMap: ['manufactureBeginDate', 'manufactureEndDate'], + componentProps: { + valueFormat: 'YYYY-MM-DD', + placeholder: ['开始日期', '结束日期'], + }, + }, + ], + }, + // pagination: { pageSizeOptions: false }, + rowKey: 'id', + }; +};