feat:overview 添加过滤 & 部分列表页默认加载10条数据的bug修复

1.overview asset topN 添加过滤下拉选
2.overview 字体修改为rem
3.部分列表页在不改变pageSize的情况下默认加载10条数据的bug修复
This commit is contained in:
wangwenrui
2020-03-20 18:22:44 +08:00
parent 2369bf5d6e
commit cfe0ffef05
12 changed files with 138 additions and 54 deletions

View File

@@ -185,6 +185,8 @@ const en = {
asset:{ asset:{
title:'Asset', title:'Asset',
assetType:'Asset Type', assetType:'Asset Type',
modelStat:'Model Stat',
dcStat:'DataCenter Stat',
num:'Num', num:'Num',
alert:'Alert', alert:'Alert',
alertLow:'Low', alertLow:'Low',
@@ -194,7 +196,12 @@ const en = {
outStock:'Out Stock', outStock:'Out Stock',
pingUp:'Up', pingUp:'Up',
pingDown:'Down', pingDown:'Down',
host:'Host' host:'Host',
dropDownLabel:{
type:'type',
model:'model',
dc:'dataCenter'
}
}, },
project:{ project:{
project:'Project', project:'Project',
@@ -211,7 +218,10 @@ const en = {
level:'Level', level:'Level',
alertRule:'Alert Rule', alertRule:'Alert Rule',
ruleNum:'Rule Num', ruleNum:'Rule Num',
alertNum:'Alert Num' alertNum:'Alert Num',
alertRuleTopN:'According to Alert Rule',
assetTopN:'According to Asset',
top:'Top'
} }
} }
}, },

View File

@@ -408,7 +408,7 @@
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);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -361,7 +361,7 @@
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);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -774,10 +774,10 @@
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);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }
console.log('pageSize:'+this.pageObj.pageSize)
this.$nextTick(() => { this.$nextTick(() => {
//左侧dc列表初始选中状态 //左侧dc列表初始选中状态
if (this.$store.state.assetData.selectedData.length > 0) { if (this.$store.state.assetData.selectedData.length > 0) {
@@ -788,7 +788,6 @@
let el = this.$refs.assetTable.$el.querySelector(".el-table__body-wrapper"); let el = this.$refs.assetTable.$el.querySelector(".el-table__body-wrapper");
if (el._ps_) { if (el._ps_) {
el.addEventListener("ps-scroll-y", () => { el.addEventListener("ps-scroll-y", () => {
console.info(el._ps_.scrollbarYTop)
if (el._ps_.scrollbarYTop > 50) { if (el._ps_.scrollbarYTop > 50) {
this.showTopBtn = true; this.showTopBtn = true;
} else { } else {

View File

@@ -516,7 +516,7 @@
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);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -566,7 +566,7 @@
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);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -277,7 +277,7 @@
mounted: function () { mounted: function () {
//是否存在分页缓存 //是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId); let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -647,7 +647,7 @@
mounted: function () { mounted: function () {
//是否存在分页缓存 //是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId); let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined') { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }

View File

@@ -10,7 +10,7 @@
flex:13; flex:13;
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
font-size: 24px !important; font-size: 1.5rem !important;
font-weight: 700; font-weight: 700;
margin-left: 15px; margin-left: 15px;
} }
@@ -24,7 +24,7 @@
} }
.tool-container .time{ .tool-container .time{
flex: 4; flex: 4;
font-size: 24px !important; font-size: 1.5rem !important;
font-weight: 700; font-weight: 700;
display: inline-block; display: inline-block;
height: 35px; height: 35px;
@@ -36,12 +36,12 @@
height: 35px; height: 35px;
} }
.date .week{ .date .week{
font-size: 18px; font-size: 1.125rem;
font-weight: bold; font-weight: bold;
} }
.date .sys-date{ .date .sys-date{
padding-top: 5px; padding-top: 5px;
font-size: 12px; font-size: .75rem;
} }
.tool-container .operation{ .tool-container .operation{
flex: 2; flex: 2;
@@ -49,7 +49,7 @@
line-height: 35px; line-height: 35px;
} }
.operation .nz-icon-maxview{ .operation .nz-icon-maxview{
font-size: 30px !important; font-size: 1.875rem !important;
} }
.overview-content{ .overview-content{
height: calc(100% - 45px); height: calc(100% - 45px);
@@ -103,7 +103,12 @@
cursor: pointer; cursor: pointer;
} }
.mini-font{ .mini-font{
font-size: 12px; font-size: .75rem;
-webkit-transform:scale(0.7); -webkit-transform:scale(0.7);
display: inline-block; display: inline-block;
} }
.avg-children-space{
display: flex;
align-items: center;
justify-content: space-between;
}

View File

@@ -31,18 +31,7 @@
<el-scrollbar style="height: 100%" ref="overviewScrollbar"> <el-scrollbar style="height: 100%" ref="overviewScrollbar">
<div class="content-row-box" > <div class="content-row-box" >
<div class="content-col-box box-height-200 " style="flex:3;"> <div class="content-col-box box-height-200 " style="flex:3;">
<table-box :pop-data="assetStatData" ref="assetTab"> <table-box :pop-data="assetStatData" ref="assetTab" ></table-box>
<div :slot="this.$t('dashboard.overview.asset.assetType')+'-header'" class="mini-button" @click="showTypeFilter" >
<span class="mini-button-icon"><i class="nz-icon mini-font nz-icon-arrow-down" ></i></span>
<div v-show="this.typeFilter.show">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
</div>
</table-box>
</div> </div>
<div class="content-col-box box-height-200 " style="flex: 2"> <div class="content-col-box box-height-200 " style="flex: 2">
<table-box :pop-data="projectStatData" ref="projectTab"></table-box> <table-box :pop-data="projectStatData" ref="projectTab"></table-box>
@@ -63,7 +52,15 @@
</div> </div>
<div class="content-row-box"> <div class="content-row-box">
<div class="content-col-box box-height-300 "style="flex: 3"> <div class="content-col-box box-height-300 "style="flex: 3">
<table-box :pop-data="topNStatData" ref="topNTab"></table-box> <div class="avg-children-space">
<el-select v-model="topNFilter.default" placeholder="" size="mini" style="display: inline-block;width: 200px" @change="topNChange">
<el-option v-for="(item,index) in topNFilter.options" :label="item.label" :value="item.value" :key="item.value+index"></el-option>
</el-select>
<el-select v-model="topNFilter.defaultTop" placeholder="" size="mini" style="display: inline-block;width: 100px" @change="topNChange">
<el-option v-for="(item,index) in topNFilter.tops" :label="item.label" :value="item.value" :key="item.value+index"></el-option>
</el-select>
</div>
<table-box :pop-data="topNStatData" ref="topNTab" style="height: 90%;"></table-box>
</div> </div>
<div class="content-col-box box-height-300 "style="flex: 8;"></div> <div class="content-col-box box-height-300 "style="flex: 8;"></div>
<div class="content-col-box box-height-300 "style="flex: 2;"> <div class="content-col-box box-height-300 "style="flex: 2;">
@@ -88,14 +85,24 @@
data(){ data(){
return { return {
assetStatData:{}, assetStatData:{},
typeFilter:{ typeFilter: 'typeStat',
show:false,
type:'typeStat'
},
projectStatData:{}, projectStatData:{},
endpointStatData:{}, endpointStatData:{},
dataCenterStatData:{}, dataCenterStatData:{},
topNStatData:{}, topNStatData:{},
topNFilter:{
default:'alertRule',
defaultTop:10,
options:[
{label:this.$t('dashboard.overview.alert.alertRuleTopN'),value:'alertRule'},
{label:this.$t('dashboard.overview.alert.assetTopN'),value:'asset'},
],
tops:[
{label:this.$t('dashboard.overview.alert.top')+'10',value:10},
{label:this.$t('dashboard.overview.alert.top')+'20',value:20},
{label:this.$t('dashboard.overview.alert.top')+'50',value:50},
]
},
alertRuleStatData:{}, alertRuleStatData:{},
sysTime:'', sysTime:'',
sysDate:'', sysDate:'',
@@ -111,7 +118,7 @@
this.queryProjectData(); this.queryProjectData();
this.queryEndpointData(); this.queryEndpointData();
this.queryDataCenterData(); this.queryDataCenterData();
this.queryAlertTopNData(); this.topNChange();
this.queryAlertRuleStatData(); this.queryAlertRuleStatData();
}, },
queryAssetData:function(){ queryAssetData:function(){
@@ -119,7 +126,7 @@
axios.get('/overview/assetStat').then((res)=>{ axios.get('/overview/assetStat').then((res)=>{
let response=res.data; let response=res.data;
if(response.msg == 'success'){ if(response.msg == 'success'){
let showData=response.data.typeStat; let showData=response.data[this.typeFilter];
this.assetStatData=this.formatAssetData(showData,response.data.totalStat); this.assetStatData=this.formatAssetData(showData,response.data.totalStat);
this.$refs.assetTab.endLoading(); this.$refs.assetTab.endLoading();
}else{ }else{
@@ -174,9 +181,10 @@
tableData:data, tableData:data,
tableLabel:[ tableLabel:[
{ {
label:this.$t('dashboard.overview.asset.assetType'), label:this.getAssetTabTitle(),
prop:'name', prop:'name',
show:true show:true,
renderHeader:this.assetRenderHeader,
}, },
{ {
label:this.$t('dashboard.overview.asset.num'), label:this.$t('dashboard.overview.asset.num'),
@@ -471,7 +479,7 @@
}, },
queryAlertTopNData:function(){ queryAlertTopNData:function(){
this.$refs.topNTab.startLoading(); this.$refs.topNTab.startLoading();
this.$get('/overview/alertStatByRule?top=10').then(response=>{ this.$get('/overview/alertStatByRule?top='+this.topNFilter.defaultTop).then(response=>{
if(response.msg == 'success') { if(response.msg == 'success') {
let showData = response.data.list; let showData = response.data.list;
this.topNStatData = this.formatAlertTopNData(showData); this.topNStatData = this.formatAlertTopNData(showData);
@@ -537,7 +545,7 @@
}, },
queryAssetTopNData:function(){ queryAssetTopNData:function(){
this.$refs.topNTab.startLoading(); this.$refs.topNTab.startLoading();
this.$get('/overview/alertStatByAsset?top=10').then(response=>{ this.$get('/overview/alertStatByAsset?top='+this.topNFilter.defaultTop).then(response=>{
if(response.msg == 'success') { if(response.msg == 'success') {
let showData=response.data.list; let showData=response.data.list;
this.topNStatData=this.formatAssetTopNData(showData); this.topNStatData=this.formatAssetTopNData(showData);
@@ -662,12 +670,76 @@
} }
}, },
/*加载数据 end*/ /*加载数据 end*/
showTypeFilter:function(){ getAssetTabTitle:function(){
this.typeFilter.show=true; switch (this.typeFilter) {
console.log(this.typeFilter.show) case "typeStat":
return this.$t('dashboard.overview.asset.assetType');
case "modelStat":
return this.$t('dashboard.overview.asset.modelStat');
case "dcStat":
return this.$t('dashboard.overview.asset.dcStat');
}
}, },
closeTypeFilter:function(){ assetRenderHeader:function(h, { column, $index }){ //修改header为dropdown
// this.typeFilter.show=false; let filters = [
{text:this.$t('dashboard.overview.asset.dropDownLabel.type'),value:'typeStat'},
{text:this.$t('dashboard.overview.asset.dropDownLabel.model'),value:'modelStat'},
{text:this.$t('dashboard.overview.asset.dropDownLabel.dc'),value:'dcStat'},
];
return h('div',
{
},
[
h('el-dropdown',
{
attrs:{
trigger:'click'
}
},
[
h('span',
{
domProps: {
innerHTML: column.label+'<i class="el-icon-arrow-down el-icon--right"></i>'
}
}
),
h('el-dropdown-menu',
{
attrs:{
slot:'dropdown'
}
},
[
filters.map(item => {
return h("el-dropdown-item", {
domProps: {
innerHTML:item.text
},
nativeOn:{
click:this.assetTabFilterChange.bind(this,item.value)
}
});
})
]
)
]
)
]
)
},
assetTabFilterChange:function(type){
this.typeFilter=type;
this.queryAssetData();
},
topNChange:function(){
if(this.topNFilter.default == 'alertRule'){
this.queryAlertTopNData();
}else if(this.topNFilter.default == 'asset'){
this.queryAssetTopNData();
}
}, },
/*header 时间处理 start*/ /*header 时间处理 start*/
initDate:function(){ initDate:function(){

View File

@@ -43,14 +43,14 @@
text-align: center; text-align: center;
} }
.super-icon{ .super-icon{
font-size: 80px !important; font-size:5rem !important;
} }
.middle-font{ .middle-font{
font-size: 30px !important; font-size: 1.875rem !important;
font-weight: 600; font-weight: 600;
} }
.middle-icon{ .middle-icon{
font-size: 30px !important; font-size: 1.875rem !important;
font-weight: 700; font-weight: 700;
margin-right: 5px; margin-right: 5px;
} }
@@ -60,7 +60,7 @@ font-size: 80px !important;
justify-content: center; justify-content: center;
} }
.super-font{ .super-font{
font-size: 40px !important; font-size: 2.5rem !important;
font-weight: 700; font-weight: 700;
} }
.red-icon{ .red-icon{

View File

@@ -51,12 +51,10 @@
v-if="item.show" v-if="item.show"
:key="`col-${index}`" :key="`col-${index}`"
:label="item.label" :label="item.label"
:render-header="item.renderHeader"
show-overflow-tooltip show-overflow-tooltip
min-width="90" min-width="90"
> >
<template slot="header" slot-scope="scope">
{{item.label}}<slot :name="item.label+'-header'"></slot>
</template>
<template slot-scope="scope" :column="item"> <template slot-scope="scope" :column="item">
<template v-if="item.showPopover"> <template v-if="item.showPopover">
<el-popover trigger="hover" placement="right" > <el-popover trigger="hover" placement="right" >
@@ -76,7 +74,6 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</template> </template>
@@ -136,7 +133,8 @@
immediate:true, immediate:true,
deep:true, deep:true,
handler(n,o){ handler(n,o){
this.showData=JSON.parse(JSON.stringify(n)); // this.showData=JSON.parse(JSON.stringify(n));
this.showData=Object.assign({},n);
} }
} }
} }