From 5e2982df8aca712c3156711c1917fcedb6cfb087 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期三, 09 九月 2026 10:30:23 +0800
Subject: [PATCH] fix: 09-09上午整改——RULE_001分项运政对比(6段)+阈值说明联动通用化+汇总大表列宽回归母版+导入结果弹窗 + 测试报告与工作日结
---
traffic-audit-web/src/views/DataView.vue | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 1 deletions(-)
diff --git a/traffic-audit-web/src/views/DataView.vue b/traffic-audit-web/src/views/DataView.vue
index 8ef5b0d..3dce26a 100644
--- a/traffic-audit-web/src/views/DataView.vue
+++ b/traffic-audit-web/src/views/DataView.vue
@@ -81,12 +81,14 @@
total: 0,
records: [],
columns: [],
- loading: false
+ loading: false,
+ loadingMore: false
}
},
methods: {
loadData() {
this.loading = true
+ this.loadingMore = false
api.get('/data/list', {
params: {
type: this.type,
@@ -109,7 +111,71 @@
this.$message.error('鏁版嵁鏌ヨ澶辫触')
}).finally(() => {
this.loading = false
+ this.$nextTick(() => this.attachBodyScroll())
})
+ },
+ // el-table 鍥哄畾楂樺害鍚庯紝鐪熸鐨勭珫鍚戞粴鍔ㄥ鍣ㄦ槸鍐呴儴鐨� body-wrapper锛堥〉闈㈡湰韬笉婊氬姩锛�
+ attachBodyScroll() {
+ const wrap = this.$refs.tableWrap
+ if (!wrap) return
+ const bw = wrap.querySelector('.el-table__body-wrapper')
+ if (bw && bw._vwScrollHandler !== this.onScroll) {
+ if (bw._vwScrollHandler) bw.removeEventListener('scroll', bw._vwScrollHandler)
+ bw.addEventListener('scroll', this.onScroll, { passive: true })
+ bw._vwScrollHandler = this.onScroll
+ }
+ },
+ // 婊氬姩鍒板簳閮ㄨ嚜鍔ㄨ拷鍔犱笅涓�椤碉紙淇濈暀鎵嬪姩鍒嗛〉璺抽〉鑳藉姏锛�
+ loadMore() {
+ if (this.loading || this.loadingMore) return
+ if (this.records.length >= this.total || this.total <= 0) return
+ const nextPage = this.page + 1
+ this.loadingMore = true
+ api.get('/data/list', {
+ params: {
+ type: this.type,
+ period: this.period || undefined,
+ keyword: this.keyword || undefined,
+ page: nextPage,
+ size: this.size
+ }
+ }).then(res => {
+ const d = res.data || {}
+ const addRows = d.records || []
+ if (!addRows.length) {
+ this.page = nextPage - 1
+ return
+ }
+ this.records = this.records.concat(addRows)
+ this.page = nextPage
+ if (d.total != null) this.total = d.total
+ if (d.columns && d.columns.length) this.columns = d.columns
+ }).catch(e => {
+ if (e && e._toast) return
+ this.$message.error('鍔犺浇鏇村澶辫触')
+ }).finally(() => {
+ this.loadingMore = false
+ this.$nextTick(() => this.attachBodyScroll())
+ })
+ },
+ onScroll(e) {
+ // 鏅��/鍏ㄥ睆涓嬬湡姝g殑婊氬姩瀹瑰櫒閮芥槸 el-table 鍐呴儴 body-wrapper锛堟崟鑾烽樁娈靛彲鏀跺埌锛夛紱
+ // 椤甸潰鏁翠綋婊氬姩鏃朵互 window/document 涓哄噯銆�
+ const t = e && e.target
+ let scrollTop, clientHeight, scrollHeight
+ if (t && t.nodeType === 1 && t !== document && typeof t.scrollTop === 'number' && t.scrollHeight > t.clientHeight) {
+ scrollTop = t.scrollTop
+ clientHeight = t.clientHeight
+ scrollHeight = t.scrollHeight
+ } else {
+ const se = document.scrollingElement || document.documentElement
+ scrollTop = se.scrollTop
+ clientHeight = window.innerHeight
+ scrollHeight = se.scrollHeight
+ }
+ if (scrollHeight > 0 && scrollTop + clientHeight >= scrollHeight - 80) {
+ this.loadMore()
+ }
},
toggleFullscreen() {
const el = this.$refs.tableWrap
@@ -131,11 +197,44 @@
if (q.period) this.period = q.period
if (q.keyword) this.keyword = q.keyword
this.loadData()
+ window.addEventListener('scroll', this.onScroll, { passive: true })
+ if (this.$refs.tableWrap) {
+ // capture=true锛歟l-table 鍐呴儴 body-wrapper 鐨勬粴鍔ㄥ湪鎹曡幏闃舵涔熻兘鏀跺埌
+ this.$refs.tableWrap.addEventListener('scroll', this.onScroll, { passive: true, capture: true })
+ }
+ this.$nextTick(() => this.attachBodyScroll())
+ },
+ beforeDestroy() {
+ window.removeEventListener('scroll', this.onScroll)
+ if (this.$refs.tableWrap) {
+ this.$refs.tableWrap.removeEventListener('scroll', this.onScroll, { capture: true })
+ const bw = this.$refs.tableWrap.querySelector('.el-table__body-wrapper')
+ if (bw && bw._vwScrollHandler) bw.removeEventListener('scroll', bw._vwScrollHandler)
+ }
}
}
</script>
<style scoped>
.el-header { background: #409EFF; color: white; line-height: 60px; font-size: 18px; }
+#app .table-wrap {
+ display: flex;
+ flex-direction: column;
+ height: calc(100vh - 330px);
+ min-height: 300px;
+}
+#app .table-area {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: hidden;
+}
+#app .table-area .el-table {
+ width: 100%;
+ height: 100%;
+}
+#app .table-wrap .el-pagination {
+ flex: none;
+ margin-top: 8px;
+}
#app .table-area:fullscreen {
padding: 20px;
background: #fff;
@@ -147,6 +246,7 @@
overflow: auto;
display: flex;
flex-direction: column;
+ height: 100vh;
}
#app .table-wrap:fullscreen .table-area {
flex: 1 1 auto;
--
Gitblit v1.9.1