fix:添加设备告警 换图标 设备告警详情 状态流程 按钮权限

This commit is contained in:
zhaohy
2024-07-17 11:13:56 +08:00
parent 1401d3611f
commit c2e69b4d36
19 changed files with 491 additions and 292 deletions

View File

@@ -20,7 +20,7 @@
</div>
</div>
<div class="item-box-right">
<img width="54px" height="54px" src="../../../../src/icon/gaojingguanli.svg" />
<img width="54px" height="54px" src="../../../../src/icon/gaojingtonglan.svg" />
</div>
</div>
</div>
@@ -45,7 +45,7 @@
import * as echarts from 'echarts';
defineOptions({
name: 'alarmOverview', // 与页面路由name一致缓存才可生效
name: 'alarmOverviewIndex', // 与页面路由name一致缓存才可生效
});
const info = ref({});
@@ -134,13 +134,13 @@
itemGap: 30, // 这里可以调整图例项之间的间距,单位为像素
},
],
toolbox: {
show: true,
feature: {
restore: {},
saveAsImage: {},
},
},
// toolbox: {
// show: true,
// feature: {
// restore: {},
// saveAsImage: {},
// },
// },
calculable: true,
xAxis: [
{

View File

@@ -106,7 +106,7 @@
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
name: 'configureEnergyAlarmAdd',
type: 'primary',
handle: () => {
editConfigureEnergyAlarms.value.toggle(null, configureEnergyAlarmsData.value);
@@ -114,7 +114,7 @@
},
{
label: '导入',
name: 'groupImport',
name: 'configureEnergyAlarmImport',
type: 'primary',
extra: {
// api: props.postImportApi, // 导入接口名
@@ -131,7 +131,7 @@
},
{
label: '导出',
name: 'groupExports',
name: 'configureEnergyAlarmExports',
type: 'primary',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
@@ -140,7 +140,7 @@
{
label: '批量删除',
type: 'primary',
name: 'userBatchDel',
name: 'configureEnergyAlarmDels',
confirm: true,
dynamicDisabled: (data: any) => {
return data.list.length === 0;
@@ -205,7 +205,7 @@
actions: [
{
label: '编辑',
name: 'FeedBackDetail',
name: 'configureEnergyAlarmEdit',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
editConfigureEnergyAlarms.value.toggle(data, configureEnergyAlarmsData.value);
@@ -213,7 +213,7 @@
},
{
label: '删除',
name: 'FeedBackDetail',
name: 'configureEnergyAlarmDel',
dynamicParams: ['uuid', 'appealType'],
confirm: true,
handle: (data: any) => {

View File

@@ -79,7 +79,7 @@
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
name: 'configureEquipmentAlarmAdd',
type: 'primary',
handle: () => {
editConfigureDeviceAlarms.value.toggle(null, configureDeviceAlarmsData.value);
@@ -87,7 +87,7 @@
},
{
label: '导入',
name: 'groupImport',
name: 'configureEquipmentAlarmImport',
type: 'primary',
extra: {
// api: props.postImportApi, // 导入接口名
@@ -104,7 +104,7 @@
},
{
label: '导出',
name: 'groupExports',
name: 'configureEquipmentAlarmExports',
type: 'primary',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
@@ -112,7 +112,7 @@
},
{
label: '批量删除',
name: 'groupTemDownload',
name: 'configureEquipmentAlarmDels',
type: 'primary',
confirm: true,
dynamicDisabled: (data: any) => {
@@ -177,7 +177,7 @@
actions: [
{
label: '编辑',
name: 'FeedBackDetail',
name: 'configureEquipmentAlarmEdit',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
editConfigureDeviceAlarms.value.toggle(data, configureDeviceAlarmsData);
@@ -185,7 +185,7 @@
},
{
label: '删除',
name: 'FeedBackDetail',
name: 'configureEquipmentAlarmDel',
dynamicParams: ['uuid', 'appealType'],
confirm: true,
handle: (data: any) => {

View File

@@ -126,7 +126,7 @@
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
export default {
name: 'AlarmSettings',
name: 'AlarmSettingsIndex',
components: {
editeEquipmentAlarm,
configureDeviceAlarms,

View File

@@ -57,7 +57,7 @@ export const energyAlarmConfigs = (
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
name: 'energyAlarmAdd',
type: 'primary',
handle: () => {
editeEnergyAlarm.value.toggle();
@@ -65,7 +65,7 @@ export const energyAlarmConfigs = (
},
{
label: '导入',
name: 'groupImport',
name: 'energyAlarmImport',
type: 'primary',
extra: {
title: '设备信息', // 弹窗title
@@ -81,7 +81,7 @@ export const energyAlarmConfigs = (
},
{
label: '导出',
name: 'groupExports',
name: 'energyAlarmExports',
type: 'primary',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
@@ -95,7 +95,7 @@ export const energyAlarmConfigs = (
actions: [
{
label: '编辑',
name: 'FeedBackDetail',
name: 'energyAlarmEdit',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
data.monitorFrequency = data.monitorFrequency.value;
@@ -106,7 +106,7 @@ export const energyAlarmConfigs = (
},
{
label: '配置',
name: 'FeedBackDetail',
name: 'alarmSettingsIndex',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
energyAlarm.value = !energyAlarm.value;
@@ -115,7 +115,7 @@ export const energyAlarmConfigs = (
},
{
label: '删除',
name: 'FeedBackDetail',
name: 'energyAlarmDel',
dynamicParams: ['uuid', 'appealType'],
confirm: true,
handle: (data: any) => {

View File

@@ -61,7 +61,7 @@ export const equipmentAlarmTableConfig = (
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
name: 'equipmentAlarmAdd',
type: 'primary',
handle: () => {
editEquipmentAlarm.value.toggle();
@@ -69,7 +69,7 @@ export const equipmentAlarmTableConfig = (
},
{
label: '导入',
name: 'groupImport',
name: 'equipmentAlarmImport',
type: 'primary',
extra: {
// api: props.postImportApi, // 导入接口名
@@ -86,7 +86,7 @@ export const equipmentAlarmTableConfig = (
},
{
label: '导出',
name: 'groupExports',
name: 'equipmentAlarmExports',
type: 'primary',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
@@ -100,7 +100,7 @@ export const equipmentAlarmTableConfig = (
actions: [
{
label: '编辑',
name: 'FeedBackDetail',
name: 'equipmentAlarmEdit',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
data.priority = data.priority.value;
@@ -111,7 +111,7 @@ export const equipmentAlarmTableConfig = (
},
{
label: '配置',
name: 'FeedBackDetail',
name: 'alarmSettingsIndex',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
equipmentAlarm.value = !equipmentAlarm.value;
@@ -120,7 +120,7 @@ export const equipmentAlarmTableConfig = (
},
{
label: '删除',
name: 'FeedBackDetail',
name: 'equipmentAlarmDel',
dynamicParams: ['uuid', 'appealType'],
confirm: true,
handle: (data: any) => {

View File

@@ -12,6 +12,7 @@
import { ref } from 'vue';
export default {
name: 'EquipmentAlarmIndex',
components: { Look, Status },
setup() {

View File

@@ -8,7 +8,7 @@
:cancel="handleClose"
placement="right"
@close="handleClose">
<div style="width: 100%; height: 100%; overflow-y: auto">
<div style="width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden">
<!-- top -->
<div
style="
@@ -28,247 +28,202 @@
</div>
</div>
<!-- center -->
<div style="width: 100%; height: 300px; border: 1px solid red" ref="graphChart"></div>
<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="优先级">紧急</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: #ff7602">用电量超标</div> 当日用电量超出预设值</a-descriptions-item
>
<a-descriptions-item label="设备信息"> 1栋10层低压柜 </a-descriptions-item>
<a-descriptions-item label="重复次数"> 0 </a-descriptions-item>
</a-descriptions>
</div>
</div>
<template #footer>
<a-button type="primary" @click="handleClose">确定</a-button>
</template>
</ns-drawer>
</template>
<script>
import { defineComponent } from 'vue';
<script lang="ts" setup>
defineOptions({
name: 'look', // 与页面路由name一致缓存才可生效
});
import { ref } from 'vue';
import * as echarts from 'echarts';
export default defineComponent({
setup() {
let chartInstance = null;
const graphChart = ref(null);
const visible = ref(false);
const handleClose = () => {
visible.value = false;
};
const btnClick = () => {
console.log('btnClick');
};
const toggle = (data) => {
console.log(data, 'data');
visible.value = true;
getChatr();
};
const getChatr = () => {
let dayData = [];
let energyAlarm = [];
let wgAlarm = [];
let equipmentAlarm = [];
let total = [];
// Extend data for 30 days
for (let i = 1; i < 30; i++) {
dayData.push(`3/${i}`);
energyAlarm.push(Math.floor(Math.random() * 11)); // Assuming the same value for simplicity
wgAlarm.push(Math.floor(Math.random() * 11)); // Assuming the same value for simplicity
equipmentAlarm.push(Math.floor(Math.random() * 11)); // Assuming the same value for simplicity
total.push(0); // Assuming the same value for simplicity
}
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%',
let chartInstance: echarts.ECharts | null = null;
const graphChart = ref(null);
const visible = ref(false);
const handleClose = () => {
visible.value = false;
};
const btnClick = () => {
console.log('btnClick');
handleClose();
};
const toggle = (data: any) => {
console.log(data, '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,
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
let res =
params[0].axisValue +
'<br/>' +
params[0].marker +
' ' +
params[0].seriesName +
' : ' +
params[0].data +
'<br/>' +
params[1].marker +
' ' +
params[1].seriesName +
' : ' +
params[1].data +
'<br/>' +
params[2].marker +
' ' +
params[2].seriesName +
' : ' +
params[2].data +
'<br/>';
return res;
},
},
grid: {
left: '2%', // 设置图表距离左边的距离
right: '2%', // 设置图表距离右边的距离
borderWidth: 0,
y2: 60, // 距离底边
},
legend: [
{
top: 5,
left: 'center', // 将图例居中显示
textStyle: {
color: 'rgb(89, 89, 89)',
fontSize: '14',
fontWeight: 'normal',
}, // 注意这里的颜色值要用引号括起来
data: ['设备告警', '网关告警', '能源告警'],
itemGap: 30, // 这里可以调整图例项之间的间距,单位为像素
},
],
toolbox: {
axisTick: {
show: true,
feature: {
restore: {},
saveAsImage: {},
},
splitArea: {
show: false,
},
axisLabel: {
show: true, // 显示 X 轴刻度标签
color: 'rgb(89, 89, 89)', // X 轴刻度标签的字体颜色
fontSize: 12, // X 轴刻度标签的字体大小
formatter: function (value) {
// 可选:格式化 X 轴刻度标签文本
return value;
},
},
calculable: true,
xAxis: [
{
type: 'category',
splitLine: {
show: false,
},
axisTick: {
show: false,
},
splitArea: {
show: false,
},
data: dayData,
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'; // 在刻度值后加上单位
},
],
yAxis: [
{
type: 'value',
shwo: false,
splitLine: {
show: true,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitArea: {
show: false,
},
axisLabel: {
show: false, // 不显示刻度值
},
},
},
],
dataZoom: [
{
height: 12,
start: 0,
end: 100,
handleSize: '300%', // 设置滑块的大小
bottom: 15,
},
],
series: [
{
name: '电压值',
type: 'line',
itemStyle: {
normal: {
barBorderRadius: 0,
color: '#6395F9',
},
],
dataZoom: [
{
height: 12,
start: 0,
end: 100,
handleSize: '300%', // 设置滑块的大小
bottom: 15,
},
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';
},
],
series: [
{
name: '能源告警',
type: 'bar',
stack: '能源告警',
barMaxWidth: 40,
barGap: '10%',
itemStyle: {
normal: {
barBorderRadius: 0,
color: 'rgb(246, 189, 22)',
},
},
data: energyAlarm,
},
{
name: '网关告警',
type: 'bar',
stack: '能源告警',
barMaxWidth: 40,
barGap: '10%',
itemStyle: {
normal: {
barBorderRadius: 0,
color: 'rgb(91, 143, 249)',
},
},
data: wgAlarm,
},
{
name: '设备告警',
type: 'bar',
stack: '能源告警',
barMaxWidth: 40,
barGap: '10%',
itemStyle: {
normal: {
barBorderRadius: 0,
color: 'rgb(48, 191, 120)',
},
},
data: equipmentAlarm,
},
{
name: '总数',
type: 'bar',
stack: '能源告警',
barMaxWidth: 40,
barHight: 0,
itemStyle: {
normal: {
barBorderRadius: 0,
color: 'rgba(0,0,0,0)',
},
},
label: {
show: true,
color: '#000000',
position: 'top',
top: '10',
formatter: function (value) {
return (
Number(energyAlarm[value.dataIndex]) +
Number(wgAlarm[value.dataIndex]) +
Number(equipmentAlarm[value.dataIndex])
);
},
},
data: total,
},
],
};
chartInstance = echarts.init(graphChart.value);
chartInstance.setOption(option);
};
return {
btnClick,
visible,
chartInstance,
handleClose,
toggle,
graphChart,
getChatr,
};
},
},
data: energyAlarm,
},
],
};
chartInstance = echarts.init(graphChart.value);
chartInstance.setOption(option);
};
defineExpose({
toggle,
});
</script>
<style scoped lang="less">
@@ -280,4 +235,7 @@
height: 35px;
background-color: rgb(254, 118, 2);
}
:deep(.ant-descriptions-item-label) {
width: 25%;
}
</style>

View File

@@ -8,16 +8,81 @@
:cancel="handleClose"
placement="right"
@close="handleClose">
状态
<a-tabs>
<a-tab-pane key="1" tab="更新状态">Content of Tab Pane 1</a-tab-pane>
<a-tab-pane key="2" tab="状态流程">
<!-- <a-steps direction="vertical" :current="4">
<template v-for="index in 4">
<a-step>
<template #icon>
<img src="../../../../src/icon/status-off.svg" />
</template>
<template #description>
<div
style="
width: 400px;
min-height: 40px;
background-color: #f8fafc;
margin-left: 20px;
border-radius: 4px; /* 设置圆角半径 */
padding: 12px;
">
<div style="width: 100%; height: 40px; display: flex; position: relative">
<a-tag style="width: 60px; height: 20px; text-align: center" color="#04d919"
>已完成</a-tag
>
<div
style="
position: absolute;
left: 30%;
top: -2px;
transform: translateX(-50%);
color: #3a3a3a;
"
>李四</div
>
<div style="position: absolute; right: 10px; top: -2px; color: #ff7602"
>2024-03-11 11:30:06</div
>
</div>
<div style="width: 100%; color: #3a3a3a"> 工单已完成并通过验收 </div>
</div>
</template>
</a-step>
</template>
</a-steps> -->
<NsSteps 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 } from 'vue';
import { ref, createVNode } from 'vue';
import NsSteps from '/@/components/ns-steps.vue';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
export default defineComponent({
components: { NsSteps },
setup() {
const visible = ref(false);
const logList = ref([
{ name: '李四', status: '2' },
{ name: '王五', status: '4' },
{ name: '王五', status: '3' },
{ name: '王五', status: '1' },
{ name: '赵六', status: '0' },
]);
const config = ref({
size: logList.value.length,
dataSource: logList.value,
});
const handleClose = () => {
visible.value = false;
};
@@ -28,12 +93,42 @@
console.log(data, 'data');
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 {
btnClick,
createOrder,
visible,
logList,
config,
handleClose,
toggle,
};
},
});
</script>
<style scoped lang="less"></style>

View File

@@ -130,18 +130,10 @@ export const notificationtableConfig = (look: any, status: any) => {
],
},
},
{
field: 'provider',
label: '告警标题',
component: 'NsInput',
componentProps: {
placeholder: '请输入告警标题关键字',
},
},
{
field: 'provider',
label: '错误码',
component: 'NsInputApi',
component: 'NsInput',
componentProps: {
placeholder: '请输入告警错误码',
},