From 60e821fb16078a83e0233a1600d9f4d3cbb59b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Tue, 31 Oct 2023 14:43:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddetection=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=88=B7=E6=96=B0=E7=95=8C=E9=9D=A2=E5=90=8E=E9=A1=B5?= =?UTF-8?q?=E7=A0=81=E9=87=8D=E7=BD=AE=E4=B8=BA1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/detections/Index.vue | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/views/detections/Index.vue b/src/views/detections/Index.vue index 18f19b01..15999dba 100644 --- a/src/views/detections/Index.vue +++ b/src/views/detections/Index.vue @@ -172,12 +172,12 @@ export default { // } ], chartInit: [], - pageObj: { - pageNo: 1, - pageSize: defaultPageSize, - total: 0, - resetPageNo: true - }, + // pageObj: { + // pageNo: 1, + // pageSize: defaultPageSize, + // total: 0, + // resetPageNo: true + // }, q: '', detectionPageType, filterData: { @@ -716,7 +716,7 @@ export default { this.q = '' this.metaList = [] } - if (this.pageObj.resetPageNo) { + if (this.pageObj.resetPageNo && !this.initFlag) { this.pageObj.pageNo = 1 } else { this.pageObj.resetPageNo = true @@ -774,11 +774,11 @@ export default { this.search(this.metaList, this.q) }, pageNo (val) { - this.pageObj.pageNo = val || 1 - this.pageObj.resetPageNo = false // 初始化时,mounted和pageNo都会调用列表接口,且pageNo先执行, // 初始化保证mounted执行,后续pageNo变动则不影响接口调用 if (!this.initFlag) { + this.pageObj.pageNo = val || 1 + this.pageObj.resetPageNo = false this.search(this.metaList, this.q) } }, @@ -849,7 +849,11 @@ export default { } } this.queryFilter(q) - this.initFlag = false + if (this.initFlag) { + this.timer = setTimeout(() => { + this.initFlag = false + }, 1000) + } this.queryList(q) this.debounceFunc = this.$_.debounce(this.resize, 300) window.addEventListener('resize', this.debounceFunc) @@ -1028,9 +1032,17 @@ export default { timeFilter.value.startTime = parseInt(startTimeParam) timeFilter.value.endTime = parseInt(endTimeParam) } + const pageObj = ref({ + pageNo: query.pageNo ? parseInt(query.pageNo) : 1, + // 是否重置pageNo,在执行新搜索时是true + resetPageNo: true, + pageSize: query.pageSize ? parseInt(query.pageSize) : defaultPageSize, + total: 0 + }) return { timeFilter, - pageType + pageType, + pageObj } } }