NEZ-1618 feat: alert message 列表页面修改

This commit is contained in:
zhangyu
2022-03-02 16:05:27 +08:00
parent 94cf807332
commit 677e14a7a9
9 changed files with 68 additions and 19 deletions

View File

@@ -73,6 +73,9 @@
.green-bg { .green-bg {
background-color:$--color-success !important; background-color:$--color-success !important;
} }
.yellow-bg {
background-color:$--color-silence !important;
}
.gray-bg { .gray-bg {
background-color: $--color-suspended !important; background-color: $--color-suspended !important;
} }

View File

@@ -101,3 +101,8 @@
.nz-message .el-textarea textarea{ .nz-message .el-textarea textarea{
height: 108px !important; height: 108px !important;
} }
.alert-message-state{
padding: 3px 5px;
border-radius: 4px;
color: $--color-text-primary;
}

View File

@@ -69,6 +69,8 @@ $--color-info: #999998;
$--color-suspended: #9e9c98; $--color-suspended: #9e9c98;
// 监控色 // 监控色
$--color-monitor: #98AEC5; $--color-monitor: #98AEC5;
// silence
$--color-silence: #FFC107;
/* 6.table */ /* 6.table */
// 表头字色 // 表头字色

View File

@@ -69,6 +69,8 @@ $--color-info: #999998;
$--color-suspended: #9e9c98; $--color-suspended: #9e9c98;
// 监控色 // 监控色
$--color-monitor: #98AEC5; $--color-monitor: #98AEC5;
// sliences
$--color-silence: #FFC107;
/* 6.table */ /* 6.table */
// 表头字色 // 表头字色

View File

@@ -19,7 +19,7 @@
<el-select v-model="state" class="margin-r-10" size="small" value-key="value" @change="getTableData" popper-class="right-box-select-top right-public-box-dropdown-top" style="width: 100px"> <el-select v-model="state" class="margin-r-10" size="small" value-key="value" @change="getTableData" popper-class="right-box-select-top right-public-box-dropdown-top" style="width: 100px">
<el-option v-for="item in stateOptions" :key="item.value" :label="$t(item.label)" :value="item.value"></el-option> <el-option v-for="item in stateOptions" :key="item.value" :label="$t(item.label)" :value="item.value"></el-option>
</el-select> </el-select>
<pick-time v-model="searchTimeHeader" :default-pick="12" :refresh-data-func="getTableData" :show-empty="true" :use-chart-unit="false" :use-refresh="false"></pick-time> <pick-time v-model="searchTimeHeader" :default-pick="8" :refresh-data-func="getTableData" :show-empty="true" :use-chart-unit="false" :use-refresh="false"></pick-time>
</template> </template>
<template v-slot> <template v-slot>
<alertMessageTable <alertMessageTable
@@ -230,7 +230,7 @@ export default {
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'], sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'],
legend: [], legend: [],
searchTime: [], searchTime: [],
searchTimeHeader: [], searchTimeHeader: [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))],
searchTimeSelect: bus.getTimezontDateRange(), searchTimeSelect: bus.getTimezontDateRange(),
currentMsg: {}, currentMsg: {},
chartUnit: 5, chartUnit: 5,
@@ -296,7 +296,11 @@ export default {
} }
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
if (this.state) {
this.$set(this.searchLabel, 'state', this.state) this.$set(this.searchLabel, 'state', this.state)
} else {
delete this.searchLabel.state
}
if (this.searchTimeHeader && this.searchTimeHeader.length > 1) { if (this.searchTimeHeader && this.searchTimeHeader.length > 1) {
this.$set(this.searchLabel, 'startAt', this.timezoneToUtcTimeStr(this.searchTimeHeader[0])) this.$set(this.searchLabel, 'startAt', this.timezoneToUtcTimeStr(this.searchTimeHeader[0]))
this.$set(this.searchLabel, 'endAt', this.timezoneToUtcTimeStr(this.searchTimeHeader[1])) this.$set(this.searchLabel, 'endAt', this.timezoneToUtcTimeStr(this.searchTimeHeader[1]))
@@ -305,10 +309,10 @@ export default {
delete this.searchLabel.endAt delete this.searchLabel.endAt
} }
this.tools.loading = true this.tools.loading = true
if (state) { // if (state) {
delete this.searchLabel.startAt // delete this.searchLabel.startAt
delete this.searchLabel.endAt // delete this.searchLabel.endAt
} // }
if (this.from === fromRoute.module) { if (this.from === fromRoute.module) {
this.searchLabel.moduleIds = this.obj.id this.searchLabel.moduleIds = this.obj.id
} else if (this.from === fromRoute.endpoint) { } else if (this.from === fromRoute.endpoint) {
@@ -401,6 +405,15 @@ export default {
this.currentMsg = { ...row, alertRule: { ...res.data } } this.currentMsg = { ...row, alertRule: { ...res.data } }
this.$nextTick(() => { this.$nextTick(() => {
this.searchTime = [bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())] this.searchTime = [bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())]
this.$store.dispatch('dispatchPanelTime', {
time: this.searchTime ,
nowTimeType: {
id: 4,
text: this.$t('dashboard.panel.lastOneHour'),
type: 'hour',
value: 1
}
})
this.queryDate() this.queryDate()
}) })
}) })

View File

@@ -202,6 +202,7 @@ export const alertMessage = {
{ value: 'P3', label: i18n.t('alert.config.P3') } { value: 'P3', label: i18n.t('alert.config.P3') }
], ],
states: [ states: [
{ value: '', label: i18n.t('overall.all') },
{ value: '1', label: i18n.t('overall.active') }, { value: '1', label: i18n.t('overall.active') },
{ value: '2', label: i18n.t('overall.silence') }, { value: '2', label: i18n.t('overall.silence') },
{ value: '3', label: i18n.t('alert.list.expired') } { value: '3', label: i18n.t('alert.list.expired') }

View File

@@ -83,9 +83,10 @@
</span> </span>
</span> </span>
</template> </template>
<span v-else-if="item.prop === 'state'" :class="{'green': scope.row['state'] == 2, 'red': scope.row['state'] == 1}"> <span v-else-if="item.prop === 'state'">
{{scope.row['state'] == 1 ? "Pending" : ""}} <span class="alert-message-state" :class="{'green-bg': scope.row['state'] == 3, 'red-bg': scope.row['state'] == 1,'yellow-bg': scope.row['state'] == 2}">
{{scope.row['state'] == 2 ? "Expired" : ""}} {{$t(stateOptions.find(state=>state.value == scope.row['state']).label)}}
</span>
</span> </span>
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span> <span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
<template v-else>-</template> <template v-else>-</template>
@@ -141,6 +142,7 @@ import chartDataFormat from '../../../charts/chartDataFormat'
import alertRuleInfo from '../../alert/alertRuleInfo' import alertRuleInfo from '../../alert/alertRuleInfo'
import alertLabel from '../../alert/alertLabel' import alertLabel from '../../alert/alertLabel'
import { calcDurationByStringTimeB } from '../../js/tools' import { calcDurationByStringTimeB } from '../../js/tools'
import {alertMessage as alertMessageConstant} from "@/components/common/js/constants";
export default { export default {
name: 'alertMessageTable', name: 'alertMessageTable',
components: { components: {
@@ -166,7 +168,7 @@ export default {
/* 二级列表相关 */ /* 二级列表相关 */
tabList: [], // 二级列表的标签 tabList: [], // 二级列表的标签
tabDetailList: [], // 多个详情 tabDetailList: [], // 多个详情
stateOptions: alertMessageConstant.states,
// 详情相关 // 详情相关
graphShow: false, graphShow: false,
chartDatas: [], chartDatas: [],
@@ -178,6 +180,7 @@ export default {
chartUnit: 5, chartUnit: 5,
severityData: [], severityData: [],
tableTitle: [ tableTitle: [
{ {
label: 'ID', label: 'ID',
prop: 'id', prop: 'id',
@@ -213,6 +216,12 @@ export default {
prop: 'description', prop: 'description',
show: true, show: true,
minWidth: 200 minWidth: 200
}, {
label: this.$t('alert.list.state'),
prop: 'state',
show: true,
width: 100,
sortable: 'custom'
}, { }, {
label: this.$t('alert.startAt'), label: this.$t('alert.startAt'),
prop: 'startAt', prop: 'startAt',

View File

@@ -305,6 +305,7 @@ export default {
const showTime = this.timeData.find(item => item.id == n) const showTime = this.timeData.find(item => item.id == n)
if (showTime) { if (showTime) {
this.showTime = Object.assign({}, showTime) this.showTime = Object.assign({}, showTime)
this.searchTime = this.$parent.searchTime
} }
if (this.showEmpty && this.defaultPick === 12) { if (this.showEmpty && this.defaultPick === 12) {
this.searchTime = [] this.searchTime = []

View File

@@ -18,7 +18,7 @@
<button id="asset-filter" :class="[dataListLayout.indexOf('clickSearch') > -1?'is-focus':'' ]" class="top-tool-btn margin-r-10" @click.stop="showClickSearch"> <button id="asset-filter" :class="[dataListLayout.indexOf('clickSearch') > -1?'is-focus':'' ]" class="top-tool-btn margin-r-10" @click.stop="showClickSearch">
<i class="nz-icon nz-icon-funnel"></i> <i class="nz-icon nz-icon-funnel"></i>
</button> </button>
<pick-time v-model="searchTime" :default-pick="12" :refresh-data-func="getTableData" :show-empty="true" :use-chart-unit="false" :use-refresh="false"></pick-time> <pick-time v-model="searchTime" :default-pick="8" :refresh-data-func="getTableData" :show-empty="true" :use-chart-unit="false" :use-refresh="false"></pick-time>
<button id="roles-add" v-has="'alertMessage_view'" :title="$t('overall.exportExcelLower')" class="top-tool-btn margin-r-10" <button id="roles-add" v-has="'alertMessage_view'" :title="$t('overall.exportExcelLower')" class="top-tool-btn margin-r-10"
type="button" @click="showExportDialog"> type="button" @click="showExportDialog">
<i class="nz-icon-download1 nz-icon"></i> <i class="nz-icon-download1 nz-icon"></i>
@@ -192,7 +192,7 @@ export default {
chartDatas: [], chartDatas: [],
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'], sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'],
legend: [], legend: [],
searchTime: [], searchTime: [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))],
searchTimeDialog: [], searchTimeDialog: [],
searchTimeSelect: bus.getTimezontDateRange(), searchTimeSelect: bus.getTimezontDateRange(),
currentMsg: {}, currentMsg: {},
@@ -560,6 +560,15 @@ export default {
this.currentMsg = { ...row, alertRule: { ...res.data } } this.currentMsg = { ...row, alertRule: { ...res.data } }
this.$nextTick(() => { this.$nextTick(() => {
this.searchTimeDialog = [bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())] this.searchTimeDialog = [bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())]
this.$store.dispatch('dispatchPanelTime', {
time: this.searchTimeDialog,
nowTimeType: {
id: 4,
text: this.$t('dashboard.panel.lastOneHour'),
type: 'hour',
value: 1
}
})
this.queryDate() this.queryDate()
}) })
}) })
@@ -731,7 +740,11 @@ export default {
} }
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
if (this.state) {
this.$set(this.searchLabel, 'state', this.state) this.$set(this.searchLabel, 'state', this.state)
} else {
delete this.searchLabel.state
}
if (this.searchTime && this.searchTime.length > 1) { if (this.searchTime && this.searchTime.length > 1) {
this.$set(this.searchLabel, 'startAt', bus.timeFormate(this.timezoneToUtcTime(bus.formateTimeToTime(this.searchTime[0])), 'YYYY-MM-DD HH:mm:ss')) this.$set(this.searchLabel, 'startAt', bus.timeFormate(this.timezoneToUtcTime(bus.formateTimeToTime(this.searchTime[0])), 'YYYY-MM-DD HH:mm:ss'))
this.$set(this.searchLabel, 'endAt', bus.timeFormate(this.timezoneToUtcTime(bus.formateTimeToTime(this.searchTime[1])), 'YYYY-MM-DD HH:mm:ss')) this.$set(this.searchLabel, 'endAt', bus.timeFormate(this.timezoneToUtcTime(bus.formateTimeToTime(this.searchTime[1])), 'YYYY-MM-DD HH:mm:ss'))
@@ -745,10 +758,10 @@ export default {
delete this.searchLabel.statistics delete this.searchLabel.statistics
} */ } */
this.tools.loading = true this.tools.loading = true
if (state) { // if (state) {
delete this.searchLabel.startAt // delete this.searchLabel.startAt
delete this.searchLabel.endAt // delete this.searchLabel.endAt
} // }
const param = { const param = {
...this.searchLabel, ...this.searchLabel,
...this.searchCheckBox ...this.searchCheckBox