zhang_nuo
5 天以前 4e687db2a039313b69cd1369afcae9233a13ca41
feat(productionManagement): 增加每小时平均产量列与工单报工数量优化

- 生产成本核算页面新增"平均(小时)"列,通过自定义插槽展示
每小时平均生产件数,新增 formatAvgPerHour 方法计算并格式化
数值,工时为 0 时显示"-",结果保留两位小数并附带单位
- 工单管理页面报工表单的生产合格数量输入框设为禁用状态,
报工数量默认取计划产量,避免手动输入错误

涉及文件:
- src/views/productionManagement/productionCosting/index.vue
- src/views/productionManagement/workOrderManagement/index.vue
已修改2个文件
27 ■■■■ 文件已修改
src/views/productionManagement/productionCosting/index.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrderManagement/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionCosting/index.vue
@@ -65,7 +65,11 @@
                      :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>
@@ -122,6 +126,13 @@
    {
      label: "工序",
      prop: "process",
      minWidth: 100,
    },
    {
      label: "平均(小时)",
      prop: "avgPerHour",
      dataType: "slot",
      slot: "avgPerHour",
      minWidth: 100,
    },
    {
@@ -311,6 +322,16 @@
  };
  // 点击左侧行,刷右侧明细(按生产人过滤)
  // 计算每小时平均生产件数 = 生产数量 / 工时
  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();
src/views/productionManagement/workOrderManagement/index.vue
@@ -134,6 +134,7 @@
                    type="number"
                    min="0"
                    step="0.0001"
                    disabled
                    style="width: 300px"
                    placeholder="请输入生产合格数量"
                    @input="handleQuantityInput" />
@@ -663,8 +664,7 @@
      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;