【web】 预警信息增加编辑功能

dev
Wangxin 8 months ago
parent 1403426e9f
commit f23fd9975b
  1. 9
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue
  2. 30
      ALOps_sys_fe/alops-ui/src/views/index.vue

@ -75,6 +75,7 @@
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" v-if="scope.row.status == 'UNHANDLED'" type="text" @click="handleUpdate(scope.row)" v-hasPermi="['inMonitoring:message:edit']">去处理</el-button> <el-button size="mini" v-if="scope.row.status == 'UNHANDLED'" type="text" @click="handleUpdate(scope.row)" v-hasPermi="['inMonitoring:message:edit']">去处理</el-button>
<el-button size="mini" type="text" @click="handleUpdate(scope.row)" v-if="scope.row.status == 'HANDLED'" v-hasPermi="['inMonitoring:message:edit']">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['inMonitoring:message:remove']">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['inMonitoring:message:remove']">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -300,6 +301,14 @@ export default {
this.open = true this.open = true
this.title = "处理" this.title = "处理"
}, },
/** 编辑按钮操作 */
handleEdit(row) {
this.reset()
this.form = {...row}
this.open = true
this.title = "编辑"
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {

@ -109,6 +109,9 @@
class="warning-item" > class="warning-item" >
<div class="warning-header"> <div class="warning-header">
<span :class="['warning-type', `level-${warning.displayLevel}`]">{{ warning.name }}</span> <span :class="['warning-type', `level-${warning.displayLevel}`]">{{ warning.name }}</span>
<span :class="['warning-status-indicator', warning.status]">
{{ getStatusText2(warning.status) }}
</span>
</div> </div>
<div class="warning-time">预警时间: {{ warning.time }}</div> <div class="warning-time">预警时间: {{ warning.time }}</div>
<div class="warning-position">设备位置: {{ warning.location }}</div> <div class="warning-position">设备位置: {{ warning.location }}</div>
@ -398,6 +401,12 @@ export default {
} }
}, },
methods: { methods: {
getStatusText2(status) {
console.log("%c 🤨: data -> status ", "font-size:16px;background-color:#df83a6;color:white;", status)
if (status === 'HANDLED') return '已处理';
if (status === 'UNHANDLED') return '未处理';
return status;
},
// //
goToDeviceFiles() { goToDeviceFiles() {
this.$router.push('/device/files'); this.$router.push('/device/files');
@ -493,6 +502,7 @@ export default {
time: row.occurTime ? this.formatOccurTime(row.occurTime) : '', time: row.occurTime ? this.formatOccurTime(row.occurTime) : '',
location: row.location || '未知位置', location: row.location || '未知位置',
ruleName: row.ruleName || '-', ruleName: row.ruleName || '-',
status: row.status || '-',
message: row.message || '-' message: row.message || '-'
})); }));
} }
@ -1429,6 +1439,26 @@ export default {
.warning-header { .warning-header {
margin-bottom: 8px; margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: space-between;
}
.warning-status-indicator {
font-size: 0.8rem;
padding: 2px 6px;
border-radius: 4px;
font-weight: bold;
}
.warning-status-indicator.HANDLED {
background-color: #4CAF50;
color: white;
}
.warning-status-indicator.UNHANDLED {
background-color: #F44336;
color: white;
} }
.warning-type { .warning-type {

Loading…
Cancel
Save