2020-08-26 10:05:56 +08:00
|
|
|
|
<template>
|
2020-08-27 15:23:52 +08:00
|
|
|
|
<div class="mc" @click.self="clickOutside">
|
|
|
|
|
|
<div class="right-box right-box-project-alert">
|
2020-08-26 10:05:56 +08:00
|
|
|
|
<!-- begin--标题-->
|
2020-09-04 10:04:41 +08:00
|
|
|
|
<div class="right-box-title">Alert messages</div>
|
2020-08-26 10:05:56 +08:00
|
|
|
|
<!-- end--标题-->
|
|
|
|
|
|
|
2020-09-09 15:32:44 +08:00
|
|
|
|
<!-- begin搜素框-->
|
|
|
|
|
|
<div class="top-tools">
|
|
|
|
|
|
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': false}">
|
2020-10-12 18:15:24 +08:00
|
|
|
|
<pick-time :refresh-data-func="getAlertList" v-model="searchTime" :use-chart-unit="false" :use-refresh="false" :default-pick="12" :show-empty="true"></pick-time>
|
2020-09-09 15:32:44 +08:00
|
|
|
|
<div class="top-tool-search">
|
2021-03-19 18:52:19 +08:00
|
|
|
|
<search-input :inTransform="true" :searchMsg="searchMsg" @search="search"></search-input>
|
2020-09-09 15:32:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!--<button type="button" @click="showExportDialog" :title="$t('overall.exportExcelLower')"-->
|
|
|
|
|
|
<!--class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="alert-list-export">-->
|
2020-09-11 16:34:28 +08:00
|
|
|
|
<!--<i class="nz-icon nz-icon-download1"></i>-->
|
2020-09-09 15:32:44 +08:00
|
|
|
|
<!--</button>-->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="pagination-top pagination-top-hide display-none"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end搜素框-->
|
|
|
|
|
|
|
2020-08-26 10:05:56 +08:00
|
|
|
|
<!-- begin--表格-->
|
2020-12-14 20:25:24 +08:00
|
|
|
|
<div class="right-box-form-box">
|
2020-08-26 11:28:09 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
class="nz-table tabelH100"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
border
|
|
|
|
|
|
ref="alertListTable"
|
|
|
|
|
|
tooltip-effect="light"
|
|
|
|
|
|
:height="tableHeight"
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
:cell-class-name="labelsClassName"
|
|
|
|
|
|
@selection-change="selectChange"
|
|
|
|
|
|
style="width: 100%;height: 100%"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
:id="projectId"
|
|
|
|
|
|
>
|
|
|
|
|
|
<!--<el-table-column-->
|
|
|
|
|
|
<!--:resizable="false"-->
|
|
|
|
|
|
<!--type="selection"-->
|
|
|
|
|
|
<!--width="38"-->
|
|
|
|
|
|
<!--align="center"-->
|
|
|
|
|
|
<!-->-->
|
|
|
|
|
|
<!--</el-table-column>-->
|
|
|
|
|
|
<el-table-column
|
2020-11-04 15:38:34 +08:00
|
|
|
|
:resizable="true"
|
2020-08-26 11:28:09 +08:00
|
|
|
|
v-for="(item, index) in tableTitle"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:width="item.width"
|
|
|
|
|
|
:minWidth="item.minWidth"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:show-overflow-tooltip="item.prop != 'labels'"
|
|
|
|
|
|
min-width="110px"
|
|
|
|
|
|
:sortable="$tableSet.sortableShow(item.prop,'alertMessage')"
|
|
|
|
|
|
:prop="$tableSet.propTitle(item.prop,'alertMessage')"
|
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<template v-if="item.prop == 'alertRule'">
|
2020-09-30 16:44:52 +08:00
|
|
|
|
<div v-if="scope.row.alertRule.alertName" >
|
|
|
|
|
|
<span @mouseenter="alertMessagehover(scope.row.alertRule, true, $event)" @mouseleave="alertMessagehover(scope.row.alertRule, false)">{{scope.row.alertRule.alertName}}</span>
|
|
|
|
|
|
<alertRuleInfo v-if="scope.row.alertRule.loading" :id="scope.row.alertRule.id" :that="scope.row.alertRule"></alertRuleInfo>
|
|
|
|
|
|
</div>
|
2020-08-26 11:28:09 +08:00
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'summary'">
|
|
|
|
|
|
<template v-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="item.prop == 'description'">
|
|
|
|
|
|
<template v-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
|
</template>
|
2020-10-12 11:02:30 +08:00
|
|
|
|
<span v-else-if="item.prop == 'severity'" class="severity">
|
2020-10-14 14:24:07 +08:00
|
|
|
|
<span v-if="scope.row[item.prop] == 'P1'" class="P1">P1</span>
|
2020-10-12 11:02:30 +08:00
|
|
|
|
<!--<i class="nz-icon nz-icon-arrow-up"></i> {{returnSeverityLabel(scope.row[item.prop])}}-->
|
2020-10-14 14:24:07 +08:00
|
|
|
|
<span v-if="scope.row[item.prop] == 'P2'" class="P2">P2</span>
|
2020-10-12 11:02:30 +08:00
|
|
|
|
<!--{{returnSeverityLabel(scope.row[item.prop])}}-->
|
2020-10-14 14:24:07 +08:00
|
|
|
|
<span v-if="scope.row[item.prop] == 'P3'" class="P3">P3</span>
|
2020-10-12 11:02:30 +08:00
|
|
|
|
<!--<i class="nz-icon nz-icon-arrow-down"></i> {{returnSeverityLabel(scope.row[item.prop])}}-->
|
2020-08-26 11:28:09 +08:00
|
|
|
|
</span>
|
|
|
|
|
|
<template v-else-if="item.prop == 'labels'" class="labels">
|
2021-03-19 18:52:19 +08:00
|
|
|
|
<span v-for="(item, i) in labelsSort(scope.row.labels)" :key="i">
|
|
|
|
|
|
<span @mouseenter="labelHover(scope.row,scope.$index, item.label, true, $event)" @mouseleave="labelHover(scope.row,scope.$index, item.label, false)">
|
|
|
|
|
|
<nz-alert-tag
|
|
|
|
|
|
v-if="item.label != 'alertname' && item.label != 'severity'" :key="item.label" :cursor-point="tagType(item.label) == 'info' ? false : true"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:type="tagType(item.label)"
|
|
|
|
|
|
style="margin: 5px 0 5px 5px;"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{item.value}}
|
|
|
|
|
|
</nz-alert-tag>
|
|
|
|
|
|
</span>
|
2020-09-30 16:44:52 +08:00
|
|
|
|
<alertLabel
|
|
|
|
|
|
v-if="(item.label === 'asset' ||item.label === 'module' || item.label === 'project') && scope.row[item.label] && scope.row[item.label].loading"
|
|
|
|
|
|
:id="scope.row[item.label].id"
|
|
|
|
|
|
:that="scope.row[item.label]"
|
|
|
|
|
|
:type="item.label"
|
|
|
|
|
|
></alertLabel>
|
2020-10-09 11:26:16 +08:00
|
|
|
|
</span>
|
2020-09-30 16:44:52 +08:00
|
|
|
|
|
|
|
|
|
|
<!--<el-tooltip
|
2020-08-26 11:28:09 +08:00
|
|
|
|
v-for="(item,i) in labelsSort(scope.row.labels)"
|
|
|
|
|
|
:placement="scope.$index==0?'right-start':(scope.$index==tableData.length-1?'right-end':'right')"
|
|
|
|
|
|
effect="light"
|
|
|
|
|
|
:disabled="!(item.label === 'asset' ||item.label === 'module' || item.label === 'project')"
|
|
|
|
|
|
:key="item.label"
|
|
|
|
|
|
>
|
|
|
|
|
|
<alertLabel
|
|
|
|
|
|
v-if="item.label === 'asset' ||item.label === 'module' || item.label === 'project'"
|
|
|
|
|
|
slot="content"
|
|
|
|
|
|
:id="scope.row[item.label].id"
|
|
|
|
|
|
:type="item.label"
|
|
|
|
|
|
:labelLoading="scope.row[item.label].loading"
|
|
|
|
|
|
></alertLabel>
|
|
|
|
|
|
<span @mouseover="labelHover(scope.row,scope.$index,item.label)" >
|
2020-09-30 16:44:52 +08:00
|
|
|
|
<nz-alert-tag
|
|
|
|
|
|
:label="item.label" :type="tagType(item.label)" style="margin: 5px 0 5px 5px;"
|
|
|
|
|
|
:cursor-point="tagType(item.label) == 'info' ? false : true"
|
|
|
|
|
|
:key="item.label"
|
|
|
|
|
|
v-if="item.label != 'alertname' && item.label != 'severity'"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{item.value}}
|
|
|
|
|
|
</nz-alert-tag>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</el-tooltip>-->
|
|
|
|
|
|
|
2020-08-26 11:28:09 +08:00
|
|
|
|
</template>
|
2020-10-09 11:26:16 +08:00
|
|
|
|
<span v-else-if="item.prop == 'state'" :class="{'green': scope.row['state'] == 2, 'red': scope.row['state'] == 1}">
|
|
|
|
|
|
{{scope.row['state'] == 1 ? "Pending" : ""}}
|
|
|
|
|
|
{{scope.row['state'] == 2 ? "Expired" : ""}}
|
|
|
|
|
|
</span>
|
2020-08-26 11:28:09 +08:00
|
|
|
|
<div v-else-if="item.prop == 'current'" class="too-long-split pointer" @click="detail(scope.row)">
|
|
|
|
|
|
<span v-if="!scope.row.current">-</span>
|
|
|
|
|
|
<el-popover v-else placement="right" trigger="hover">
|
|
|
|
|
|
<div slot="reference">
|
|
|
|
|
|
<span class="content-right-option" :id="'alert-list-detail-'+scope.row.id"><i class="nz-icon nz-icon-chart"></i></span>
|
|
|
|
|
|
<span>{{formatThreshold(scope.row.current[1],scope.row.alertRule.unit)}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>{{$unixTimeParseToString(scope.row.current[0])}}</div>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="item.prop == 'option'" class="content-right-options">
|
2020-09-10 17:00:32 +08:00
|
|
|
|
<span :title="$t('overall.delete')" @click="toDeleteMessage(scope.row)" class="content-right-option" :id="'alert-list-delete-'+scope.row.id"><i class="nz-icon nz-icon-delete"></i></span>
|
2020-08-26 11:28:09 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2020-12-14 20:25:24 +08:00
|
|
|
|
</div>
|
2020-08-26 10:05:56 +08:00
|
|
|
|
<!-- end--表格-->
|
|
|
|
|
|
|
2020-08-26 11:28:09 +08:00
|
|
|
|
<!--底部分頁-->
|
|
|
|
|
|
<div class="pagination-bottom">
|
|
|
|
|
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
2020-08-26 10:05:56 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-08-27 15:23:52 +08:00
|
|
|
|
</div>
|
2020-08-26 10:05:56 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-03-19 18:52:19 +08:00
|
|
|
|
import bus from '@/libs/bus'
|
|
|
|
|
|
import nzAlertTag from '@/components/page/alert/nzAlertTag'
|
|
|
|
|
|
import alertRuleInfo from '@/components/common/alert/alertRuleInfo'
|
|
|
|
|
|
import alertLabel from '@/components/common/alert/alertLabel'
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'alertTable',
|
|
|
|
|
|
props: {
|
|
|
|
|
|
moduleId: {},
|
|
|
|
|
|
projectId: {}
|
|
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
'nz-alert-tag': nzAlertTag,
|
|
|
|
|
|
alertRuleInfo: alertRuleInfo,
|
|
|
|
|
|
alertLabel: alertLabel
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
tagType () {
|
|
|
|
|
|
return (key) => {
|
|
|
|
|
|
if (key == 'asset' || key == 'module' || key == 'project' || key == 'datacenter' || key == 'endpoint') {
|
|
|
|
|
|
return 'normal'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return 'info'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-08-26 11:28:09 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tagValue () {
|
|
|
|
|
|
return (key, value) => {
|
|
|
|
|
|
if (key == 'type') {
|
|
|
|
|
|
if (value == 1) {
|
2021-05-14 15:24:32 +08:00
|
|
|
|
value = this.$t('project.project.projectName')
|
2021-03-19 18:52:19 +08:00
|
|
|
|
} else if (value == 2) {
|
|
|
|
|
|
value = this.$t('module.module.module')
|
|
|
|
|
|
} else if (value == 3) {
|
|
|
|
|
|
value = this.$t('asset.asset')
|
2020-08-26 10:05:56 +08:00
|
|
|
|
}
|
2020-08-26 11:28:09 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
return key + ':' + value
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: this.$CONSTANTS.defaultPageSize,
|
|
|
|
|
|
total: 0
|
2020-08-26 11:28:09 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('alert.alertName'),
|
|
|
|
|
|
prop: 'alertRule',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 180
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.list.labels'),
|
|
|
|
|
|
prop: 'labels',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
NotSet: true,
|
|
|
|
|
|
minWidth: 200
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.severity'),
|
|
|
|
|
|
prop: 'severity',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 110
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.summary'),
|
|
|
|
|
|
prop: 'summary',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 100
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.list.state'),
|
|
|
|
|
|
prop: 'state',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 100
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('alert.startAt'),
|
|
|
|
|
|
prop: 'startAt',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 150
|
2020-08-26 11:28:09 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
searchTime: [],
|
|
|
|
|
|
searchMsg: { // 给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: this.$t('alert.alertName'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'alertName',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, /* {
|
2020-09-09 15:32:44 +08:00
|
|
|
|
id: 3,
|
|
|
|
|
|
name: this.$t('alert.list.type'),
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
label: 'alertType',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, */{
|
2021-03-19 18:52:19 +08:00
|
|
|
|
id: 20,
|
|
|
|
|
|
name: this.$t('alert.severity'),
|
|
|
|
|
|
type: 'selectString',
|
|
|
|
|
|
label: 'severity',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 21,
|
|
|
|
|
|
name: this.$t('asset.asset'),
|
|
|
|
|
|
type: 'asset',
|
|
|
|
|
|
label: 'asset',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 22,
|
2021-05-14 15:24:32 +08:00
|
|
|
|
name: this.$t('project.project.projectName'),
|
2021-03-19 18:52:19 +08:00
|
|
|
|
type: 'project',
|
|
|
|
|
|
label: 'project',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 23,
|
|
|
|
|
|
name: this.$t('project.module.module'),
|
|
|
|
|
|
type: 'module',
|
|
|
|
|
|
label: 'module',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 24,
|
|
|
|
|
|
name: this.$t('project.endpoint.endpoint'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'endpointId',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 25,
|
|
|
|
|
|
name: this.$t('alert.list.state'),
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
label: 'alertMessageState',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}]
|
|
|
|
|
|
},
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
tableHeight: '100%',
|
|
|
|
|
|
searchLabel: {
|
2020-08-26 11:28:09 +08:00
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
deleteBox: {},
|
|
|
|
|
|
nowTime: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created () {
|
|
|
|
|
|
// 是否存在分页缓存
|
|
|
|
|
|
const pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId)
|
|
|
|
|
|
if (pageSize != 'undefined' && pageSize != null) {
|
|
|
|
|
|
this.pageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.getAlertList()
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getAlertList: function () {
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
|
|
|
|
|
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
|
|
|
|
|
|
this.$set(this.searchLabel, 'moduleId', this.moduleId)
|
|
|
|
|
|
if (this.searchTime && this.searchTime.length > 1) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'startAt', bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss'))
|
|
|
|
|
|
this.$set(this.searchLabel, 'endAt', bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss'))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
delete this.searchLabel.startAt
|
|
|
|
|
|
delete this.searchLabel.endAt
|
2020-08-26 10:05:56 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
this.$get('alert/message', { ...this.searchLabel }).then(response => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
|
this.nowTime = this.utcTimeToTimezoneStr(response.time)
|
|
|
|
|
|
this.tableData = response.data.list
|
|
|
|
|
|
this.tableData.forEach((item) => {
|
|
|
|
|
|
item.labels = JSON.parse(item.labels)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.deleteBox.ids = ''
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2020-08-26 10:05:56 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
labelsSort: function (obj) {
|
|
|
|
|
|
const buildIn = ['asset', 'endpoint', 'module', 'project', 'datacenter']
|
|
|
|
|
|
const labels = JSON.parse(JSON.stringify(obj))
|
|
|
|
|
|
const result = []
|
|
|
|
|
|
for (const key of buildIn) {
|
|
|
|
|
|
if (key in labels) {
|
|
|
|
|
|
result.push({ label: key, value: labels[key] })
|
|
|
|
|
|
delete labels[key]
|
|
|
|
|
|
}
|
2020-11-21 12:21:27 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
Object.keys(labels).sort().forEach(key => {
|
|
|
|
|
|
result.push({ label: key, value: labels[key] })
|
|
|
|
|
|
})
|
|
|
|
|
|
return result
|
2020-11-21 12:21:27 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
labelsClassName (row) {
|
|
|
|
|
|
if (row.column.label == this.$t('alert.list.labels')) {
|
|
|
|
|
|
return 'alert-message-list-labels'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
}
|
2020-08-26 10:05:56 +08:00
|
|
|
|
},
|
2021-03-19 18:52:19 +08:00
|
|
|
|
pageNo (val) {
|
|
|
|
|
|
this.pageObj.pageNo = val
|
|
|
|
|
|
this.getAlertList()
|
|
|
|
|
|
},
|
|
|
|
|
|
pageSize (val) {
|
|
|
|
|
|
this.pageObj.pageSize = val
|
|
|
|
|
|
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val)
|
|
|
|
|
|
this.getAlertList()
|
|
|
|
|
|
},
|
|
|
|
|
|
selectChange (s) {
|
|
|
|
|
|
const ids = []
|
|
|
|
|
|
this.deleteBox.ids = ''
|
|
|
|
|
|
s.forEach(item => {
|
|
|
|
|
|
ids.push(item.id)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.deleteBox.ids = ids.join(',')
|
|
|
|
|
|
},
|
|
|
|
|
|
// alertNmae鼠标划入
|
|
|
|
|
|
alertMessagehover (item, loading, e) {
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
const dom = e.currentTarget
|
|
|
|
|
|
const position = dom.getBoundingClientRect()
|
|
|
|
|
|
this.$set(item, 'position', position)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(item, 'loading', loading)
|
|
|
|
|
|
// item.loading = true;
|
|
|
|
|
|
// this.$set(this.tableData,index,item);// 调用父组件
|
|
|
|
|
|
},
|
|
|
|
|
|
// label 鼠标划入
|
|
|
|
|
|
labelHover (item, index, type, loading, e) {
|
|
|
|
|
|
if (this.labelToolTipDis(type)) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
const dom = e.currentTarget
|
|
|
|
|
|
const position = dom.getBoundingClientRect()
|
|
|
|
|
|
this.$set(item[type], 'position', position)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$set(item[type], 'loading', loading)
|
|
|
|
|
|
this.$set(this.tableData, index, item)// 调用父组件
|
|
|
|
|
|
},
|
|
|
|
|
|
// label tooltip是否显示
|
|
|
|
|
|
labelToolTipDis (labelType) {
|
|
|
|
|
|
switch (labelType) {
|
|
|
|
|
|
case 'asset':
|
|
|
|
|
|
case 'module':
|
|
|
|
|
|
case 'project':
|
|
|
|
|
|
return false
|
|
|
|
|
|
default: return true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// Severity Label
|
|
|
|
|
|
returnSeverityLabel (key) {
|
|
|
|
|
|
return this.$CONSTANTS.alertMessage.severityData.find(s => { return s.value == key }).label
|
|
|
|
|
|
},
|
|
|
|
|
|
tableDataSort (item) {
|
|
|
|
|
|
let orderBy = ''
|
|
|
|
|
|
if (item.order === 'ascending') {
|
|
|
|
|
|
orderBy = item.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.order === 'descending') {
|
|
|
|
|
|
orderBy = '-' + item.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
this.pageObj.orderBy = orderBy
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy)
|
|
|
|
|
|
this.getAlertList()
|
|
|
|
|
|
},
|
|
|
|
|
|
/* 关闭弹框 */
|
|
|
|
|
|
esc (refresh) {
|
|
|
|
|
|
this.$emit('close', refresh)
|
|
|
|
|
|
},
|
|
|
|
|
|
clickOutside () {
|
|
|
|
|
|
this.esc(false)
|
|
|
|
|
|
},
|
|
|
|
|
|
search (searchObj) {
|
|
|
|
|
|
let orderBy = ''
|
|
|
|
|
|
if (this.searchLabel.orderBy) {
|
|
|
|
|
|
orderBy = this.searchLabel.orderBy
|
|
|
|
|
|
}
|
|
|
|
|
|
this.searchLabel = {}
|
|
|
|
|
|
this.pageObj.pageNo = 1
|
|
|
|
|
|
for (const item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
if (item == 'alertMessageState') {
|
|
|
|
|
|
this.$set(this.searchLabel, 'state', searchObj[item])
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$set(this.searchLabel, item, searchObj[item])
|
2020-09-09 15:32:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (orderBy) {
|
|
|
|
|
|
this.$set(this.searchLabel, 'orderBy', orderBy)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.$refs.alertListTable && this.$refs.alertListTable.bodyWrapper) {
|
|
|
|
|
|
this.$refs.alertListTable.bodyWrapper.scrollTop = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getAlertList()
|
2020-08-26 10:05:56 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2021-03-19 18:52:19 +08:00
|
|
|
|
showExportDialog () {
|
|
|
|
|
|
this.importBox.show = true
|
2020-11-20 11:19:25 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeDestroy () {
|
|
|
|
|
|
|
2020-08-26 10:05:56 +08:00
|
|
|
|
}
|
2021-03-19 18:52:19 +08:00
|
|
|
|
}
|
2020-08-26 10:05:56 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2020-08-26 11:28:09 +08:00
|
|
|
|
.right-box-project-alert{
|
2020-10-12 13:46:31 +08:00
|
|
|
|
width: 850px;
|
2020-09-07 10:42:10 +08:00
|
|
|
|
padding-right: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-box-title{
|
|
|
|
|
|
font-weight: bold;
|
2020-08-26 11:28:09 +08:00
|
|
|
|
}
|
2020-08-26 10:05:56 +08:00
|
|
|
|
.mc{
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
width: 100vw;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
2020-08-26 11:28:09 +08:00
|
|
|
|
z-index: 11;
|
2020-08-26 10:05:56 +08:00
|
|
|
|
}
|
2020-09-09 15:32:44 +08:00
|
|
|
|
.top-tools{
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/ .top-tools>div{
|
2020-09-10 09:18:37 +08:00
|
|
|
|
margin-top: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
/deep/.el-tooltip{
|
|
|
|
|
|
display: inline-block;
|
2020-09-09 15:32:44 +08:00
|
|
|
|
}
|
2020-10-09 11:26:16 +08:00
|
|
|
|
.red,.green{
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
padding: 2px 5px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
}
|
2020-10-14 14:24:07 +08:00
|
|
|
|
.severity .P1{
|
2020-10-13 11:18:04 +08:00
|
|
|
|
background: #F5846A;
|
2020-10-12 11:02:30 +08:00
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
}
|
2020-10-14 14:24:07 +08:00
|
|
|
|
.severity .P2{
|
2020-10-13 11:18:04 +08:00
|
|
|
|
background: #F7A54A;
|
2020-10-12 11:02:30 +08:00
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
}
|
2020-10-14 14:24:07 +08:00
|
|
|
|
.severity .P3{
|
2020-10-13 11:18:04 +08:00
|
|
|
|
background: #F1C13D;
|
2020-10-12 11:02:30 +08:00
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
}
|
2020-08-26 10:05:56 +08:00
|
|
|
|
/* end--table*/
|
|
|
|
|
|
</style>
|