| | |
| | | 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 |
| | | } |
| | |
| | | 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) |
| | |
| | | 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 |
| | | } |
| | | |