| 222 | } |
| 223 | } |
| 224 | export function findGroupForId (nowGroupId, templateList) { |
| 225 | // 根据组id获取组 |
| 226 | let nowGroupTemplate = null |
| 227 | const find = (node) => { // 匿名函数防止this指向错误 |
| 228 | node.some(item => { |
| 229 | const { type, elementId } = item.property |
| 230 | if (type === 'group' && elementId === nowGroupId) { |
| 231 | nowGroupTemplate = item; |
| 232 | return true |
| 233 | } if (type === 'group') { |
| 234 | // 去组里面找看是否为组嵌套 |
| 235 | find(item.property.children) |
| 236 | } |
| 237 | }) |
| 238 | } |
| 239 | find(templateList) |
| 240 | return nowGroupTemplate |
| 241 | } |
| 242 | /** |
| 243 | * 求partArr数组中不包含allArr的数组 |
| 244 | * @param allArr:全数组 |