From ab10f7ff0f3f6c1e921bfbffc96975897c8c7cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Fri, 12 Jan 2024 11:56:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=BB=A3=E7=A0=81=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=8D=A0=E7=94=A8=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entityDetail/tabs/SecurityEvent.vue | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/views/charts2/charts/entityDetail/tabs/SecurityEvent.vue b/src/views/charts2/charts/entityDetail/tabs/SecurityEvent.vue index f888943e..e804111f 100644 --- a/src/views/charts2/charts/entityDetail/tabs/SecurityEvent.vue +++ b/src/views/charts2/charts/entityDetail/tabs/SecurityEvent.vue @@ -5,7 +5,7 @@
@@ -93,10 +93,10 @@ export default { data () { return { eventList: [], - eventListAll: [], showError: false, eventSeverityColor, - errorMsg: '' + errorMsg: '', + showEventNum: 0 } }, components: { chartNoData }, @@ -148,8 +148,12 @@ export default { this.$emit('checkTag', entityDetailTabsName.securityEvent, res.data.result.length) this.showError = false if (!this.isNoData) { - this.eventListAll = res.data.result - this.eventList = this.getTargetPageData(1, 10, this.eventListAll) + this.eventList = res.data.result + if (res.data.result.length <= 10) { + this.showEventNum = res.data.result.length + } else { + this.showEventNum = 10 + } } } else { this.httpError(res) @@ -185,15 +189,13 @@ export default { const scrollTop = e.target.scrollTop const scrollHeight = e.target.scrollHeight if (scrollTop && this.$_.ceil(clientHeight + scrollTop) >= scrollHeight) { - if (this.eventListAll.length > this.eventList.length) { - const diff = (this.eventListAll.length - this.eventList.length) <= 10 ? this.eventListAll.length - this.eventList.length : 10 - const num = this.$_.ceil(this.eventList.length / 10) + 1 - this.eventList = this.eventList.concat(this.getTargetPageData(num, diff, this.eventListAll)) + if (this.showEventNum < this.eventList.length) { + this.showEventNum = this.showEventNum + 10 + if (this.showEventNum > this.eventList.length) { + this.eventList.num = this.eventList.length + } } } - }, - getTargetPageData (pageNum, pageSize, data) { - return this.$_.slice(data, (pageNum - 1) * pageSize, pageNum * pageSize) } } }