From 000e35373fbda7498bedc248c510b00e49d30a3b Mon Sep 17 00:00:00 2001 From: LHD_HY <2872546851@qq.com> Date: Sat, 29 Nov 2025 17:54:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../child/AnalysisLabelItemForm.vue | 2 +- .../templateInfo/components/AnalysisRule.vue | 49 ++++++++++++++++--- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/views/template/analysisLabel/components/child/AnalysisLabelItemForm.vue b/src/views/template/analysisLabel/components/child/AnalysisLabelItemForm.vue index 797e7c5..92ef416 100644 --- a/src/views/template/analysisLabel/components/child/AnalysisLabelItemForm.vue +++ b/src/views/template/analysisLabel/components/child/AnalysisLabelItemForm.vue @@ -496,7 +496,7 @@ export default { .tree-container { max-height: 300px; - overflow-y: auto; + overflow: auto; padding: 8px 0; .limited-level-tree { diff --git a/src/views/template/templateInfo/components/AnalysisRule.vue b/src/views/template/templateInfo/components/AnalysisRule.vue index cccc1ef..95a956b 100644 --- a/src/views/template/templateInfo/components/AnalysisRule.vue +++ b/src/views/template/templateInfo/components/AnalysisRule.vue @@ -475,14 +475,47 @@ export default { // 加载树形结构数据 loadTreeData() { - listAnalysisLabelItem({ - analysisId: this.analysisLabelId - }).then(res => { - if (res.code === 200) { - this.treeData = this.buildTree(res.rows) - this.buildLabelItemMap(res.rows) - } - }) + const allItems = []; // 用于存储所有页的数据 + const pageSize = 10; // 每页数量,根据后端接口定义调整 + let currentPage = 1; // 当前页码 + + // 定义一个递归函数来获取每一页的数据 + const fetchPage = () => { + listAnalysisLabelItem({ + analysisId: this.analysisLabelId, + pageNum: currentPage, + pageSize: pageSize + }).then(res => { + if (res.code === 200) { + const { rows, total } = res; + + // 将当前页的数据追加到总数组 + if (rows && rows.length > 0) { + allItems.push(...rows); + } + + // 计算总页数 + const totalPages = Math.ceil(total / pageSize); + + // 如果当前页不是最后一页,则继续获取下一页 + if (currentPage < totalPages) { + currentPage++; + fetchPage(); // 递归调用,获取下一页 + } else { + // 所有页都获取完毕,构建树形结构 + console.log('所有数据获取完毕,共', allItems.length, '条'); + this.treeData = this.buildTree(allItems); + this.buildLabelItemMap(allItems); // 构建映射表 + } + } else { + // 出错处理 + this.$modal.msgError('加载标签项数据失败'); + } + }); + }; + + // 开始执行首次获取 + fetchPage(); }, // 构建树形结构