| | |
| | | }); |
| | | }; |
| | | |
| | | const findSiblings = (items, tempId) => { |
| | | if (!items || items.length === 0) return null; |
| | | // 检查当前层级 |
| | | if (items.some(item => item.tempId === tempId)) { |
| | | return items; |
| | | } |
| | | // 递归查找子级 |
| | | for (const item of items) { |
| | | if (item.children && item.children.length > 0) { |
| | | const result = findSiblings(item.children, tempId); |
| | | if (result) return result; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const handleBomProcessChange = (row, value) => { |
| | | row.processId = value || ""; |
| | | syncProcessOperationFields(row); |
| | | |
| | | // 同一层级只能选一样的工序 |
| | | const siblings = findSiblings(bomDataValue.value.dataList, row.tempId); |
| | | if (siblings && value) { |
| | | siblings.forEach(sibling => { |
| | | if (sibling.tempId !== row.tempId) { |
| | | sibling.processId = value; |
| | | syncProcessOperationFields(sibling); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const openBomDialog = tempId => { |