guoyuji
2025-02-20 ca83a37c04d4d4029eaffa7a7d11578c26ad74b8
north-glass-erp/northglass-erp/src/views/pp/report/ProcessCardProgress.vue
@@ -52,17 +52,19 @@
let column = [1,3,8]
//点击查询
const getWorkOrder = () => {
  gridOptions.columns = gridOptions.columns.slice(0, 11); //清除动态生成的列重新查询
  request.post(`/report/processCardProgress/${form.orderId}`, column).then((res) => {
    if (res.code == 200) {
      if (res.data.data.length === 0) {
        ElMessage.warning(t('report.noDataFoundForThisOrder'))
        return
      }
      // 动态添加列
      res.data.title.forEach((item, index) => {
        let column = {
          slots: { default: 'quantitySum' },
          width: 90,
          width: 150,
          title: item.process,
          field: `dynamicColumn${index}` // 为动态列添加唯一的 field
        }
@@ -71,6 +73,7 @@
      res.data.data.forEach(item => {
        item.reportWorkQuantity = JSON.parse(item.reportWorkQuantity)
        item.reportWorkQuantityCount = JSON.parse(item.reportWorkQuantityCount)
        item.reportWorkTime = JSON.parse(item.reportWorkTime)
      })
      mergeCells.value = res.data.mergeCell
      xGrid.value.loadData(res.data.data)
@@ -92,14 +95,34 @@
const quantitySum = ( row,column )=>{
  const reportWorkQuantity = row.reportWorkQuantity[column.title] || 0
  const reportWorkQuantityCount = row.reportWorkQuantityCount[column.title] || 0
  if(reportWorkQuantity===reportWorkQuantityCount){
    return reportWorkQuantity
  const reportWorkTime = row.reportWorkTime[column.title] || 0
  if (reportWorkTime===0){
    if(reportWorkQuantity===reportWorkQuantityCount){
      return reportWorkQuantity
    }
    return (reportWorkQuantity
        +'('
        +reportWorkQuantityCount
        +')' )
  }
  else {
    if(reportWorkQuantity===reportWorkQuantityCount){
      return (reportWorkQuantity+'['
          +reportWorkTime
          +']')
    }
    return (reportWorkQuantity
        +'('
        +reportWorkQuantityCount
        +')'
        +'['
        +reportWorkTime
        +']'
    )
  }
  return (reportWorkQuantity
      +'('
      +reportWorkQuantityCount
      +')' )
  //return
}