| | |
| | | // 产品名称默认傻老大原味瓜子(质检试压) |
| | | productTreeList({productName: '质量'}).then((res) => { |
| | | productOptions.value = convertIdToValue(res); |
| | | const target = res.find((item) => item.label === "傻老大原味瓜子(质检试压)"); |
| | | // 递归查找目标节点 |
| | | const findTarget = (nodes) => { |
| | | for (const node of nodes) { |
| | | if (node.label === "傻老大原味瓜子(质检试压)") { |
| | | return node; |
| | | } |
| | | if (node.children && node.children.length > 0) { |
| | | const found = findTarget(node.children); |
| | | if (found) return found; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | const target = findTarget(res); |
| | | if (target) { |
| | | form.value.productId = target.id; |
| | | form.value.productName = target.label; |