回显问题修复
This commit is contained in:
parent
f5812a995c
commit
a611990ae6
|
|
@ -59,7 +59,7 @@
|
|||
<el-tag style="margin-left: 10px" size="mini" type="primary">节点{{ row.level }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="层级名称">
|
||||
<template slot-scope="{ row }">
|
||||
<!-- 只在项目级(第一级)显示层级名称 -->
|
||||
|
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue