feat: alertMessage-labels等

1.alertMessage-labels
2.退出登录切换语言再重登后国际化不对的bug
3.修复切换左侧菜单后顶部菜单显示不对的问题
This commit is contained in:
陈劲松
2020-04-06 22:11:25 +08:00
parent 874696feb7
commit f74f852470
21 changed files with 286 additions and 134 deletions

View File

@@ -147,7 +147,7 @@ li{
position: relative; position: relative;
} }
.to-top { .to-top {
position: fixed; position: absolute;
bottom: 10px; bottom: 10px;
right: 5px; right: 5px;
border-radius: 5px; border-radius: 5px;
@@ -721,9 +721,13 @@ li{
/*box-shadow: inset -1px -2px 1px 0 rgba(0,0,0,0.11), inset 2px 2px 1px 0 rgba(255,255,255,0.50);*/ /*box-shadow: inset -1px -2px 1px 0 rgba(0,0,0,0.11), inset 2px 2px 1px 0 rgba(255,255,255,0.50);*/
} }
.nz-table.el-table td .cell{ .nz-table.el-table td .cell{
height: 38px; min-height: 38px;
line-height: 38px; line-height: 38px;
} }
.nz-table.el-table td.alert-message-list-labels .cell{
line-height: unset;
padding: 3px;
}
/*.nz-table .el-table__row td:first-of-type { /*.nz-table .el-table__row td:first-of-type {
padding-left: 38px; padding-left: 38px;
}*/ }*/
@@ -742,7 +746,9 @@ li{
position: absolute; position: absolute;
left: -3px; left: -3px;
} }
.alert-message-tag {
margin: 3px;
}
/* end--内容*/ /* end--内容*/
/* begin--右弹框滑入滑出动画*/ /* begin--右弹框滑入滑出动画*/
@@ -1486,3 +1492,9 @@ li{
margin: 0 -7px; margin: 0 -7px;
padding: 3px 0; padding: 3px 0;
} }
.metric-tip-icon{
vertical-align: middle;
transform: scale(0.6);
display:inline-block;
}

View File

@@ -28,10 +28,23 @@
<!--endpoint页的asset详情--> <!--endpoint页的asset详情-->
<common-detail-tab v-show="subResizeShow" :obj="obj" :from="from" :detail="assetDetail" :targetTab="targetTab" <common-detail-tab v-show="subResizeShow" :obj="obj" :from="from" :detail="assetDetail" :targetTab="targetTab"
v-if="targetTab == 'assetDetail' && from == 'endpoint'" v-if="targetTab == 'assetDetail' && from == 'endpoint'"
@changeTab="changeTab" @changeTab="changeTab"></common-detail-tab>
></common-detail-tab>
<!--endpoint-query--> <!--endpoint-query-->
<endpoint-query-tab v-show="subResizeShow" v-if="(from == 'endpoint' && targetTab == 'endpointQuery')" :from="from" :obj="obj" @changeTab="changeTab"></endpoint-query-tab> <endpoint-query-tab v-show="subResizeShow" v-if="(from == 'endpoint' && targetTab == 'endpointQuery')" :from="from" :obj="obj" @changeTab="changeTab"></endpoint-query-tab>
<!--alertMessage页的详情-->
<template v-if="from == 'alertMessage'">
<common-detail-tab v-show="subResizeShow" :from="from" :targetTab="targetTab" v-for="item, index in tabList"
v-if="targetTab == item" @changeTab="changeTab"></common-detail-tab>
<!--<common-detail-tab v-show="subResizeShow" :from="from" :detail="detail" :targetTab="targetTab" v-for="item in tagList"
v-if="targetTab == 'project'" @changeTab="changeTab"></common-detail-tab>
<common-detail-tab v-show="subResizeShow" :from="from" :detail="detail" :targetTab="targetTab" v-for="item in tagList"
v-if="targetTab == 'module'" @changeTab="changeTab"></common-detail-tab>
<common-detail-tab v-show="subResizeShow" :from="from" :detail="detail" :targetTab="targetTab" v-for="item in tagList"
v-if="targetTab == 'endpoint'" @changeTab="changeTab"></common-detail-tab>
<common-detail-tab v-show="subResizeShow" :from="from" :detail="detail" :targetTab="targetTab" v-for="item in tagList"
v-if="targetTab == 'dc'" @changeTab="changeTab"></common-detail-tab>-->
</template>
</div> </div>
</span> </span>
</template> </template>
@@ -58,8 +71,10 @@
subResizeShow: Boolean, //resize时用v-show="subResizeShow"控制页面内容是否显示 subResizeShow: Boolean, //resize时用v-show="subResizeShow"控制页面内容是否显示
obj: Object, //关联的实体对象 obj: Object, //关联的实体对象
from: String, //来自哪个页面 from: String, //来自哪个页面
tabList: Array, //动态页签列表
targetTab: String, //展示哪个页签 targetTab: String, //展示哪个页签
detail: Array, //对象详情内容 detail: Array, //对象详情内容
detailList: Array, //多个对象详情内容
assetDetail: Array, //endpoint页的asset详情 assetDetail: Array, //endpoint页的asset详情
}, },

