fix:将分页缓存放入created里 以及pagination取值取pageObj的值

This commit is contained in:
zhangyu
2020-11-21 12:21:27 +08:00
parent d25eb264e7
commit dd5f2dfe6d
17 changed files with 105 additions and 47 deletions

View File

@@ -783,13 +783,15 @@ export default {
}, },
}, },
mounted() { created(){
this.firstLoad = false;
//是否存在分页缓存 //是否存在分页缓存
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' && pageSize != null) { if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }
},
mounted() {
this.firstLoad = false;
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList') this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList')
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList')) ? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + '/alertList'))
: this.tableTitle; : this.tableTitle;

View File

@@ -686,12 +686,14 @@
} }
}, },
}, },
mounted() { created(){
//是否存在分页缓存 //是否存在分页缓存
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) { if (pageSize) {
this.pageObj.pageSize = pageSize this.pageObj.pageSize = pageSize
} }
},
mounted() {
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList") this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList")
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList")) ? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-/alertList"))
: this.tableTitle; : this.tableTitle;

View File

@@ -8,7 +8,7 @@
@current-change="current" @current-change="current"
:current-page="pageObj.pageNo" :current-page="pageObj.pageNo"
:page-sizes="pageSizes?pageSizes:[50, 100, 200]" :page-sizes="pageSizes?pageSizes:[50, 100, 200]"
:page-size="pageSize" :page-size="Number(pageObj.pageSize)"
layout="total, prev, pager, next, slot" layout="total, prev, pager, next, slot"
:total="this.pageObj.total" :total="this.pageObj.total"
> >
@@ -125,7 +125,7 @@ export default {
this.pageSize=this.postPageSizes[0]; this.pageSize=this.postPageSizes[0];
this.resetPageSizes(); this.resetPageSizes();
}else{ }else{
let pageSize = ''; let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if(pageSize != 'undefined' && pageSize != null){ if(pageSize != 'undefined' && pageSize != null){
this.pageSize=parseInt(pageSize); this.pageSize=parseInt(pageSize);
} }

View File

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

View File

@@ -234,6 +234,13 @@
deleteBox:{} deleteBox:{}
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted(){ mounted(){
this.getTableTitle(); this.getTableTitle();
this.getAssetList(); this.getAssetList();

View File

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

View File

@@ -550,17 +550,19 @@
bus.$off("dc-list-change"); bus.$off("dc-list-change");
bus.$off('alert-message-change') bus.$off('alert-message-change')
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
this.initEvent(); this.initEvent();
this.getTableData(); this.getTableData();

View File

@@ -719,6 +719,13 @@
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)

View File

@@ -767,7 +767,13 @@
self.tools.tableHover = false; self.tools.tableHover = false;
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
let tableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) let tableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)

View File

@@ -375,17 +375,19 @@
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
this.getTableData(); this.getTableData();
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -509,6 +509,13 @@
beforeDestroy(){ beforeDestroy(){
bus.$off("dc-list-change"); bus.$off("dc-list-change");
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;
}, },
@@ -518,11 +525,6 @@
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize;
}
this.getTableData(); this.getTableData();
this.$nextTick(function(){ this.$nextTick(function(){
this.getUserData();//绑定滚动条事件控制top按钮 this.getUserData();//绑定滚动条事件控制top按钮

View File

@@ -347,17 +347,19 @@
self.tools.tableHover = false; self.tools.tableHover = false;
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
this.getTableData(); this.getTableData();
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -347,17 +347,19 @@
self.tools.tableHover = false; self.tools.tableHover = false;
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
this.getTableData(); this.getTableData();
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -286,18 +286,19 @@
} }
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize && pageSize != 'undefined') {
this.pageObj.pageSize = pageSize
}
this.getTableData(); this.getTableData();
this.$nextTick(() => { this.$nextTick(() => {
//绑定滚动条事件控制top按钮 //绑定滚动条事件控制top按钮

View File

@@ -412,6 +412,13 @@
self.tools.tableHover = false; self.tools.tableHover = false;
} }
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化数据 //初始化数据
Promise.all([this.getDcData()]).then(response => { Promise.all([this.getDcData()]).then(response => {

View File

@@ -299,17 +299,19 @@
}, },
watch:{ watch:{
}, },
created(){
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize != 'undefined' && pageSize != null) {
this.pageObj.pageSize = pageSize
}
},
mounted() { mounted() {
//初始化表头 //初始化表头
this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path) this.tools.customTableTitle = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
? JSON.parse(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.tableTitle;
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
//是否存在分页缓存
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
if (pageSize && pageSize != 'undefined') {
this.pageObj.pageSize = pageSize
}
this.getTableData(); this.getTableData();
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -767,6 +767,11 @@
}, },
created(){ created(){
this.currentProject=this.$store.state.currentProject; this.currentProject=this.$store.state.currentProject;
//是否存在分页缓存
let pageSize=localStorage.getItem('nz-pageSize-'+localStorage.getItem('nz-username')+'-'+this.tableId);
if(pageSize){
this.endpointPageObj.pageSize=pageSize
}
this.getModuleList(); this.getModuleList();
this.getUserData(); this.getUserData();
this.getProjectList(); this.getProjectList();
@@ -776,11 +781,6 @@
this.tools.customTableTitle=localStorage.getItem("nz-tableTitle-"+localStorage.getItem("nz-username")+"-"+this.$route.path) this.tools.customTableTitle=localStorage.getItem("nz-tableTitle-"+localStorage.getItem("nz-username")+"-"+this.$route.path)
?JSON.parse(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.tableTitle;
//是否存在分页缓存
let pageSize=localStorage.getItem('nz-pageSize-'+localStorage.getItem('nz-username')+'-'+this.tableId);
if(pageSize){
this.endpointPageObj.pageSize=pageSize
}
setTimeout(()=>{ setTimeout(()=>{
this.ready=true; this.ready=true;
},300); },300);