From 8d48fa86c9096f6bac90e83ed779e5a5b62b0fc7 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 24 三月 2026 18:01:47 +0800
Subject: [PATCH] 生产报工模块

---
 src/views/productionManagement/productionReporting/index.vue |  314 ++++++++++++++++++----------------------------------
 1 files changed, 109 insertions(+), 205 deletions(-)

diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index c19fab2..81ea100 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -4,14 +4,14 @@
       <el-form :model="searchForm"
                :inline="true">
         <el-form-item label="鐢熶骇璁㈠崟鍙�:">
-          <el-input v-model="searchForm.orderNo"
+          <el-input v-model="searchForm.npsNo"
                     placeholder="璇疯緭鍏�"
                     clearable
                     style="width: 160px;"
                     @keyup.enter="handleQuery" />
         </el-form-item>
         <el-form-item label="鐝粍:">
-          <el-select v-model="searchForm.teamName"
+          <el-select v-model="searchForm.schedule"
                      placeholder="璇烽�夋嫨"
                      clearable
                      style="width: 160px;"
@@ -21,7 +21,7 @@
             <el-option label="澶滅彮"
                        value="澶滅彮" />
           </el-select>
-          <!-- <el-input v-model="searchForm.teamName"
+          <!-- <el-input v-model="searchForm.schedule"
                     placeholder="璇疯緭鍏�""
                     @keyup.enter="handleQuery" /> -->
         </el-form-item>
@@ -54,17 +54,20 @@
                 :isSelection="false"
                 @selection-change="handleSelectionChange"
                 @pagination="pagination">