View File

@@ -9,8 +9,9 @@
<template v-else-if="from == 'alertRule'">{{$t("alert.alertName")}}{{obj.alertName}}</template> <template v-else-if="from == 'alertRule'">{{$t("alert.alertName")}}{{obj.alertName}}</template>
<template v-else-if="from == 'asset'">{{$t("project.endpoint.asset")}}{{obj.host}}</template> <template v-else-if="from == 'asset'">{{$t("project.endpoint.asset")}}{{obj.host}}</template>
<template v-else-if="from == 'endpoint'">{{$t("project.endpoint.endpointId")}}: {{obj.id}}</template> <template v-else-if="from == 'endpoint'">{{$t("project.endpoint.endpointId")}}: {{obj.id}}</template>
<template v-else-if="from == 'alertMessage'">&nbsp;</template>
<!-- 为防止代码换行导致页面中元素之间有间隙所以将元素的标签尾部和相邻元素的标签头部连在一起写 --> <!-- 为防止代码换行导致页面中元素之间有间隙所以将元素的标签尾部和相邻元素的标签头部连在一起写 -->
</div><div class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'detail'}" @click="changeTab('detail')">{{$t("overall.detail")}}</div><template v-if="from == 'dc'"> </div><div v-if="from != 'alertMessage'" class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'detail'}" @click="changeTab('detail')">{{$t("overall.detail")}}</div><template v-if="from == 'dc'">
<div class="sub-list-tab" @click="changeTab('cabinet')">{{$t("config.dc.cabinets")}}</div> <div class="sub-list-tab" @click="changeTab('cabinet')">{{$t("config.dc.cabinets")}}</div>
</template><template v-if="from == 'alertRule' || from == 'asset'"> </template><template v-if="from == 'alertRule' || from == 'asset'">
<div class="sub-list-tab" @click="changeTab('alertMessage')">{{$t("asset.tableTitle.alerts")}}</div> <div class="sub-list-tab" @click="changeTab('alertMessage')">{{$t("asset.tableTitle.alerts")}}</div>
@@ -19,6 +20,12 @@
</template><template v-if="from == 'endpoint'"> </template><template v-if="from == 'endpoint'">
<div class="sub-list-tab" @click="changeTab('endpointQuery')">{{$t("overall.query")}}</div><div <div class="sub-list-tab" @click="changeTab('endpointQuery')">{{$t("overall.query")}}</div><div
class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'assetDetail'}" @click="changeTab('assetDetail')">{{$t("project.endpoint.asset")}}</div> class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'assetDetail'}" @click="changeTab('assetDetail')">{{$t("project.endpoint.asset")}}</div>
</template><template v-if="from == 'alertMessage'">
<div class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'asset'}" @click="changeTab('asset')">{{$t("project.endpoint.asset")}}</div><div
class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'project'}" @click="changeTab('project')">{{$t("project.project.project")}}</div><div
class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'module'}" @click="changeTab('module')">{{$t("project.module.module")}}</div><div
class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'endpoint'}" @click="changeTab('endpoint')">{{$t("project.endpoint.endpoint")}}</div><div
class="sub-list-tab" :class="{'sub-list-tab-active': targetTab == 'datacenter'}" @click="changeTab('datacenter')">{{$t("config.dc.dc")}}</div>
</template> </template>
</div> </div>
</div> </div>

View File

