fix:设备告警 网关告警

This commit is contained in:
zhaohy
2024-07-22 10:34:40 +08:00
parent 57d97eb3e2
commit 4c2989239d
18 changed files with 218 additions and 180 deletions

View File

@@ -1,5 +1,18 @@
<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 === '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" />
<!-- 状态页面 -->

View File

@@ -13,10 +13,10 @@
<div class="box">
<div class="card"></div>
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px">
告警编号20230310001
告警编号{{ infoObject.alarmCode }}
</div>
<div style="right: 20px; position: absolute; height: 35px; line-height: 35px">
2024-03-10 15:08:10
{{ infoObject.updateTime }}
</div>
</div>
<!-- center -->
@@ -26,14 +26,21 @@
<!-- bottom -->
<div style="width: 100%; margin-top: 10px">
<a-descriptions :column="1" bordered>
<a-descriptions-item label="优先级">紧急</a-descriptions-item>
<a-descriptions-item label="状态">新告警</a-descriptions-item>
<a-descriptions-item label="错误码">C003</a-descriptions-item>
<a-descriptions-item label="告警描述"
><div style="color: #2778ff">用电量超标</div> 当日用电量超出预设值</a-descriptions-item
<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="设备信息"> 1栋10层低压柜 </a-descriptions-item>
<a-descriptions-item label="重复次数"> 0 </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>
@@ -51,16 +58,37 @@
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;
infoObject.value = {
priority: null,
alarmCode: null,
alarmLogState: null,
errorCode: null,
alarmTitle: null,
abnormalDescription: null,
deviceInfo: null,
alarmRepetitions: null,
updateTime: null,
};
};
const btnClick = () => {
console.log('btnClick');
handleClose();
};
const toggle = (data: any) => {
console.log(data, 'data');
infoObject.value = data;
visible.value = true;
setTimeout(() => {
getChatr();

View File

@@ -39,21 +39,22 @@
</div>
</a-tab-pane>
<a-tab-pane key="2" tab="状态流程">
<NsSteps v-bind="config" />
<!-- 自动生成工单 -->
<div v-if="infoObject.createWorkOrder === 1"> xxxx </div>
<!-- 没有自动生成工单 -->
<NsSteps v-else v-bind="config" />
</a-tab-pane>
</a-tabs>
<template #footer>
<!-- <a-button style="margin-right: 8px" type="primary" @click="createOrder">创建工单</a-button> -->
<a-button type="primary" @click="btnClick">确定</a-button>
</template>
</ns-drawer>
</template>
<script>
import { defineComponent } from 'vue';
import { ref, createVNode } from 'vue';
import { ref } from 'vue';
import NsSteps from '/@/components/ns-steps.vue';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { NsMessage } from '/nerv-lib/component';
export default defineComponent({
components: { NsSteps },
@@ -62,19 +63,14 @@
const visible = ref(false);
const showEdit = ref(true);
const infoObject = ref({});
const statusOptions = ref([
{ value: '0', label: '待处理' },
{ value: '1', label: '处理中' },
{ value: '2', label: '已完成' },
{ value: '3', label: '超时' },
{ value: '4', label: '已关闭' },
]);
const data = ref({});
const statusOptions = ref();
const logList = ref([
{ name: '李四', status: '2', time: '2024-03-10 10:00:00', desc: '完成' },
{ name: '李四', status: '3', time: '2024-03-10 10:00:00', desc: '完成' },
{ name: '王五', status: '5', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '4', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '3', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '1', time: '2024-03-10 10:00:00', desc: '创建工单' },
{ name: '赵六', status: '0', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '2', time: '2024-03-10 10:00:00', desc: '创建工单' },
{ name: '赵六', status: '1', time: '2024-03-10 10:00:00' },
]);
const config = ref({
size: logList.value.length,
@@ -84,23 +80,41 @@
visible.value = false;
};
const btnClick = () => {
NsMessage.success('操作成功');
console.log('btnClick');
};
const toggle = (data) => {
data.value = data;
infoObject.value = { ...logList.value[0] };
if (data.value.createWorkOrder === 1) {
statusOptions.value = [
{ value: '1', label: '待处理' },
{ value: '2', label: '处理中' },
{ value: '3', label: '已完成' },
{ value: '4', label: '超时' },
{ value: '5', label: '已关闭' },
];
} else {
statusOptions.value = [
{ value: '1', label: '待处理' },
{ value: '2', label: '处理中' },
{ value: '3', label: '已完成' },
{ value: '5', label: '已关闭' },
];
}
let statusMap = {
0: '待处理',
1: '处理中',
2: '已完成',
3: '超时',
4: '已关闭',
1: '待处理',
2: '处理中',
3: '已完成',
4: '超时',
5: '已关闭',
};
let colorMap = {
0: '#ff7602',
1: '#00a1e6',
2: '#04d919',
3: '#d9001b',
4: '#a6a6a6',
1: '#ff7602',
2: '#00a1e6',
3: '#04d919',
4: '#d9001b',
5: '#a6a6a6',
};
logList.value.forEach((item) => {
item.statusName = statusMap[item.status];
@@ -109,38 +123,12 @@
});
visible.value = true;
};
const createOrder = () => {
NsModal.confirm({
title: '提示',
icon: createVNode(ExclamationCircleOutlined),
content: '是否创建工单',
okText: '确认',
okType: 'primary',
cancelText: '取消',
onOk() {
NsModal.confirm({
title: '提示',
icon: createVNode(ExclamationCircleOutlined),
content: '工单创建成功工单号xxxxxxxxx',
okText: '确认',
okType: 'primary',
cancelButtonProps: { style: { display: 'none' } }, // 正确设置取消按钮样式
onOk() {
console.log('创建工单');
},
});
},
onCancel() {
console.log('Cancel');
},
});
};
return {
infoObject,
showEdit,
data,
statusOptions,
btnClick,
createOrder,
visible,
logList,
config,

View File

@@ -1,6 +1,8 @@
import { dateUtil } from '/nerv-lib/util/date-util';
import data from '../notificationManagementMock.json';
import { http } from '/nerv-lib/util';
import { equipmentAlarmApi } from '/@/api/alarmManagement/equipmentAlarm';
import { ref } from 'vue';
const tableKeyMap = [
{
@@ -12,45 +14,45 @@ const tableKeyMap = [
},
{
title: '告警编号',
dataIndex: 'id',
dataIndex: 'alarmCode',
},
{
title: '告警描述',
dataIndex: 'deviceCode',
dataIndex: 'alarmTitle',
},
{
title: '优先级',
dataIndex: 'deviceName',
dataIndex: 'priority',
},
{
title: '状态',
dataIndex: 'position',
dataIndex: 'alarmLogState',
},
{
title: '错误码',
dataIndex: 'position',
textEllipsis: true,
dataIndex: 'errorCode',
},
{
title: '设备信息',
dataIndex: 'position',
dataIndex: 'deviceInfo',
},
{
title: '更新时间',
dataIndex: 'enableRules',
dataIndex: 'updateTime',
},
{
title: '重复次数',
dataIndex: 'enableRules',
dataIndex: 'alarmRepetitions',
},
];
const mockData = ref(data.listData);
export const notificationtableConfig = (look: any, status: any) => {
return {
title: '告警记录',
// api: '/carbon_emission/device/getDeviceList',
api: equipmentAlarmApi.getTableList,
value: mockData.value,
headerActions: [{}],
scroll: { x: 2000 },
columns: tableKeyMap,
// rowSelection: null, 选择按钮
columnActions: {
@@ -61,7 +63,6 @@ export const notificationtableConfig = (look: any, status: any) => {
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
console.log(look.value);
look.value.toggle(data);
},
},
@@ -79,29 +80,29 @@ export const notificationtableConfig = (look: any, status: any) => {
formConfig: {
schemas: [
{
field: 'name',
label: '告警类型',
field: 'priority',
label: '优先级',
component: 'NsSelect',
componentProps: {
placeholder: '请选择告警优先级',
options: [
{
label: '紧急',
value: '1',
value: 1,
},
{
label: '重要',
value: '2',
value: 2,
},
{
label: '一般',
value: '3',
value: 3,
},
],
},
},
{
field: 'provider',
field: 'alarmLogState',
label: '状态',
component: 'NsSelect',
componentProps: {
@@ -109,33 +110,38 @@ export const notificationtableConfig = (look: any, status: any) => {
options: [
{
label: '待处理',
value: '1',
value: 1,
},
{
label: '处理中',
value: '2',
value: 2,
},
{
label: '已完成',
value: '3',
value: 3,
},
{
label: '超时',
value: '4',
value: 4,
},
{
label: '关闭',
value: '5',
value: 5,
},
],
},
},
{
field: 'provider',
field: 'errorCode',
label: '错误码',
component: 'NsInput',
component: 'NsSelectApi',
componentProps: {
placeholder: '请输入告警错误码',
placeholder: '请选择错误码',
autoSelectFirst: false,
api: equipmentAlarmApi.getCodeList,
resultField: 'data',
labelField: 'errorCode',
valueField: 'errorCode',
},
},
{