feat: alert-rule、asset的alert-message二级列表
This commit is contained in:
@@ -91,6 +91,13 @@
|
|||||||
<template v-else>-</template>
|
<template v-else>-</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column width="28" :resizable="false">
|
||||||
|
<template slot="header" slot-scope="scope">
|
||||||
|
<span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">
|
||||||
|
<i class="nz-icon nz-icon-gear"></i>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
<button class="to-top" v-show="showTopBtn && subResizeShow" @click="toTop('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" v-show="showTopBtn && subResizeShow" @click="toTop('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
@@ -98,6 +105,16 @@
|
|||||||
<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-box :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl" ref="assetEditUnit"></asset-box>
|
<asset-box :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl" ref="assetEditUnit"></asset-box>
|
||||||
|
<element-set
|
||||||
|
v-if="showElementSet"
|
||||||
|
v-clickoutside="elementsetHide"
|
||||||
|
:table-title="tableTitle"
|
||||||
|
:dropCol="dropCol"
|
||||||
|
:path="'/alertList'"
|
||||||
|
@close="elementsetHide"
|
||||||
|
@tablelable="tablelabelEmit"
|
||||||
|
ref="elementset"
|
||||||
|
></element-set>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -113,6 +130,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showElementSet: false,
|
||||||
tableId: 'alertListTable', //需要分页的table的id,用于记录每页数量
|
tableId: 'alertListTable', //需要分页的table的id,用于记录每页数量
|
||||||
showTopBtn: false, //top按钮是否显示
|
showTopBtn: false, //top按钮是否显示
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -232,6 +250,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
elementsetShow(s, e) {
|
||||||
|
this.showElementSet = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
var eventfixed = {
|
||||||
|
shezhi: 0,
|
||||||
|
screen: 0
|
||||||
|
};
|
||||||
|
eventfixed[s] = 1;
|
||||||
|
e.preventDefault();
|
||||||
|
this.$store.commit('setHeaderTable', this.tablelable);
|
||||||
|
this.$store.commit('setEventfixed', eventfixed);
|
||||||
|
const h = document.documentElement.clientHeight;
|
||||||
|
const w = document.documentElement.clientWidth;
|
||||||
|
const dw = this.$refs.elementset.$el.offsetWidth;
|
||||||
|
const dh = this.$refs.elementset.$el.offsetHeight;
|
||||||
|
let positionx =
|
||||||
|
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
||||||
|
let positiony =
|
||||||
|
e.clientY + dh <= h - 10
|
||||||
|
? e.clientY
|
||||||
|
: e.clientY - (e.clientY + dh - h);
|
||||||
|
this.$store.commit('setPosition', {positionx, positiony});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
elementsetHide() {
|
||||||
|
//悬浮点击空白隐藏
|
||||||
|
//this.$refs.elementset.elementsetHide();
|
||||||
|
this.showElementSet = false;
|
||||||
|
},
|
||||||
|
tablelabelEmit(data) {
|
||||||
|
//获取子组件传过来的参数
|
||||||
|
this.$store.commit('setHeaderTable', data);
|
||||||
|
this.tablelable = data;
|
||||||
|
this.dropCol = data;
|
||||||
|
},
|
||||||
getAlertList() {
|
getAlertList() {
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -256,6 +309,11 @@
|
|||||||
},
|
},
|
||||||
search: function (searchObj) {
|
search: function (searchObj) {
|
||||||
this.searchLabel = {};
|
this.searchLabel = {};
|
||||||
|
if (this.from == "alertRule") {
|
||||||
|
this.searchLabel.alertName = this.obj.alertName;
|
||||||
|
} else if (this.from == "asset") {
|
||||||
|
|
||||||
|
}
|
||||||
this.pageObj.pageNo = 1;
|
this.pageObj.pageNo = 1;
|
||||||
for (let item in searchObj) {
|
for (let item in searchObj) {
|
||||||
if (searchObj[item]) {
|
if (searchObj[item]) {
|
||||||
@@ -264,7 +322,8 @@
|
|||||||
}
|
}
|
||||||
this.getAlertList();
|
this.getAlertList();
|
||||||
},
|
},
|
||||||
viewAlertType: function (type, typeObj) {
|
viewAlertType(type, typeObj) {
|
||||||
|
console.info(type, typeObj)
|
||||||
this.closeViews();
|
this.closeViews();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -296,7 +355,6 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeViews: function () {
|
closeViews: function () {
|
||||||
this.$refs.alertConfigBox.show(false, false);
|
|
||||||
this.$refs.projectBox.show(false, false);
|
this.$refs.projectBox.show(false, false);
|
||||||
this.$refs.moduleBox.show(false, false);
|
this.$refs.moduleBox.show(false, false);
|
||||||
this.viewAssetState = false;
|
this.viewAssetState = false;
|
||||||
@@ -328,11 +386,16 @@
|
|||||||
deep: true,
|
deep: true,
|
||||||
handler(n) {
|
handler(n) {
|
||||||
if (this.from == "alertRule") {
|
if (this.from == "alertRule") {
|
||||||
|
this.searchMsg.searchLabelList = this.searchMsg.searchLabelList.filter((item, index) => {
|
||||||
|
return item.label != "alertName" && item.label != "severity"
|
||||||
|
});
|
||||||
this.searchLabel.alertName = this.obj.alertName;
|
this.searchLabel.alertName = this.obj.alertName;
|
||||||
this.searchLabel.host = "";
|
|
||||||
} else if (this.from == "asset") {
|
} else if (this.from == "asset") {
|
||||||
this.searchLabel.host = this.obj.host;
|
this.searchMsg.searchLabelList = this.searchMsg.searchLabelList.filter((item, index) => {
|
||||||
this.searchLabel.alertName = "";
|
return item.label != "alertType" && item.label != "asset"
|
||||||
|
});
|
||||||
|
this.searchLabel.type = 3;
|
||||||
|
this.searchLabel.linkId = this.obj.id;
|
||||||
}
|
}
|
||||||
this.getAlertList();
|
this.getAlertList();
|
||||||
}
|
}
|
||||||
@@ -357,11 +420,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList")
|
||||||
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList"))
|
||||||
: this.tableTitle;
|
: this.tableTitle;
|
||||||
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList")
|
||||||
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList"))
|
||||||
: this.tableTitle;
|
: this.tableTitle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="pop-elementset"
|
class="pop-elementset"
|
||||||
v-clickoutside="elementsetHide"
|
|
||||||
:style="{opacity:(eventfixedVal.shezhi==1),left:(eventfixedVal.shezhi==1 ? event_positionx : -2000)+'px',top:(event_positiony)+'px'}"
|
:style="{opacity:(eventfixedVal.shezhi==1),left:(eventfixedVal.shezhi==1 ? event_positionx : -2000)+'px',top:(event_positiony)+'px'}"
|
||||||
>
|
>
|
||||||
<!--<div class="pop-top-btns">
|
<!--<div class="pop-top-btns">
|
||||||
@@ -56,7 +55,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ["dropCol","tableTitle"],
|
props: ["dropCol","tableTitle","path"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
other: this.$t("overall.other"),
|
other: this.$t("overall.other"),
|
||||||
@@ -110,6 +109,7 @@ export default {
|
|||||||
//悬浮点击空白隐藏
|
//悬浮点击空白隐藏
|
||||||
elementsetHide() {
|
elementsetHide() {
|
||||||
this.eventfixedVal.shezhi = 0;
|
this.eventfixedVal.shezhi = 0;
|
||||||
|
this.$emit('close');
|
||||||
},
|
},
|
||||||
//点击全选all或者cancel按钮
|
//点击全选all或者cancel按钮
|
||||||
dropAll(state) {
|
dropAll(state) {
|
||||||
@@ -134,7 +134,7 @@ export default {
|
|||||||
if (t == "ok") {
|
if (t == "ok") {
|
||||||
this.$emit("tablelable", JSON.parse(JSON.stringify(this.dropColRes)));
|
this.$emit("tablelable", JSON.parse(JSON.stringify(this.dropColRes)));
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path,
|
"nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + ((typeof this.path != 'undefined') ? this.path : this.$route.path),
|
||||||
JSON.stringify(this.tablelable)
|
JSON.stringify(this.tablelable)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ const en = {
|
|||||||
assetState: 'State',//'状态'
|
assetState: 'State',//'状态'
|
||||||
assetPing: 'Ping',
|
assetPing: 'Ping',
|
||||||
modules: 'Endpoint',//'组件'
|
modules: 'Endpoint',//'组件'
|
||||||
alerts: 'Alert message',//'告警信息'
|
alerts: 'Alerts',//'告警信息'
|
||||||
dataCenter: 'DC',//DC
|
dataCenter: 'DC',//DC
|
||||||
cabinet: 'Cabinet',//'机柜'
|
cabinet: 'Cabinet',//'机柜'
|
||||||
model: 'Model',//'型号'
|
model: 'Model',//'型号'
|
||||||
@@ -531,6 +531,7 @@ const en = {
|
|||||||
createAlertConfig: 'New alert rule',//"新增告警规则"
|
createAlertConfig: 'New alert rule',//"新增告警规则"
|
||||||
editAlertConfig: 'Edit alert rule',//"修改告警规则"
|
editAlertConfig: 'Edit alert rule',//"修改告警规则"
|
||||||
medium: 'Medium',//"中"
|
medium: 'Medium',//"中"
|
||||||
|
alertNum: 'Alert number', //告警信息数量
|
||||||
high: 'High',//"高"
|
high: 'High',//"高"
|
||||||
low: 'Low',//"低"
|
low: 'Low',//"低"
|
||||||
typeOption: {
|
typeOption: {
|
||||||
|
|||||||
@@ -71,7 +71,10 @@
|
|||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.prop == 'alertName'">{{scope.row.alertName}}</template>
|
<template v-else-if="item.prop == 'alertName'">{{scope.row.alertName}}</template>
|
||||||
<template v-else-if="item.prop == 'id'"><span class="link" @click="queryMessage(scope.row)">{{scope.row.id}}</span></template>
|
<template v-else-if="item.prop == 'alertNum'">
|
||||||
|
<span v-if="scope.row.alertNum" class="link" @click="queryMessage(scope.row)">{{scope.row.alertNum}}</span>
|
||||||
|
<template v-else>0</template>
|
||||||
|
</template>
|
||||||
<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>
|
||||||
</template>
|
</template>
|
||||||
@@ -89,7 +92,7 @@
|
|||||||
</div>
|
</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-message-box v-if="showSubList" @listResize="listResize" :show-sub-list="showSubList" :from="'alertRule'" :subResizeShow="subResizeShow" :obj="alertRule" :isFullScreen="isFullScreen"
|
<alert-message-box v-if="showSubList" @listResize="listResize" :show-sub-list="showSubList" :from="'alertRule'" :subResizeShow="subResizeShow" :obj="alertRuleForMessage" :isFullScreen="isFullScreen"
|
||||||
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen"></alert-message-box>
|
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen"></alert-message-box>
|
||||||
</div>
|
</div>
|
||||||
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
|
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
|
||||||
@@ -100,6 +103,8 @@
|
|||||||
<asset-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
|
<asset-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
|
||||||
ref="assetEditUnit"></asset-box>
|
ref="assetEditUnit"></asset-box>
|
||||||
<element-set
|
<element-set
|
||||||
|
v-if="showElementSet"
|
||||||
|
@close="elementsetHide"
|
||||||
v-clickoutside="elementsetHide"
|
v-clickoutside="elementsetHide"
|
||||||
:table-title="tableTitle"
|
:table-title="tableTitle"
|
||||||
:dropCol="dropCol"
|
:dropCol="dropCol"
|
||||||
@@ -114,6 +119,7 @@
|
|||||||
name: "alert-config",
|
name: "alert-config",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showElementSet: false, //控制自定义列的弹框
|
||||||
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
||||||
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
||||||
subResizeShow: true,
|
subResizeShow: true,
|
||||||
@@ -167,6 +173,7 @@
|
|||||||
description: '',
|
description: '',
|
||||||
receiver: '',
|
receiver: '',
|
||||||
},
|
},
|
||||||
|
alertRuleForMessage: {}, //传给alertMessage上滑框的对象
|
||||||
tablelable: [],
|
tablelable: [],
|
||||||
dropCol: [],
|
dropCol: [],
|
||||||
pageObj: {
|
pageObj: {
|
||||||
@@ -213,6 +220,11 @@
|
|||||||
prop: 'alertName',
|
prop: 'alertName',
|
||||||
show: true,
|
show: true,
|
||||||
width: 120
|
width: 120
|
||||||
|
}, {
|
||||||
|
label: this.$t("alert.config.alertNum"),
|
||||||
|
prop: 'alertNum',
|
||||||
|
show: true,
|
||||||
|
width: 120
|
||||||
}, {
|
}, {
|
||||||
label: this.$t("alert.config.expr"),
|
label: this.$t("alert.config.expr"),
|
||||||
prop: 'expr',
|
prop: 'expr',
|
||||||
@@ -257,7 +269,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
queryMessage(alertRule) {
|
queryMessage(alertRule) {
|
||||||
this.alertRule = alertRule;
|
this.alertRuleForMessage = alertRule;
|
||||||
this.showSubList = true;
|
this.showSubList = true;
|
||||||
},
|
},
|
||||||
// 鼠标拖动二级列表
|
// 鼠标拖动二级列表
|
||||||
@@ -328,6 +340,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
elementsetShow(s, e) {
|
elementsetShow(s, e) {
|
||||||
|
this.showElementSet = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
var eventfixed = {
|
var eventfixed = {
|
||||||
shezhi: 0,
|
shezhi: 0,
|
||||||
screen: 0
|
screen: 0
|
||||||
@@ -347,15 +361,18 @@
|
|||||||
? e.clientY + 20
|
? e.clientY + 20
|
||||||
: e.clientY + 20 - (e.clientY + dh - h);
|
: e.clientY + 20 - (e.clientY + dh - h);
|
||||||
this.$store.commit('setPosition', {positionx, positiony});
|
this.$store.commit('setPosition', {positionx, positiony});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
elementsetHide() {
|
elementsetHide() {
|
||||||
//悬浮点击空白隐藏
|
//悬浮点击空白隐藏
|
||||||
this.$refs.elementset.elementsetHide();
|
//this.$refs.elementset.elementsetHide();
|
||||||
|
this.showElementSet = false;
|
||||||
},
|
},
|
||||||
tablelabelEmit(data) {
|
tablelabelEmit(data) {
|
||||||
//获取子组件传过来的参数
|
//获取子组件传过来的参数
|
||||||
this.$store.commit('setHeaderTable', data);
|
this.$store.commit('setHeaderTable', data);
|
||||||
this.tablelable = data;
|
this.tablelable = data;
|
||||||
|
this.dropCol = data;
|
||||||
},
|
},
|
||||||
toEdit: function (u) {
|
toEdit: function (u) {
|
||||||
this.alertRule = Object.assign({}, u);
|
this.alertRule = Object.assign({}, u);
|
||||||
@@ -528,9 +545,6 @@
|
|||||||
if (!n) {
|
if (!n) {
|
||||||
this.mainTableHeight = this.$tableHeight.normal; //重置table的高度
|
this.mainTableHeight = this.$tableHeight.normal; //重置table的高度
|
||||||
this.isFullScreen = false;
|
this.isFullScreen = false;
|
||||||
//重置二级列表数据
|
|
||||||
this.selectedEndpoints=[];
|
|
||||||
this.showTableData = [];
|
|
||||||
//移动分页组件的位置
|
//移动分页组件的位置
|
||||||
let paginationTop = document.querySelector(".pagination-top");
|
let paginationTop = document.querySelector(".pagination-top");
|
||||||
let paginationBottom = document.querySelector(".pagination-bottom");
|
let paginationBottom = document.querySelector(".pagination-bottom");
|
||||||
@@ -546,7 +560,6 @@
|
|||||||
paginationBottom.appendChild(paginationTop.removeChild(document.querySelector(".pagination")));
|
paginationBottom.appendChild(paginationTop.removeChild(document.querySelector(".pagination")));
|
||||||
}, 210);
|
}, 210);
|
||||||
|
|
||||||
this.showTopBtn1 = false;
|
|
||||||
// 主列表恢复全屏
|
// 主列表恢复全屏
|
||||||
this.mainResizeShow = this.subResizeShow = true;
|
this.mainResizeShow = this.subResizeShow = true;
|
||||||
document.querySelector('.main-list').style.height = "";
|
document.querySelector('.main-list').style.height = "";
|
||||||
|
|||||||
@@ -32,28 +32,32 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-right">
|
<div class="content-right">
|
||||||
<div class="top-tools">
|
<div class="main-list" :class="{'main-list-with-sub': showSubList}">
|
||||||
<div class="top-tool-main-right">
|
<div class="top-tools" v-show="mainResizeShow">
|
||||||
<div class="top-tool-search margin-r-20"><search-input :searchMsg="searchMsg" @search="search"></search-input></div>
|
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': showSubList}">
|
||||||
|
<div class="top-tool-search margin-r-20"><search-input :searchMsg="searchMsg" @search="search" :inTransform="inTransform"></search-input></div>
|
||||||
<export-excel
|
<export-excel
|
||||||
export-file-name="asset"
|
export-file-name="asset"
|
||||||
export-url="/asset/export"
|
export-url="/asset/export"
|
||||||
:params="searchLabel"
|
:params="searchLabel"
|
||||||
@afterImport="getAssetData"
|
@afterImport="getAssetData"
|
||||||
|
style="width: 59px;"
|
||||||
class="float-right">
|
class="float-right">
|
||||||
<template slot="optionZone">
|
<template slot="optionZone">
|
||||||
<i class="nz-icon nz-icon-create-square" @click.stop="tagShow('showAdd')" :title="$t('overall.createAsset')" ></i>
|
<i class="nz-icon nz-icon-create-square" @click.stop="tagShow('showAdd')" :title="$t('overall.createAsset')" ></i>
|
||||||
</template>
|
</template>
|
||||||
</export-excel>
|
</export-excel>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pagination-top pagination-top-hide display-none"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
class="nz-table"
|
class="nz-table"
|
||||||
:height="$tableHeight.normal"
|
:height="mainTableHeight"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
v-scrollBar:el-table
|
v-scrollBar:el-table
|
||||||
|
v-show="mainResizeShow"
|
||||||
border
|
border
|
||||||
tooltip-effect="light"
|
tooltip-effect="light"
|
||||||
ref="assetTable"
|
ref="assetTable"
|
||||||
@@ -116,8 +120,8 @@
|
|||||||
<template v-if="item.prop=='Alert'">
|
<template v-if="item.prop=='Alert'">
|
||||||
<!-- <button type="button" v-if="scope.row.alertNum > 0" id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row.id)" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-75">{{scope.row.alertNum}}</button>-->
|
<!-- <button type="button" v-if="scope.row.alertNum > 0" id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row.id)" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-75">{{scope.row.alertNum}}</button>-->
|
||||||
<!-- <button type="button" v-else class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-75 nz-btn-disabled">{{scope.row.alertNum}}</button>-->
|
<!-- <button type="button" v-else class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-75 nz-btn-disabled">{{scope.row.alertNum}}</button>-->
|
||||||
<span v-if="scope.row.alertNum > 0" id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row.id)" class="clickable">{{scope.row.alertNum}}</span>
|
<span v-if="scope.row.alertNum" :id="'asset-alerts-'+scope.row.id" @click="jumpToAlertMsg(scope.row)" class="link">{{scope.row.alertNum}}</span>
|
||||||
<span v-else class="unclickable">{{scope.row.alertNum}}</span>
|
<span v-else>0</span>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="item.prop=='dataCenter'">
|
<div v-if="item.prop=='dataCenter'">
|
||||||
<!-- <idc-config-box :post-idc="JSON.parse(JSON.stringify(scope.row.idc))" ref="idcConfigBox" :is-edit="false" placement="left" @after="getAssetData(null, true)" :button-class="'checkbox-edit'" :user-data="idcUserData">-->
|
<!-- <idc-config-box :post-idc="JSON.parse(JSON.stringify(scope.row.idc))" ref="idcConfigBox" :is-edit="false" placement="left" @after="getAssetData(null, true)" :button-class="'checkbox-edit'" :user-data="idcUserData">-->
|
||||||
@@ -179,9 +183,14 @@
|
|||||||
</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-message-box v-if="showSubList" @listResize="listResize" :show-sub-list="showSubList" :from="'asset'" :subResizeShow="subResizeShow" :obj="alertMsgAsset" :isFullScreen="isFullScreen"
|
||||||
|
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen"></alert-message-box>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--<asset-add-unit :add-unit-show='addUnitShow' @refreshData="flushData" ref="assetAddUnit"
|
<!--<asset-add-unit :add-unit-show='addUnitShow' @refreshData="flushData" ref="assetAddUnit"
|
||||||
@sendStateData="tabControl"></asset-add-unit>
|
@sendStateData="tabControl"></asset-add-unit>
|
||||||
@@ -190,6 +199,8 @@
|
|||||||
<asset-box :edit-unit-show='editUnitShow' @refreshData="flushData" @sendStateData="tabControl"
|
<asset-box :edit-unit-show='editUnitShow' @refreshData="flushData" @sendStateData="tabControl"
|
||||||
ref="assetEditUnit"></asset-box>
|
ref="assetEditUnit"></asset-box>
|
||||||
<element-set
|
<element-set
|
||||||
|
v-if="showElementSet"
|
||||||
|
@close="elementsetHide"
|
||||||
v-clickoutside="elementsetHide"
|
v-clickoutside="elementsetHide"
|
||||||
:drop-col="dropCol"
|
:drop-col="dropCol"
|
||||||
:table-title="tableTitle"
|
:table-title="tableTitle"
|
||||||
@@ -213,6 +224,15 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
alertMsgAsset: {}, //告警信息对应的asset对象
|
||||||
|
showElementSet: false, //控制自定义列的弹框
|
||||||
|
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
||||||
|
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
||||||
|
subResizeShow: true,
|
||||||
|
isFullScreen: false,
|
||||||
|
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
||||||
|
showSubList: false, //是否展示二级列表
|
||||||
|
showElementSet: false, //自定义列弹框是否显示
|
||||||
tableId: 'assetTable', //需要分页的table的id,用于记录每页数量
|
tableId: 'assetTable', //需要分页的table的id,用于记录每页数量
|
||||||
searchMsg: { //给搜索框子组件传递的信息
|
searchMsg: { //给搜索框子组件传递的信息
|
||||||
zheze_none: true,
|
zheze_none: true,
|
||||||
@@ -292,7 +312,7 @@
|
|||||||
label: this.$t("asset.tableTitle.alerts"),
|
label: this.$t("asset.tableTitle.alerts"),
|
||||||
prop: 'Alert',
|
prop: 'Alert',
|
||||||
show: true,
|
show: true,
|
||||||
width: 105
|
width: 80
|
||||||
}, {
|
}, {
|
||||||
label: this.$t("asset.tableTitle.dataCenter"),
|
label: this.$t("asset.tableTitle.dataCenter"),
|
||||||
prop: 'dataCenter',
|
prop: 'dataCenter',
|
||||||
@@ -427,9 +447,146 @@
|
|||||||
}
|
}
|
||||||
this.getAssetData();
|
this.getAssetData();
|
||||||
}, 50);
|
}, 50);
|
||||||
|
},
|
||||||
|
showSubList(n) {
|
||||||
|
this.inTransform = n;
|
||||||
|
if (!n) {
|
||||||
|
this.mainTableHeight = this.$tableHeight.normal; //重置table的高度
|
||||||
|
this.isFullScreen = false;
|
||||||
|
//移动分页组件的位置
|
||||||
|
let paginationTop = document.querySelector(".pagination-top");
|
||||||
|
let paginationBottom = document.querySelector(".pagination-bottom");
|
||||||
|
paginationTop.classList.remove("display-none");
|
||||||
|
if (paginationTop.classList.contains("pagination-top-show")) {
|
||||||
|
paginationTop.classList.remove("pagination-top-show");
|
||||||
|
}
|
||||||
|
if (!paginationTop.classList.contains("pagination-top-hide")) {
|
||||||
|
paginationTop.classList.add("pagination-top-hide");
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
paginationTop.classList.add("display-none");
|
||||||
|
paginationBottom.appendChild(paginationTop.removeChild(document.querySelector(".pagination")));
|
||||||
|
}, 210);
|
||||||
|
|
||||||
|
// 主列表恢复全屏
|
||||||
|
this.mainResizeShow = this.subResizeShow = true;
|
||||||
|
document.querySelector('.main-list').style.height = "";
|
||||||
|
//副列表高度清空
|
||||||
|
document.querySelector(".sub-list").style.height = '';
|
||||||
|
} else {
|
||||||
|
this.mainTableHeight = this.$tableHeight.openSubList.mainList; //重置table高度
|
||||||
|
//移动分页组件的位置
|
||||||
|
let paginationTop = document.querySelector(".pagination-top");
|
||||||
|
paginationTop.appendChild(document.querySelector(".pagination-bottom").removeChild(document.querySelector(".pagination")));
|
||||||
|
paginationTop.classList.remove("display-none");
|
||||||
|
setTimeout(() => {
|
||||||
|
if (paginationTop.classList.contains("pagination-top-hide")) {
|
||||||
|
paginationTop.classList.remove("pagination-top-hide");
|
||||||
|
}
|
||||||
|
if (!paginationTop.classList.contains("pagination-top-show")) {
|
||||||
|
paginationTop.classList.add("pagination-top-show");
|
||||||
|
}
|
||||||
|
}, 210);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 鼠标拖动二级列表
|
||||||
|
listResize(e) {
|
||||||
|
let mainListDom = document.querySelector(".main-list-with-sub"); //主列表
|
||||||
|
let subListDom = document.querySelector(".sub-list"); //副列表
|
||||||
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
||||||
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
||||||
|
//得到点击时俩dom的初始高度:
|
||||||
|
let mainInitialHeight = mainListDom.offsetHeight;
|
||||||
|
let subInitialHeight = subListDom.offsetHeight;
|
||||||
|
//点击时鼠标的Y轴位置
|
||||||
|
let mouseInitialY = e.clientY;
|
||||||
|
|
||||||
|
let _this = this;
|
||||||
|
|
||||||
|
document.onmousemove = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
//得到鼠标拖动的距离
|
||||||
|
let mouseMoveY = Math.abs(e.clientY - mouseInitialY);
|
||||||
|
|
||||||
|
//往上方拖动:
|
||||||
|
if (e.clientY < mouseInitialY) {
|
||||||
|
mainListDom.style.height = mainInitialHeight-mouseMoveY+'px';
|
||||||
|
subListDom.style.height = subInitialHeight+mouseMoveY+'px';
|
||||||
|
}
|
||||||
|
//往下方拖动:
|
||||||
|
if (e.clientY > mouseInitialY) {
|
||||||
|
mainListDom.style.height = mainInitialHeight+mouseMoveY+'px';
|
||||||
|
subListDom.style.height = subInitialHeight-mouseMoveY+'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主、副列表最小高度限制为15px
|
||||||
|
if(parseInt(mainListDom.style.height) >= contentRightHeight-15){
|
||||||
|
mainListDom.style.height = contentRightHeight-15+'px';
|
||||||
|
}
|
||||||
|
if(parseInt(mainListDom.style.height) <= 15){
|
||||||
|
mainListDom.style.height = 15+'px';
|
||||||
|
}
|
||||||
|
if(parseInt(subListDom.style.height) >= contentRightHeight-15){
|
||||||
|
subListDom.style.height = contentRightHeight-15+'px';
|
||||||
|
}
|
||||||
|
if(parseInt(subListDom.style.height) <= 15){
|
||||||
|
subListDom.style.height = 15+'px';
|
||||||
|
}
|
||||||
|
//当主副列表可视区域小于一定值时,不展示内容
|
||||||
|
if(parseInt(mainListDom.style.height) <= 100){
|
||||||
|
if (_this.mainResizeShow) {
|
||||||
|
_this.mainResizeShow = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!_this.mainResizeShow) {
|
||||||
|
_this.mainResizeShow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(parseInt(subListDom.offsetHeight) <= 100){
|
||||||
|
if (_this.subResizeShow) {
|
||||||
|
_this.subResizeShow = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!_this.subResizeShow) {
|
||||||
|
_this.subResizeShow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.onmouseup = () => {
|
||||||
|
document.onmousemove = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exitFullScreen() {
|
||||||
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
||||||
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
||||||
|
//主列表
|
||||||
|
document.querySelector(".main-list-with-sub").style.height = this.mainListHeight ? this.mainListHeight + 'px' : 'calc(50% - 4px)';
|
||||||
|
|
||||||
|
//副列表
|
||||||
|
document.querySelector(".sub-list").style.height = this.mainListHeight ? contentRightHeight-this.mainListHeight-9 + 'px' : 'calc(50% - 4px)';
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isFullScreen = false;
|
||||||
|
if (document.querySelector(".main-list-with-sub").offsetHeight >= 100) {
|
||||||
|
this.mainResizeShow = true;
|
||||||
|
}
|
||||||
|
if (document.querySelector(".sub-list").offsetHeight >= 100) {
|
||||||
|
this.subResizeShow = true;
|
||||||
|
}
|
||||||
|
}, 210);
|
||||||
|
},
|
||||||
|
fullScreen() {
|
||||||
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
||||||
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
||||||
|
this.isFullScreen = true;
|
||||||
|
//主列表
|
||||||
|
this.mainListHeight = document.querySelector(".main-list-with-sub").offsetHeight; //记录全屏前主列表的高度
|
||||||
|
document.querySelector(".main-list-with-sub").style.height = '0';
|
||||||
|
this.mainResizeShow = false;
|
||||||
|
//副列表
|
||||||
|
document.querySelector(".sub-list").style.height = contentRightHeight + 'px';
|
||||||
|
},
|
||||||
dcSelectAll(val) { //DC全选
|
dcSelectAll(val) { //DC全选
|
||||||
if (this.checkListData.length > 0) {
|
if (this.checkListData.length > 0) {
|
||||||
this.checkList = [];
|
this.checkList = [];
|
||||||
@@ -463,6 +620,8 @@
|
|||||||
this.$refs['moduleListPop' + id][0].getModuleList();
|
this.$refs['moduleListPop' + id][0].getModuleList();
|
||||||
},
|
},
|
||||||
elementsetShow(s, e) {
|
elementsetShow(s, e) {
|
||||||
|
this.showElementSet = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
var eventfixed = {
|
var eventfixed = {
|
||||||
shezhi: 0,
|
shezhi: 0,
|
||||||
screen: 0
|
screen: 0
|
||||||
@@ -482,6 +641,7 @@
|
|||||||
? e.clientY + 20
|
? e.clientY + 20
|
||||||
: e.clientY + 20 - (e.clientY + dh - h);
|
: e.clientY + 20 - (e.clientY + dh - h);
|
||||||
this.$store.commit('setPosition', { positionx, positiony });
|
this.$store.commit('setPosition', { positionx, positiony });
|
||||||
|
});
|
||||||
},
|
},
|
||||||
elementsetHide() {
|
elementsetHide() {
|
||||||
//悬浮点击空白隐藏
|
//悬浮点击空白隐藏
|
||||||
@@ -522,15 +682,9 @@
|
|||||||
this.$store.commit('addConsole',consoleParam);
|
this.$store.commit('addConsole',consoleParam);
|
||||||
//this.$refs.webSsh.show(id,host,accountId,port);
|
//this.$refs.webSsh.show(id,host,accountId,port);
|
||||||
},
|
},
|
||||||
jumpToAlertMsg(assetId) {
|
jumpToAlertMsg(asset) {
|
||||||
this.$store.commit('assetForAlertListChange', assetId);
|
this.alertMsgAsset = JSON.parse(JSON.stringify(asset));
|
||||||
bus.$emit("menu-change", 'alertList');
|
this.showSubList = true;
|
||||||
this.$router.push({
|
|
||||||
path: "/alertList",
|
|
||||||
query: {
|
|
||||||
t: +new Date()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getAssetData(data, flushRightBoxDc) {
|
getAssetData(data, flushRightBoxDc) {
|
||||||
this.searchLabel = Object.assign(this.searchLabel, this.pageObj);
|
this.searchLabel = Object.assign(this.searchLabel, this.pageObj);
|
||||||
|
|||||||
Reference in New Issue
Block a user