NEZ-598 alert message 页面修改
This commit is contained in:
@@ -12,6 +12,13 @@
|
||||
:search-msg="searchMsg"
|
||||
@search="search"
|
||||
>
|
||||
<template v-slot:top-tool-left >
|
||||
<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" :class="{active:ind==isActive}">{{item.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:top-tool-right>
|
||||
<pick-time v-model="searchTime" :default-pick="12" :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"
|
||||
@@ -32,7 +39,8 @@
|
||||
@del="del"
|
||||
@edit="edit"
|
||||
@orderBy="tableDataSort"
|
||||
@reload="getTableData"
|
||||
@reload="getTableData"
|
||||
@queryMessage="queryMessage"
|
||||
@selectionChange="selectionChange"
|
||||
@showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"
|
||||
@toDelete="toDeleteMessage"></alert-message-table>
|
||||
@@ -113,6 +121,21 @@ export default {
|
||||
mixins: [dataListMixin],
|
||||
data () {
|
||||
return {
|
||||
tablist:[
|
||||
{
|
||||
state:'1',
|
||||
name:'Active'
|
||||
},
|
||||
{
|
||||
state:'2',
|
||||
name:'Silebt'
|
||||
},
|
||||
{
|
||||
state:'3',
|
||||
name:'Expired'
|
||||
}
|
||||
],
|
||||
isActive:0,
|
||||
url: 'alert/message',
|
||||
// 导出相关
|
||||
importBox: { show: false, title: this.$t('overall.exportExcel') },
|
||||
@@ -224,6 +247,59 @@ export default {
|
||||
}
|
||||
},
|
||||
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) {
|
||||
const buildIn = ['asset', 'endpoint', 'module', 'project', 'datacenter']
|
||||
const labels = JSON.parse(JSON.stringify(obj))
|
||||
@@ -363,7 +439,7 @@ export default {
|
||||
delete this.searchLabel.endAt
|
||||
}
|
||||
this.tools.loading = true
|
||||
this.$get(this.url, this.searchLabel).then(response => {
|
||||
this.$get(this.url+'?state=1', this.searchLabel).then(response => {
|
||||
this.tools.loading = false
|
||||
if (response.code == 200) {
|
||||
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
||||
@@ -595,3 +671,12 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.active{
|
||||
border-bottom: 3px solid #fa901c;
|
||||
color: #333;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user