|  |  | 
 |  |  |   // let parseData = code.trim(); | 
 |  |  |   console.log("code:===========", JSON.parse(code.code)); | 
 |  |  |   console.log("id:=============", JSON.parse(code.code).id); | 
 |  |  |   const { data } = await TwistApi.getScarn({ | 
 |  |  |     outPutId: JSON.parse(code.code).id, | 
 |  |  |   }); | 
 |  |  |   try { | 
 |  |  |     const { data } = await TwistApi.getScarn({ | 
 |  |  |       outPutId: JSON.parse(code.code).id, | 
 |  |  |     }); | 
 |  |  |  | 
 |  |  |   // 检查是否已选择标签 | 
 |  |  |   if (!tab.value) { | 
 |  |  |     toast.error("请先选择一个层"); | 
 |  |  |     return; | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   // 找到当前选中的层 | 
 |  |  |   console.log("tab.value:===========2", tab.value); | 
 |  |  |   const currentLayer = nodeList.value.find((node) => node.twistedLayer === tab.value); | 
 |  |  |   if (!currentLayer) { | 
 |  |  |     toast.error("未找到当前选中的层"); | 
 |  |  |     return; | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   // 检查当前层是否已存在该单丝 | 
 |  |  |   const exists = currentLayer.strandedWireDish?.some( | 
 |  |  |     (item: any) => item.monofilamentNumber === data.monofilamentNumber | 
 |  |  |   ); | 
 |  |  |   if (!exists) { | 
 |  |  |     const { id, outPutId, wireId, oneLength, ...rest } = data; | 
 |  |  |     const newItem = { | 
 |  |  |       wireId: paramsId.value, | 
 |  |  |       outputId: id, | 
 |  |  |       amount: oneLength, | 
 |  |  |       ongLength: oneLength, | 
 |  |  |       ...rest, | 
 |  |  |     }; | 
 |  |  |  | 
 |  |  |     // 添加到当前层的 strandedWireDish 中 | 
 |  |  |     if (!currentLayer.strandedWireDish) { | 
 |  |  |       currentLayer.strandedWireDish = []; | 
 |  |  |     // 检查是否已选择标签 | 
 |  |  |     if (!tab.value) { | 
 |  |  |       toast.error("请先选择一个层"); | 
 |  |  |       return; | 
 |  |  |     } | 
 |  |  |     currentLayer.strandedWireDish.push(newItem); | 
 |  |  |  | 
 |  |  |     // 刷新当前层的数据显示 | 
 |  |  |     getList(); | 
 |  |  |   } else { | 
 |  |  |     toast.error("该单丝已领用,请勿重复扫码"); | 
 |  |  |     // 找到当前选中的层 | 
 |  |  |     console.log("tab.value:===========2", tab.value); | 
 |  |  |     const currentLayer = nodeList.value.find((node) => node.twistedLayer === tab.value); | 
 |  |  |     if (!currentLayer) { | 
 |  |  |       toast.error("未找到当前选中的层"); | 
 |  |  |       return; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 检查当前层是否已存在该单丝 | 
 |  |  |     const exists = currentLayer.strandedWireDish?.some( | 
 |  |  |       (item: any) => item.monofilamentNumber === data.monofilamentNumber | 
 |  |  |     ); | 
 |  |  |     if (!exists) { | 
 |  |  |       const { id, outPutId, wireId, oneLength, ...rest } = data; | 
 |  |  |       const newItem = { | 
 |  |  |         wireId: paramsId.value, | 
 |  |  |         outputId: id, | 
 |  |  |         amount: oneLength, | 
 |  |  |         ongLength: oneLength, | 
 |  |  |         ...rest, | 
 |  |  |       }; | 
 |  |  |  | 
 |  |  |       // 添加到当前层的 strandedWireDish 中 | 
 |  |  |       if (!currentLayer.strandedWireDish) { | 
 |  |  |         currentLayer.strandedWireDish = []; | 
 |  |  |       } | 
 |  |  |       currentLayer.strandedWireDish.push(newItem); | 
 |  |  |  | 
 |  |  |       // 刷新当前层的数据显示 | 
 |  |  |       getList(); | 
 |  |  |     } else { | 
 |  |  |       toast.error("该单丝已领用,请勿重复扫码"); | 
 |  |  |     } | 
 |  |  |   } catch (error) { | 
 |  |  |     toast.error("二维码异常,请更换二维码!"); | 
 |  |  |   } | 
 |  |  | }; | 
 |  |  |  |