NEZ-598 alert message 页面修改
This commit is contained in:
@@ -287,7 +287,7 @@ export function stringTimeParseToUnix (stringTime) {
|
|||||||
offset = moment.tz(offset).format('Z')
|
offset = moment.tz(offset).format('Z')
|
||||||
offset = Number.parseInt(offset)
|
offset = Number.parseInt(offset)
|
||||||
const localOffset = new Date().getTimezoneOffset() * 60 * 1000 * -1 // 默认 一分钟显示时区偏移的结果
|
const localOffset = new Date().getTimezoneOffset() * 60 * 1000 * -1 // 默认 一分钟显示时区偏移的结果
|
||||||
console.log(offset,localOffset, time)
|
// console.log(offset,localOffset, time)
|
||||||
time = time + localOffset - offset * 60 * 60 * 1000
|
time = time + localOffset - offset * 60 * 60 * 1000
|
||||||
return time / 1000
|
return time / 1000
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
>
|
>
|
||||||
<template v-slot:top-tool-left >
|
<template v-slot:top-tool-left >
|
||||||
<div v-for="(item,ind) in tablist">
|
<div v-for="(item,ind) in tablist">
|
||||||
<div class="nz-tab-item-box" @click="getstate(ind)" :index="ind" :key="item.state">
|
<div class="nz-tab-item-box" @click="getTableData(ind)" :index="ind" :key="item.state">
|
||||||
<div class="nz-tab-item" :class="{active:ind==isActive}">{{item.name}}</div>
|
<div class="nz-tab-item" :class="{active:ind==isActive}">{{item.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,8 +39,7 @@
|
|||||||
@del="del"
|
@del="del"
|
||||||
@edit="edit"
|
@edit="edit"
|
||||||
@orderBy="tableDataSort"
|
@orderBy="tableDataSort"
|
||||||
@reload="getTableData"
|
@reload="getTableData"
|
||||||
@queryMessage="queryMessage"
|
|
||||||
@selectionChange="selectionChange"
|
@selectionChange="selectionChange"
|
||||||
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"
|
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"
|
||||||
@toDelete="toDeleteMessage"></alert-message-table>
|
@toDelete="toDeleteMessage"></alert-message-table>
|
||||||
@@ -136,6 +135,7 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
isActive:0,
|
isActive:0,
|
||||||
|
ind:0,
|
||||||
url: 'alert/message',
|
url: 'alert/message',
|
||||||
// 导出相关
|
// 导出相关
|
||||||
importBox: { show: false, title: this.$t('overall.exportExcel') },
|
importBox: { show: false, title: this.$t('overall.exportExcel') },
|
||||||
@@ -247,59 +247,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
queryMessage (alertRule) {
|
|
||||||
if (!this.hasButton('alertMessage_view')) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.$refs.dataList.showBottomBox('alertMessage', alertRule)
|
|
||||||
},
|
|
||||||
getstate(ind){
|
|
||||||
const i =ind+1
|
|
||||||
// console.log(i);
|
|
||||||
this.isActive=ind
|
|
||||||
this.tools.loading = true
|
|
||||||
this.$get(this.url+'?state='+i+'&pageNo=1&pageSize=20').then(response => {
|
|
||||||
this.tools.loading = false
|
|
||||||
if (response.code == 200) {
|
|
||||||
// console.log(response.data);
|
|
||||||
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
|
||||||
this.tableData = response.data.list
|
|
||||||
const axiosAll = []
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.tableData.forEach((item) => {
|
|
||||||
item.labels = JSON.parse(item.labels)
|
|
||||||
if (!this.isBuildIn(item.alertRule)) {
|
|
||||||
const paramStr = JSON.stringify(this.promQueryParamConvert(item))
|
|
||||||
axiosAll.push(axios.get('/prom/api/v1/query?query=' + paramStr.substring(1, paramStr.length - 1).replace(/\+/g, '%2B').replace(/ /g, '%20').replace(/\\/g, '')))
|
|
||||||
} else {
|
|
||||||
axiosAll.push('')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
axios.all(axiosAll).then(res => {
|
|
||||||
res.forEach((item, index) => {
|
|
||||||
let current = []
|
|
||||||
const response2 = item.data
|
|
||||||
if (response2.data && response2.data.result && response2.data.result.length > 0) {
|
|
||||||
current = response2.data.result[0].value.map((item, i) => {
|
|
||||||
if (i == 0) {
|
|
||||||
return bus.computeTimezone(item)
|
|
||||||
} else {
|
|
||||||
return parseFloat(item).toFixed(2)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
current = [null, null]
|
|
||||||
}
|
|
||||||
this.tableData[index].current = current
|
|
||||||
})
|
|
||||||
this.$set(this.tableData, [...this.tableData])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.deleteBox.ids = ''
|
|
||||||
this.pageObj.total = response.data.total
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
labelsSort (obj) {
|
labelsSort (obj) {
|
||||||
const buildIn = ['asset', 'endpoint', 'module', 'project', 'datacenter']
|
const buildIn = ['asset', 'endpoint', 'module', 'project', 'datacenter']
|
||||||
const labels = JSON.parse(JSON.stringify(obj))
|
const labels = JSON.parse(JSON.stringify(obj))
|
||||||
@@ -428,7 +375,14 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTableData () {
|
getTableData (ind) {
|
||||||
|
if(ind ==undefined){
|
||||||
|
ind=this.ind
|
||||||
|
}else{
|
||||||
|
this.ind =ind
|
||||||
|
}
|
||||||
|
const ii =ind+1
|
||||||
|
this.isActive=ind
|
||||||
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.searchTime && this.searchTime.length > 1) {
|
if (this.searchTime && this.searchTime.length > 1) {
|
||||||
@@ -439,7 +393,13 @@ export default {
|
|||||||
delete this.searchLabel.endAt
|
delete this.searchLabel.endAt
|
||||||
}
|
}
|
||||||
this.tools.loading = true
|
this.tools.loading = true
|
||||||
this.$get(this.url+'?state=1', this.searchLabel).then(response => {
|
if(ind===0){
|
||||||
|
console.log(1);
|
||||||
|
delete this.searchLabel.startAt
|
||||||
|
delete this.searchLabel.endAt
|
||||||
|
}
|
||||||
|
this.$get(this.url+'?state='+ii, this.searchLabel).then(response => {
|
||||||
|
console.log(this.searchLabel)
|
||||||
this.tools.loading = false
|
this.tools.loading = false
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
||||||
|
|||||||
Reference in New Issue
Block a user