|
@@ -3,27 +3,13 @@
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="16">
|
|
<el-col :span="16">
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="0">
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="0">
|
|
-<!-- <el-form-item label="" prop="objId" style="margin-right:10px">-->
|
|
|
|
-<!-- <el-select v-model="queryParams.objId" placeholder="请选择业务类型" style="width: 260px" clearable filterable remote reserve-keyword :remote-method="remoteMethod">-->
|
|
|
|
-<!-- <el-option-->
|
|
|
|
-<!-- v-for="dict in objList"-->
|
|
|
|
-<!-- :key="dict.objId"-->
|
|
|
|
-<!-- :label="dict.objName"-->
|
|
|
|
-<!-- :value="dict.objId"-->
|
|
|
|
-<!-- ></el-option>-->
|
|
|
|
-<!-- </el-select>-->
|
|
|
|
-<!-- </el-form-item>-->
|
|
|
|
-<!-- <el-form-item label="" prop="alarmLevel" style="margin-right:10px">-->
|
|
|
|
-<!-- <el-select v-model="queryParams.alarmLevel" placeholder="告警级别" clearable style="width:100px;">-->
|
|
|
|
-<!-- <el-option-->
|
|
|
|
-<!-- v-for="dict in alarm_level"-->
|
|
|
|
-<!-- :key="dict.value"-->
|
|
|
|
-<!-- :label="dict.label"-->
|
|
|
|
-<!-- :value="dict.value"-->
|
|
|
|
-<!-- />-->
|
|
|
|
-<!-- </el-select>-->
|
|
|
|
-<!-- </el-form-item>-->
|
|
|
|
- <el-form-item label="" style="width: 308px;margin-right:10px">
|
|
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" plain @click="timeSelect(0)">今天</el-button>
|
|
|
|
+ <el-button type="primary" plain @click="timeSelect(3)">3天</el-button>
|
|
|
|
+ <el-button type="primary" plain @click="timeSelect(7)">7天</el-button>
|
|
|
|
+ <el-button type="primary" plain @click="timeSelect(30)">1月</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="daterangeAlarmTime"
|
|
v-model="daterangeAlarmTime"
|
|
value-format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
@@ -33,6 +19,27 @@
|
|
end-placeholder="结束日期"
|
|
end-placeholder="结束日期"
|
|
></el-date-picker>
|
|
></el-date-picker>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="" prop="objId" style="margin-right:10px">
|
|
|
|
+ <el-select v-model="queryParams.objId" placeholder="请选择告警对象" style="width: 260px" clearable
|
|
|
|
+ filterable remote reserve-keyword :remote-method="remoteMethod">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in objList"
|
|
|
|
+ :key="dict.objId"
|
|
|
|
+ :label="dict.objName"
|
|
|
|
+ :value="dict.objId"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="alarmLevel" style="margin-right:10px">
|
|
|
|
+ <el-select v-model="queryParams.alarmType" placeholder="风险状态" clearable style="width:100px;">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in alarm_type"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item style="margin-right:10px">
|
|
<el-form-item style="margin-right:10px">
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
@@ -52,17 +59,26 @@
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
- <el-table v-loading="loading" :data="recordList" border>
|
|
|
|
- <el-table-column label="告警ID" align="left" prop="alarmId" width="80"/>
|
|
|
|
- <el-table-column label="告警对象" align="left" prop="bizobj.objName"/>
|
|
|
|
- <el-table-column label="告警指标" align="center" prop="bizObjMetrics.metricsName"/>
|
|
|
|
- <el-table-column label="告警级别" align="center" prop="alarmLevel">
|
|
|
|
|
|
+ <el-table ref="recordRef" v-loading="loading" :data="recordList" border :default-sort="defaultSort"
|
|
|
|
+ @sort-change="handleSortChange">
|
|
|
|
+ <!-- <el-table-column label="告警ID" align="left" prop="alarmId" width="80"/>-->
|
|
|
|
+ <el-table-column label="风险对象" align="left" prop="objName" sortable="custom"
|
|
|
|
+ :sort-orders="['descending', 'ascending']"/>
|
|
|
|
+ <el-table-column label="风险指标" align="center" prop="metricsName"/>
|
|
|
|
+ <el-table-column label="风险级别" align="center" prop="alarmLevel" sortable="custom"
|
|
|
|
+ :sort-orders="['descending', 'ascending']">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<dict-tag :options="alarm_level" :value="scope.row.alarmLevel"/>
|
|
<dict-tag :options="alarm_level" :value="scope.row.alarmLevel"/>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="告警值" align="center" prop="alarmValue" :formatter="rounding"/>
|
|
|
|
- <el-table-column label="告警时间" align="center" prop="alarmTime" width="220">
|
|
|
|
|
|
+ <el-table-column label="风险状态" align="center" prop="alarmType">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <dict-tag :options="alarm_type" :value="scope.row.alarmType"/>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="风险值" align="center" prop="alarmValue" :formatter="rounding"/>
|
|
|
|
+ <el-table-column label="事件时间" align="center" prop="alarmTime" width="220" sortable="custom"
|
|
|
|
+ :sort-orders="['descending', 'ascending']">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
|
|
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
|
|
</template>
|
|
</template>
|
|
@@ -79,11 +95,14 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup name="Record">
|
|
<script setup name="Record">
|
|
-import {listRecord,getLevelSort} from "@/api/alarm/record";
|
|
|
|
|
|
+import {getLevelSort, listRecord} from "@/api/alarm/record";
|
|
import {listObj} from "@/api/obj/obj.js"
|
|
import {listObj} from "@/api/obj/obj.js"
|
|
import * as echarts from 'echarts'
|
|
import * as echarts from 'echarts'
|
|
|
|
+import moment from 'moment'
|
|
|
|
+
|
|
const {proxy} = getCurrentInstance();
|
|
const {proxy} = getCurrentInstance();
|
|
const {alarm_level} = proxy.useDict('alarm_level');
|
|
const {alarm_level} = proxy.useDict('alarm_level');
|
|
|
|
+const {alarm_type} = proxy.useDict('alarm_type');
|
|
|
|
|
|
const recordList = ref([]);
|
|
const recordList = ref([]);
|
|
const loading = ref(true);
|
|
const loading = ref(true);
|
|
@@ -94,6 +113,7 @@ const daterangeAlarmTime = ref([]);
|
|
const objList = ref([]);
|
|
const objList = ref([]);
|
|
const alarmLeft = ref();
|
|
const alarmLeft = ref();
|
|
const alarmRight = ref([]);
|
|
const alarmRight = ref([]);
|
|
|
|
+const defaultSort = ref({prop: "alarmTime", order: "descending"});
|
|
|
|
|
|
const data = reactive({
|
|
const data = reactive({
|
|
form: {},
|
|
form: {},
|
|
@@ -110,19 +130,19 @@ const data = reactive({
|
|
|
|
|
|
const {queryParams, form, rules} = toRefs(data);
|
|
const {queryParams, form, rules} = toRefs(data);
|
|
|
|
|
|
-function remoteMethod(keyword){
|
|
|
|
- listObj({ pageNum: 1,pageSize: 5,objName: keyword}).then(res=>{
|
|
|
|
|
|
+function remoteMethod(keyword) {
|
|
|
|
+ listObj({pageNum: 1, pageSize: 5, objName: keyword}).then(res => {
|
|
objList.value = res.rows
|
|
objList.value = res.rows
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-function left(){
|
|
|
|
|
|
+function left() {
|
|
let myChart = echarts.init(alarmLeft.value);
|
|
let myChart = echarts.init(alarmLeft.value);
|
|
- getLevelSort(queryParams.value).then(res=>{
|
|
|
|
|
|
+ getLevelSort(queryParams.value).then(res => {
|
|
console.log(res);
|
|
console.log(res);
|
|
const d_data = [];
|
|
const d_data = [];
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
- let d={value:res.data[i].num,name:res.data[i].name}
|
|
|
|
|
|
+ let d = {value: res.data[i].num, name: res.data[i].name}
|
|
d_data.push(d);
|
|
d_data.push(d);
|
|
}
|
|
}
|
|
let legend_style = {
|
|
let legend_style = {
|
|
@@ -147,7 +167,7 @@ function left(){
|
|
},
|
|
},
|
|
title: {
|
|
title: {
|
|
show: true,
|
|
show: true,
|
|
- text: '告警级别统计',
|
|
|
|
|
|
+ text: '风险级别统计',
|
|
textStyle: {
|
|
textStyle: {
|
|
fontFamily: 'PingFangSC-Regular, PingFang SC',
|
|
fontFamily: 'PingFangSC-Regular, PingFang SC',
|
|
align: 'center',
|
|
align: 'center',
|
|
@@ -194,15 +214,15 @@ function left(){
|
|
}
|
|
}
|
|
}
|
|
}
|
|
let percent = (x_data.value * 100 / total).toFixed(2);
|
|
let percent = (x_data.value * 100 / total).toFixed(2);
|
|
- return '{a|' + name + '} {b|' + percent + '%} {c|'+x_data.value+'}次';
|
|
|
|
|
|
+ return '{a|' + name + '} {b|' + percent + '%} {c|' + x_data.value + '}次';
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-function right(){
|
|
|
|
|
|
+function right() {
|
|
let myChart = echarts.init(alarmRight.value);
|
|
let myChart = echarts.init(alarmRight.value);
|
|
- var res=[
|
|
|
|
|
|
+ var res = [
|
|
{
|
|
{
|
|
"scores": [
|
|
"scores": [
|
|
58.0,
|
|
58.0,
|
|
@@ -234,7 +254,7 @@ function right(){
|
|
symbol: 'circle',
|
|
symbol: 'circle',
|
|
smooth: true,
|
|
smooth: true,
|
|
showSymbol: false,
|
|
showSymbol: false,
|
|
- stack:'total'
|
|
|
|
|
|
+ stack: 'total'
|
|
}
|
|
}
|
|
ss.push(xx);
|
|
ss.push(xx);
|
|
}
|
|
}
|
|
@@ -342,12 +362,17 @@ function right(){
|
|
|
|
|
|
/** 查询告警记录列表 */
|
|
/** 查询告警记录列表 */
|
|
function getList() {
|
|
function getList() {
|
|
|
|
+ console.error(alarm_type);
|
|
loading.value = true;
|
|
loading.value = true;
|
|
queryParams.value.params = {};
|
|
queryParams.value.params = {};
|
|
if (null != daterangeAlarmTime && '' != daterangeAlarmTime) {
|
|
if (null != daterangeAlarmTime && '' != daterangeAlarmTime) {
|
|
queryParams.value.params["beginAlarmTime"] = daterangeAlarmTime.value[0];
|
|
queryParams.value.params["beginAlarmTime"] = daterangeAlarmTime.value[0];
|
|
queryParams.value.params["endAlarmTime"] = daterangeAlarmTime.value[1];
|
|
queryParams.value.params["endAlarmTime"] = daterangeAlarmTime.value[1];
|
|
}
|
|
}
|
|
|
|
+ if (queryParams.value.orderByColumn == null || queryParams.value.orderByColumn == '') {
|
|
|
|
+ queryParams.value.orderByColumn = defaultSort.value.prop;
|
|
|
|
+ queryParams.value.isAsc = defaultSort.value.order;
|
|
|
|
+ }
|
|
listRecord(queryParams.value).then(response => {
|
|
listRecord(queryParams.value).then(response => {
|
|
recordList.value = response.rows;
|
|
recordList.value = response.rows;
|
|
total.value = response.total;
|
|
total.value = response.total;
|
|
@@ -357,6 +382,13 @@ function getList() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function timeSelect(v) {
|
|
|
|
+ let end = new Date();
|
|
|
|
+ let start = new Date().setDate(end.getDate() - v);
|
|
|
|
+ daterangeAlarmTime.value[0] = moment(start).format('YYYY-MM-DD');
|
|
|
|
+ daterangeAlarmTime.value[1] = moment(end).format('YYYY-MM-DD');
|
|
|
|
+}
|
|
|
|
+
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
function handleQuery() {
|
|
function handleQuery() {
|
|
queryParams.value.pageNum = 1;
|
|
queryParams.value.pageNum = 1;
|
|
@@ -367,6 +399,7 @@ function handleQuery() {
|
|
function resetQuery() {
|
|
function resetQuery() {
|
|
daterangeAlarmTime.value = [];
|
|
daterangeAlarmTime.value = [];
|
|
proxy.resetForm("queryRef");
|
|
proxy.resetForm("queryRef");
|
|
|
|
+ proxy.$refs["recordRef"].sort(defaultSort.value.prop, defaultSort.value.order);
|
|
handleQuery();
|
|
handleQuery();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -375,5 +408,12 @@ function rounding(row, column) {
|
|
return parseFloat(row[column.property]).toFixed(2)
|
|
return parseFloat(row[column.property]).toFixed(2)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/** 排序触发事件 */
|
|
|
|
+function handleSortChange(column, prop, order) {
|
|
|
|
+ queryParams.value.orderByColumn = column.prop;
|
|
|
|
+ queryParams.value.isAsc = column.order;
|
|
|
|
+ getList();
|
|
|
|
+}
|
|
|
|
+
|
|
getList();
|
|
getList();
|
|
</script>
|
|
</script>
|