From 22780b97d4276249b36e80fdda3f07cb6a31c732 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Tue, 15 Jul 2025 17:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/basic/model-manage/index.vue | 61 +++++++++++++++++--------- vue.config.js | 2 +- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/views/basic/model-manage/index.vue b/src/views/basic/model-manage/index.vue index 1ca165e..d42d329 100644 --- a/src/views/basic/model-manage/index.vue +++ b/src/views/basic/model-manage/index.vue @@ -47,22 +47,21 @@ --> - + + - + @@ -203,14 +202,34 @@ export default { }, // 获取设备列表 - getModelList() { - this.loading = true - getModelListApi(this.queryParams).then((response) => { - this.modelList = response.rows - this.total = response.total - this.loading = false - }) - }, +getModelList() { + this.loading = true + getModelListApi(this.queryParams).then((response) => { + const rawList = response.rows + + // 递归处理 nodes + const formatNodes = (nodes = []) => { + return nodes.map(item => ({ + ...item, + id: item.nodeId, // row-key 统一使用 id + name: item.nodeName, // 展示统一使用 name + nodes: formatNodes(item.nodes || []) + })) + } + + // 第一层项目(显示 proName,子节点进入 formatNodes) + const formatted = rawList.map(project => ({ + ...project, + id: project.projectId, + name: project.proName, + nodes: formatNodes(project.children || []) + })) + + this.modelList = formatted + this.total = response.total + this.loading = false + }) +}, // 上传按钮 handleUploadModel(row) { diff --git a/vue.config.js b/vue.config.js index 80e0cfa..16916b8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin') const name = process.env.VUE_APP_TITLE || '水运工程设计施工AR应用平台' // 网页标题 -const baseUrl = 'http://192.168.0.60:58080' // 后端接口 +const baseUrl = 'http://127.0.0.1:58080' // 后端接口 const port = process.env.port || process.env.npm_config_port || 80 // 端口