From a611990ae6b0b2dc83a5443f19b72458cd5dca0f Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Mon, 28 Jul 2025 10:41:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/basic/model-manage/index.vue | 32 ++++++++++++++------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/views/basic/model-manage/index.vue b/src/views/basic/model-manage/index.vue
index 7147e5d..e7907fb 100644
--- a/src/views/basic/model-manage/index.vue
+++ b/src/views/basic/model-manage/index.vue
@@ -59,7 +59,7 @@
节点{{ row.level }}
-
+
@@ -231,7 +231,7 @@ export default {
proName: undefined,
unit: undefined,
chargePerson: undefined,
- },
+ },
}
},
created() {
@@ -265,13 +265,13 @@ export default {
return
} */
/* 新需求 重新做 上面建议不要删除 有需要直接可以查看 */
- openView({ id: row.id }).then(response => {
+ openView({ id: row.id }).then(response => {
this.dxfPreviewUrl = response.data
this.viewDialogVisible = true
}).catch(error => {
console.error("获取项目详情失败:", error);
});
-
+
},
// 查询按钮
@@ -295,12 +295,14 @@ export default {
// 新增子节点
handleAddChild(row) {
- const { id, proName, level, nodeCount, projectId } = row
+ const { id, proName, nodeName, level, nodeCount, projectId } = row;
+ const name = nodeName || proName; // 如果 nodeName 存在就用它,否则用 proName
+
this.addOrEditFormTitle = '新增'
this.editForm = null
this.addOrEditFormVisible = true
- const editForm = { deviceName: proName, id, level, nodeCount, projectId }
+ const editForm = { deviceName: name, id, level, nodeCount, projectId }
this.$nextTick(() => {
this.$refs.addOrEditComponentRef.setFormData(editForm)
})
@@ -323,11 +325,11 @@ export default {
this.loading = true;
getModelListApi(this.queryParams).then((response) => {
const rawList = response.rows || [];
-
+
// 增强型递归处理
const formatNodes = (nodes, level = 2) => { // 从第二级开始
if (!Array.isArray(nodes)) return [];
-
+
return nodes
.filter(item => item && item.nodeId) // 过滤无效节点
.map(item => ({
@@ -339,11 +341,11 @@ export default {
nodes: formatNodes(item.nodes || item.children || [], level + 1)
}));
};
-
+
// 处理项目层数据
const formatted = rawList.map(project => {
const children = project.children || [];
-
+
// 获取层级名称(项目级才需要)
let levelName = '';
let nodeCount = '';
@@ -353,7 +355,7 @@ export default {
);
levelName = levelConfig ? levelConfig.configName : '';
}
-
+
return {
...project,
id: project.projectId,
@@ -365,11 +367,11 @@ export default {
nodeCount:project.nodeCount
};
});
-
+
this.modelList = formatted;
this.total = response.total;
this.loading = false;
-
+
}).catch(error => {
console.error("获取模型列表失败:", error);
this.loading = false;
@@ -437,7 +439,7 @@ export default {
} else {
res = await delModelApi({ id: row.id }); // 使用 delModelApi 删除模型节点
}
-
+
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
this.getModelList()
@@ -540,4 +542,4 @@ export default {
color: #409eff;
background-color: #f0f7ff;
}
-
\ No newline at end of file
+