spring
7 天以前 8fba42cefa944e11e189d8bf8dcb0b50bfe3cc67
src/pages/production/twist/receive/monofil.vue
@@ -109,48 +109,53 @@
  // 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,
  });
  // 检查是否已选择标签
  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 = [];
  try {
    // 检查是否已选择标签
    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;
    }
    console.log("tab.value:===========3", currentLayer);
    const { data } = await TwistApi.getScarn({
      outPutId: JSON.parse(code.code).id,
      twistId: currentLayer.twistId,
    });
    // 检查当前层是否已存在该单丝
    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("二维码异常,请更换二维码!");
  }
};
@@ -347,7 +352,7 @@
<style lang="scss" scoped>
.list_box {
  height: calc(100vh - 100px);
  height: calc(100vh - 50px);
  background: #f3f9f8;
  display: flex;
  flex-direction: column;
@@ -410,7 +415,7 @@
}
.content {
  height: calc(100vh - 280px);
  height: calc(100vh - 200px);
  width: 100%;
}