feat: alert-rule页二级列表调整,小细节未调好:
1.loading 2.搜索
This commit is contained in:
@@ -514,6 +514,7 @@ li{
|
||||
.top-tool-right {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
height: 26px;
|
||||
}
|
||||
.top-tool-main-right {
|
||||
position: absolute;
|
||||
@@ -571,6 +572,63 @@ li{
|
||||
.has-sub-popper {
|
||||
color: red;
|
||||
}
|
||||
.main-list {
|
||||
height: 100%;
|
||||
transition: .4s height, .4s transform;
|
||||
position: relative;
|
||||
}
|
||||
.main-list.main-list-with-sub {
|
||||
transform: translate3d(0,0,0);
|
||||
height: calc(50% - 4px);
|
||||
}
|
||||
.sub-list {
|
||||
height: calc(50% - 4px);
|
||||
transition: .4s height;
|
||||
position: relative;
|
||||
}
|
||||
.sub-list-resize {
|
||||
margin: 0 -6px;
|
||||
border-top: 1px solid #aaa;
|
||||
background-color: #eaeaea;
|
||||
height: 9px;
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
color: #5f6368;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 3px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.sub-list-window-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 14px;
|
||||
}
|
||||
.window-control-btn {
|
||||
cursor: pointer;
|
||||
width: 29px;
|
||||
text-align: center;
|
||||
}
|
||||
.window-control-btn:last-of-type {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.window-control-btn>i {
|
||||
color: #909399;
|
||||
font-size: 17px;
|
||||
}
|
||||
.window-control-btn>i:hover {
|
||||
color: $global-text-color-active;
|
||||
}
|
||||
.pagination-top {
|
||||
transition: .2s transform;
|
||||
}
|
||||
.pagination-top-show {
|
||||
transform: translateX(0);
|
||||
}
|
||||
.pagination-top-hide {
|
||||
transform: translateX(150%);
|
||||
}
|
||||
/* end--二级顶部工具栏*/
|
||||
|
||||
/* start--内容*/
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
<template>
|
||||
<span>
|
||||
<!-- 副列表 endpoint query-->
|
||||
<div @mousedown="listResize" class="sub-list-resize" v-if="showSubList && !isFullScreen">一</div>
|
||||
<div class="sub-list" v-if="showSubList">
|
||||
<div class="sub-top-tools" v-show="subResizeShow">
|
||||
<div class="sub-list-tabs margin-l-20" style="width: calc(100% - 780px);">
|
||||
<div class="sub-list-tab">{{$t("overall.query")}}</div>
|
||||
<span class="sub-list-tab-txt">
|
||||
<template v-if="from == 'asset'">{{$t("project.endpoint.asset")}}:{{obj.host}}</template>
|
||||
<template v-if="from == 'alertRule'">{{$t("alert.alertName")}}:{{obj.alertName}}</template>
|
||||
</span>
|
||||
</div>
|
||||
<!--时间选择器-->
|
||||
<div class="top-tool-right">
|
||||
<div class="top-tool-search">
|
||||
<search-input :searchMsg="searchMsg" @search="search"></search-input>
|
||||
</div>
|
||||
<div class="sub-list-window-control">
|
||||
<!--半屏-->
|
||||
<div class="window-control-btn" v-if="isFullScreen" @click="exitFullScreen"><i class="nz-icon nz-icon-exit-full-screen"></i></div>
|
||||
<!--全屏-->
|
||||
<div class="window-control-btn" v-if="!isFullScreen" @click="fullScreen"><i class="el-icon-full-screen"></i></div>
|
||||
<!--关闭-->
|
||||
<div class="window-control-btn" @click="closeSubList"><i class="el-icon-close"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
element-loading-background="rgba(0, 0, 0, 0)"
|
||||
border
|
||||
tooltip-effect="light"
|
||||
v-scrollBar:el-table
|
||||
class="nz-table"
|
||||
:height="$tableHeight.openSubList.subList"
|
||||
ref="alertMessageSubList"
|
||||
v-show="subResizeShow"
|
||||
style="width: 100%; margin-top: 5px;">
|
||||
<el-table-column
|
||||
:resizable="false"
|
||||
v-for="(item, index) in tablelable"
|
||||
v-if="item.show"
|
||||
:width="item.width"
|
||||
:key="`col-${index}`"
|
||||
:label="item.label"
|
||||
show-overflow-tooltip
|
||||
min-width="110px"
|
||||
>
|
||||
<template slot-scope="scope" :column="item">
|
||||
<template v-if="item.prop == 'alertRule'">
|
||||
<div class="too-long-split" :id="'view-rule-'+scope.row[item.prop].id"
|
||||
v-if="scope.row[item.prop].alertName">{{scope.row[item.prop].alertName}}</div>
|
||||
<template v-else>-</template>
|
||||
</template>
|
||||
<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] == 2">Module</span>
|
||||
<span v-if="scope.row[item.prop] == 3">Device</span>
|
||||
</div>
|
||||
<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>
|
||||
<span v-else-if="item.prop == 'severity'">
|
||||
<span v-if="scope.row[item.prop] == 'high'"><i class="el-icon-arrow-up"></i> {{severityData[1].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> {{severityData[2].value}}</span>
|
||||
</span>
|
||||
<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"
|
||||
@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>
|
||||
<span v-else-if="scope.row['type'] == 3 && scope.row[item.prop]" class="link"
|
||||
@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>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
<div v-else-if="item.prop == 'state'">
|
||||
<span class="">
|
||||
{{scope.row['state'] == 1 ? "Pending" : ""}}
|
||||
{{scope.row['state'] == 2 ? "Expired" : ""}}
|
||||
</span>
|
||||
</div>
|
||||
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
||||
<template v-else>-</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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>
|
||||
</div>
|
||||
<project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-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>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "alertMessageBox",
|
||||
props: {
|
||||
isFullScreen: false, //是否全屏
|
||||
showSubList: Boolean, //是否显示
|
||||
subResizeShow: Boolean, //resize时,用v-show="subResizeShow"控制页面内容是否显示
|
||||
from: String, //来自哪个主页面,有:"asset"、"alertRule"
|
||||
obj: Object, //关联的实体对象,有:"asset"、"alertRule"
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableId: 'alertListTable', //需要分页的table的id,用于记录每页数量
|
||||
showTopBtn: false, //top按钮是否显示
|
||||
loading: false,
|
||||
pageObj: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
},
|
||||
tableTitle: [
|
||||
{
|
||||
label: this.$t("alert.alertName"),
|
||||
prop: 'alertRule',
|
||||
show: true,
|
||||
width: 180
|
||||
}, {
|
||||
label: this.$t("alert.list.type"),
|
||||
prop: 'type',
|
||||
show: true,
|
||||
width: 100
|
||||
}, {
|
||||
label: this.$t("alert.list.linked"),
|
||||
prop: 'linkObject',
|
||||
show: true,
|
||||
width: 140
|
||||
}, {
|
||||
label: this.$t("alert.severity"),
|
||||
prop: 'severity',
|
||||
show: true,
|
||||
width: 100
|
||||
}, {
|
||||
label: this.$t('alert.summary'),
|
||||
prop: 'summary',
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('alert.description'),
|
||||
prop: 'description',
|
||||
show: true
|
||||
}, {
|
||||
label: this.$t('alert.list.state'),
|
||||
prop: 'state',
|
||||
show: true,
|
||||
width: 100
|
||||
}, {
|
||||
label: this.$t("alert.startAt"),
|
||||
prop: 'startAt',
|
||||
show: true,
|
||||
}, {
|
||||
label: this.$t('alert.endAt'),
|
||||
prop: 'endAt',
|
||||
show: true,
|
||||
}
|
||||
],
|
||||
searchMsg: { //给搜索框子组件传递的信息
|
||||
zheze_none: true,
|
||||
searchLabelList: [{
|
||||
id: 2,
|
||||
name: this.$t('alert.alertName'),
|
||||
type: 'input',
|
||||
label: 'alertName',
|
||||
disabled: false
|
||||
}, {
|
||||
id: 3,
|
||||
name: this.$t('alert.list.type'),
|
||||
type: 'select',
|
||||
label: 'alertType',
|
||||
disabled: false
|
||||
}, {
|
||||
id: 4,
|
||||
name: this.$t('alert.severity'),
|
||||
type: 'selectString',
|
||||
label: 'severity',
|
||||
disabled: false
|
||||
}, {
|
||||
id: 11,
|
||||
name: this.$t('asset.asset'),
|
||||
type: 'asset',
|
||||
label: 'asset',
|
||||
disabled: true
|
||||
}],
|
||||
},
|
||||
searchLabel: { //搜索参数
|
||||
|
||||
},
|
||||
tablelable: [],
|
||||
dropCol: [],
|
||||
severityData: [
|
||||
{
|
||||
key: 'medium',
|
||||
value: this.$t("alert.config.medium")
|
||||
},
|
||||
{
|
||||
key: 'high',
|
||||
value: this.$t("alert.config.high")
|
||||
},
|
||||
{
|
||||
key: 'low',
|
||||
value: this.$t("alert.config.low")
|
||||
}
|
||||
],
|
||||
tableData: [],
|
||||
viewRuleData: {
|
||||
id: '',
|
||||
alertName: '',
|
||||
type: '',
|
||||
linkObject: {id: '', name: ''},
|
||||
linkId: '',
|
||||
expr: '',
|
||||
last: '',
|
||||
severity: '',
|
||||
summary: '',
|
||||
description: '',
|
||||
receiver: '',
|
||||
},
|
||||
viewProjectData: {id: '', name: '', remark: ''},
|
||||
viewModuleData: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []},
|
||||
viewAssetState: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getAlertList: function () {
|
||||
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
|
||||
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
|
||||
this.$get('alert/message', this.searchLabel).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.tableData = response.data.list
|
||||
this.pageObj.total = response.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
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();
|
||||
},
|
||||
search: function (searchObj) {
|
||||
this.searchLabel = {};
|
||||
this.pageObj.pageNo = 1;
|
||||
for (let item in searchObj) {
|
||||
if (searchObj[item]) {
|
||||
this.$set(this.searchLabel, item, searchObj[item]);
|
||||
}
|
||||
}
|
||||
this.getAlertList();
|
||||
},
|
||||
viewAlertType: function (type, typeObj) {
|
||||
this.closeViews();
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.viewProjectData = JSON.parse(JSON.stringify(typeObj));
|
||||
this.$refs.projectBox.show(true);
|
||||
break;
|
||||
case 2:
|
||||
let tempObj = JSON.parse(typeObj.param)
|
||||
this.$set(typeObj, 'paramObj', []);
|
||||
for (let k in tempObj) {
|
||||
typeObj.paramObj.push({key: k, value: tempObj[k]});
|
||||
}
|
||||
this.viewModuleData = JSON.parse(JSON.stringify(typeObj));
|
||||
|
||||
this.$refs.moduleBox.show(true);
|
||||
break;
|
||||
case 3:
|
||||
this.viewAssetState = true;
|
||||
this.$refs.assetEditUnit.getAssetData(typeObj);
|
||||
this.$refs.assetEditUnit.tabView = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
fillProject: function (module) {
|
||||
this.$get('project', {"id": module.projectId}).then(response => {
|
||||
if (response.code == 200) {
|
||||
module.project = response.data.list[0];
|
||||
}
|
||||
})
|
||||
},
|
||||
closeViews: function () {
|
||||
this.$refs.alertConfigBox.show(false, false);
|
||||
this.$refs.projectBox.show(false, false);
|
||||
this.$refs.moduleBox.show(false, false);
|
||||
this.viewAssetState = false;
|
||||
},
|
||||
exitFullScreen() {
|
||||
this.$emit("exitFullScreen");
|
||||
},
|
||||
fullScreen() {
|
||||
this.$emit("fullScreen");
|
||||
},
|
||||
closeSubList() {
|
||||
this.$emit("closeSubList");
|
||||
this.tableData = [];
|
||||
},
|
||||
//asset弹框控制
|
||||
tabControl(data) {
|
||||
if (data === 'close') {
|
||||
this.viewAssetState = false
|
||||
this.$refs['assetEditUnit'].tabView = false
|
||||
}
|
||||
},
|
||||
listResize(e) {
|
||||
this.$emit('listResize', e);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
obj: {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
handler(n) {
|
||||
if (this.from == "alertRule") {
|
||||
this.searchLabel.alertName = this.obj.alertName;
|
||||
this.searchLabel.host = "";
|
||||
} else if (this.from == "asset") {
|
||||
this.searchLabel.host = this.obj.host;
|
||||
this.searchLabel.alertName = "";
|
||||
}
|
||||
this.getAlertList();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//是否存在分页缓存
|
||||
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
||||
if (pageSize) {
|
||||
this.pageObj.pageSize = pageSize
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
//绑定滚动条事件,控制top按钮
|
||||
let el = this.$refs.alertMessageSubList.$el.querySelector(".el-table__body-wrapper");
|
||||
if (el._ps_) {
|
||||
el.addEventListener("ps-scroll-y", () => {
|
||||
if (el._ps_.scrollbarYTop > 50) {
|
||||
this.showTopBtn = true;
|
||||
} else {
|
||||
this.showTopBtn = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
||||
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
||||
: this.tableTitle;
|
||||
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
||||
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
||||
: this.tableTitle;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -564,7 +564,7 @@ const en = {
|
||||
port: 'Port',//"端口"
|
||||
param: 'Parameter',//"参数"
|
||||
path: 'Path',//"路径"
|
||||
asset: 'Device',//"设备"
|
||||
asset: 'Asset',//"设备"
|
||||
lastUpdate: 'Last Reply',//"最后更新时间"
|
||||
moduleParameter: 'Module',//"组件参数"
|
||||
addGraph: 'View Graph', //添加图标
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-right">
|
||||
<div class="top-tools">
|
||||
<div class="top-tool-main-right">
|
||||
<div class="main-list" :class="{'main-list-with-sub': showSubList}">
|
||||
<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 float-right">
|
||||
<search-input :searchMsg="searchMsg" @search="search"></search-input>
|
||||
</div>
|
||||
@@ -25,14 +26,16 @@
|
||||
<i class="nz-icon-create-square nz-icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="pagination-top pagination-top-hide display-none"></div>
|
||||
</div>
|
||||
<el-table
|
||||
class="nz-table"
|
||||
:data="tableData"
|
||||
border
|
||||
v-show="mainResizeShow"
|
||||
ref="alertRuleTable"
|
||||
tooltip-effect="light"
|
||||
:height="$tableHeight.normal"
|
||||
:height="mainTableHeight"
|
||||
v-scrollBar:el-table
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
@@ -68,6 +71,7 @@
|
||||
<span v-else>-</span>
|
||||
</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>
|
||||
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
||||
<template v-else>-</template>
|
||||
</template>
|
||||
@@ -80,14 +84,21 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-bottom" v-show="!showSubList">
|
||||
<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>
|
||||
</div>
|
||||
<alert-Message-box v-if="showSubList" @listResize="listResize" :show-sub-list="showSubList" :from="'alertRule'" :subResizeShow="subResizeShow" :obj="alertRule" :isFullScreen="isFullScreen"
|
||||
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen"></alert-Message-box>
|
||||
</div>
|
||||
<alert-config-box :parentAlertRule="alertRule" @reload="getTableData" ref="alertConfigBox"></alert-config-box>
|
||||
<project-box :project="viewProjectData" ref="projectBox" @reload="getTableData"></project-box>
|
||||
<module-box :module="viewModuleData" @reload="getTableData" ref="moduleBox"></module-box>
|
||||
<asset-edit-unit :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-edit-unit>
|
||||
<!--<asset-edit-unit :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-edit-unit>-->
|
||||
<asset-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-box>
|
||||
<element-set
|
||||
v-clickoutside="elementsetHide"
|
||||
:table-title="tableTitle"
|
||||
@@ -103,8 +114,13 @@
|
||||
name: "alert-config",
|
||||
data() {
|
||||
return {
|
||||
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
||||
subResizeShow: true,
|
||||
isFullScreen: false,
|
||||
showSubList: false, //是否展示二级列表
|
||||
tableId: 'alertRuleTable', //需要分页的table的id,用于记录每页数量
|
||||
showTopBtn: false,
|
||||
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
||||
searchMsg: { //给搜索框子组件传递的信息
|
||||
zheze_none: true,
|
||||
searchLabelList: [{
|
||||
@@ -239,6 +255,77 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
queryMessage(alertRule) {
|
||||
this.alertRule = alertRule;
|
||||
this.showSubList = true;
|
||||
},
|
||||
// 鼠标拖动二级列表
|
||||
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;
|
||||
}
|
||||
},
|
||||
elementsetShow(s, e) {
|
||||
var eventfixed = {
|
||||
shezhi: 0,
|
||||
@@ -365,6 +452,35 @@
|
||||
}
|
||||
this.getTableData();
|
||||
},
|
||||
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';
|
||||
},
|
||||
viewAlertType: function (type, typeObj) {
|
||||
this.closeViews();
|
||||
switch (type) {
|
||||
@@ -405,6 +521,55 @@
|
||||
this.viewAsset = false;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
showSubList(n) {
|
||||
if (!n) {
|
||||
this.mainTableHeight = this.$tableHeight.normal; //重置table的高度
|
||||
this.isFullScreen = false;
|
||||
//重置二级列表数据
|
||||
this.selectedEndpoints=[];
|
||||
this.showTableData = [];
|
||||
//移动分页组件的位置
|
||||
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.showTopBtn1 = false;
|
||||
// 主列表恢复全屏
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
window.onresize = null;
|
||||
},
|
||||
mounted() {
|
||||
//是否存在分页缓存
|
||||
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
||||
|
||||
@@ -99,8 +99,10 @@
|
||||
<alert-config-box :parentAlertRule="viewRuleData" @reload="getAlertList" ref="alertConfigBox"></alert-config-box>
|
||||
<project-box :project="viewProjectData" ref="projectBox" @reload="getAlertList"></project-box>
|
||||
<module-box :module="viewModuleData" @reload="getAlertList" ref="moduleBox"></module-box>
|
||||
<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-edit-unit>
|
||||
<!--<asset-edit-unit :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-edit-unit>-->
|
||||
<asset-box :edit-unit-show='viewAssetState' @refreshData="getAlertList" @sendStateData="tabControl"
|
||||
ref="assetEditUnit"></asset-box>
|
||||
<element-set
|
||||
v-clickoutside="elementsetHide"
|
||||
:table-title="tableTitle"
|
||||
@@ -121,7 +123,7 @@
|
||||
pageObj: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
total: 13
|
||||
total: 0
|
||||
},
|
||||
tableTitle: [
|
||||
{
|
||||
|
||||
@@ -21,64 +21,6 @@
|
||||
.date-pick-group button:last-of-type {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.main-list {
|
||||
height: 100%;
|
||||
transition: .4s height, .4s transform;
|
||||
position: relative;
|
||||
}
|
||||
.main-list.main-list-with-sub {
|
||||
transform: translate3d(0,0,0);
|
||||
height: calc(50% - 4px);
|
||||
}
|
||||
.sub-list {
|
||||
height: calc(50% - 4px);
|
||||
transition: .4s height;
|
||||
position: relative;
|
||||
}
|
||||
.sub-list-resize {
|
||||
margin: 0 -6px;
|
||||
border-top: 1px solid #aaa;
|
||||
background-color: #eaeaea;
|
||||
height: 9px;
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
color: #5f6368;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 3px;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.sub-list-window-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 14px;
|
||||
}
|
||||
.window-control-btn {
|
||||
cursor: pointer;
|
||||
width: 29px;
|
||||
text-align: center;
|
||||
}
|
||||
.window-control-btn:last-of-type {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.window-control-btn>i {
|
||||
color: #909399;
|
||||
font-size: 17px;
|
||||
}
|
||||
.window-control-btn>i:hover {
|
||||
color: $global-text-color-active;
|
||||
}
|
||||
.pagination-top {
|
||||
transition: .2s transform;
|
||||
}
|
||||
.pagination-top-show {
|
||||
transform: translateX(0);
|
||||
}
|
||||
.pagination-top-hide {
|
||||
transform: translateX(150%);
|
||||
}
|
||||
</style>
|
||||
<style scope>
|
||||
.chart-bottom {
|
||||
@@ -147,9 +89,7 @@
|
||||
</template>
|
||||
</export-excel>
|
||||
</div>
|
||||
<div class="pagination-top pagination-top-hide display-none">
|
||||
<!--<Pagination :tableId="tableId" v-cloak :pageObj="endpointPageObj" @pageNo='endpointPageNo' @pageSize='endpointPageSize' ref="endpointPagination2"></Pagination>-->
|
||||
</div>
|
||||
<div class="pagination-top pagination-top-hide display-none"></div>
|
||||
</div>
|
||||
<el-table
|
||||
:data="endpointTableData"
|
||||
@@ -216,7 +156,7 @@
|
||||
<div class="sub-top-tools" v-show="subResizeShow">
|
||||
<div class="sub-list-tabs margin-l-20" style="width: calc(100% - 780px);">
|
||||
<div class="sub-list-tab">{{$t("overall.query")}}</div>
|
||||
<span class="sub-list-tab-txt">Endpoint ID: {{curEndpoint ? curEndpoint.id : ''}}</span>
|
||||
<span class="sub-list-tab-txt">{{$t("project.endpoint.endpointId")}}: {{curEndpoint ? curEndpoint.id : ''}}</span>
|
||||
</div>
|
||||
<!--时间选择器-->
|
||||
<div class="top-tool-right">
|
||||
@@ -271,7 +211,7 @@
|
||||
v-scrollBar:el-table
|
||||
class="nz-table endpoint-query-table"
|
||||
:header-cell-class-name="cellClass"
|
||||
:height="$tableHeight.endpointQuery"
|
||||
:height="$tableHeight.noPagination"
|
||||
@selection-change="selectChange"
|
||||
ref="metricInfoTab"
|
||||
v-show="subResizeShow"
|
||||
@@ -398,8 +338,8 @@
|
||||
subResizeShow: true,
|
||||
mainListHeight: '', //主列表dom的高度
|
||||
tableShow: 1, // 1.endpoint; 3.query
|
||||
showTopBtn1: false,
|
||||
showTopBtn2: false,
|
||||
showTopBtn1: false, //主列表top按钮
|
||||
showTopBtn2: false, //副列表top按钮
|
||||
editEndpoint: {id: '', host: '', port: '', param: '', path: '', asset: {}, project: {}, module: {}, moduleId: '', assetId: '', paramObj: []},
|
||||
endpointTableTitle: [
|
||||
{
|
||||
@@ -831,7 +771,7 @@
|
||||
subListDom.style.height = 15+'px';
|
||||
}
|
||||
//当主副列表可视区域小于一定值时,不展示内容
|
||||
if(parseInt(mainListDom.style.height) <= 100){
|
||||
if(parseInt(mainListDom.offsetHeight) <= 100){
|
||||
if (_this.mainResizeShow) {
|
||||
_this.mainResizeShow = false;
|
||||
}
|
||||
@@ -864,9 +804,13 @@
|
||||
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;
|
||||
}, 200);
|
||||
}
|
||||
}, 210);
|
||||
},
|
||||
fullScreen() {
|
||||
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
||||
@@ -1634,7 +1578,6 @@
|
||||
let edpQueryData={element:temp,value:item.value[1],type:(item.metric.type?item.metric.type:'2')};
|
||||
this.showTableData.push(edpQueryData);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
focusInput:function(){
|
||||
@@ -1653,7 +1596,6 @@
|
||||
}
|
||||
},
|
||||
clearInput:function(){
|
||||
|
||||
this.$refs.elementQuery.focus();
|
||||
},
|
||||
queryElementTips:async function(){
|
||||
|
||||
@@ -35,6 +35,7 @@ import cabinetConfigBox from "./components/common/popBox/cabinetConfig"; //面
|
||||
import dcBox from "./components/common/rightBox/dcBox"; //dc弹框
|
||||
import modelBox from "./components/common/rightBox/modelBox"; //model弹框
|
||||
import selectArea from "./components/common/popBox/selectArea"; //dc弹框
|
||||
import alertMessageBox from "./components/common/bottomBox/alertMessageBox"; //dc弹框
|
||||
import PerfectScrollbar from "perfect-scrollbar";
|
||||
import "perfect-scrollbar/css/perfect-scrollbar.css";
|
||||
import loading from "./components/common/loading";
|
||||
@@ -58,6 +59,7 @@ Vue.component("dc-box", dcBox);
|
||||
Vue.component("model-box", modelBox);
|
||||
Vue.component("select-area", selectArea);
|
||||
Vue.component('loading',loading);
|
||||
Vue.component('alert-Message-box',alertMessageBox);
|
||||
|
||||
Vue.prototype.$axios = axios;
|
||||
Vue.prototype.$post = post;
|
||||
@@ -68,9 +70,9 @@ Vue.prototype.$tableHeight = { //列表页表格的高度
|
||||
normal: 'calc(100% - 100px)', //常规高度,特例在下方定义
|
||||
openSubList: { //打开二级列表后的高度
|
||||
mainList: 'calc(100% - 60px)',
|
||||
subList: ''
|
||||
subList: 'calc(100% - 86px)'
|
||||
},
|
||||
endpointQuery: 'calc(100% - 60px)', //特例:endpoint query页,没有翻页组件
|
||||
noPagination: 'calc(100% - 60px)', //特例:endpoint query页,没有翻页组件
|
||||
};
|
||||
Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
|
||||
if (type == 'el') {
|
||||
@@ -272,5 +274,5 @@ export default vm;
|
||||
|
||||
/* 重写组件内容 */
|
||||
const elUi = require("element-ui");
|
||||
//去掉el-table右侧的滚动条预留空间
|
||||
//去掉el-table表头右侧的滚动条预留空间
|
||||
elUi.Table.components.TableHeader.computed.hasGutter = () => {return false;};
|
||||
|
||||
Reference in New Issue
Block a user