Commit 9f5fb0be authored by 胡占生's avatar 胡占生 🇨🇳

fix: 点位管理修复 树节点回显问题

parent 884b6aa1
......@@ -343,10 +343,31 @@ function createPoint() {
}
/* 新增子区域 */
function areaMangerAddBefore(data){
areaManger.form.value.parents = [data.id];
const parentIds = findParentIds(areaManger.list.value ,data.id);
areaManger.form.value.parents =parentIds;
console.log(data)
areaManger.toAdd(data)
}
function findParentIds(nodes, targetId, path = [], result = []) {
for (let node of nodes) {
// 将当前节点的ID添加到路径中
path.push(node.id);
// 检查是否找到目标节点
if (node.id === targetId) {
// 复制当前路径到结果中(因为路径会被后续迭代修改)
result.push(...path);
}
// 如果当前节点有子节点,则递归查找
if (node.children) {
findParentIds(node.children, targetId, path, result);
}
// 回溯,移除当前节点ID
path.pop();
}
return result;
}
function configProTime(data) {
aiAlarmPeriodTime.getList({ regionalLocationId: data.id });
algorithmManage.getDetail(data.id).then(({ data }) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment