guoyuji
2024-07-04 1c13bd7a2cd2c8ba69a185da69344c8b59f4e561
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -97,6 +97,32 @@
        titleUploadData.value = res.data.reportingWork
        titleSelectJson.value = res.data.basic
        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 解析错误或其他异常情况
          }
        });
        // 遍历 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 =  {
@@ -170,13 +196,22 @@
  customConfig: {
    storage: true
  },
  mouseConfig:{selected: true},//鼠标选中
  keyboardConfig:{
    isArrow: true,
    isDel: true,
    isEnter: true,
    isTab: true,
    isEdit: true,
    isChecked: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },
  /*menuConfig: {
    body: {
  menuConfig: {
    /*body: {
      options: [
        [
          {
@@ -202,14 +237,21 @@
          },
        ]
      ]
    }
  },*/
    }*/
  },
  //表头参数
  columns: [
    //  {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
    {
      field: 'order_number',
      title: t('order.OrderNum'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
    },
    {
      field: 's01Value',
      title: t('reportingWorks.glassNumber'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
@@ -389,10 +431,13 @@
    }
    //brokenGrid.value.reloadData(brokenRow.damageDetail)
    //改变brokenVisible的值触发openedBrokenTable()方法
    brokenVisible.value = true
    const { rows, column, cell } = params; // 解构获取行、列和单元格信息
    //点击次破数量时打开明细界面
    if(column.field=="breakageQuantity"){
      brokenVisible.value = true
    }
  },
  /*menuClick({menu, row, column}) {
  menuClick({menu, row, column}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (menu.code) {
@@ -443,7 +488,7 @@
        }
      }
    }
  },*/
  },
}
@@ -454,7 +499,7 @@
  align: 'center',//文字居中
  stripe: true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
  id: 'CustomerList',
  id: 'CustomerListDetail',
  //showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
@@ -959,6 +1004,37 @@
      //判断早晚班
      titleUploadData.value.classes=t('reportingWorks.early')
      titleUploadData.value.reportingWorkTime = formatCurrentTime()
      // 声明一个空数组,用于存储每个订单的 S01 值
      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 解析错误或其他异常情况
        }
      });
// 遍历 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 中的值不足,可以添加默认值或者不进行赋值处理
        }
      });
      //绑定下方表格
      detail.value = res.data.Detail
      xGrid.value.reloadData(detail.value)
@@ -1049,6 +1125,7 @@
}
onMounted(() => {
  window.addEventListener('keypress', qrcodeScanner);
  //addListener(xGrid.value, gridOptions)
})
// 在组件卸载时移除键盘事件监听