Browse Source

add:设备告警网关告警对接 接口

temp
zhaohy 4 months ago
parent
commit
7b77c3cc88
  1. 6
      hx-ai-intelligent/src/api/alarmManagement/energyAlarm.ts
  2. 3
      hx-ai-intelligent/src/api/alarmManagement/gatewayAlarm.ts
  3. 19
      hx-ai-intelligent/src/router/alarmManagement.ts
  4. 3
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue
  5. 12
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue
  6. 1
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
  7. 48
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/index.vue
  8. 272
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/look.vue
  9. 108
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/notificationManagementMock.json
  10. 170
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue
  11. 187
      hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts
  12. 1
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue
  13. 23
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue
  14. 11
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue
  15. 47
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue
  16. 91
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts

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

@ -0,0 +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
}

3
hx-ai-intelligent/src/api/alarmManagement/gatewayAlarm.ts

@ -0,0 +1,3 @@
export enum gatewayAlarmApi {
getTableList = '/carbon-smart/api/AlarmGatewayLog/selectAlarmGatewayLog', //网关告警 列表
}

19
hx-ai-intelligent/src/router/alarmManagement.ts

@ -63,6 +63,25 @@ const alarmManagement = {
], ],
}, },
{ {
path: 'EnergyAlarm',
name: 'EnergyAlarm',
meta: { title: '能碳告警', hideChildren: true, icon: 'gaojingguanli' },
component: Base,
redirect: { name: 'EnergyAlarmIndex' },
children: [
{
path: 'index',
name: 'EnergyAlarmIndex',
component: () => import('/@/view/alarmManagement/energyAlarm/index.vue'),
meta: {
title: '能碳告警',
keepAlive: false,
// backApi: [],
},
},
],
},
{
path: 'alarmSettings', path: 'alarmSettings',
name: 'AlarmSettings', name: 'AlarmSettings',
meta: { title: '告警设置', hideChildren: true, icon: 'gaojingguanli' }, meta: { title: '告警设置', hideChildren: true, icon: 'gaojingguanli' },

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

@ -138,7 +138,6 @@
import { energyAlarms } from '/@/api/alarmManagement/alarmSettings/energyAlarm'; import { energyAlarms } from '/@/api/alarmManagement/alarmSettings/energyAlarm';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { dict } from '/@/api'; import { dict } from '/@/api';
import { async } from '@antv/x6/lib/registry/marker/async';
// import type { Rule } from 'ant-design-vue/es/form'; // import type { Rule } from 'ant-design-vue/es/form';
@ -367,7 +366,7 @@
message: '请输入异常描述', message: '请输入异常描述',
trigger: 'blur', trigger: 'blur',
validator: (rules: any, abnormalDescription: any, cbfn: any) => { validator: (rules: any, abnormalDescription: any, cbfn: any) => {
if (abnormalDescription.trim() !== '') { if (abnormalDescription && abnormalDescription.trim() !== '') {
cbfn(); cbfn();
} else { } else {
cbfn('告警标题不能为空'); cbfn('告警标题不能为空');

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

@ -46,6 +46,7 @@
:disabled="!(infoObject && infoObject.deviceType && infoObject.deviceType.length > 0)" :disabled="!(infoObject && infoObject.deviceType && infoObject.deviceType.length > 0)"
style="width: 100%" style="width: 100%"
:autoClearSearchValue="true" :autoClearSearchValue="true"
allow-clear
@change="selectDevice" @change="selectDevice"
placeholder="请选择设备名称"> placeholder="请选择设备名称">
<template v-for="(item, index) in deviceNameTreeData" :key="index"> <template v-for="(item, index) in deviceNameTreeData" :key="index">
@ -59,6 +60,8 @@
<a-select <a-select
v-model:value="infoObject.devicePoint" v-model:value="infoObject.devicePoint"
show-search show-search
:autoClearSearchValue="true"
allow-clear
placeholder="请选择设备点位" placeholder="请选择设备点位"
style="width: 100%" style="width: 100%"
:disabled="!infoObject?.deviceId" :disabled="!infoObject?.deviceId"
@ -78,6 +81,7 @@
<a-select <a-select
v-model:value="infoObject.valueType" v-model:value="infoObject.valueType"
placeholder="请选择取值类型" placeholder="请选择取值类型"
allow-clear
style="width: 100%" style="width: 100%"
:options="qzOptions" /> :options="qzOptions" />
</a-form-item> </a-form-item>
@ -151,11 +155,8 @@
import type { ShowSearchType } from 'ant-design-vue/es/cascader'; import type { ShowSearchType } from 'ant-design-vue/es/cascader';
import { device } from '/@/api/deviceManage'; import { device } from '/@/api/deviceManage';
import { deviceAlarms } from '/@/api/alarmManagement/alarmSettings/deviceAlarms'; import { deviceAlarms } from '/@/api/alarmManagement/alarmSettings/deviceAlarms';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { async } from '@antv/x6/lib/registry/marker/async';
const visible = ref(false); const visible = ref(false);
// //
const equipmentAlarm = ref({}); const equipmentAlarm = ref({});
@ -187,6 +188,8 @@
let deviceNameTreeData = ref([]); let deviceNameTreeData = ref([]);
// //
const selectDeviceType = (value: any, selectedOptions: any) => { const selectDeviceType = (value: any, selectedOptions: any) => {
infoObject.value.deviceId = null;
if (selectedOptions && selectedOptions.length > 0) {
// //
getDevicePage({ getDevicePage({
orgId: orgId.value, orgId: orgId.value,
@ -194,6 +197,7 @@
pageNum: 1, pageNum: 1,
pageSize: 999, pageSize: 999,
}); });
}
}; };
// //
const selectDevice = () => { const selectDevice = () => {
@ -379,7 +383,7 @@
message: '请输入异常描述', message: '请输入异常描述',
trigger: 'blur', trigger: 'blur',
validator: (rules: any, abnormalDescription: any, cbfn: any) => { validator: (rules: any, abnormalDescription: any, cbfn: any) => {
if (abnormalDescription.trim() !== '') { if (abnormalDescription && abnormalDescription.trim() !== '') {
cbfn(); cbfn();
} else { } else {
cbfn('告警标题不能为空'); cbfn('告警标题不能为空');

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

@ -73,7 +73,6 @@
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import linkPeople from './linkPeople/index.vue'; import linkPeople from './linkPeople/index.vue';
import { notificationManagementApi } from '/@/api/alarmManagement/alarmSettings/notificationManagements'; import { notificationManagementApi } from '/@/api/alarmManagement/alarmSettings/notificationManagements';
import { async } from '@antv/x6/lib/registry/marker/async';
//table //table
const columns = [ const columns = [

48
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/index.vue

@ -0,0 +1,48 @@
<template>
<ns-view-list-table v-bind="config" ref="mainRef">
<template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'alarmTitle'">
<div style="color: #2778ff">{{ record.alarmTitle }}</div>
{{ record.abnormalDescription }}
</template>
<template v-if="column.dataIndex === 'priority'">
{{ record.priority ? record.priority.label : '' }}
</template>
<template v-if="column.dataIndex === 'alarmLogState'">
{{ record.alarmLogState ? record.alarmLogState.label : '' }}
</template>
</template>
</ns-view-list-table>
<!-- 详情页面 -->
<Look ref="look" />
<!-- 状态页面 -->
<Status ref="status" @logAdd="logAdd" />
</template>
<script lang="ts">
import { notificationtableConfig } from './ts/config';
import Look from './look.vue';
import Status from './status.vue';
import { ref } from 'vue';
export default {
name: 'EquipmentAlarmIndex',
components: { Look, Status },
setup() {
const look = ref(null);
const status = ref(null);
const mainRef = ref(null);
const config = notificationtableConfig(look, status);
const logAdd = () => {
mainRef.value?.nsTableRef.reload();
};
return {
config,
look,
status,
mainRef,
logAdd,
};
},
};
</script>

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

@ -0,0 +1,272 @@
<template>
<ns-drawer
v-model:visible="visible"
width="520"
:title="' '"
:footer-style="{ textAlign: 'right' }"
:ok="btnClick"
:cancel="handleClose"
placement="right"
@close="handleClose">
<div style="width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden">
<!-- top -->
<div class="box">
<div class="card"></div>
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px">
告警编号{{ infoObject.alarmCode }}
</div>
<div style="right: 20px; position: absolute; height: 35px; line-height: 35px">
{{ infoObject.updateTime }}
</div>
</div>
<!-- center -->
<div style="width: 100%; height: 400px">
<div style="width: 100%; height: 100%" ref="graphChart"></div>
</div>
<!-- bottom -->
<div style="width: 100%; margin-top: 10px">
<a-descriptions :column="1" bordered>
<a-descriptions-item label="优先级">{{
infoObject.priority ? infoObject.priority.label : ''
}}</a-descriptions-item>
<a-descriptions-item label="状态">{{
infoObject.alarmLogState ? infoObject.alarmLogState.label : ''
}}</a-descriptions-item>
<a-descriptions-item label="错误码">{{ infoObject.errorCode }}</a-descriptions-item>
<a-descriptions-item label="告警描述">
<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.alarmRepetitions }}
</a-descriptions-item>
</a-descriptions>
</div>
</div>
<template #footer>
<a-button type="primary" @click="handleClose">确定</a-button>
</template>
</ns-drawer>
</template>
<script lang="ts" setup>
defineOptions({
name: 'look', // name
});
import { ref } from 'vue';
import * as echarts from 'echarts';
let chartInstance: echarts.ECharts | null = null;
const graphChart = ref(null);
const infoObject = ref({
priority: null,
alarmCode: null,
alarmLogState: null,
errorCode: null,
alarmTitle: null,
abnormalDescription: null,
deviceInfo: null,
alarmRepetitions: null,
updateTime: null,
});
const visible = ref(false);
const handleClose = () => {
visible.value = false;
if (chartInstance) {
chartInstance.dispose();
}
infoObject.value = {
priority: null,
alarmCode: null,
alarmLogState: null,
errorCode: null,
alarmTitle: null,
abnormalDescription: null,
deviceInfo: null,
alarmRepetitions: null,
updateTime: null,
};
};
const btnClick = () => {
handleClose();
};
const toggle = (data: any) => {
infoObject.value = data;
visible.value = true;
setTimeout(() => {
getChatr();
}, 500);
};
const getChatr = () => {
let dayData = [];
let energyAlarm = [];
// Extend data for 30 days
for (let i = 1; i < 30; i++) {
dayData.push(`3/${i}`);
energyAlarm.push(Math.floor(Math.random() * 250));
}
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(graphChart.value);
const option = {
// title: {
// text: '/ 30',
// textStyle: {
// fontSize: 16,
// fontWeight: 'normal',
// color: '#aaaaaa',
// },
// left: '1%',
// top: '2%',
// },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params: any) {
let res = params[0].marker + ' ' + params[0].seriesName + ' : ' + params[0].data;
return res;
},
},
grid: {
left: '10%', //
right: '4%', //
top: '6%',
borderWidth: 0,
y2: 60, //
},
legend: [
{
show: false,
top: 5,
left: 'center', //
textStyle: {
color: 'rgb(89, 89, 89)',
fontSize: '14',
fontWeight: 'normal',
}, //
data: ['电压值'],
itemGap: 30, //
},
],
// toolbox: {
// show: true,
// feature: {
// restore: {},
// saveAsImage: {},
// },
// },
calculable: true,
xAxis: [
{
type: 'category',
splitLine: {
show: false,
},
axisTick: {
show: true,
},
splitArea: {
show: false,
},
axisLabel: {
show: true, // X
color: 'rgb(89, 89, 89)', // X
fontSize: 12, // X
formatter: function (value) {
// X
return value;
},
},
data: dayData,
},
],
yAxis: [
{
type: 'value',
shwo: false,
splitLine: {
show: true,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitArea: {
show: false,
},
axisLabel: {
show: true, //
formatter: function (value) {
return value + ' V'; //
},
},
},
],
dataZoom: [
{
height: 12,
start: 0,
end: 100,
handleSize: '300%', //
bottom: 15,
},
],
series: [
{
name: '电压值',
type: 'line',
itemStyle: {
normal: {
barBorderRadius: 0,
color: '#2778FF',
},
},
symbol: 'circle', //
symbolSize: 8,
label: {
show: true,
color: 'rgb(89, 89, 89)',
position: 'top',
top: '10',
formatter: function (value) {
return Number(energyAlarm[value.dataIndex]) + 'V';
},
},
data: energyAlarm,
},
],
};
chartInstance = echarts.init(graphChart.value);
chartInstance.setOption(option);
};
defineExpose({
toggle,
});
</script>
<style scoped lang="less">
.box {
width: 100%;
height: 35px;
display: flex;
position: relative;
font-size: @font-size-base;
border-bottom: 1px solid @primary-color;
}
.card {
position: absolute;
left: 0px;
top: 0px;
width: 5px;
height: 35px;
background-color: @primary-color;
}
:deep(.ant-descriptions-item-label) {
width: 25%;
}
</style>

108
hx-ai-intelligent/src/view/alarmManagement/energyAlarm/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
}
]
}

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

@ -0,0 +1,170 @@
<template>
<ns-drawer
v-model:visible="visible"
width="550"
:title="' '"
:footer-style="{ textAlign: 'right' }"
:ok="btnClick"
:cancel="handleClose"
placement="right"
@close="handleClose">
<a-tabs>
<a-tab-pane key="1" tab="更新状态">
<div style="width: 100%; padding: 24px">
<a-form ref="formRef" :model="infoObject">
<a-form-item ref="state" label="当前状态" name="state">
<a-select
v-model:value="infoObject.state"
show-search
placeholder="请选择当前状态"
style="width: 85%"
:options="stateOptions"
:disabled="showEdit" />
<ns-icon
size="20"
@click="changeShowEdit"
style="margin-left: 20px"
:name="showEdit ? 'bianji' : 'baocun'" />
</a-form-item>
<a-form-item label="备注" name="remarks">
<a-textarea
v-model:value="infoObject.remarks"
placeholder="请输入异常描述"
:disabled="showEdit"
style="width: 85%"
:autoSize="{ minRows: 4, maxRows: 4 }" />
</a-form-item>
</a-form>
</div>
</a-tab-pane>
<a-tab-pane key="2" tab="状态流程">
<!-- 自动生成工单 -->
<div v-if="infoObject.createWorkOrder === 1"> xxxx </div>
<!-- 没有自动生成工单 -->
<NsSteps v-else v-bind="config" />
</a-tab-pane>
</a-tabs>
<template #footer>
<a-button type="primary" @click="btnClick">确定</a-button>
</template>
</ns-drawer>
</template>
<script>
import { defineComponent } from 'vue';
import { ref } from 'vue';
import NsSteps from '/@/components/ns-steps.vue';
import { NsMessage } from '/nerv-lib/component';
import { http } from '/nerv-lib/util';
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm';
export default defineComponent({
components: { NsSteps },
setup(props, { emit }) {
const visible = ref(false);
const showEdit = ref(true);
const infoObject = ref({});
const equipmentAlarm = ref({});
const stateOptions = ref();
const logList = ref([]);
const config = ref({
size: logList.value.length,
dataSource: logList.value,
});
const handleClose = () => {
showEdit.value = true;
equipmentAlarm.value = {};
infoObject.value = {};
visible.value = false;
};
const btnClick = () => {
delete infoObject.value.createTime;
infoObject.value.alarmEquipmentLogId = equipmentAlarm.value.id;
if (equipmentAlarm.value.createWorkOrder === 0) {
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
if (res.msg === 'success') {
NsMessage.success('操作成功');
showEdit.value = true;
equipmentAlarm.value = {};
infoObject.value = {};
visible.value = false;
emit('logAdd', null);
}
});
}
};
//
const changeShowEdit = () => {
//
if (equipmentAlarm.value.createWorkOrder === 0) {
showEdit.value = !showEdit.value;
}
};
const toggle = async (data) => {
equipmentAlarm.value = { ...data };
visible.value = true;
if (equipmentAlarm.value.createWorkOrder === 1) {
stateOptions.value = [
{ value: 1, label: '待处理' },
{ value: 2, label: '处理中' },
{ value: 3, label: '已完成' },
{ value: 4, label: '超时' },
{ value: 5, label: '已关闭' },
];
} else {
stateOptions.value = [
{ value: 1, label: '待处理' },
{ value: 2, label: '处理中' },
{ value: 3, label: '已完成' },
{ value: 5, label: '已关闭' },
];
}
console.log(data, 'data');
await http
.post(energyAlarmApi.getSelectAlarmEquipmentLogStatusProcess, {
alarmEquipmentLogId: data.id,
})
.then((res) => {
if (res.msg === 'success') {
logList.value = res.data;
infoObject.value = { ...logList.value[0] };
infoObject.value.state = infoObject.value.state.value;
let colorMap = {
1: '#ff7602',
2: '#00a1e6',
3: '#04d919',
4: '#d9001b',
5: '#a6a6a6',
};
logList.value.forEach((item) => {
item.stateName = item.state.label;
item.color = colorMap[item.state.value];
item.src = 'state-' + item.state.value;
});
config.value.dataSource = logList.value;
}
});
};
return {
infoObject,
changeShowEdit,
showEdit,
equipmentAlarm,
stateOptions,
btnClick,
visible,
logList,
config,
handleClose,
toggle,
};
},
});
</script>
<style scoped lang="less">
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;
width: 17%;
}
</style>

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

@ -0,0 +1,187 @@
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm';
import { dict } from '/@/api';
const tableKeyMap = [
{
title: '序号',
dataIndex: 'address',
width: 80,
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '告警编号',
dataIndex: 'alarmCode',
},
{
title: '告警描述',
dataIndex: 'alarmTitle',
},
{
title: '类型',
dataIndex: 'priority',
},
{
title: '优先级',
dataIndex: 'priority',
},
{
title: '状态',
dataIndex: 'alarmLogState',
},
{
title: '错误码',
dataIndex: 'errorCode',
},
{
title: '监测点位',
dataIndex: 'deviceInfo',
},
{
title: '更新时间',
dataIndex: 'updateTime',
},
{
title: '重复次数',
dataIndex: 'alarmRepetitions',
},
];
export const notificationtableConfig = (look: any, status: any) => {
return {
title: '告警记录',
api: energyAlarmApi.getTableList,
headerActions: [{}],
scroll: { x: 2000 },
columns: tableKeyMap,
// rowSelection: null, 选择按钮
columnActions: {
title: '操作',
actions: [
{
label: '详情',
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
look.value.toggle(data);
},
},
{
label: '状态',
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
status.value.toggle(data);
},
},
],
},
formConfig: {
schemas: [
{
field: 'dataSourcesType',
label: '类型',
component: 'nsSelectApi',
// dynamicParams: {
// id: 'deviceName', //帮定上级联动数据
// },
componentProps: {
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
immediate: true,
allowClear: true,
labelField: 'cnValue',
valueField: 'id',
placeholder: '请选择类型',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.cnValue.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
// autoSelectFirst: true,
},
},
{
field: 'priority',
label: '优先级',
component: 'NsSelect',
componentProps: {
placeholder: '请选择告警优先级',
allowClear: true,
options: [
{
label: '紧急',
value: 1,
},
{
label: '重要',
value: 2,
},
{
label: '一般',
value: 3,
},
],
},
},
{
field: 'alarmLogState',
label: '状态',
component: 'NsSelect',
componentProps: {
placeholder: '请选择状态',
allowClear: true,
options: [
{
label: '待处理',
value: 1,
},
{
label: '处理中',
value: 2,
},
{
label: '已完成',
value: 3,
},
{
label: '超时',
value: 4,
},
{
label: '关闭',
value: 5,
},
],
},
},
{
field: 'errorCode',
label: '错误码',
component: 'NsSelectApi',
componentProps: {
allowClear: true,
placeholder: '请选择错误码',
autoSelectFirst: false,
api: energyAlarmApi.getCodeList,
resultField: 'data',
labelField: 'errorCode',
valueField: 'errorCode',
},
},
{
field: 'createTime',
label: '数据日期',
component: 'NsRangePicker',
allowClear: true,
fieldMap: ['startTime', 'endTime'],
componentProps: {
valueFormat: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'],
},
},
],
},
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};
};

1
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue

@ -94,6 +94,7 @@
infoObject.value = data; infoObject.value = data;
visible.value = true; visible.value = true;
setTimeout(() => { setTimeout(() => {
// echarts
getChatr(); getChatr();
}, 500); }, 500);
}; };

23
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue

@ -11,7 +11,7 @@
<a-tabs> <a-tabs>
<a-tab-pane key="1" tab="更新状态"> <a-tab-pane key="1" tab="更新状态">
<div style="width: 100%; padding: 24px"> <div style="width: 100%; padding: 24px">
<a-form ref="formRef" :model="infoObject"> <a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item ref="state" label="当前状态" name="state"> <a-form-item ref="state" label="当前状态" name="state">
<a-select <a-select
v-model:value="infoObject.state" v-model:value="infoObject.state"
@ -29,7 +29,7 @@
<a-form-item label="备注" name="remarks"> <a-form-item label="备注" name="remarks">
<a-textarea <a-textarea
v-model:value="infoObject.remarks" v-model:value="infoObject.remarks"
placeholder="请输入异常描述" placeholder="请输入备注"
:disabled="showEdit" :disabled="showEdit"
style="width: 85%" style="width: 85%"
:autoSize="{ minRows: 4, maxRows: 4 }" /> :autoSize="{ minRows: 4, maxRows: 4 }" />
@ -71,6 +71,24 @@
size: logList.value.length, size: logList.value.length,
dataSource: logList.value, dataSource: logList.value,
}); });
//
const rules = {
remarks: [
{
required: true,
message: '请输入备注',
trigger: 'change',
validator: (rules, remarks, cbfn) => {
if (remarks && remarks.trim() !== '') {
cbfn();
} else {
cbfn('备注不能为空');
}
},
},
],
state: [{ required: true, message: '请选择当前状态', trigger: 'change' }],
};
const handleClose = () => { const handleClose = () => {
showEdit.value = true; showEdit.value = true;
equipmentAlarm.value = {}; equipmentAlarm.value = {};
@ -147,6 +165,7 @@
}; };
return { return {
infoObject, infoObject,
rules,
changeShowEdit, changeShowEdit,
showEdit, showEdit,
equipmentAlarm, equipmentAlarm,

11
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue

@ -1,5 +1,14 @@
<template> <template>
<ns-view-list-table v-bind="config" ref="mainRef" /> <ns-view-list-table v-bind="config" ref="mainRef">
<template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'priority'">
{{ record.priority ? record.priority.label : '' }}
</template>
<template v-if="column.dataIndex === 'alarmLogState'">
{{ record.alarmLogState ? record.alarmLogState.label : '' }}
</template>
</template>
</ns-view-list-table>
<!-- 详情页面 --> <!-- 详情页面 -->
<Look ref="look" /> <Look ref="look" />
<!-- 状态页面 --> <!-- 状态页面 -->

47
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue

@ -13,10 +13,10 @@
<div class="box"> <div class="box">
<div class="card"></div> <div class="card"></div>
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px"> <div style="left: 25px; position: absolute; height: 35px; line-height: 35px">
告警编号20230310001 告警编号{{ infoObject.alarmCode }}
</div> </div>
<div style="right: 20px; position: absolute; height: 35px; line-height: 35px"> <div style="right: 20px; position: absolute; height: 35px; line-height: 35px">
2024-03-10 15:08:10 {{ infoObject.updateTime }}
</div> </div>
</div> </div>
<!-- center --> <!-- center -->
@ -26,12 +26,20 @@
<!-- bottom --> <!-- bottom -->
<div style="width: 100%; margin-top: 10px"> <div style="width: 100%; margin-top: 10px">
<a-descriptions :column="1" bordered> <a-descriptions :column="1" bordered>
<a-descriptions-item label="优先级">紧急</a-descriptions-item> <a-descriptions-item label="优先级">{{
<a-descriptions-item label="状态">新告警</a-descriptions-item> infoObject.priority ? infoObject.priority.label : ''
<a-descriptions-item label="错误码">C003</a-descriptions-item> }}</a-descriptions-item>
<a-descriptions-item label="告警描述">网关心跳包丢失</a-descriptions-item> <a-descriptions-item label="状态">{{
<a-descriptions-item label="设备信息">1号网关_Di23j596_0001 </a-descriptions-item> infoObject.alarmLogState ? infoObject.alarmLogState.label : ''
<a-descriptions-item label="重复次数"> 0 </a-descriptions-item> }}</a-descriptions-item>
<a-descriptions-item label="错误码">{{ infoObject.errorCode }}</a-descriptions-item>
<a-descriptions-item label="告警描述">{{
infoObject.alarmDescription
}}</a-descriptions-item>
<a-descriptions-item label="设备信息">{{ infoObject.deviceInfo }} </a-descriptions-item>
<a-descriptions-item label="断往时长">
{{ infoObject.durationOfNetworkDisconnection }}</a-descriptions-item
>
</a-descriptions> </a-descriptions>
</div> </div>
</div> </div>
@ -49,16 +57,35 @@
let chartInstance: echarts.ECharts | null = null; let chartInstance: echarts.ECharts | null = null;
const graphChart = ref(null); const graphChart = ref(null);
const infoObject = ref({
alarmCode: null,
updateTime: null,
priority: null,
alarmLogState: null,
errorCode: null,
alarmDescription: null,
deviceInfo: null,
durationOfNetworkDisconnection: null,
});
const visible = ref(false); const visible = ref(false);
const handleClose = () => { const handleClose = () => {
visible.value = false; visible.value = false;
infoObject.value = {
alarmCode: null,
updateTime: null,
priority: null,
alarmLogState: null,
errorCode: null,
alarmDescription: null,
deviceInfo: null,
durationOfNetworkDisconnection: null,
};
}; };
const btnClick = () => { const btnClick = () => {
console.log('btnClick');
handleClose(); handleClose();
}; };
const toggle = (data: any) => { const toggle = (data: any) => {
console.log(data, 'data'); infoObject.value = { ...data };
visible.value = true; visible.value = true;
setTimeout(() => { setTimeout(() => {
getChatr(); getChatr();

91
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts

@ -1,7 +1,4 @@
import { dateUtil } from '/nerv-lib/util/date-util'; import { gatewayAlarmApi } from '/@/api/alarmManagement/gatewayAlarm';
import data from '../notificationManagementMock.json';
import { http } from '/nerv-lib/util';
import { ref } from 'vue';
const tableKeyMap = [ const tableKeyMap = [
{ {
title: '序号', title: '序号',
@ -12,44 +9,41 @@ const tableKeyMap = [
}, },
{ {
title: '告警编号', title: '告警编号',
dataIndex: 'id', dataIndex: 'alarmCode',
}, },
{ {
title: '告警描述', title: '告警描述',
dataIndex: 'deviceCode', dataIndex: 'alarmDescription',
}, },
{ {
title: '优先级', title: '优先级',
dataIndex: 'deviceName', dataIndex: 'priority',
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'position', dataIndex: 'alarmLogState',
}, },
{ {
title: '错误码', title: '错误码',
dataIndex: 'position', dataIndex: 'errorCode',
textEllipsis: true,
}, },
{ {
title: '设备信息', title: '设备信息',
dataIndex: 'position', dataIndex: 'deviceInfo',
}, },
{ {
title: '更新时间', title: '更新时间',
dataIndex: 'enableRules', dataIndex: 'updateTime',
}, },
{ {
title: '断网时长', title: '断网时长',
dataIndex: 'enableRules', dataIndex: 'durationOfNetworkDisconnection',
}, },
]; ];
const mockData = ref(data.listData);
export const notificationtableConfig = (look: any, status: any) => { export const notificationtableConfig = (look: any, status: any) => {
return { return {
title: '告警记录', title: '告警记录',
// api: '/carbon_emission/device/getDeviceList', api: gatewayAlarmApi.getTableList,
value: mockData.value,
headerActions: [{}], headerActions: [{}],
columns: tableKeyMap, columns: tableKeyMap,
// rowSelection: null, 选择按钮 // rowSelection: null, 选择按钮
@ -78,56 +72,57 @@ export const notificationtableConfig = (look: any, status: any) => {
formConfig: { formConfig: {
schemas: [ schemas: [
{ // {
field: 'name', // field: 'name',
label: '告警类型', // label: '告警类型',
component: 'NsSelect', // component: 'NsSelect',
defaultValue: '2', // defaultValue: '2',
componentProps: { // componentProps: {
placeholder: '请选择告警优先级', // placeholder: '请选择告警优先级',
disabled: true, // disabled: true, // 不可选择
options: [ // options: [
{ // {
label: '紧急', // label: '紧急',
value: '1', // value: '1',
}, // },
{ // {
label: '重要', // label: '重要',
value: '2', // value: '2',
}, // },
{ // {
label: '一般', // label: '一般',
value: '3', // value: '3',
}, // },
], // ],
}, // },
}, // },
{ {
field: 'provider', field: 'alarmLogState',
label: '状态', label: '状态',
component: 'NsSelect', component: 'NsSelect',
componentProps: { componentProps: {
placeholder: '请选择状态', placeholder: '请选择状态',
allowClear: true,
options: [ options: [
{ {
label: '待处理', label: '待处理',
value: '1', value: 1,
}, },
{ {
label: '处理中', label: '处理中',
value: '2', value: 2,
}, },
{ {
label: '已完成', label: '已完成',
value: '3', value: 3,
}, },
{ {
label: '超时', label: '超时',
value: '4', value: 4,
}, },
{ {
label: '关闭', label: '关闭',
value: '5', value: 5,
}, },
], ],
}, },
@ -136,7 +131,7 @@ export const notificationtableConfig = (look: any, status: any) => {
field: 'createTime', field: 'createTime',
label: '数据日期', label: '数据日期',
component: 'NsRangePicker', component: 'NsRangePicker',
fieldMap: ['manufactureBeginDate', 'manufactureEndDate'], fieldMap: ['startTime', 'endTime'],
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'], placeholder: ['开始日期', '结束日期'],

Loading…
Cancel
Save