Browse Source

fix:配置设备告警 联系方式

temp
zhaohy 4 months ago
parent
commit
098b4f29fd
  1. 8
      hx-ai-intelligent/src/api/alarmSettings/energyAlarm.ts
  2. 109
      hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue
  3. 165
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/configureEnergyAlarms.vue
  4. 136
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
  5. 12
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue
  6. 2
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue
  7. 10
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
  8. 335
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
  9. 45
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue
  10. 8
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts

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

@ -2,8 +2,8 @@ export enum energyAlarms {
getTableList = '/carbon-smart/api/AlarmEnergyConsumption/selectAlarmEnergyConsumption', //能耗告警分页 getTableList = '/carbon-smart/api/AlarmEnergyConsumption/selectAlarmEnergyConsumption', //能耗告警分页
addOrUpNewData = '/carbon-smart/api/AlarmEnergyConsumption/creatOrUpdate', //能耗告警添加 修改 addOrUpNewData = '/carbon-smart/api/AlarmEnergyConsumption/creatOrUpdate', //能耗告警添加 修改
del = '/carbon-smart/api/AlarmEnergyConsumption/delete', //能耗删除 del = '/carbon-smart/api/AlarmEnergyConsumption/delete', //能耗删除
configGetTableList = '/carbon-smart/api/AlarmEquipmentRule/selectAlarmEquipmentRule', //配置设备告警分页 configGetTableList = '/carbon-smart/api/AlarmEnergyConsumptionRule/selectAlarmEnergyConsumptionRule', //配置设备告警分页
configAddOrUpNewData = '/carbon-smart/api/AlarmEquipmentRule/creatOrUpdate', //配置设备告警添加 修改 configAddOrUpNewData = '/carbon-smart/api/AlarmEnergyConsumptionRule/creatOrUpdate', //配置设备告警添加 修改
configFindById = '/carbon-smart/api/AlarmEquipmentRule/findById', //配置设备告警 查询详情 configFindById = '/carbon-smart/api/AlarmEnergyConsumptionRule/findById', //配置设备告警 查询详情
configDel = '/carbon-smart/api/AlarmEquipmentRule/delete', //配置设备告警删除 configDel = '/carbon-smart/api/AlarmEnergyConsumptionRule/delete', //配置设备告警删除
} }

109
hx-ai-intelligent/src/view/alarmManagement/alarmOverview/index.vue

