NEZ-351 perf: 底部滑框、侧滑框重构、动画优化
This commit is contained in:
@@ -16,13 +16,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div slot="content-right" class="slot-content">
|
||||
<div class="main-list main-and-sub-transition" :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="main-list" :class="{'main-list-with-sub': bottomBox.showSubList}">
|
||||
<div class="main-modal"></div>
|
||||
<div class="top-tools" v-show="bottomBox.mainResizeShow">
|
||||
<div class="top-tool-main-right" :class="{'top-tool-main-right-to-left': bottomBox.showSubList}">
|
||||
<div class="top-tool-search float-right">
|
||||
<search-input :searchMsg="searchMsg" @search="search" :inTransform="inTransform"></search-input>
|
||||
<search-input :searchMsg="searchMsg" @search="search" :bottomBox.inTransform="bottomBox.inTransform"></search-input>
|
||||
</div>
|
||||
<button id="alert-add" @click="toAdd" :title="$t('overall.createAlertRule')"
|
||||
<button id="alert-add" @click="add" :title="$t('overall.createAlertRule')"
|
||||
class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20">
|
||||
<i class="nz-icon-create-square nz-icon"></i>
|
||||
</button>
|
||||
@@ -33,19 +34,19 @@
|
||||
class="nz-table"
|
||||
:data="tableData"
|
||||
border
|
||||
v-show="mainResizeShow"
|
||||
v-show="bottomBox.mainResizeShow"
|
||||
ref="alertRuleTable"
|
||||
tooltip-effect="light"
|
||||
:height="mainTableHeight"
|
||||
v-scrollBar:el-table="'large'"
|
||||
v-loading="loading"
|
||||
v-loading="tools.loading"
|
||||
:cell-class-name="messageStyle"
|
||||
style="width: 100%;"
|
||||
@sort-change="tableDataSort"
|
||||
>
|
||||
<el-table-column
|
||||
:resizable="false"
|
||||
v-for="(item, index) in tablelable"
|
||||
v-for="(item, index) in tools.tablelable"
|
||||
v-if="item.show"
|
||||
:width="item.width"
|
||||
:key="`col-${index}`"
|
||||
@@ -57,8 +58,8 @@
|
||||
>
|
||||
<template slot-scope="scope" :column="item">
|
||||
<div v-if="item.prop == 'option'" class="content-right-options">
|
||||
<span :title="$t('overall.view')" @click="detail(scope.row)" class="content-right-option" :id="'alert-detail-'+scope.row.id"><i class="nz-icon nz-icon-view"></i></span>
|
||||
<span v-if="scope.row.buildIn != 1" :title="$t('overall.edit')" @click="toEdit(scope.row)" class="content-right-option" :id="'alert-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
||||
<span :title="$t('overall.view')" @click="detail(scope.row)" class="content-right-option" :id="'alert-detail-'+scope.row.id"><i class="nz-icon nz-icon-view"></i></span>
|
||||
<span v-if="scope.row.buildIn != 1" :title="$t('overall.edit')" @click="edit(scope.row)" class="content-right-option" :id="'alert-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
||||
<span :title="$t('overall.delete')" @click="del(scope.row)" class="content-right-option" :id="'alert-del-'+scope.row.id"><i class="el-icon-delete"></i></span>
|
||||
</div>
|
||||
<span v-else-if="item.prop == 'severity'">
|
||||
@@ -86,29 +87,29 @@
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot="scope">
|
||||
<button v-if="scope.$index == 0" class="to-top" :style="{top: toTopBtnTop}" :class="{'to-top-is-hover': tableHover}" v-show="showTopBtn && mainResizeShow" @click="$toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
||||
<button v-if="scope.$index == 0" class="to-top" :style="{top: tools.toTopBtnTop}" :class="{'to-top-is-hover': tools.tableHover}" v-show="tools.showTopBtn && bottomBox.mainResizeShow" @click="$toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-bottom" v-show="!showSubList">
|
||||
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
||||
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||
</div>
|
||||
</div>
|
||||
<bottom-box v-if="showSubList" :show-sub-list="showSubList" :subResizeShow="subResizeShow" :obj="alertRuleForMessage" :isFullScreen="isFullScreen" :from="'alertRule'" :targetTab.sync="targetTab" :detail="ruleDetail"
|
||||
@closeSubList="showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen" @listResize="listResize" ></bottom-box>
|
||||
<transition name="el-zoom-in-bottom">
|
||||
<bottom-box v-if="bottomBox.showSubList" :sub-resize-show="bottomBox.subResizeShow" :obj="bottomBox.alertRule" :is-full-screen="bottomBox.isFullScreen" :from="'alertRule'" :target-tab.sync="bottomBox.targetTab" :detail="bottomBox.ruleDetail"
|
||||
@closeSubList="bottomBox.showSubList = false" @fullScreen="fullScreen" @exitFullScreen="exitFullScreen" @listResize="listResize" ></bottom-box>
|
||||
</transition>
|
||||
</div>
|
||||
</left-menu>
|
||||
<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-box :edit-unit-show='viewAsset' @refreshData="getTableData" @sendStateData="tabControl" v-if="assetBoxShow"
|
||||
ref="assetEditUnit"></asset-box>-->
|
||||
<transition name="right-box">
|
||||
<alert-config-box v-if="rightBox.show" :alert-rule="alertRule" @close="closeRightBox" ref="alertConfigBox"></alert-config-box>
|
||||
</transition>
|
||||
<element-set
|
||||
v-if="showElementSet"
|
||||
v-if="tools.showElementSet"
|
||||
@close="elementsetHide"
|
||||
v-clickoutside="elementsetHide"
|
||||
:table-title="tableTitle"
|
||||
:dropCol="dropCol"
|
||||
:tools.dropCol="tools.dropCol"
|
||||
@tablelable="tablelabelEmit"
|
||||
ref="elementset"
|
||||
></element-set>
|
||||
@@ -116,32 +117,54 @@
|
||||
|
||||
</template>
|
||||
<script>
|
||||
var vm;
|
||||
import bus from '../../../libs/bus';
|
||||
import chartDataFormat from "../../charts/chartDataFormat";
|
||||
export default {
|
||||
name: "alert-config",
|
||||
data() {
|
||||
vm = this;
|
||||
return {
|
||||
loading: false,
|
||||
/*二级列表相关*/
|
||||
ruleDetail: {},
|
||||
targetTab: '', //展示二级列表中的哪个页签
|
||||
showElementSet: false, //控制自定义列的弹框
|
||||
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
||||
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
||||
subResizeShow: true,
|
||||
isFullScreen: false,
|
||||
showSubList: false, //是否展示二级列表
|
||||
alertRuleForMessage: {}, //传给alertMessage上滑框的对象
|
||||
//侧滑
|
||||
rightBox: {
|
||||
show: false,
|
||||
},
|
||||
/*二级页面相关*/
|
||||
bottomBox: {
|
||||
ruleDetail: {},
|
||||
alertRule: {},
|
||||
mainResizeShow: true, //dom高度改变时是否展示|隐藏
|
||||
subResizeShow: true,
|
||||
isFullScreen: false, //全屏状态
|
||||
showSubList: false, //是否显示二级列表
|
||||
targetTab: '', //显示二级列表中的哪个页签
|
||||
inTransform: false, //搜索框相关,搜索条件下拉框是否在transform里
|
||||
},
|
||||
|
||||
toTopBtnTop: this.$tableHeight.toTopBtnTop, //to-top按钮的top属性
|
||||
tableHover: false, //控制滚动条和top按钮同时出现
|
||||
/*工具参数*/
|
||||
tools: {
|
||||
loading: false, //是否显示table加载动画
|
||||
toTopBtnTop: this.$tableHeight.toTopBtnTop, //to-top按钮的top属性
|
||||
tableHover: false, //控制滚动条和top按钮同时出现
|
||||
showElementSet: false, //自定义列弹框是否显示
|
||||
showTopBtn: false, //显示To top按钮
|
||||
tablelable: [], //从缓存中加载的table header
|
||||
dropCol: [], //自定义列工具的数据
|
||||
},
|
||||
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
||||
|
||||
tableId: 'alertRuleTable', //需要分页的table的id,用于记录每页数量
|
||||
showTopBtn: false,
|
||||
mainTableHeight: this.$tableHeight.normal, //主列表table高度
|
||||
alertRule: {},
|
||||
blankAlertRule: {
|
||||
id: '',
|
||||
alertName: '',
|
||||
linkObject: {id: '', name: ''},
|
||||
expr: '',
|
||||
unit:2,
|
||||
operator: '>',
|
||||
last: 60,
|
||||
severity: 'medium',
|
||||
summary: '',
|
||||
description: '',
|
||||
},
|
||||
searchMsg: { //给搜索框子组件传递的信息
|
||||
zheze_none: true,
|
||||
searchLabelList: [{
|
||||
@@ -173,25 +196,6 @@
|
||||
searchLabel: { //搜索参数
|
||||
|
||||
},
|
||||
|
||||
alertRule: {
|
||||
id: '',
|
||||
alertName: '',
|
||||
type: '',
|
||||
linkObject: {id: '', name: ''},
|
||||
linkId: '',
|
||||
operator:'>',
|
||||
threshold:'',
|
||||
unit:2,
|
||||
expr: '',
|
||||
last: 60,
|
||||
severity: '',
|
||||
summary: '',
|
||||
description: '',
|
||||
receivers: '',
|
||||
},
|
||||
tablelable: [],
|
||||
dropCol: [],
|
||||
pageObj: {
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
@@ -240,16 +244,7 @@
|
||||
label: this.$t("alert.config.expr"),
|
||||
prop: 'expr',
|
||||
show: true,
|
||||
}, /*{
|
||||
label: this.$t("alert.list.type"),
|
||||
prop: 'type',
|
||||
show: true,
|
||||
}, {
|
||||
label: this.$t("alert.config.link"),
|
||||
prop: 'linkObject',
|
||||
show: true,
|
||||
width: 140
|
||||
}, */{
|
||||
label: this.$t("alert.config.operator"),
|
||||
prop: 'operator',
|
||||
show: true,
|
||||
@@ -297,12 +292,12 @@
|
||||
},
|
||||
methods: {
|
||||
queryMessage(alertRule) {
|
||||
this.alertRuleForMessage = alertRule;
|
||||
this.showSubList = true;
|
||||
this.targetTab = 'alertMessage';
|
||||
this.bottomBox.alertRule = alertRule;
|
||||
this.bottomBox.showSubList = true;
|
||||
this.bottomBox.targetTab = 'alertMessage';
|
||||
},
|
||||
elementsetShow(s, e) {
|
||||
this.showElementSet = true;
|
||||
this.tools.showElementSet = true;
|
||||
this.$nextTick(() => {
|
||||
var eventfixed = {
|
||||
shezhi: 0,
|
||||
@@ -310,7 +305,7 @@
|
||||
};
|
||||
eventfixed[s] = 1;
|
||||
e.preventDefault();
|
||||
this.$store.commit('setHeaderTable', this.tablelable);
|
||||
this.$store.commit('setHeaderTable', this.tools.tablelable);
|
||||
this.$store.commit('setEventfixed', eventfixed);
|
||||
const h = document.documentElement.clientHeight;
|
||||
const w = document.documentElement.clientWidth;
|
||||
@@ -327,20 +322,25 @@
|
||||
},
|
||||
elementsetHide() {
|
||||
//悬浮点击空白隐藏
|
||||
//this.$refs.elementset.elementsetHide();
|
||||
this.showElementSet = false;
|
||||
this.tools.showElementSet = false;
|
||||
},
|
||||
tablelabelEmit(data) {
|
||||
//获取子组件传过来的参数
|
||||
this.$store.commit('setHeaderTable', data);
|
||||
this.tablelable = data;
|
||||
this.dropCol = data;
|
||||
this.tools.tablelable = data;
|
||||
this.tools.dropCol = data;
|
||||
},
|
||||
toEdit: function (u) {
|
||||
this.alertRule = Object.assign({}, u);
|
||||
this.$refs.alertConfigBox.show(true, true);
|
||||
edit(u) {
|
||||
this.alertRule = JSON.parse(JSON.stringify(u));
|
||||
this.rightBox.show = true;
|
||||
},
|
||||
del: function (u) {
|
||||
closeRightBox(refresh) {
|
||||
this.rightBox.show = false;
|
||||
if (refresh) {
|
||||
this.getTableData();
|
||||
}
|
||||
},
|
||||
del(u) {
|
||||
this.$confirm(this.$t("tip.confirmDelete"), {
|
||||
confirmButtonText: this.$t("tip.yes"),
|
||||
cancelButtonText: this.$t("tip.no"),
|
||||
@@ -356,22 +356,25 @@
|
||||
})
|
||||
});
|
||||
},
|
||||
formatThreshold:function(value,unit){
|
||||
let unitMethod=chartDataFormat.getUnit(unit)
|
||||
if(unitMethod&&value){
|
||||
return unitMethod.compute(value,null,2);
|
||||
}else{
|
||||
formatThreshold(value,unit) {
|
||||
let unitMethod = chartDataFormat.getUnit(unit);
|
||||
if (unitMethod&&value) {
|
||||
return unitMethod.compute(value, null, 2);
|
||||
} else {
|
||||
return value
|
||||
}
|
||||
},
|
||||
toAdd: function () {
|
||||
this.cleanAlertRule();
|
||||
this.$refs.alertConfigBox.show(true, true);
|
||||
add() {
|
||||
this.alertRule = this.newAlertRule();
|
||||
this.rightBox.show = true;
|
||||
},
|
||||
detail: function (u) {
|
||||
this.alertRuleForMessage = Object.assign({}, u);
|
||||
this.targetTab = "panel";
|
||||
this.showSubList = true;
|
||||
newAlertRule() {
|
||||
return JSON.parse(JSON.stringify(this.blankAlertRule));
|
||||
},
|
||||
detail(u) {
|
||||
this.bottomBox.alertRule = JSON.parse(JSON.stringify(u));
|
||||
this.bottomBox.targetTab = "panel";
|
||||
this.bottomBox.showSubList = true;
|
||||
},
|
||||
messageStyle(e) {
|
||||
if (e.column.label == 'Message' || e.column.label == this.$t('alert.message')) {
|
||||
@@ -383,12 +386,12 @@
|
||||
}
|
||||
return '';
|
||||
},
|
||||
getTableData: function () {
|
||||
getTableData() {
|
||||
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
|
||||
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
|
||||
this.loading = true;
|
||||
this.tools.loading = true;
|
||||
this.$get('alert/rule', this.searchLabel).then(response => {
|
||||
this.loading = false;
|
||||
this.tools.loading = false;
|
||||
if (response.code == 200) {
|
||||
response.data.list.forEach(item => {
|
||||
let temp = [];
|
||||
@@ -404,20 +407,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
cleanAlertRule: function () {
|
||||
this.alertRule = {
|
||||
id: '',
|
||||
alertName: '',
|
||||
linkObject: {id: '', name: ''},
|
||||
expr: '',
|
||||
unit:2,
|
||||
operator: '>',
|
||||
last: 60,
|
||||
severity: 'medium',
|
||||
summary: '',
|
||||
description: '',
|
||||
}
|
||||
},
|
||||
jumpTo(data, id) {
|
||||
bus.$emit("menu-change", data);
|
||||
this.$router.push({
|
||||
@@ -436,7 +425,7 @@
|
||||
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
|
||||
this.getTableData();
|
||||
},
|
||||
search: function (searchObj) {
|
||||
search(searchObj) {
|
||||
let orderBy='';
|
||||
if(this.searchLabel.orderBy){
|
||||
orderBy=this.searchLabel.orderBy
|
||||
@@ -455,17 +444,20 @@
|
||||
},
|
||||
// 全屏
|
||||
fullScreen() {
|
||||
let vm = this;
|
||||
this.$bottomBoxWindow.fullScreen(vm);
|
||||
},
|
||||
// 退出全屏
|
||||
exitFullScreen() {
|
||||
let vm = this;
|
||||
this.$bottomBoxWindow.exitFullScreen(vm);
|
||||
},
|
||||
// 鼠标拖动二级列表
|
||||
listResize(e) {
|
||||
let vm = this;
|
||||
this.$bottomBoxWindow.listResize(vm, e);
|
||||
},
|
||||
viewAlertType: function (type, typeObj) {
|
||||
viewAlertType(type, typeObj) {
|
||||
this.closeViews();
|
||||
switch (type) {
|
||||
case 1:
|
||||
@@ -510,9 +502,6 @@
|
||||
alertName: obj.alertName,
|
||||
expr: obj.expr
|
||||
};
|
||||
/*detail.push({label: "ID", value: obj.id});
|
||||
detail.push({label: this.$t("alert.alertName"), value: obj.alertName});
|
||||
detail.push({label: this.$t("alert.config.expr"), value: obj.expr});*/
|
||||
let type = "";
|
||||
for (let i = 0; i < this.typeData.length; i++) {
|
||||
if (obj.type == this.typeData[i].key) {
|
||||
@@ -521,7 +510,6 @@
|
||||
}
|
||||
}
|
||||
detail.type = type;
|
||||
//detail.push({label: this.$t("alert.list.type"), value: type});
|
||||
let link = "";
|
||||
if (obj.type == 1 || obj.type == 2) {
|
||||
link = obj.linkObject.name;
|
||||
@@ -530,17 +518,12 @@
|
||||
}
|
||||
detail.link = link;
|
||||
detail.last = obj.last;
|
||||
/*detail.push({label: this.$t("alert.config.link"), value: link});
|
||||
detail.push({label: this.$t("alert.config.for"), value: obj.last});*/
|
||||
let severity = this.severityData.filter((item, index) => {
|
||||
return obj.severity == item.key;
|
||||
})[0].value;
|
||||
detail.severity = severity;
|
||||
detail.alertNum = obj.alertNum;
|
||||
detail.description = obj.description;
|
||||
/*detail.push({label: this.$t("alert.severity"), value: severity});
|
||||
detail.push({label: this.$t("alert.description"), value: obj.description});
|
||||
detail.push({label: this.$t("alert.message"), value: obj.alertNum});*/
|
||||
return detail;
|
||||
},
|
||||
//是否需要排序
|
||||
@@ -578,13 +561,14 @@
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
showSubList(n) {
|
||||
'bottomBox.showSubList': function(n) {
|
||||
let vm = this;
|
||||
this.$bottomBoxWindow.showSubListWatch(vm, n);
|
||||
},
|
||||
alertRuleForMessage: {
|
||||
'bottomBox.alertRule': {
|
||||
deep: true,
|
||||
handler(n) {
|
||||
this.ruleDetail = this.convertToDetail(n);
|
||||
this.bottomBox.ruleDetail = this.convertToDetail(n);
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -605,23 +589,23 @@
|
||||
if (el._ps_) {
|
||||
el.addEventListener("ps-scroll-y", () => {
|
||||
if (el._ps_.scrollbarYTop > 50) {
|
||||
this.showTopBtn = true;
|
||||
this.tools.showTopBtn = true;
|
||||
} else {
|
||||
this.showTopBtn = false;
|
||||
this.tools.showTopBtn = false;
|
||||
}
|
||||
});
|
||||
el.addEventListener("mouseenter", () => {
|
||||
this.tableHover = true;
|
||||
this.tools.tableHover = true;
|
||||
});
|
||||
el.addEventListener("mouseleave", () => {
|
||||
this.tableHover = false;
|
||||
this.tools.tableHover = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
||||
this.tools.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)
|
||||
this.tools.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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user