huminmin
2026-07-30 e1570f458b2ab42bb1a212be8de63134a50b2af1
src/views/productionManagement/productionReporting/index.vue
@@ -1,5 +1,6 @@
<template>
  <div class="app-container">
    <PageHeader content="报工台账" />
    <div class="search_form">
      <el-form :model="searchForm"
               :inline="true">
@@ -19,6 +20,18 @@
                    style="width: 200px;"
                    @change="handleQuery" />
        </el-form-item>
        <el-form-item label="报工类型:">
          <el-select v-model="searchForm.reportType"
                     placeholder="请选择"
                     clearable
                     style="width: 200px;"
                     @change="handleQuery">
            <el-option label="合格" :value="0" />
            <el-option label="轻微返工" :value="1" />
            <el-option label="严重返工" :value="2" />
            <el-option label="报废" :value="3" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary"
                     @click="handleQuery">搜索</el-button>
@@ -28,8 +41,6 @@
    <div class="table_list">
      <div style="text-align: right"
           class="mb10">
        <!-- <el-button type="primary"
                   @click="openForm('add')">生产报工</el-button> -->
        <el-button @click="handleOut">导出</el-button>
      </div>
      <PIMTable rowKey="id"
@@ -169,6 +180,7 @@
      nickName: "",
      workOrderNo: "",
      workOrderStatus: "",
      reportType: "",
    },
  });
  const { searchForm } = toRefs(data);
@@ -185,6 +197,21 @@
      label: "报工人员",
      prop: "nickName",
      width: 120,
    },
    {
      label: "报工类型",
      prop: "reportTypeName",
      width: 100,
    },
    {
      label: "审核状态",
      prop: "auditStatusName",
      width: 100,
    },
    {
      label: "工时(h)",
      width: 100,
      prop: "workHour",
    },
    {
      label: "工序",
@@ -316,6 +343,10 @@
      });
    });
  };
  const showInput = row => {
    isShowInput.value = true;
    isShowingId.value = row.id;
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
@@ -331,6 +362,8 @@
        tableLoading.value = false;
        tableData.value = res.data.records.map(item => ({
          ...item,
          reportTypeName: item.reportTypeName || resolveReportTypeName(item.reportType),
          auditStatusName: item.auditStatusName || resolveAuditStatusName(item.auditStatus),
          pendingFinishNum:
            (Number(item.schedulingNum) || 0) - (Number(item.finishedNum) || 0),
        }));
@@ -413,6 +446,23 @@
  const summarizeMainTable = param => {
    return proxy.summarizeTable(param, ["finishedNum"]);
  };
  const resolveReportTypeName = value => {
    const map = {
      0: "合格",
      1: "轻微返工",
      2: "严重返工",
      3: "报废",
    };
    return map[Number(value)] || "—";
  };
  const resolveAuditStatusName = value => {
    const map = {
      0: "待审核",
      1: "审核通过",
      2: "审核不通过",
    };
    return map[Number(value)] || "—";
  };
  // 打开弹框
  const openForm = (type, row) => {
    if (selectedRows.value.length !== 1) {
@@ -432,10 +482,6 @@
  // 打开投入模态框
  const isShowInput = ref(false);
  const isShowingId = ref(0);
  const showInput = row => {
    isShowInput.value = true;
    isShowingId.value = row.id;
  };
  // 导出
  const handleOut = () => {
@@ -445,7 +491,9 @@
      type: "warning",
    })
      .then(() => {
        proxy.download("/productionProductMain/export", {}, "生产报工.xlsx");
        const params = { ...searchForm.value };
        params.entryDate = undefined;
        proxy.download("/productionProductMain/export", params, "生产报工.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");