@ -30,7 +30,9 @@
style="flex: 1; height: 100%; background-color: white; border-radius: 4px; padding: 12px"> style="flex: 1; height: 100%; background-color: white; border-radius: 4px; padding: 12px">
<div ref="echartPieOne" style="width: 100%; height: 100%"></div> <div ref="echartPieOne" style="width: 100%; height: 100%"></div>
</div> </div>
<div style="flex: 1; height: 100%; background-color: white; border-radius: 4px"> xxxx </div> <div style="flex: 1; height: 100%; background-color: white; border-radius: 4px">
<div ref="echartPieTow" style="width: 100%; height: 100%"></div>
</div>
</div> </div>
<!-- 告警矩形 echarts --> <!-- 告警矩形 echarts -->
<div style="flex: 4; width: 100%; background-color: white; border-radius: 4px; padding: 12px"> <div style="flex: 4; width: 100%; background-color: white; border-radius: 4px; padding: 12px">
@ -49,8 +51,10 @@
const info = ref({}); const info = ref({});
let chartInstance: echarts.ECharts | null = null; let chartInstance: echarts.ECharts | null = null;
let chartInstanceOne: echarts.ECharts | null = null; let chartInstanceOne: echarts.ECharts | null = null;
let chartInstanceTow: echarts.ECharts | null = null;
const graphChart = ref(null); const graphChart = ref(null);
const echartPieOne = ref(null); const echartPieOne = ref(null);
const echartPieTow = ref(null);
const getGraphChart = () => { const getGraphChart = () => {
let dayData = []; let dayData = [];
let energyAlarm = []; let energyAlarm = [];
@ -294,7 +298,7 @@
}, },
textAlign: 'center', textAlign: 'center',
x: '44.3%', x: '44.3%',
y: '46%', y: '43%',
}, },
], ],
tooltip: { tooltip: {
@ -327,9 +331,10 @@
clockwise: false, // clockwise: false, //
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: { label: {
show: true,
normal: { normal: {
show: true, show: true,
position: 'outter', position: 'outside',
textStyle: { textStyle: {
fontSize: 14, fontSize: 14,
fontWeight: 'bold', fontWeight: 'bold',
@ -342,7 +347,7 @@
labelLine: { labelLine: {
show: true, // 线 show: true, // 线
length: 10, // 线 length: 10, // 线
length2: 20, // 线 length2: 0, // 线
// lineStyle // lineStyle
}, },
data: m2R2Data, data: m2R2Data,
@ -352,11 +357,107 @@
chartInstanceOne = echarts.init(echartPieOne.value); chartInstanceOne = echarts.init(echartPieOne.value);
chartInstanceOne.setOption(option); chartInstanceOne.setOption(option);
}; };
const getEchartPieTow = () => {
if (chartInstanceTow) {
chartInstanceTow.dispose();
}
chartInstanceTow = echarts.init(echartPieTow.value);
var m2R2Data = [
{ value: 335, name: '紧急', itemStyle: { color: '#F56E53' } },
{ value: 310, name: '重要', itemStyle: { color: '#F7C122' } },
{ value: 234, name: '一般', itemStyle: { color: '#3BC27F' } },
];
const option = {
title: [
{
text: '优先级 / 近30天',
textStyle: {
fontSize: 16,
fontWeight: 'normal',
color: '#aaaaaa',
},
left: '2%',
top: '2%',
},
{
text: '优先级',
subtext: 12312 + '个',
textStyle: {
fontSize: 24,
color: 'black',
},
subtextStyle: {
fontSize: 24,
fontWeight: '700',
color: 'black',
},
textAlign: 'center',
x: '44.3%',
y: '43%',
},
],
tooltip: {
trigger: 'item',
formatter: function (parms) {
var str = parms.marker + ' :' + parms.data.value;
return str;
},
},
legend: {
//
right: 50,
top: 'center',
orient: 'vertical',
//
icon: 'circle',
itemWidth: 12,
itemHeight: 12,
itemGap: 16,
textStyle: {
fontSize: 14,
},
},
series: [
{
name: '优先级',
type: 'pie',
center: ['45%', '50%'],
radius: ['50%', '70%'],
clockwise: false, //
avoidLabelOverlap: false,
label: {
show: true,
normal: {
show: true,
position: 'outside',
textStyle: {
fontSize: 14,
fontWeight: 'bold',
},
formatter: function (parms) {
return '[ ' + parms.data.name + ' ] : ' + parms.data.value;
},
},
},
labelLine: {
show: true, // 线
length: 10, // 线
length2: 0, // 线
// lineStyle
},
data: m2R2Data,
},
],
};
chartInstanceTow = echarts.init(echartPieTow.value);
chartInstanceTow.setOption(option);
};
onMounted(() => { onMounted(() => {
// //
getGraphChart(); getGraphChart();
// //
getEchartPieOne(); getEchartPieOne();
getEchartPieTow();
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

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

@ -11,27 +11,23 @@
}" }"
@click="clickSwitch({ enableRules: record.enableRules, record: record })" /> @click="clickSwitch({ enableRules: record.enableRules, record: record })" />
</template> </template>
<template v-if="column.dataIndex === 'equipmentInfo'"> <template v-if="column.dataIndex === 'comparisonType'">
{{ {{ getcomparisonType(record) }}
record?.enableRules
? record.enableRules + '>' + record.deviceType + '>' + record.deviceName
: '-'
}}
</template> </template>
</template> </template>
</ns-view-list-table> </ns-view-list-table>
<!-- 新增or编辑界面 --> <!-- 新增or编辑界面 -->
<editConfigureEnergyAlarm ref="editConfigureEnergyAlarms" /> <editConfigureEnergyAlarm ref="editConfigureEnergyAlarms" @editObject="editObject" />
</template> </template>
<script lang="ts"> <script lang="ts">
import { ref, createVNode } from 'vue'; import { ref, createVNode } from 'vue';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import data from '../notificationManagementMock.json';
import { NsMessage, NsModal } from '/nerv-lib/component'; import { NsMessage, NsModal } from '/nerv-lib/component';
import editConfigureEnergyAlarm from './editConfigureEnergyAlarm.vue'; import editConfigureEnergyAlarm from './editConfigureEnergyAlarm.vue';
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; import { energyAlarms } from '/@/api/alarmSettings/energyAlarm';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { device } from '/@/api/deviceManage'; import { device } from '/@/api/deviceManage';
import { dict } from '/@/api';
export default { export default {
components: { editConfigureEnergyAlarm }, components: { editConfigureEnergyAlarm },
@ -43,11 +39,37 @@
const tableConfig = ref({}); const tableConfig = ref({});
const mainRef = ref({}); const mainRef = ref({});
const editConfigureEnergyAlarms = ref({}); const editConfigureEnergyAlarms = ref({});
const mockData = ref(data.listData);
// //
const orgId = ref(''); const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result; orgId.value = result;
//
const getcomparisonType = (data: any) => {
let datas = data.comparisonType.split(',');
if (datas[0] === '1') {
switch (datas[1]) {
case '1':
return '数值>输入数值';
case '2':
return '数值>同比';
case '3':
return '数值>环比';
case '4':
return '数值>对比基准';
}
} else {
switch (datas[1]) {
case '1':
return '比例>输入比例';
case '2':
return '比例>同比';
case '3':
return '比例>环比';
case '4':
return '比例>对比基准';
}
}
};
const clickSwitch = (data: any) => { const clickSwitch = (data: any) => {
NsModal.confirm({ NsModal.confirm({
title: '启用状态', title: '启用状态',
@ -55,7 +77,7 @@
content: '确定' + (data.record.enableRules === 1 ? '关闭' : '启用') + '规则吗?', content: '确定' + (data.record.enableRules === 1 ? '关闭' : '启用') + '规则吗?',
onOk: () => { onOk: () => {
http http
.post(deviceAlarms.addOrUpNewData, { .post(energyAlarms.configAddOrUpNewData, {
id: data.record.id, id: data.record.id,
enableRules: data.record.enableRules === 1 ? 0 : 1, enableRules: data.record.enableRules === 1 ? 0 : 1,
}) })
@ -80,8 +102,7 @@
show.value = true; show.value = true;
tableConfig.value = { tableConfig.value = {
title: '告警规则', title: '告警规则',
api: deviceAlarms.getTableList, api: energyAlarms.configGetTableList,
value: mockData.value,
headerActions: [ headerActions: [
{ {
label: '新增', label: '新增',
@ -120,14 +141,24 @@
label: '批量删除', label: '批量删除',
type: 'primary', type: 'primary',
name: 'userBatchDel', name: 'userBatchDel',
confirm: true,
dynamicDisabled: (data: any) => { dynamicDisabled: (data: any) => {
return data.list.length === 0; return data.list.length === 0;
}, },
confirm: true, handle: (data: any) => {
isReload: true, let ids = [];
isClearCheck: true, data.list.forEach((item) => {
// api: origanizemanage.batchDel, ids.push(item.id);
dynamicParams: { userIds: 'userId[]' }, });
data.list = [];
http.post(energyAlarms.configDel, { ids: ids.toString() }).then(() => {
NsMessage.success('告警规则删除成功');
//
mainRef.value.nsTableRef.clearCheck();
//
mainRef.value?.nsTableRef.reload();
});
},
}, },
], ],
columns: [ columns: [
@ -144,7 +175,7 @@
}, },
{ {
title: '设备信息/节点信息', title: '设备信息/节点信息',
dataIndex: 'equipmentInfo', dataIndex: 'deviceInfo',
}, },
{ {
title: '对比类型', title: '对比类型',
@ -152,11 +183,11 @@
}, },
{ {
title: '告警点位', title: '告警点位',
dataIndex: 'devicePoint', dataIndex: 'devicePointName',
}, },
{ {
title: '判断条件', title: '判断条件',
dataIndex: 'ruleType', dataIndex: 'conditionalJudgment',
}, },
{ {
title: '异常描述', title: '异常描述',
@ -185,8 +216,12 @@
name: 'FeedBackDetail', name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'], dynamicParams: ['uuid', 'appealType'],
confirm: true, confirm: true,
handle: () => { handle: (data: any) => {
// mockData.value.splice(0, 1); http.post(energyAlarms.configDel, { ids: data.id }).then(() => {
NsMessage.success('告警规则删除成功');
//
mainRef.value?.nsTableRef.reload();
});
}, },
}, },
], ],
@ -194,78 +229,106 @@
formConfig: { formConfig: {
title: value.errorCode, title: value.errorCode,
schemas: [ schemas: [
// {
// field: 'deviceNode',
// label: '',
// component: 'nsSelectApi',
// componentProps: {
// api: device.queryDevicePage,
// allowClear: true,
// params: {
// orgId: orgId.value,
// pageNum: 1,
// pageSize: 99,
// },
// placeholder: '',
// resultField: 'data.records',
// labelField: 'deviceName',
// valueField: 'id',
// showSearch: true,
// filterOption: (input: string, option: any) => {
// return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
// },
// // autoAddLink: true, //
// },
// },
{ {
field: 'deviceName', field: 'deviceName',
label: '设备名称', label: '设备信息/节点信息',
component: 'nsSelectApi', component: 'NsInput',
componentProps: { componentProps: {
api: device.queryDevicePage, allowClear: true,
params: { placeholder: '请输入设备信息/节点信息关键字',
orgId: orgId.value,
pageNum: 1,
pageSize: 99,
},
placeholder: '请选择设备名称',
resultField: 'data.records',
labelField: 'deviceName',
valueField: 'id',
autoAddLink: true, //
}, },
}, },
{ {
field: 'devicePoint', field: 'dataSourcesType',
label: '设备点位', label: '告警点位',
component: 'nsSelectApi', component: 'nsSelectApi',
dynamicParams: { // dynamicParams: {
id: 'deviceName', // // id: 'deviceName', //
}, // },
componentProps: { componentProps: {
api: device.queryDevicePoint, api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
resultField: 'data', immediate: true,
placeholder: '请选择设备点位', allowClear: true,
labelField: 'code', labelField: 'cnValue',
valueField: 'id', valueField: 'id',
dependency: 'deviceName', placeholder: '请选择告警点位',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.cnValue.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
// autoSelectFirst: true,
}, },
}, },
{ {
field: 'payWay', field: 'enableRules',
label: '启用状态', label: '启用状态',
component: 'NsSelect', component: 'NsSelect',
componentProps: { componentProps: {
allowClear: true,
placeholder: '请选择启用状态', placeholder: '请选择启用状态',
options: [ options: [
{ {
label: '启用', label: '启用',
value: '1', value: 1,
}, },
{ {
label: '关闭', label: '关闭',
value: '0', value: 0,
}, },
], ],
}, },
}, },
{ {
field: 'provider', field: 'abnormalDescription',
label: '异常描述', label: '异常描述',
component: 'NsInput', component: 'NsInput',
componentProps: { componentProps: {
allowClear: true,
placeholder: '请输入异常描述关键字', placeholder: '请输入异常描述关键字',
}, },
}, },
], ],
}, },
params: { id: value.id }, params: { equipmentAlarmId: value.id },
// pagination: { pageSizeOptions: false }, // pagination: { pageSizeOptions: false },
rowKey: 'id', rowKey: 'id',
}; };
}; };
//
const editObject = () => {
mainRef.value?.nsTableRef.reload();
};
return { return {
configureEnergyAlarmsData, configureEnergyAlarmsData,
show, show,
clickSwitch, clickSwitch,
doWnload, doWnload,
mainRef,
editObject,
getcomparisonType,
orgId, orgId,
tableConfig, tableConfig,
editConfigureEnergyAlarms, editConfigureEnergyAlarms,

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

@ -27,9 +27,9 @@
}" }"
tree-node-filter-prop="orgName" /> tree-node-filter-prop="orgName" />
</a-form-item> </a-form-item>
<a-form-item label="数据来源" name="sbtype"> <a-form-item label="数据来源" name="dataSources">
<a-cascader <a-cascader
v-model:value="infoObject.sbtype" v-model:value="infoObject.dataSources"
:options="deviceTypeTreeData" :options="deviceTypeTreeData"
:field-names="{ :field-names="{
children: 'children', children: 'children',
@ -45,16 +45,19 @@
v-model:value="infoObject.deviceNode" v-model:value="infoObject.deviceNode"
style="width: 100%" style="width: 100%"
placeholder="请选择设备节点" placeholder="请选择设备节点"
:disabled="!infoObject.sbtype" :disabled="!infoObject.dataSources"
:tree-line="true && { showLeafIcon: false }" :tree-line="true && { showLeafIcon: false }"
:tree-data="jdTreeData" :tree-data="jdTreeData"
:field-names="{ :field-names="{
children: 'children', children: 'children',
label: infoObject.sbtype && infoObject.sbtype[1] === 1 ? 'deviceName' : 'pointName', label:
infoObject.dataSources && infoObject.dataSources[1] === 1
? 'deviceName'
: 'pointName',
value: 'id', value: 'id',
}" /> }" />
</a-form-item> </a-form-item>
<a-form-item label="启用规则" name="enableRules"> <a-form-item label="启用规则">
<a-switch <a-switch
:checked="infoObject.enableRules === 1 ? true : false" :checked="infoObject.enableRules === 1 ? true : false"
:class="{ :class="{
@ -67,6 +70,7 @@
<a-textarea <a-textarea
v-model:value="infoObject.abnormalDescription" v-model:value="infoObject.abnormalDescription"
style="height: 32px" style="height: 32px"
placeholder="请输入异常描述"
:autoSize="{ minRows: 1, maxRows: 1 }" :autoSize="{ minRows: 1, maxRows: 1 }"
show-count show-count
:maxlength="30" /> :maxlength="30" />
@ -152,10 +156,11 @@
deviceNode: null, deviceNode: null,
ruleType: null, ruleType: null,
abnormalDescription: null, abnormalDescription: null,
sbtype: null, dataSources: null,
enableRules: 0, enableRules: 0,
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }], alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
}); });
const emit = defineEmits(['editObject']);
// //
const delAlarmList = ref([]); const delAlarmList = ref([]);
// //
@ -271,19 +276,24 @@
const toggle = async (value: any, info: any) => { const toggle = async (value: any, info: any) => {
// //
let energyType = await dict({ params: { dicKey: 'ENERGY_TYPE' } }); let energyType = await dict({ params: { dicKey: 'ENERGY_TYPE' } });
energyType.data.data.forEach((item: any) => { if (energyType.data.data) {
item.children = [ energyType.data.data.forEach((item: any) => {
{ item.children = [
id: 1, {
cnValue: '设备', id: 1,
}, cnValue: '设备',
{ },
id: 2, {
cnValue: '节点', id: 2,
}, cnValue: '节点',
]; },
}); ];
deviceTypeTreeData.value = energyType.data.data; });
deviceTypeTreeData.value = energyType.data.data;
} else {
deviceTypeTreeData.value = [];
}
// //
energyAlarm.value = info; energyAlarm.value = info;
// //
@ -294,16 +304,29 @@
}); });
// //
if (value) { if (value) {
value.ruleType = value.ruleType + ''; await http.post(energyAlarms.configFindById, { id: value.id }).then((res) => {
value.comparisonType = value.comparisonType.split(','); if (res.msg === 'success') {
value.sbtype = [value.dataSourcesType, value.dataSourcesWay]; infoObject.value = res.data;
delete value.dataSourcesType; //
delete value.dataSourcesWay; infoObject.value.dataSources = [
infoObject.value = value; infoObject.value.dataSourcesType,
/// infoObject.value.dataSourcesWay,
deviceTypeTreeData.value.forEach((item: any) => { ];
if (item.id === infoObject.value.sbtype[0]) { delete infoObject.value.dataSourcesType;
selectDeviceType(infoObject.value.sbtype, [{ ...item }]); delete infoObject.value.dataSourcesWay;
infoObject.value.comparisonType = infoObject.value.comparisonType.split(',');
infoObject.value.ruleType = infoObject.value.ruleType + '';
infoObject.value.alarmList = infoObject.value.hxAlarmRuleLogicList || [];
delete infoObject.value.hxAlarmRuleLogicList;
///
if (deviceTypeTreeData && deviceTypeTreeData.value.length > 0) {
deviceTypeTreeData.value.forEach((item: any) => {
if (item.id === infoObject.value.dataSources[0]) {
selectDeviceType(infoObject.value.dataSources, [{ ...item }]);
}
});
}
} }
}); });
} else { } else {
@ -313,7 +336,7 @@
deviceNode: null, deviceNode: null,
ruleType: null, ruleType: null,
abnormalDescription: null, abnormalDescription: null,
sbtype: null, dataSources: null,
enableRules: 0, enableRules: 0,
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }], alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
}; };
@ -324,8 +347,7 @@
// //
const rules = { const rules = {
site: [{ required: true, message: '请选择站点', trigger: 'change' }], site: [{ required: true, message: '请选择站点', trigger: 'change' }],
sbtype: [{ required: true, message: '请选择设备类型', trigger: 'change' }], dataSources: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
deviceNode: [{ required: true, message: '请选择设备名称', trigger: 'change' }], deviceNode: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
sbAdress: [{ required: true, message: '请选择设备点位', trigger: 'change' }], sbAdress: [{ required: true, message: '请选择设备点位', trigger: 'change' }],
comparisonType: [{ required: true, message: '请选择对比类型', trigger: 'change' }], comparisonType: [{ required: true, message: '请选择对比类型', trigger: 'change' }],
@ -344,12 +366,9 @@
}, },
}, },
], ],
logic: [{ required: true, message: '请选择逻辑', trigger: 'blur' }],
num: [{ required: true, message: '请输入数值', trigger: 'blur' }],
}; };
// //
const btnClick = () => { const btnClick = () => {
console.log(infoObject.value, '数据');
infoObject.value.alarmList.forEach((item) => { infoObject.value.alarmList.forEach((item) => {
if (item.logic === null || item.num === null) { if (item.logic === null || item.num === null) {
return; return;
@ -361,17 +380,16 @@
} }
// //
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
console.log(energyAlarm.value, '数据');
// //
let data = { ...infoObject.value }; let data = { ...infoObject.value };
//id //id
data.equipmentAlarmId = energyAlarm.value.id; data.equipmentAlarmId = energyAlarm.value.id;
data.errorCode = energyAlarm.value.errorCode; data.errorCode = energyAlarm.value.errorCode;
data.dataSourcesType = data.sbtype[0]; data.dataSourcesType = data.dataSources[0];
data.dataSourcesWay = data.sbtype[1]; data.dataSourcesWay = data.dataSources[1];
delete data.dataSources;
data.hxAlarmRuleLogicList = [...infoObject.value.alarmList, ...delAlarmList.value]; data.hxAlarmRuleLogicList = [...infoObject.value.alarmList, ...delAlarmList.value];
data.comparisonType = data.comparisonType.toString; data.comparisonType = data.comparisonType.toString();
data.hxAlarmRuleLogicList.forEach((item) => { data.hxAlarmRuleLogicList.forEach((item) => {
const num = Number(item.num); const num = Number(item.num);
if (!isNaN(num)) { if (!isNaN(num)) {
@ -382,24 +400,24 @@
}); });
data.ruleType = Number(data.ruleType); data.ruleType = Number(data.ruleType);
delete data.alarmList; delete data.alarmList;
// http http
// .post(energyAlarms.configAddOrUpNewData, data) .post(energyAlarms.configAddOrUpNewData, data)
// .then((res) => { .then((res) => {
// if (res.msg === 'success') { if (res.msg === 'success') {
// // //
// if (data.id) { if (data.id) {
// NsMessage.success(''); NsMessage.success('告警规则编辑成功');
// } else { } else {
// NsMessage.success(''); NsMessage.success('告警规则新增成功');
// } }
// emit('editObject', null); emit('editObject', null);
// handleClose(); handleClose();
// } }
// }) })
// .catch((error) => { .catch((error) => {
// // //
// console.error('', error); console.error('请求失败:', error);
// }); });
}); });
}; };
// //
@ -413,7 +431,7 @@
ruleType: null, ruleType: null,
deviceNode: null, deviceNode: null,
abnormalDescription: null, abnormalDescription: null,
sbtype: null, dataSources: null,
enableRules: 0, enableRules: 0,
alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }], alarmList: [{ id: null, logic: null, num: null, isDelete: 0 }],
}; };

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

