perf: 尝试修复pl-table在resize时高度不对的问题

This commit is contained in:
陈劲松
2020-04-27 22:38:10 +08:00
parent 79cac9103a
commit df6f7cf04a
2 changed files with 93 additions and 75 deletions

View File

@@ -30,7 +30,7 @@
v-if="targetTab == 'assetDetail' && from == 'endpoint'"
@changeTab="changeTab"></common-detail-tab>
<!--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" ref="endpointQuery"></endpoint-query-tab>
<!--alertMessage页的详情-->
<template v-if="from == 'alertMessage'">
@@ -76,19 +76,26 @@
methods: {
exitFullScreen() {
this.$emit("exitFullScreen");
this.$nextTick(this.afterResize());
},
fullScreen() {
this.$emit("fullScreen");
this.$nextTick(this.afterResize());
},
closeSubList() {
this.$emit("closeSubList");
},
listResize(e) {
this.$emit('listResize', e);
this.$nextTick(this.afterResize());
},
changeTab(tab) {
this.$emit('update:targetTab', tab);
//this.targetTab = tab;
},
afterResize() {
if (this.from == 'endpoint' && this.targetTab == 'endpointQuery') {
this.$refs.endpointQuery.tableReload();
}
}
}
}

View File

@@ -69,7 +69,7 @@
<div class="table-header-inner" @click="clearSelectedMetrics"><span><i style="font-size: 12px;margin-left: 2px;" class="nz-icon nz-icon-close " :class="{'control-icon-unchecked':selectedEndpoints.length<1,'control-icon-checked':selectedEndpoints.length>0}"></i></span></div>
<pl-table :row-height="28" use-virtual :datas="tableData" border :empty-text="$t('config.mib.noData')" :header-cell-class-name="cellClass" :style="{height: $tableHeight.noPagination}"
class="nz-table endpoint-query-table" style="width: 100%;" v-loading="loading" v-scrollBar:el-table="'large'" :pagination-show="false" ref="endpointQueryTable"
@selection-change="selectChange">
@selection-change="selectChange" v-if="tableShow">
<pl-table-column
:resizable="false"
type="selection"
@@ -193,6 +193,7 @@
data() {
let temp = this;
return {
tableShow: true,
tableHover: false,
dropdownShow: false,
loading: false,
@@ -263,6 +264,14 @@
});
});
},
tableReload() {
this.tableShow = false;
setTimeout(() => {
this.tableShow = true;
//this.queryEndpoint();
}, 300);
//this.$nextTick(() => {this.tableShow = true});
},
queryEndpoint() {
this.loading = true;
this.queryElementTips();
@@ -270,7 +279,6 @@
this.tableData = [];
this.tableDataCopy = '';
this.$get("/prom/api/v1/query?query={endpoint='" + this.currentEndpoint.id + "'}&time=" + this.formatTime).then(response=>{
setTimeout(() => {
this.loading = false;
if(response.status==="success"){
let results = response.data.result;
@@ -340,8 +348,8 @@
this.tableData.push(edpQueryData);
}
this.tableDataCopy = JSON.stringify(this.tableData);
this.$nextTick(this.$refs.endpointQueryTable.doLayout());
}
}, 300);
});
},
clearSelectedMetrics() {
@@ -675,7 +683,8 @@
},
mounted() {
this.getPanelData();
this.$nextTick(() => {
//this.$nextTick(() => {
setTimeout(() => {
//绑定滚动条事件控制top按钮
let el = this.$refs.endpointQueryTable.$el.querySelector(".el-table__body-wrapper");
if (el._ps_) {
@@ -693,7 +702,9 @@
this.tableHover = false;
});
}
});
}, 300);
//});
}
}
</script>