@@ -93,7 +93,7 @@
</el-submenu> </el-submenu>
<el-submenu index="5" popper-class="nz-submenu"> <el-submenu index="5" popper-class="nz-submenu">
<template slot="title"> <template slot="title">
<div @click="jumpTo('account')" :class ="activeIndex == 'account' || activeIndex == 'promServer' || activeIndex == 'dc' || activeIndex == 'model' ? 'menu-active' :''">{{$t('overall.config')}}</div> <div @click="jumpTo('account')" :class ="activeIndex == 'account' || activeIndex == 'promServer' || activeIndex == 'dc' || activeIndex == 'model' || activeIndex == 'mib' || activeIndex == 'system' || activeIndex == 'terminallog' ? 'menu-active' :''">{{$t('overall.config')}}</div>
</template> </template>
<el-menu-item index="5-0"> <el-menu-item index="5-0">
<div @click="jumpTo('account')" :class="{'menu-item-active' :(activeIndex == 'account' )}">{{$t('config.account.account')}}</div> <div @click="jumpTo('account')" :class="{'menu-item-active' :(activeIndex == 'account' )}">{{$t('config.account.account')}}</div>
@@ -325,11 +325,6 @@
let index = this.indOf(this.activeItemIndexes, id); let index = this.indOf(this.activeItemIndexes, id);
this.activeItemIndexes=[];//2020-02-25 修改为单选 this.activeItemIndexes=[];//2020-02-25 修改为单选
this.activeItemIndexes.push(id); this.activeItemIndexes.push(id);
// if (index > -1) {
// this.activeItemIndexes.splice(index, 1);
// } else {
// this.activeItemIndexes.push(id);
// }
this.$store.state.assetData = {selectedData: this.activeItemIndexes, step: this.$store.state.assetData.step+1, type: 1}; this.$store.state.assetData = {selectedData: this.activeItemIndexes, step: this.$store.state.assetData.step+1, type: 1};
this.jumpTo('asset'); this.jumpTo('asset');
}, },
@@ -449,11 +444,6 @@
c.push(a[i]); c.push(a[i]);
} }
return c.indexOf(b); return c.indexOf(b);
/*if (c.indexOf(b) > -1) {
return true;
} else {
return false;
}*/
}, },
panelListReload(){ panelListReload(){
if(this.$route.path==='/panel'){ if(this.$route.path==='/panel'){
@@ -474,6 +464,9 @@
refreshLang() { refreshLang() {
this.language = localStorage.getItem("nz-language"); this.language = localStorage.getItem("nz-language");
this.$i18n.locale = this.language; this.$i18n.locale = this.language;
this.$nextTick(() => {
window.location.reload();
});
}, },
showPwdDialog:function(){ showPwdDialog:function(){
this.showChangePwd=true; this.showChangePwd=true;
@@ -498,7 +491,6 @@
this.getUserData(); this.getUserData();
this.getAssetData(); this.getAssetData();
this.getProjectList(); this.getProjectList();
this.refreshLang();
// 刷新后有高亮 // 刷新后有高亮
let activePath = this.$route.path.slice(1); let activePath = this.$route.path.slice(1);
this.activeIndex = activePath; this.activeIndex = activePath;
@@ -508,10 +500,7 @@
bus.$on('login', () => { bus.$on('login', () => {
this.username = sessionStorage.getItem("nz-username"); this.username = sessionStorage.getItem("nz-username");
this.refreshLang(); this.refreshLang();
this.activeIndex = 'panel'; this.activeIndex = 'overview';
/*this.$nextTick(function(){
window.location.reload();
});*/
}); });
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {

View File

@@ -654,7 +654,8 @@ const en = {
moduleAlert: 'Module alert',//"组件告警" moduleAlert: 'Module alert',//"组件告警"
deviceAlert: 'Device alert',//"设备告警" deviceAlert: 'Device alert',//"设备告警"
pending: 'Pending',//"待处理" pending: 'Pending',//"待处理"
expired: 'Expired'//"已过期" expired: 'Expired',//"已过期"
labels: 'Labels'
}, },
config: { config: {
name: 'Name',//"名称" name: 'Name',//"名称"

View File

@@ -24,8 +24,7 @@
<i v-if="data.type.toUpperCase() == 'OBJECT' && data.subTree.length == 0" class="nz-icon nz-icon-leaf"></i> <i v-if="data.type.toUpperCase() == 'OBJECT' && data.subTree.length == 0" class="nz-icon nz-icon-leaf"></i>
<i v-if="data.type.toUpperCase() == 'ENTRY'" class="nz-icon nz-icon-table-edit"></i> <i v-if="data.type.toUpperCase() == 'ENTRY'" class="nz-icon nz-icon-table-edit"></i>
<i v-if="data.type.toUpperCase() == 'TABLE'" class="nz-icon nz-icon-table"></i> <i v-if="data.type.toUpperCase() == 'TABLE'" class="nz-icon nz-icon-table"></i>
</span> <el-popover ref="walkDetail" trigger="click" placement="left" popper-class="nz-pop nz-pop-walk-detail">
<el-popover trigger="click" placement="left" v-if="data.objectID" popper-class="walk-detail">
<div> <div>
<ul> <ul>
<li><span class="metirc-tip-list">Name&nbsp;:&nbsp;</span><span>{{data.name}}</span></li> <li><span class="metirc-tip-list">Name&nbsp;:&nbsp;</span><span>{{data.name}}</span></li>
@@ -35,6 +34,7 @@
</div> </div>
<span @click.stop slot="reference"><i class="nz-icon nz-icon-info-normal metric-tip-icon"></i></span> <span @click.stop slot="reference"><i class="nz-icon nz-icon-info-normal metric-tip-icon"></i></span>
</el-popover> </el-popover>
</span>
{{data.name}} {{data.name}}
</span> </span>
</el-tree> </el-tree>
@@ -59,7 +59,7 @@
}, },
data() { data() {
return { return {
popBox: {show: false} popBox: {show: false},
} }
}, },
computed: { computed: {

View File

@@ -28,19 +28,19 @@
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.alertName}}</div> <div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.alertName}}</div>
</el-form-item> </el-form-item>
<!--type--> <!--type-->
<el-form-item :label="$t('alert.list.type')" prop="type"> <!-- <el-form-item :label="$t('alert.list.type')" prop="type">
<el-select v-if="rightBox.isEdit" @change="(val) => {changeType(val);}" popper-class="config-dropdown" v-model="alertRule.type" placeholder="" size="small" > <el-select v-if="rightBox.isEdit" @change="(val) => {changeType(val);}" popper-class="config-dropdown" v-model="alertRule.type" placeholder="" size="small" >
<el-option :id="'alert-type-'+item.value" v-for="item in typeData" :key="item.key" :label="item.value" :value="item.key"></el-option> <el-option :id="'alert-type-'+item.value" v-for="item in typeData" :key="item.key" :label="item.value" :value="item.key"></el-option>
</el-select> </el-select>
<div v-for="item in typeData" v-if="!rightBox.isEdit && item.key == alertRule.type" class="right-box-form-content-txt">{{item.value}}</div> <div v-for="item in typeData" v-if="!rightBox.isEdit && item.key == alertRule.type" class="right-box-form-content-txt">{{item.value}}</div>
</el-form-item> </el-form-item>-->
<!--linkedId--> <!--linkedId-->
<el-form-item :label="$t('alert.config.link')" prop="linkId"> <!--<el-form-item :label="$t('alert.config.link')" prop="linkId">
<el-select v-if="rightBox.isEdit" v-model="alertRule.linkId" placeholder="" size="small" popper-class="config-dropdown"> <el-select v-if="rightBox.isEdit" v-model="alertRule.linkId" placeholder="" size="small" popper-class="config-dropdown">
<el-option :id="'alert-linke-'+item.id" v-for="item in linkObjList" :key="item.id" :label="alertRule.type == 3 ? item.host : item.name" :value="item.id"></el-option> <el-option :id="'alert-linke-'+item.id" v-for="item in linkObjList" :key="item.id" :label="alertRule.type == 3 ? item.host : item.name" :value="item.id"></el-option>
</el-select> </el-select>
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.linkObject ? alertRule.linkObject.name : ''}}</div> <div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{alertRule.linkObject ? alertRule.linkObject.name : ''}}</div>
</el-form-item> </el-form-item>-->
<!--expr--> <!--expr-->
<el-form-item :label="$t('alert.config.expr')" prop="expr"> <el-form-item :label="$t('alert.config.expr')" prop="expr">
<el-input maxlength="512" rows="4" show-word-limit v-if="rightBox.isEdit" type="textarea" placeholder="" v-model="alertRule.expr" size="small"></el-input> <el-input maxlength="512" rows="4" show-word-limit v-if="rightBox.isEdit" type="textarea" placeholder="" v-model="alertRule.expr" size="small"></el-input>

View File

@@ -62,8 +62,8 @@
<el-scrollbar style="height: 100%;" ref="walkScrollbar"> <el-scrollbar style="height: 100%;" ref="walkScrollbar">
<span class="el-tag el-tag--info el-tag--small el-tag--light" v-for="item in currentModule.walk"> <span class="el-tag el-tag--info el-tag--small el-tag--light" v-for="item in currentModule.walk">
<span v-html="mibName(item)"></span> <span v-html="mibName(item)"></span>
<div @click.stop="removeWalk(item)"> <div class="walk-close-box" @click.stop="removeWalk(item)">
<i class="el-tag__close el-icon-close"></i> <i class="el-tag__close el-icon-close walk-close"></i>
</div> </div>
</span> </span>
</el-scrollbar> </el-scrollbar>
@@ -432,10 +432,21 @@
let obj = JSON.parse(response.data); let obj = JSON.parse(response.data);
this.walkData = []; this.walkData = [];
for (let item in obj) { for (let item in obj) {
this.walkData.push({name: item, subTree: obj[item]}); setAttr(obj[item], "detailShow", false);
this.walkData.push({name: item, detailShow: false, subTree: obj[item]});
} }
} }
}); });
function setAttr(tree, name, value) {
if (tree && tree.length > 0) {
for (let i = 0; i < tree.length; i++) {
tree[i][name] = value;
if (tree[i].subTree && tree[i].subTree.length > 0) {
setAttr(tree[i].subTree, name, value);
}
}
}
}
}, },
show(show, isEdit) { show(show, isEdit) {
@@ -747,4 +758,11 @@
.module-box-type { .module-box-type {
margin: 25px 0 10px -15px; margin: 25px 0 10px -15px;
} }
.walk-close-box {
margin-left: 6px;
width: 14px;
}
.walk-close {
margin-left: -6px;
}
</style> </style>

View File

@@ -61,17 +61,16 @@
<span style="padding-left: 18px;" v-if="scope.row[item.prop] == 'medium'">{{severityData[0].value}}</span> <span style="padding-left: 18px;" v-if="scope.row[item.prop] == 'medium'">{{severityData[0].value}}</span>
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span> <span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span>
</span> </span>
<span v-else-if="item.prop == 'type'"> <!--<span v-else-if="item.prop == 'type'">
<template v-for="type in typeData" v-if="type.key == scope.row[item.prop]">{{type.value}}</template> <template v-for="type in typeData" v-if="type.key == scope.row[item.prop]">{{type.value}}</template>
</span> </span>
<!-- <span v-else-if="item.prop == 'linkObject' && scope.row[item.prop]">{{scope.row.type != 3 && scope.row.linkObject ? scope.row[item.prop].name : scope.row[item.prop].host}}</span>-->
<template v-else-if="item.prop == 'linkObject'"> <template v-else-if="item.prop == 'linkObject'">
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="link too-long-split" <span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="link too-long-split"
@click="viewAlertType(scope.row['type'],scope.row[item.prop])" style="max-width: 125px;">{{scope.row[item.prop].name}}</span> @click="viewAlertType(scope.row['type'],scope.row[item.prop])" style="max-width: 125px;">{{scope.row[item.prop].name}}</span>
<span v-else-if="scope.row['type'] == 3 && scope.row[item.prop]" class="link" <span v-else-if="scope.row['type'] == 3 && scope.row[item.prop]" class="link"
@click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span> @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>-->
<template v-else-if="item.prop == 'alertNum'"> <template v-else-if="item.prop == 'alertNum'">
<span class="link" @click="queryMessage(scope.row)">{{scope.row.alertNum + ' ' + $t('overall.active')}}</span> <span class="link" @click="queryMessage(scope.row)">{{scope.row.alertNum + ' ' + $t('overall.active')}}</span>
</template> </template>
@@ -114,6 +113,7 @@
</template> </template>
<script> <script>
var vm; var vm;
import bus from '../../../libs/bus';
export default { export default {
name: "alert-config", name: "alert-config",
data() { data() {
@@ -228,7 +228,7 @@
label: this.$t("alert.config.expr"), label: this.$t("alert.config.expr"),
prop: 'expr', prop: 'expr',
show: true, show: true,
}, { }, /*{
label: this.$t("alert.list.type"), label: this.$t("alert.list.type"),
prop: 'type', prop: 'type',
show: true, show: true,
@@ -237,7 +237,7 @@
prop: 'linkObject', prop: 'linkObject',
show: true, show: true,
width: 140 width: 140
}, { }, */{
label: this.$t("alert.config.for"), label: this.$t("alert.config.for"),
prop: 'last', prop: 'last',
show: true, show: true,
@@ -349,7 +349,7 @@
this.showSubList = true; this.showSubList = true;
}, },
messageStyle(e) { messageStyle(e) {
if (e.columnIndex == 8) { if (e.columnIndex == 6) {
if (e.row.alertNum > 0) { if (e.row.alertNum > 0) {
return 'has-message'; return 'has-message';
} else { } else {
@@ -392,6 +392,7 @@
} }
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -15,21 +15,25 @@
</div> </div>
</div> </div>
<div class="content-right"> <div class="content-right">
<div class="top-tools"> <div class="main-list main-and-sub-transition" :class="{'main-list-with-sub': showSubList}">
<div class="top-tool-main-right"> <div class="top-tools" v-show="mainResizeShow">
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': showSubList}">
<div class="top-tool-search"> <div class="top-tool-search">
<search-input :searchMsg="searchMsg" @search="search"></search-input> <search-input :searchMsg="searchMsg" @search="search" :inTransform="inTransform"></search-input>
</div> </div>
</div> </div>
<div class="pagination-top pagination-top-hide display-none"></div>
</div> </div>
<el-table <el-table
class="nz-table" class="nz-table"
:data="tableData" :data="tableData"
border border
v-show="mainResizeShow"
ref="alertListTable" ref="alertListTable"
tooltip-effect="light" tooltip-effect="light"
:height="$tableHeight.normal" :height="mainTableHeight"
v-scrollBar:el-table v-scrollBar:el-table
:cell-class-name="labelsClassName"
style="width: 100%;"> style="width: 100%;">
<el-table-column <el-table-column
:resizable="false" :resizable="false"
@@ -38,7 +42,7 @@
:width="item.width" :width="item.width"
:key="`col-${index}`" :key="`col-${index}`"
:label="item.label" :label="item.label"
show-overflow-tooltip :show-overflow-tooltip="item.prop != 'labels'"
min-width="110px" min-width="110px"
> >
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
@@ -48,11 +52,11 @@
v-if="scope.row[item.prop].alertName">{{scope.row[item.prop].alertName}}</div> v-if="scope.row[item.prop].alertName">{{scope.row[item.prop].alertName}}</div>
<template v-else>-</template> <template v-else>-</template>
</template> </template>
<div v-else-if="item.prop == 'type'" class="content-right-options"> <!--<div v-else-if="item.prop == 'type'" class="content-right-options">
<span v-if="scope.row[item.prop] == 1">Project</span> <span v-if="scope.row[item.prop] == 1">Project</span>
<span v-if="scope.row[item.prop] == 2">Module</span> <span v-if="scope.row[item.prop] == 2">Module</span>
<span v-if="scope.row[item.prop] == 3">Device</span> <span v-if="scope.row[item.prop] == 3">Device</span>
</div> </div>-->
<template v-else-if="item.prop == 'summary'"> <template v-else-if="item.prop == 'summary'">
<template v-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template> <template v-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template> <template v-else>-</template>
@@ -66,7 +70,7 @@
<span style="padding-left: 18px;" v-if="scope.row[item.prop] == 'medium'">{{severityData[0].value}}</span> <span style="padding-left: 18px;" v-if="scope.row[item.prop] == 'medium'">{{severityData[0].value}}</span>
<span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span> <span v-if="scope.row[item.prop] == 'low'"><i class="el-icon-arrow-down"></i>&nbsp;{{severityData[2].value}}</span>
</span> </span>
<div v-else-if="item.prop == 'linkObject'"> <!--<div v-else-if="item.prop == 'linkObject'">
<span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="link too-long-split" <span v-if="(scope.row['type'] == 1 || scope.row['type'] == 2) && scope.row[item.prop]" class="link too-long-split"
@click="viewAlertType(scope.row['type'],scope.row[item.prop])" style="max-width: 125px;" @click="viewAlertType(scope.row['type'],scope.row[item.prop])" style="max-width: 125px;"
:id="'link-obj-'+scope.row['type']+'-'+scope.row[item.prop].id">{{scope.row[item.prop].name}}</span> :id="'link-obj-'+scope.row['type']+'-'+scope.row[item.prop].id">{{scope.row[item.prop].name}}</span>
@@ -74,7 +78,13 @@
@click="viewAlertType(scope.row['type'],scope.row[item.prop].id)" @click="viewAlertType(scope.row['type'],scope.row[item.prop].id)"
:id="'link-obj-'+scope.row['type']+'-'+scope.row[item.prop].id">{{scope.row[item.prop].host}}</span> :id="'link-obj-'+scope.row['type']+'-'+scope.row[item.prop].id">{{scope.row[item.prop].host}}</span>
<span v-else>-</span> <span v-else>-</span>
</div> </div>-->
<template v-else-if="item.prop == 'labels'">
<el-tag @click="showTagDetail(scope.row.labels, key)"
:class="{'link': key == 'asset' || key == 'endpoint' || key == 'project' || key == 'module' || key == 'datacenter'}"
:type="tagType(key)"
size="mini" v-for="(value, key) in scope.row.labels" class="alert-message-tag">{{value}}</el-tag>
</template>
<div v-else-if="item.prop == 'state'"> <div v-else-if="item.prop == 'state'">
<span class=""> <span class="">
{{scope.row['state'] == 1 ? "Pending" : ""}} {{scope.row['state'] == 1 ? "Pending" : ""}}
@@ -93,16 +103,21 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination-bottom" v-show="!showSubList">
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination> <Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
</div>
<button class="to-top" v-show="showTopBtn" @click="$toTop"><i class="nz-icon nz-icon-top"></i></button> <button class="to-top" v-show="showTopBtn" @click="$toTop"><i class="nz-icon nz-icon-top"></i></button>
</div> </div>
<alert-config-box :parentAlertRule="viewRuleData" @reload="getAlertList" ref="alertConfigBox"></alert-config-box> <bottom-box v-if="showSubList" :show-sub-list="showSubList" :subResizeShow="subResizeShow" :isFullScreen="isFullScreen" :from="'alertMessage'" :targetTab="targetTab" :detailList="tabDetailList"
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen" @listResize="listResize" :tabList="tabList"></bottom-box>
</div>
<!--<alert-config-box :parentAlertRule="viewRuleData" @reload="getAlertList" ref="alertConfigBox"></alert-config-box>
<project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-box> <project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-box>
<module-box :module="viewModuleData" @reload="getAlertList" ref="moduleBox"></module-box> <module-box :module="viewModuleData" @reload="getAlertList" ref="moduleBox"></module-box>-->
<!--<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl" <!--<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl"
ref="assetEditUnit"></asset-edit-unit>--> ref="assetEditUnit"></asset-edit-unit>-->
<asset-box :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl" <!--<asset-box :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl"
ref="assetEditUnit"></asset-box> ref="assetEditUnit"></asset-box>-->
<element-set <element-set
v-clickoutside="elementsetHide" v-clickoutside="elementsetHide"
:table-title="tableTitle" :table-title="tableTitle"
@@ -114,10 +129,24 @@
</template> </template>
<script> <script>
import bus from '../../../libs/bus';
var vm;
export default { export default {
name: "alertList", name: "alertList",
data() { data() {
vm = this;
return { return {
/*二级列表相关*/
tabList: [], //二级列表的标签
tabDetailList: [], //多个详情
targetTab: '', //展示二级列表中的哪个页签
inTransform: false, //搜索框相关搜索条件下拉框是否在transform里
mainResizeShow: true, //dom高度改变时部分内容是否展示
subResizeShow: true,
isFullScreen: false,
showSubList: false, //是否展示二级列表
mainTableHeight: this.$tableHeight.normal, //主列表table高度
tableId: 'alertListTable', //需要分页的table的id用于记录每页数量 tableId: 'alertListTable', //需要分页的table的id用于记录每页数量
showTopBtn: false, showTopBtn: false,
pageObj: { pageObj: {
@@ -131,7 +160,7 @@
prop: 'alertRule', prop: 'alertRule',
show: true, show: true,
width: 180 width: 180
}, { }, /*{
label: this.$t("alert.list.type"), label: this.$t("alert.list.type"),
prop: 'type', prop: 'type',
show: true, show: true,
@@ -141,6 +170,10 @@
prop: 'linkObject', prop: 'linkObject',
show: true, show: true,
width: 140 width: 140
}, */{
label: this.$t("alert.list.labels"),
prop: 'labels',
show: true,
}, { }, {
label: this.$t("alert.severity"), label: this.$t("alert.severity"),
prop: 'severity', prop: 'severity',
@@ -241,6 +274,17 @@
viewAssetState: false, viewAssetState: false,
} }
}, },
computed: {
tagType() {
return (key) => {
if (key == 'asset' || key == 'module' || key == 'project' || key == 'datacenter' || key == 'endpoint') {
return "";
} else {
return "info";
}
}
}
},
methods: { methods: {
elementsetShow(s, e) { elementsetShow(s, e) {
var eventfixed = { var eventfixed = {
@@ -277,10 +321,13 @@
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize); this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
this.$get('alert/message', this.searchLabel).then(response => { this.$get('alert/message', this.searchLabel).then(response => {
if (response.code == 200) { if (response.code == 200) {
this.tableData = response.data.list this.tableData = response.data.list;
this.pageObj.total = response.data.total this.tableData.forEach((item) => {
item.labels = JSON.parse(item.labels);
});
this.pageObj.total = response.data.total;
} }
}) });
}, },
//asset弹框控制 //asset弹框控制
tabControl(data) { tabControl(data) {
@@ -289,7 +336,47 @@
this.$refs['assetEditUnit'].tabView = false this.$refs['assetEditUnit'].tabView = false
} }
}, },
// 全屏
fullScreen() {
this.$bottomBoxWindow.fullScreen(vm);
},
// 退出全屏
exitFullScreen() {
this.$bottomBoxWindow.exitFullScreen(vm);
},
// 鼠标拖动二级列表
listResize(e) {
this.$bottomBoxWindow.listResize(vm, e);
},
showTagDetail(labels, key) {
let open = false;
if (key == "asset" || key == "project" || key == "module" || key == "endpoint" || key == "datacenter") {
open = true;
}
if (open) {
let labelList = [];
let detailList = [];
for (let item in labels) {
if (item == "asset" || item == "project" || item == "module" || item == "endpoint" || item == "datacenter") {
labelList.push(item);
detailList.push(labels[item]);
}
}
this.showSubList = true;
this.tabList = labelList;
this.tabDetailList = detailList;
this.targetTab = key;
}
},
labelsClassName(row) {
if (row.columnIndex == 1) {
return "alert-message-list-labels";
} else {
return "";
}
},
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$store.state.assetData.moduleData = data this.$store.state.assetData.moduleData = data
this.$store.state.assetData.selectedData = id this.$store.state.assetData.selectedData = id
this.$router.push({ this.$router.push({
@@ -366,6 +453,11 @@
this.viewAssetState = false; this.viewAssetState = false;
} }
}, },
watch: {
showSubList(n) {
this.$bottomBoxWindow.showSubListWatch(vm, n);
},
},
mounted() { mounted() {
//是否存在分页缓存 //是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId); let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);

View File

@@ -189,6 +189,7 @@
</template> </template>
<script> <script>
var vm; var vm;
import bus from '../../../libs/bus';
export default { export default {
name: "account", name: "account",
data() { data() {
@@ -329,6 +330,7 @@
this.$bottomBoxWindow.listResize(vm, e); this.$bottomBoxWindow.listResize(vm, e);
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -160,6 +160,7 @@
</template> </template>
<script> <script>
var vm; var vm;
import bus from '../../../libs/bus';
export default { export default {
name: "dc", name: "dc",
data() { data() {
@@ -288,6 +289,7 @@
this.tablelable = data; this.tablelable = data;
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -113,6 +113,7 @@
</template> </template>
<script> <script>
import axios from 'axios' import axios from 'axios'
import bus from '../../../libs/bus';
export default { export default {
name: "mib", name: "mib",
data() { data() {
@@ -257,6 +258,7 @@
this.rightBox.show = false; this.rightBox.show = false;
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -92,6 +92,7 @@
</template> </template>
<script> <script>
import bus from '../../../libs/bus';
export default { export default {
name: "model", name: "model",
data() { data() {
@@ -231,6 +232,7 @@
this.rightBox.show = false; this.rightBox.show = false;
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -193,7 +193,7 @@
<script> <script>
import {host} from '../../common/js/validate'; import {host} from '../../common/js/validate';
import {port} from '../../common/js/validate'; import {port} from '../../common/js/validate';
import bus from '../../../libs/bus';
var vm; var vm;
export default { export default {
name: "prom", name: "prom",
@@ -568,6 +568,7 @@
this.rightBox.show = false; this.rightBox.show = false;
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -186,6 +186,7 @@
import {port} from '../../common/js/validate' import {port} from '../../common/js/validate'
import {domain} from '../../common/js/validate' import {domain} from '../../common/js/validate'
import {host} from '../../common/js/validate' import {host} from '../../common/js/validate'
import bus from '../../../libs/bus';
export default { export default {
name: "system", name: "system",
@@ -410,6 +411,7 @@
} }
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -95,6 +95,7 @@
</div> </div>
</template> </template>
<script> <script>
import bus from '../../../libs/bus';
export default { export default {
name: "terminallog", name: "terminallog",
data() { data() {
@@ -278,6 +279,7 @@
}) })
}, },
jumpTo(data, id) { jumpTo(data, id) {
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -197,6 +197,7 @@ export default {
jumpTo(data,id) { jumpTo(data,id) {
//this.$store.state.assetData.moduleData = data; //this.$store.state.assetData.moduleData = data;
//this.$store.state.assetData.selectedData = id; //this.$store.state.assetData.selectedData = id;
bus.$emit("menu-change", data);
this.$store.state.showPanel.id = 0; this.$store.state.showPanel.id = 0;
this.$store.state.showPanel.name = ''; this.$store.state.showPanel.name = '';
this.$router.push({ this.$router.push({

View File

@@ -94,6 +94,7 @@
import chart from "./chart"; import chart from "./chart";
import axios from 'axios'; import axios from 'axios';
import chartDataFormat from "../../../charts/chartDataFormat"; import chartDataFormat from "../../../charts/chartDataFormat";
import bus from '../../../../libs/bus';
export default { export default {
name: "overview", name: "overview",
components:{ components:{
@@ -1139,6 +1140,7 @@
jumpTo(data, id) { jumpTo(data, id) {
//this.$store.state.assetData.moduleData = data //this.$store.state.assetData.moduleData = data
//this.$store.state.assetData.selectedData = id //this.$store.state.assetData.selectedData = id
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -428,6 +428,7 @@
jumpTo(data, id) { jumpTo(data, id) {
//this.$store.state.assetData.moduleData = data //this.$store.state.assetData.moduleData = data
//this.$store.state.assetData.selectedData = id //this.$store.state.assetData.selectedData = id
bus.$emit("menu-change", data);
this.$router.push({ this.$router.push({
path: "/" + data, path: "/" + data,
query: { query: {

View File

@@ -1233,7 +1233,7 @@
.metric-tip-icon{ .metric-tip-icon{
vertical-align: middle; vertical-align: middle;
/*color: #3971BA;*/ /*color: #3971BA;*/
-webkit-transform:scale(0.6); transform: scale(0.6);
/*-webkit-transform-origin: left top;*/ /*-webkit-transform-origin: left top;*/
display:inline-block; display:inline-block;
} }