@ -188,9 +188,9 @@
name: 'FeedBackDetail', name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'], dynamicParams: ['uuid', 'appealType'],
confirm: true, confirm: true,
handle: () => { handle: (data: any) => {
http.post(deviceAlarms.configDel, { ids: data.id }).then(() => { http.post(deviceAlarms.configDel, { ids: data.id }).then(() => {
NsMessage.success('规则删除成功'); NsMessage.success('告警规则删除成功');
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
}); });
}, },
@ -216,6 +216,10 @@
resultField: 'data.records', resultField: 'data.records',
labelField: 'deviceName', labelField: 'deviceName',
valueField: 'id', valueField: 'id',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
autoAddLink: true, // autoAddLink: true, //
}, },
}, },
@ -234,6 +238,10 @@
labelField: 'code', labelField: 'code',
valueField: 'id', valueField: 'id',
dependency: 'deviceName', dependency: 'deviceName',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.code.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
}, },
}, },
{ {

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

@ -85,6 +85,7 @@
<a-textarea <a-textarea
v-model:value="infoObject.abnormalDescription" v-model:value="infoObject.abnormalDescription"
style="height: 32px" style="height: 32px"
placeholder="请输入异常描述"
:autoSize="{ minRows: 1, maxRows: 1 }" :autoSize="{ minRows: 1, maxRows: 1 }"
show-count show-count
:maxlength="30" /> :maxlength="30" />
@ -323,7 +324,6 @@
delete infoObject.value.hxAlarmRuleLogicList; delete infoObject.value.hxAlarmRuleLogicList;
infoObject.value.deviceType = selectDevice; infoObject.value.deviceType = selectDevice;
infoObject.value.ruleType = infoObject.value.ruleType + ''; infoObject.value.ruleType = infoObject.value.ruleType + '';
console.log(infoObject.value, '数据');
} }
}); });
} else { } else {

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

@ -40,11 +40,17 @@
</template> </template>
<template v-if="column.dataIndex === 'monitor'"> <template v-if="column.dataIndex === 'monitor'">
{{ {{
record?.monitorTime && record?.monitorTimeUnit record.monitorTime && record.monitorTimeUnit
? record?.monitorTime + '' + record?.monitorTimeUnit ? record.monitorTime + '' + record.monitorTimeUnit.label
: '-' : '-'
}} }}
</template> </template>
<template v-if="column.dataIndex === 'repetition'">
{{ record.repetitions.label }}
</template>
<template v-if="column.dataIndex === 'prioritys'">
{{ record.priority.label }}
</template>
</template> </template>
</ns-view-list-table> </ns-view-list-table>
<a-button <a-button

335
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue

@ -1,15 +1,15 @@
<template> <template>
<ns-drawer <ns-drawer
v-model:visible="visible" v-model:visible="visible"
width="520" width="600"
:title="' '" :title="'设置通知联系人'"
:ok="btnClick" :ok="btnClick"
:cancel="handleClose" :cancel="handleClose"
placement="right" placement="right"
:footer-style="{ textAlign: 'right' }" :footer-style="{ textAlign: 'right' }"
@close="handleClose"> @close="handleClose">
<div style="padding: 18px; width: 100%; overflow: hidden"> <div style="width: 100%; overflow: hidden; overflow-y: hidden; height: 100%">
<a-form ref="formRef" :model="infoObject" :rules="rules"> <a-form ref="formRef" :model="infoObject" :rules="rules" style="width: 80%">
<a-form-item ref="notification" label="通知方式" name="notification"> <a-form-item ref="notification" label="通知方式" name="notification">
<a-select <a-select
ref="select" ref="select"
@ -22,7 +22,7 @@
placeholder="请选择通知方式" placeholder="请选择通知方式"
:filter-option="filterDevicePoint" /> :filter-option="filterDevicePoint" />
</a-form-item> </a-form-item>
<a-form-item label="启用规则" name="enableRules"> <a-form-item label="启用规则">
<a-switch <a-switch
:checked="infoObject.enableRules === 1 ? true : false" :checked="infoObject.enableRules === 1 ? true : false"
:class="{ :class="{
@ -31,28 +31,57 @@
}" }"
@click="clickSwitch" /> @click="clickSwitch" />
</a-form-item> </a-form-item>
<a-form-item label="通知用户" name="user">
<a-cascader
v-model:value="infoObject.user"
style="width: 100%"
multiple
:max-tag-count="1"
:options="options"
:load-data="loadData"
placeholder="请选择通知用户"
:show-checked-strategy="Cascader.SHOW_CHILD" />
</a-form-item>
</a-form> </a-form>
<a-table :dataSource="dataSource" :columns="columns" :pagination="false" /> <div style="width: 100%; height: 765px; overflow-y: auto">
<div style="margin-bottom: 8px">
<div style="width: 100%; display: flex; position: relative">
<div
style="
border-width: 0px;
position: absolute;
left: 0px;
top: 5px;
width: 5px;
height: 15px;
background: inherit;
background-color: rgba(251, 156, 67, 1);
border: none;
border-radius: 5px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
"></div>
<span style="margin-left: 24px; color: #333333">联系人名单</span>
</div>
<img
style="width: 100%; margin-top: -10px"
src="https://files.axshare.com/gsc/4T0UQR/7e/5d/a2/7e5da2a277344db8af30521cefeb70cc/images/告警设置/u150.svg?pageId=1f58c1ba-b461-4fe8-a2b3-295f1e7b0aa0" />
</div>
<div style="margin-bottom: 16px">
<a-button type="primary" @click="chengUser">选择联系人 </a-button>
</div>
<a-table
:dataSource="dataSource"
:columns="columns"
:scroll="{ x: 800, y: 700 }"
:pagination="pagination">
<template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'operation'">
<a style="color: rgb(210, 0, 5)" @click="remove(record)">移除</a>
</template>
</template>
</a-table>
</div>
</div> </div>
<linkPeople v-show="visibleModel" ref="linkPeoples" @handleCancel="handleCancel" />
</ns-drawer> </ns-drawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { Cascader } from 'ant-design-vue'; // import { NsMessage } from '/nerv-lib/component';
// import { http } from '/nerv-lib/util';
import { NsMessage } from '/nerv-lib/component'; // import { number } from 'vue-types';
import { http } from '/nerv-lib/util'; import linkPeople from './linkPeople/index.vue';
// import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; // import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
@ -61,25 +90,191 @@
{ {
title: '序号', title: '序号',
dataIndex: 'address', dataIndex: 'address',
width: 80,
fixed: 'left',
customRender: (text: any) => { customRender: (text: any) => {
return text.index + 1; return text.index + 1;
}, },
}, },
{ {
title: '通知名单', title: '姓名',
dataIndex: 'name', dataIndex: 'name',
width: 80,
fixed: 'left',
key: 'name', key: 'name',
}, },
];
const dataSource = [
{ {
name: '运维>运维1部>张三', title: '性别',
dataIndex: 'sex',
width: 80,
key: 'sex',
},
{
title: '组织关系',
dataIndex: 'site',
key: 'site',
},
{
title: '部门',
dataIndex: 'department',
key: 'department',
}, },
{ {
name: '运维>运维1部>李四', title: '操作',
width: 80,
dataIndex: 'operation',
fixed: 'right',
}, },
]; ];
const visibleModel = ref(false);
const dataSource = ref([
{
id: 1,
name: '张三1',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 2,
name: '张三2',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 3,
name: '张三3',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 4,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 5,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 6,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 7,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 8,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 9,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 10,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 11,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 12,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 13,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 14,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 15,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 16,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
{
id: 17,
name: '张三',
sex: '男',
site: '济阳站',
department: '济阳站/产品/产品经理',
},
]);
const visible = ref(false); const visible = ref(false);
const linkPeoples = ref(null);
const handleChangePage = (current: number, pageSize: number) => {
pagination.value.current = current;
pagination.value.pageSize = pageSize;
};
const pagination = ref({
total: 0,
size: 'small',
current: 1,
pageSize: 10,
showQuickJumper: true,
showLessItems: true,
// showSizeChanger: true,
showTotal: (total: number, range: any) =>
total && range ? `显示第${range[0]}${range[1]}条记录,共 ${total} 条记录` : '',
onChange: handleChangePage,
});
//
const chengUser = () => {
visibleModel.value = true;
linkPeoples.value.getData();
};
//
const handleCancel = () => {
visibleModel.value = false;
};
// //
const infoObject = ref({ const infoObject = ref({
enableRules: 0, enableRules: 0,
@ -101,63 +296,10 @@
{ label: '站内信息', value: 1 }, { label: '站内信息', value: 1 },
{ label: '邮件', value: 2 }, { label: '邮件', value: 2 },
]); ]);
//
const options = ref([
{
value: 1,
label: 'Zhejiang',
isLeaf: false,
},
{
value: 2,
label: 'Jiangsu',
isLeaf: false,
},
]);
//
const loadData = (selectedOptions: any) => {
const targetOption = selectedOptions[selectedOptions.length - 1];
targetOption.loading = true;
// load options lazily
setTimeout(() => {
targetOption.loading = false;
console.log(targetOption, '数据');
targetOption.children = [
{
label: `${targetOption.label} Dynamic 1`,
value: 3,
isLeaf: false,
},
{
label: `${targetOption.label} Dynamic 2`,
value: 4,
isLeaf: false,
},
];
options.value = [...options.value];
}, 1000);
};
const rules = { const rules = {
notification: [{ required: true, message: '请选择站点', trigger: 'change' }], notification: [{ required: true, message: '请选择通知方式', trigger: 'change' }],
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
user: [{ required: true, message: '请选择通知人', trigger: 'change' }], user: [{ required: true, message: '请选择通知人', trigger: 'change' }],
abnormalDescription: [
{
required: true,
message: '请输入异常描述',
trigger: 'blur',
validator: (rules: any, abnormalDescription: any, cbfn: any) => {
if (abnormalDescription.trim() !== '') {
cbfn();
} else {
cbfn('告警标题不能为空');
}
},
},
],
alarm: [{ required: true, message: '请选择逻辑', trigger: 'blur' }],
number: [{ required: true, message: '请输入数值', trigger: 'blur' }],
}; };
const formRef = ref(); const formRef = ref();
const emit = defineEmits(['editObject']); const emit = defineEmits(['editObject']);
@ -165,7 +307,9 @@
// //
if (value) { if (value) {
// infoObject.value = value; // infoObject.value = value;
infoObject.value = {}; infoObject.value = {
enableRules: 0,
};
} else { } else {
infoObject.value = { infoObject.value = {
enableRules: 0, enableRules: 0,
@ -173,7 +317,15 @@
} }
visible.value = !visible.value; visible.value = !visible.value;
}; };
//
const remove = (data: any) => {
dataSource.value.forEach((item, index) => {
if (item.id === data.id) {
dataSource.value.splice(index, 1);
}
});
dataSource.value = [...dataSource.value];
};
const btnClick = () => { const btnClick = () => {
console.log(infoObject.value); console.log(infoObject.value);
// //
@ -190,22 +342,13 @@
// //
formRef.value.resetFields(); formRef.value.resetFields();
visible.value = false; visible.value = false;
options.value = [ visibleModel.value = false;
{
value: 'zhejiang',
label: 'Zhejiang',
isLeaf: false,
},
{
value: 'jiangsu',
label: 'Jiangsu',
isLeaf: false,
},
];
}; };
defineExpose({ defineExpose({
toggle, toggle,
handleClose, handleClose,
handleCancel,
handleChangePage,
formRef, formRef,
}); });
</script> </script>
@ -240,7 +383,7 @@
} }
/deep/ .ant-form-item-label { /deep/ .ant-form-item-label {
z-index: 20; z-index: 20;
text-align: right; text-align: left;
width: 23%; width: 20%;
} }
</style> </style>

45
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue

@ -0,0 +1,45 @@
<template>
<a-modal
v-model:visible="show"
width="1000px"
style="top: 50%; transform: translateY(-50%)"
title="添加联系人"
@ok="handleOk"
@cancel="handleCancel">
<div style="width: 100%; height: 100%">
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</div>
</a-modal>
</template>
<script lang="ts">
import { ref } from 'vue';
import { defineComponent } from 'vue';
export default defineComponent({
setup(props, { emit }) {
const handleOk = () => {
//
console.log('点击了确定按钮');
};
const getData = () => {
show.value = true;
};
const show = ref(false);
const handleCancel = () => {
//
console.log('点击了取消按钮');
emit('handleCancel', null);
show.value = false;
};
return {
handleOk,
show,
getData,
handleCancel,
};
},
});
</script>

8
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts

@ -14,7 +14,7 @@ const tableKeyMap = [
}, },
{ {
title: '优先级', title: '优先级',
dataIndex: 'priority', dataIndex: 'prioritys',
}, },
{ {
title: '告警标题', title: '告警标题',
@ -26,8 +26,7 @@ const tableKeyMap = [
}, },
{ {
title: '重复次数', title: '重复次数',
dataIndex: 'repetitions', dataIndex: 'repetition',
textEllipsis: true,
}, },
{ {
title: '监测时长', title: '监测时长',
@ -104,6 +103,9 @@ export const equipmentAlarmTableConfig = (
name: 'FeedBackDetail', name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'], dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => { handle: (data: any) => {
data.priority = data.priority.value;
data.repetitions = data.repetitions.value;
data.monitorTimeUnit = data.monitorTimeUnit.value;
editEquipmentAlarm.value.toggle(data); editEquipmentAlarm.value.toggle(data);
}, },
}, },

Loading…
Cancel
Save