| | |
| | | export function formatAreaTree(item, list) { |
| | | if (item.parentId === 0) { |
| | | export function formatAreaTree(item, ids, list) { |
| | | // parentId 不在id列表中; |
| | | // if (item.parentId === 0) { |
| | | if (ids.indexOf(item.parentId) === -1) { |
| | | list.push({ |
| | | label: item.areaName, |
| | | id: item.id, |
| | | data: item, |
| | | children: [] |
| | | areaDescript: item.areaDescript, |
| | | charger: item.areaUsers.map((v) => v.uname).join(","), |
| | | children: [], |
| | | }); |
| | | } else { |
| | | let isCurrentChild = false; |
| | |
| | | label: item.areaName, |
| | | id: item.id, |
| | | data: item, |
| | | children: [] |
| | | areaDescript: item.areaDescript, |
| | | charger: item.areaUsers.map((v) => v.uname).join(","), |
| | | children: [], |
| | | }); |
| | | } |
| | | } |
| | |
| | | for (let i = 0; i < list.length; i++) { |
| | | const listItem = list[i]; |
| | | if (!isCurrentChild && listItem.children !== 0) { |
| | | formatAreaTree(item, listItem.children); |
| | | formatAreaTree(item, ids, listItem.children); |
| | | } |
| | | } |
| | | } |