feat(productionManagement): 增加每小时平均产量列与工单报工数量优化
- 生产成本核算页面新增"平均(小时)"列,通过自定义插槽展示
每小时平均生产件数,新增 formatAvgPerHour 方法计算并格式化
数值,工时为 0 时显示"-",结果保留两位小数并附带单位
- 工单管理页面报工表单的生产合格数量输入框设为禁用状态,
报工数量默认取计划产量,避免手动输入错误
涉及文件:
- src/views/productionManagement/productionCosting/index.vue
- src/views/productionManagement/workOrderManagement/index.vue
| | |
| | | :page="page1" |
| | | :tableLoading="tableLoading1" |
| | | style="margin-right: 20px;" |
| | | @pagination="pagination1"></PIMTable> |
| | | @pagination="pagination1"> |
| | | <template #avgPerHour="{ row }"> |
| | | {{ formatAvgPerHour(row) }} |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | { |
| | | label: "工序", |
| | | prop: "process", |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | label: "平均(小时)", |
| | | prop: "avgPerHour", |
| | | dataType: "slot", |
| | | slot: "avgPerHour", |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | |
| | | }; |
| | | |
| | | // 点击左侧行,刷右侧明细(按生产人过滤) |
| | | // 计算每小时平均生产件数 = 生产数量 / 工时 |
| | | const formatAvgPerHour = row => { |
| | | const quantity = Number(row?.quantity) || 0; |
| | | const workHour = Number(row?.workHour) || 0; |
| | | if (workHour <= 0) return "-"; |
| | | // 单位 |
| | | console.log(row) |
| | | return (quantity / workHour).toFixed(2)+" "+row.unit; |
| | | }; |
| | | |
| | | const handleLeftRowClick = row => { |
| | | searchForm.value.schedulingUserName = row.schedulingUserName || ""; |
| | | handleQuery(); |
| | |
| | | type="number" |
| | | min="0" |
| | | step="0.0001" |
| | | disabled |
| | | style="width: 300px" |
| | | placeholder="请输入生产合格数量" |
| | | @input="handleQuantityInput" /> |
| | |
| | | row.planQuantity, |
| | | row.completeQuantity |
| | | ); |
| | | reportForm.quantity = |
| | | row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |
| | | reportForm.quantity = reportForm.planQuantity; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |