yyb
2026-04-29 7509df62180e7e4b08bf41bf3a181b23910d7c6c
优化扫码结果处理逻辑
已修改2个文件
14 ■■■■■ 文件已修改
src/pages/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/works.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue
@@ -249,9 +249,13 @@
        console.log("扫码结果:", res);
        // 解析扫码结果并跳转到生产报工页面
        try {
          const scanResult = JSON.parse(res.result);
          const scanRaw = res.result;
          const scanResult =
            typeof scanRaw === "string" ? JSON.parse(scanRaw) : scanRaw;
          console.log("scanResult", scanResult);
          uni.navigateTo({
            url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(JSON.stringify(scanResult))}`
            // 传递整个 orderRow 对象(扫码对象)给报工页
            url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(JSON.stringify(scanResult))}`,
          });
        } catch (e) {
          console.error("扫码结果解析失败:", e);
@@ -260,7 +264,7 @@
      },
      fail: (err) => {
        console.error("扫码失败:", err);
      }
      }
    });
    return;
  }
src/pages/works.vue
@@ -980,7 +980,7 @@
              console.log("工单数据:", workData);
              orderRow = JSON.stringify({
                id: workData.id || workOrderId,
                workOrderId: workData.id || workOrderId,
                planQuantity: workData.planQuantity - workData.completeQuantity,
                productProcessRouteItemId:
                  workData.productProcessRouteItemId ||
@@ -1027,7 +1027,7 @@
        }
        // 扫码成功后跳转到生产报工页面,并传递orderRow参数
        uni.navigateTo({
          url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
          url: `/pages/productionManagement/productionReport/index?orderRow=${encodeURIComponent(orderRow)}`,
        });
      },
      fail: err => {