廖井涛
2024-07-10 78809560f4315777e770acec0e24cb42e2ca97a7
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -100,30 +100,25 @@
        layer= res.data.layer
        const s01Values = [];
        // 遍历 res.data.numberList 数组,获取每个元素的 S01 值并存储到 s01Values 数组中
        res.data.numberList.forEach(element => {
          try {
            const otherColumnsObject = JSON.parse(element.other_columns);
            const s01Value = otherColumnsObject.S01;
            if (s01Value) {
              s01Values.push(s01Value);
            } else {
              // 如果 S01 值为空,可以选择添加默认值或者忽略这个元素
              s01Values.push(''); // 例如添加空字符串
            }
          } catch (error) {
            // console.error('Error parsing JSON or accessing S01 value:', error);
            // 处理 JSON 解析错误或其他异常情况
        for (let i = 0; i < res.data.reportingWorkDetails.length; i++) {
          const s01Values = [];
          // 遍历 detailList 数组,提取 S01 值到 s01Values 数组
          if (res.data.reportingWorkDetails[i].other_columns!=null|| res.data.reportingWorkDetails[i].other_columns!=undefined){
            res.data.reportingWorkDetails.forEach(element => {
              const otherColumnsObject = JSON.parse(element.other_columns);
              const s01Value = otherColumnsObject.S01;
              s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值
            });
            // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
            res.data.reportingWorkDetails.forEach((detail, index) => {
              detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性
            });
          }
        });
        // 遍历 res.data.Detail 数组,将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
        res.data.reportingWorkDetails.forEach((detail, index) => {
          if (index < s01Values.length) {
            detail.s01Value = s01Values[index]; // 添加一个名为 s01Value 的新属性,存储对应的 S01 值
          } else {
            detail.s01Value = ''; // 如果 s01Values 中的值不足,可以添加默认值或者不进行赋值处理
          }
        });
        }
        //titleUploadData.value.processId=titleUploadData.value.processId+'/'+layer
        xGrid.value.reloadData(res.data.reportingWorkDetails)
        let button =  {
@@ -1012,34 +1007,26 @@
      titleUploadData.value.classes=t('reportingWorks.early')
      titleUploadData.value.reportingWorkTime = formatCurrentTime()
      // 声明一个空数组,用于存储每个订单的 S01 值
      //处理编号列
      //定义存放编号数组
      const s01Values = [];
      for (let i = 0; i < res.data.Detail.length; i++) {
        const s01Values = [];
        // 遍历 detailList 数组,提取 S01 值到 s01Values 数组
        if (res.data.Detail[i].other_columns!=null|| res.data.Detail[i].other_columns!=undefined){
          res.data.Detail.forEach(element => {
            const otherColumnsObject = JSON.parse(element.other_columns);
            const s01Value = otherColumnsObject.S01;
            s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值
          });
// 遍历 res.data.numberList 数组,获取每个元素的 S01 值并存储到 s01Values 数组中
      res.data.numberList.forEach(element => {
        try {
          const otherColumnsObject = JSON.parse(element.other_columns);
          const s01Value = otherColumnsObject.S01;
          if (s01Value) {
            s01Values.push(s01Value);
          } else {
            // 如果 S01 值为空,可以选择添加默认值或者忽略这个元素
            s01Values.push(''); // 例如添加空字符串
          }
        } catch (error) {
          // console.error('Error parsing JSON or accessing S01 value:', error);
          // 处理 JSON 解析错误或其他异常情况
          // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
          res.data.Detail.forEach((detail, index) => {
            detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性
          });
        }
      });
// 遍历 res.data.Detail 数组,将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
      res.data.Detail.forEach((detail, index) => {
        if (index < s01Values.length) {
          detail.s01Value = s01Values[index]; // 添加一个名为 s01Value 的新属性,存储对应的 S01 值
        } else {
          detail.s01Value = ''; // 如果 s01Values 中的值不足,可以添加默认值或者不进行赋值处理
        }
      });
      }
      //绑定下方表格