告警日志和消息推送开发并联调

1、优化列表操作列宽度
2、联调告警日志模块(100%)
3、前端开发并联调消息推送模块(100%)
4、服务器管理和交换机管理的图形监控下的数据进行默认展开排序
This commit is contained in:
康冉冉
2025-11-12 18:39:01 +08:00
parent a5186543d3
commit 1dff3d2a9f
26 changed files with 980 additions and 209 deletions
@@ -0,0 +1,91 @@
<template>
<div class="app-container">
<Form :formList="formList" :ruleFormData="ruleForm" :config="paramsData && paramsData.readonly ? config : {}" @fnClick="callback"></Form>
</div>
</template>
<script setup name="Handle">
import Form from '@/components/form/index.vue';
import {addAlarmPush, getAlarmPush, updateAlarmPush} from "@/api/disRevenue/resource"
export default {
name: 'messagePushDetails',
components: {Form},
dicts: ['alarm_type', 'push_method'],
data() {
return {
ruleForm: {},
formList: [],
config: {
buttonGroup: [{title: '返回', fnCode: 'goBack'}]
},
paramsData: {}
}
},
created() {
this.paramsData = this.$route && this.$route.query;
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
}
this.fnFormList();
},
methods: {
// formList集合
fnFormList(objVal) {
let spanNum = this.paramsData && this.paramsData.readonly ? 12 : 16;
this.formList = [{
config: {title: '基本信息', readonly: this.paramsData && this.paramsData.readonly},
controls: {
id: {label: 'ID',hidden: true},
configName: {label: '配置名称', span: spanNum, type: 'input', required: true},
pushMethod: {label: '推送方式', span: spanNum, type: 'select', options: this.dict.type.push_method, required: true},
pushAddress: {label: '推送地址', span: spanNum, type: 'input', required: true},
pushAlarmTypes: {label: '推送告警类型', span: spanNum, type: 'select', options: this.dict.type.alarm_type, required: true},
contactPhones: {label: '提示人手机号', span: spanNum, type: 'input'},
createBy: {label: '创建人', span: spanNum, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
createTime: {label: '创建时间', span: spanNum, type: 'datetime', hidden: !(this.paramsData && this.paramsData.readonly)},
updateTime: {label: '修改时间', span: spanNum, type: 'datetime', hidden: !(this.paramsData && this.paramsData.readonly)},
messageContent: {label: '消息内容', span: spanNum, type: 'textarea', required: true, warningTitle: '可引用的告警字段包括[告警时间]、[管理网-公网IP]、[告警类型]、[告警设备]、[告警内容]'}
}
}];
},
// 获取详情
getFormDataList(id) {
getAlarmPush(id).then(val => {
if (val && val.data) {
this.ruleForm = val.data;
}
}).catch(() => {
this.$modal.msgError("操作失败")
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'submit':
let fnType = addAlarmPush;
if (dataVal && dataVal.id) {
fnType = updateAlarmPush;
}
if(this.loading) return;
this.loading = true;
fnType(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
this.$router.push("/resource/messagePush");
this.loading = false;
}).catch(() => {
this.$modal.msgError("操作失败")
});
break;
case 'cancel':
this.$router.push("/resource/messagePush");
break;
default:
}
}
}
}
}
</script>
<style>
</style>
@@ -0,0 +1,171 @@
<template>
<div class="app-container pageTopForm">
<el-form :model="queryParams" ref="queryRef" size="small" v-show="showSearch" label-width="auto">
<el-col :span="6">
<el-form-item label="配置名称" prop="configName">
<el-input
v-model="queryParams.configName"
placeholder="请输入配置名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="lastBtnSty">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :modelIdent="this.$options.name" :queryParams="queryParams" :tableList="tableList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempAlarmType="{ row, column }">
<dict-tag :options="dict.type.alarm_type" :value="row.pushAlarmTypes"/>
</template>
<template #tempPushMethod="{ row, column }">
<dict-tag :options="dict.type.push_method" :value="row.pushMethod"/>
</template>
</TableList>
</div>
</template>
<script setup>
import TableList from "@/components/table/index.vue"
import {listAlarmPush, delAlarmPush} from "@/api/disRevenue/resource"
export default {
name: 'MessagePush',
components: {TableList},
dicts: ['alarm_type', 'push_method'],
data() {
return {
loading: true,
showSearch: true,
tableList: [],
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
},
// 列显隐信息
columns: {
id: { label: `ID`,width: '50'},
configName: { label: `配置名称`, minWidth: '120', visible: true },
pushMethod: { label: `推送方式`, minWidth: '80', slotName: 'tempPushMethod', visible: true},
pushAddress: { label: `推送地址`,minWidth: '150',visible: true},
pushAlarmTypes: { label: `推送告警类型`,minWidth: '120', slotName: 'tempAlarmType', visible: true},
messageContent: { label: `消息内容`,minWidth: '200', visible: true },
contactPhones: { label: `消息提示人手机号`,minWidth: '150'},
createBy: { label: `创建人`,minWidth: '80'},
createTime: { label: `创建时间`,minWidth: '160'},
updateTime: { label: `修改时间`,minWidth: '160'},
},
config: {
tableButton: {
top: [
{content: '添加配置', fnCode: 'add', type: 'primary', icon: 'el-icon-plus', hasPermi: 'resource:messagePush:add'},
{content: '删除', fnCode: 'delete', type: 'danger', icon: 'el-icon-delete', hasPermi: 'resource:messagePush:detele'},
{content: '导出', fnCode: 'export', type: 'warning', icon: 'el-icon-download', hasPermi: 'resource:messagePush:export'},
],
line: [
{content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'resource:messagePush:edit'},
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'resource:messagePush:details'},
]
}
}
}
},
created() {
this.getList();
},
activated() {
this.$nextTick(() => {
this.getList();
});
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
listAlarmPush(this.queryParams).then(response => {
this.tableList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
})
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
this.showSearch = newValue;
// console.log('父组件拿到新值:', newValue);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryRef");
this.handleQuery();
},
callback(result, rowData, selectChange, selectList) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'add':
this.$router.push({
path:'/resource/messagePush/details'});
break;
case 'edit':
this.$router.push({
path:'/resource/messagePush/details',
query:{
id: rowData.id
}
});
break;
case 'details':
this.$router.push({
path: '/resource/messagePush/details',
query: {
id: rowData.id,
readonly: true
}
});
break;
case 'delete':
if (selectList && selectList.length <= 0) {
this.$modal.msgWarning("请选择数据!");
return;
}
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delAlarmPush(selectChange)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功")
}).catch(() => {});
break;
case 'export':
// let dataList = [];
// Object.keys(this.columns).forEach(item => {
// if (item.visible) {
// dataList.push(item.prop);
// }
// });
// this.download("/system/alarmManage/export", {properties: dataList,}, `拓扑管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/alarmManage/export", paramsList, `消息推送_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}
}
}
}
}
</script>
<style scoped>
::v-deep .lastBtnSty .el-form-item__content{
margin-left: 10px!important;
}
</style>