-        <template #outputVolume="{ row }">
-          <span style="font-weight: bold;color: #409eff;">{{ row.outputVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
+        <template #totalQuantity="{ row }">
+          <span style="font-weight: bold;color: #409eff;">{{ row.totalQuantity }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
         </template>
-        <template #unqualifiedVolume="{ row }">
-          <span style="font-weight: bold;color: #b43434;">{{ row.unqualifiedVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
+        <template #scrapQty="{ row }">
+          <span style="font-weight: bold;color: #b43434;">{{ row.scrapQty }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
         </template>
-        <template #completedVolume="{ row }">
-          <span style="font-weight: bold;color: #28e431;">{{ row.completedVolume }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
+        <template #quantity="{ row }">
+          <span style="font-weight: bold;color: #28e431;">{{ row.quantity }}</span><span style="margin-left: 5px;color: #909399;">鏂�</span>
         </template>
       </PIMTable>
     </div>
+    <!-- 璇︽儏寮圭獥 -->
+    <detail-dialog v-model:visible="detailDialogVisible"
+                   :data="detailData" />
   </div>
 </template>
 
@@ -74,12 +77,12 @@
   import { ElMessage, ElMessageBox } from "element-plus";
   import dayjs from "dayjs";
   import {
-    workListPage,
-    productionReport,
-    productionReportUpdate,
     productionReportDelete,
+    productionReportDetail,
+    productionReportListPage,
   } from "@/api/productionManagement/productionReporting.js";
   import PIMTable from "@/components/PIMTable/PIMTable.vue";
+  import DetailDialog from "./detailDialog.vue";
 
   const router = useRouter();
   const { proxy } = getCurrentInstance();
@@ -87,11 +90,12 @@
   const tableColumn = ref([
     {
       label: "鐢熶骇璁㈠崟鍙�",
-      prop: "orderNo",
+      prop: "npsNo",
+      width: "150px",
     },
     {
       label: "鐝粍",
-      prop: "teamName",
+      prop: "schedule",
       width: "120px",
       dataType: "tag",
       formatType: params => {
@@ -110,37 +114,37 @@
     },
     {
       label: "瑙勬牸",
-      prop: "specification",
-      width: "120px",
-      className: "specification-cell",
+      prop: "productModelName",
+      width: "150px",
+      className: "productModelName-cell",
     },
     {
       label: "浜у嚭鏂归噺",
-      prop: "outputVolume",
-      width: "120px",
+      prop: "totalQuantity",
+      width: "100px",
       align: "right",
       dataType: "slot",
-      slot: "outputVolume",
+      slot: "totalQuantity",
     },
     {
       label: "涓嶅悎鏍兼柟閲�",
-      prop: "unqualifiedVolume",
-      width: "120px",
+      prop: "scrapQty",
+      width: "100px",
       align: "right",
       dataType: "slot",
-      slot: "unqualifiedVolume",
+      slot: "scrapQty",
     },
     {
       label: "瀹屾垚鏂归噺",
-      prop: "completedVolume",
-      width: "120px",
+      prop: "quantity",
+      width: "100px",
       align: "right",
       dataType: "slot",
-      slot: "completedVolume",
+      slot: "quantity",
     },
     {
       label: "鍒涘缓浜�",
-      prop: "createBy",
+      prop: "postName",
       width: "120px",
       dataType: "tag",
     },
@@ -190,170 +194,41 @@
   });
 
   const searchForm = reactive({
-    orderNo: "",
-    teamName: "",
+    npsNo: "",
+    schedule: "",
     productName: "",
   });
-
-  const mockData = [
-    {
-      id: 1,
-      orderNo: "PO202401001",
-      teamName: "鐧界彮",
-      materialCode: "PC001",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 120.5,
-      unqualifiedVolume: 2.3,
-      completedVolume: 118.2,
-      createBy: "寮犱笁",
-      createTime: "2024-01-15 08:30:00",
-    },
-    {
-      id: 2,
-      orderNo: "PO202401002",
-      teamName: "澶滅彮",
-      materialCode: "PC002",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 150.8,
-      unqualifiedVolume: 1.5,
-      completedVolume: 149.3,
-      createBy: "鏉庡洓",
-      createTime: "2024-01-15 09:15:00",
-    },
-    {
-      id: 3,
-      orderNo: "PO202401003",
-      teamName: "鐧界彮",
-      materialCode: "PC003",
-      productName: "鍔犳皵鐮屽潡",
-      specification: "600脳240脳250",
-      outputVolume: 95.2,
-      unqualifiedVolume: 0.8,
-      completedVolume: 94.4,
-      createBy: "鐜嬩簲",
-      createTime: "2024-01-15 10:00:00",
-    },
-    {
-      id: 4,
-      orderNo: "PO202401004",
-      teamName: "鐧界彮",
-      materialCode: "PC004",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 180.6,
-      unqualifiedVolume: 3.2,
-      completedVolume: 177.4,
-      createBy: "璧靛叚",
-      createTime: "2024-01-15 14:20:00",
-    },
-    {
-      id: 5,
-      orderNo: "PO202401005",
-      teamName: "澶滅彮",
-      materialCode: "PC005",
-      productName: "鍔犳皵鐮屽潡",
-      specification: "600脳240脳250",
-      outputVolume: 110.3,
-      unqualifiedVolume: 1.1,
-      completedVolume: 109.2,
-      createBy: "瀛欎竷",
-      createTime: "2024-01-15 15:45:00",
-    },
-    {
-      id: 6,
-      orderNo: "PO202401006",
-      teamName: "鐧界彮",
-      materialCode: "PC006",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 135.7,
-      unqualifiedVolume: 2.5,
-      completedVolume: 133.2,
-      createBy: "鍛ㄥ叓",
-      createTime: "2024-01-16 08:00:00",
-    },
-    {
-      id: 7,
-      orderNo: "PO202401007",
-      teamName: "鐧界彮",
-      materialCode: "PC007",
-      productName: "鍔犳皵鐮屽潡",
-      specification: "600脳240脳250",
-      outputVolume: 88.4,
-      unqualifiedVolume: 0.6,
-      completedVolume: 87.8,
-      createBy: "鍚翠節",
-      createTime: "2024-01-16 09:30:00",
-    },
-    {
-      id: 8,
-      orderNo: "PO202401008",
-      teamName: "澶滅彮",
-      materialCode: "PC008",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 165.2,
-      unqualifiedVolume: 2.8,
-      completedVolume: 162.4,
-      createBy: "閮戝崄",
-      createTime: "2024-01-16 11:00:00",
-    },
-    {
-      id: 9,
-      orderNo: "PO202401009",
-      teamName: "鐧界彮",
-      materialCode: "PC009",
-      productName: "鍔犳皵鐮屽潡",
-      specification: "600脳240脳250",
-      outputVolume: 102.5,
-      unqualifiedVolume: 1.3,
-      completedVolume: 101.2,
-      createBy: "閽卞崄涓�",
-      createTime: "2024-01-16 13:15:00",
-    },
-    {
-      id: 10,
-      orderNo: "PO202401010",
-      teamName: "鐧界彮",
-      materialCode: "PC010",
-      productName: "鏍囧噯鐮屽潡",
-      specification: "600脳240脳200",
-      outputVolume: 142.8,
-      unqualifiedVolume: 2.1,
-      completedVolume: 140.7,
-      createBy: "鍒樺崄浜�",
-      createTime: "2024-01-16 15:00:00",
-    },
-  ];
 
   const form = reactive({
     id: undefined,
     orderId: "",
-    orderNo: "",
-    teamName: "",
+    npsNo: "",
+    schedule: "",
     materialCode: "",
     productName: "",
-    specification: "",
-    outputVolume: 0,
-    unqualifiedVolume: 0,
-    completedVolume: 0,
+    productModelName: "",
+    totalQuantity: 0,
+    scrapQty: 0,
+    quantity: 0,
     processId: "",
     params: {},
   });
 
   const selectedRows = ref([]);
+  const detailDialogVisible = ref(false);
+  const detailData = ref({});
 
   const getList = () => {
     tableLoading.value = true;
-    setTimeout(() => {
+    productionReportListPage({
+      current: page.current,
+      size: page.size,
+      ...searchForm,
+    }).then(res => {
+      tableData.value = res.data.records;
+      page.total = res.data.total;
       tableLoading.value = false;
-      const start = (page.current - 1) * page.size;
-      const end = start + page.size;
-      tableData.value = mockData.slice(start, end);
-      page.total = mockData.length;
-    }, 500);
+    });
   };
 
   const handleQuery = () => {
@@ -362,8 +237,8 @@
   };
 
   const handleReset = () => {
-    searchForm.orderNo = "";
-    searchForm.teamName = "";
+    searchForm.npsNo = "";
+    searchForm.schedule = "";
     searchForm.productName = "";
     page.current = 1;
     getList();
@@ -381,16 +256,17 @@
 
   const handleAdd = () => {
     Object.assign(form, {
+      type: "add",
       id: undefined,
       orderId: "",
-      orderNo: "",
-      teamName: "",
+      npsNo: "",
+      schedule: "",
       materialCode: "",
       productName: "",
-      specification: "",
-      outputVolume: 0,
-      unqualifiedVolume: 0,
-      completedVolume: 0,
+      productModelName: "",
+      totalQuantity: 0,
+      scrapQty: 0,
+      quantity: 0,
       processId: "",
       params: {},
     });
@@ -401,30 +277,58 @@
   };
 
   const handleEdit = row => {
-    Object.assign(form, {
-      id: row.id,
-      orderId: row.orderId || "",
-      orderNo: row.orderNo,
-      teamName: row.teamName,
-      materialCode: row.materialCode,
-      productName: row.productName,
-      specification: row.specification,
-      outputVolume: row.outputVolume,
-      unqualifiedVolume: row.unqualifiedVolume,
-      completedVolume: row.completedVolume,
-      createBy: row.createBy || "",
-      createTime: row.createTime || new Date(),
-      processId: row.processId || "",
-      params: row.params || {},
-    });
-    router.push({
-      path: "/productionManagement/ReportingDialog",
-      query: { data: JSON.stringify(form) },
-    });
+    // 璋冪敤璇︽儏鎺ュ彛鑾峰彇瀹屾暣鏁版嵁
+    productionReportDetail(row.id)
+      .then(res => {
+        if (res.code === 200) {
+          const detailData = res.data;
+          // 鏋勫缓缂栬緫琛ㄥ崟鏁版嵁
+          const editForm = {
+            id: row.id,
+            type: "edit",
+            orderId: detailData.productOrderId || "",
+            npsNo: detailData.npsNo || "",
+            schedule: detailData.schedule || "",
+            materialCode: detailData.materialCode || "",
+            productName: detailData.productName || "",
+            productModelName: detailData.model || "",
+            totalQuantity: detailData.quantity || 0,
+            scrapQty: detailData.unqualifiedQuantity || 0,
+            quantity: detailData.qualifiedQuantity || 0,
+            createBy: detailData.postName || "",
+            createTime: detailData.createTime || new Date(),
+            processId: "",
+            params: {},
+            // 浼犻�掑伐搴忎俊鎭�
+            productionProductRouteItemDtoList:
+              detailData.productionProductRouteItemDtoList || [],
+          };
+          router.push({
+            path: "/productionManagement/ReportingDialog",
+            query: { data: JSON.stringify(editForm) },
+          });
+        } else {
+          ElMessage.error("鑾峰彇璇︽儏澶辫触");
+        }
+      })
+      .catch(() => {
+        ElMessage.error("鑾峰彇璇︽儏澶辫触");
+      });
   };
 
   const handleDetail = row => {
-    ElMessage.info("璇︽儏鍔熻兘寰呭疄鐜�");
+    productionReportDetail(row.id)
+      .then(res => {
+        if (res.code === 200) {
+          detailData.value = res.data;
+          detailDialogVisible.value = true;
+        } else {
+          ElMessage.error("鑾峰彇璇︽儏澶辫触");
+        }
+      })
+      .catch(() => {
+        ElMessage.error("鑾峰彇璇︽儏澶辫触");
+      });
   };
 
   const handleDelete = row => {
@@ -434,7 +338,7 @@
       type: "warning",
     })
       .then(() => {
-        productionReportDelete({ id: row.id })
+        productionReportDelete(row.id)
           .then(() => {
             ElMessage.success("鍒犻櫎鎴愬姛");
             getList();
@@ -552,7 +456,7 @@
   }
 </style>
 <style lang="scss">
-  .specification-cell {
+  .productModelName-cell {
     color: #7a7d81;
     font-style: italic;
   }

--
Gitblit v1.9.3