From ebc1d1926273a444e832d4cd5a32e26953e366fe Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Mon, 28 Sep 2020 16:58:19 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20assetList=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/page/asset/asset.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index c6f565932..1d5678ab7 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -428,7 +428,21 @@ this.bottomBox.asset = JSON.parse(JSON.stringify(asset)); this.bottomBox.showSubList = true; }, + checkSearchLabel(n, o) { + let nKeys = Object.keys(n); + let oKeys = Object.keys(o); + if (nKeys.length != oKeys.length) { + return true; + } else { + let flag = false; + nKeys.forEach(key => { + n[key] != o[key] && (flag = true); + }); + return flag; + } + }, getTableData() { + let oldSearchLabel = JSON.parse(JSON.stringify(this.searchLabel)); this.searchLabel = Object.assign(this.searchLabel, this.pageObj); this.tools.loading = true; if(this.searchLabel.tags && this.searchLabel.tags!=''){ @@ -625,6 +639,7 @@ }, initEvent() { bus.$on("asset-filter-change", (column, content) => { + let oldPageObj = JSON.parse(JSON.stringify(this.pageObj)); if(column == 'multiParam'){ let $self=this; if(content instanceof Array && content.length>0){ @@ -635,7 +650,8 @@ }else{ this.pageObj[column] = content; } - this.getTableData(); + let isSame = this.checkSearchLabel(JSON.parse(JSON.stringify(this.pageObj)), oldPageObj); + isSame && this.getTableData(); }); }, dispatchEvent(event,param){ @@ -714,7 +730,7 @@ this.loadKeys(); - console.log('load end') + //console.log('load end') //初始化数据 this.getUserData();