From c0790dfa4a3a7a30be3c6ecdf94799267e46948d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 07 四月 2026 13:30:15 +0800
Subject: [PATCH] feat:批号

---
 src/views/productionManagement/workOrder/index.vue |  579 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 341 insertions(+), 238 deletions(-)

diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index cc1d6e3..895bffa 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -5,87 +5,112 @@
       <div class="search-row">
         <div class="search-item">
           <span class="search_title">宸ュ崟缂栧彿锛�</span>
-          <el-input v-model="searchForm.workOrderNo"
-                    style="width: 240px"
-                    placeholder="璇疯緭鍏�"
-                    @change="handleQuery"
-                    clearable
-                    prefix-icon="Search"/>
+          <el-input
+            v-model="searchForm.workOrderNo"
+            style="width: 240px"
+            placeholder="璇疯緭鍏�"
+            @change="handleQuery"
+            clearable
+            prefix-icon="Search"
+          />
         </div>
+
         <div class="search-item">
-          <el-button type="primary"
-                     @click="handleQuery">鎼滅储
-          </el-button>
+          <span class="search_title">鐢熶骇璁㈠崟鍙凤細</span>
+          <el-input
+            v-model="searchForm.productOrderNpsNo"
+            style="width: 240px"
+            placeholder="璇疯緭鍏�"
+            @change="handleQuery"
+            clearable
+            prefix-icon="Search"
+          />
+        </div>
+
+        <div class="search-item">
+          <el-button type="primary" @click="handleQuery">鎼滅储 </el-button>
         </div>
       </div>
     </div>
     <div class="table_list">
-      <PIMTable rowKey="id"
-                :column="tableColumn"
-                :tableData="tableData"
-                :page="page"
-                :tableLoading="tableLoading"
-                :rowClassName="rowClassName"
-                @pagination="pagination">
+      <PIMTable
+        rowKey="id"
+        :column="tableColumn"
+        :tableData="tableData"
+        :page="page"
+        :tableLoading="tableLoading"
+        :rowClassName="rowClassName"
+        @pagination="pagination"
+      >
         <template #completionStatus="{ row }">
-          <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
-                       :color="progressColor(toProgressPercentage(row?.completionStatus))"
-                       :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"/>
+          <el-progress
+            :percentage="toProgressPercentage(row?.completionStatus)"
+            :color="progressColor(toProgressPercentage(row?.completionStatus))"
+            :status="
+              toProgressPercentage(row?.completionStatus) >= 100
+                ? 'success'
+                : ''
+            "
+          />
         </template>
       </PIMTable>
     </div>
-    <el-dialog v-model="editDialogVisible"
-               title="缂栬緫鏃堕棿"
-               width="500px">
-      <el-form :model="editrow"
-               label-width="120px">
+    <el-dialog v-model="editDialogVisible" title="缂栬緫鏃堕棿" width="500px">
+      <el-form :model="editrow" label-width="120px">
         <el-form-item label="璁″垝寮�濮嬫椂闂�">
-          <el-date-picker v-model="editrow.planStartTime"
-                          type="date"
-                          placeholder="璇烽�夋嫨"
-                          value-format="YYYY-MM-DD"
-                          style="width: 300px"/>
+          <el-date-picker
+            v-model="editrow.planStartTime"
+            type="date"
+            placeholder="璇烽�夋嫨"
+            value-format="YYYY-MM-DD"
+            style="width: 300px"
+          />
         </el-form-item>
         <el-form-item label="璁″垝缁撴潫鏃堕棿">
-          <el-date-picker v-model="editrow.planEndTime"
-                          type="date"
-                          placeholder="璇烽�夋嫨"
-                          value-format="YYYY-MM-DD"
-                          style="width: 300px"/>
+          <el-date-picker
+            v-model="editrow.planEndTime"
+            type="date"
+            placeholder="璇烽�夋嫨"
+            value-format="YYYY-MM-DD"
+            style="width: 300px"
+          />
         </el-form-item>
         <el-form-item label="瀹為檯寮�濮嬫椂闂�">
-          <el-date-picker v-model="editrow.actualStartTime"
-                          type="date"
-                          placeholder="璇烽�夋嫨"
-                          value-format="YYYY-MM-DD"
-                          style="width: 300px"/>
+          <el-date-picker
+            v-model="editrow.actualStartTime"
+            type="date"
+            placeholder="璇烽�夋嫨"
+            value-format="YYYY-MM-DD"
+            style="width: 300px"
+          />
         </el-form-item>
         <el-form-item label="瀹為檯缁撴潫鏃堕棿">
-          <el-date-picker v-model="editrow.actualEndTime"
-                          type="date"
-                          placeholder="璇烽�夋嫨"
-                          value-format="YYYY-MM-DD"
-                          style="width: 300px"/>
+          <el-date-picker
+            v-model="editrow.actualEndTime"
+            type="date"
+            placeholder="璇烽�夋嫨"
+            value-format="YYYY-MM-DD"
+            style="width: 300px"
+          />
         </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="primary"
-                     @click="handleUpdate">纭畾</el-button>
+          <el-button type="primary" @click="handleUpdate">纭畾</el-button>
           <el-button @click="editDialogVisible = false">鍙栨秷</el-button>
         </span>
       </template>
     </el-dialog>
-    <el-dialog v-model="transferCardVisible"
-               title="娴佽浆鍗�"
-               width="1000px">
+    <el-dialog v-model="transferCardVisible" title="娴佽浆鍗�" width="1000px">
       <div class="transfer-card-title">宸ュ崟娴佽浆鍗�</div>
       <div class="transfer-card-container">
         <div class="transfer-card-info">
           <div class="info-group">
             <div class="info-item">
               <span class="info-label">宸ュ崟缂栧彿</span>
-              <span class="info-value">{{ transferCardRowData.workOrderNo }}</span>
+              <span class="info-value">{{
+                transferCardRowData.workOrderNo
+              }}</span>
             </div>
             <!-- <div class="info-item">
               <span class="info-label">浜у搧缂栧彿</span>
@@ -93,11 +118,19 @@
             </div> -->
             <div class="info-item">
               <span class="info-label">浜у搧鍚嶇О</span>
-              <span class="info-value">{{ transferCardRowData.productName }}</span>
+              <span class="info-value">{{
+                transferCardRowData.productName
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">浜у搧瑙勬牸</span>
               <span class="info-value">{{ transferCardRowData.model }}</span>
+            </div>
+            <div class="info-item">
+              <span class="info-label">鏂欏彿</span>
+              <span class="info-value">{{
+                transferCardRowData.materialCode
+              }}</span>
             </div>
             <!-- <div class="info-item">
               <span class="info-label">宸ュ崟鐘舵��</span>
@@ -112,11 +145,15 @@
 
             <div class="info-item">
               <span class="info-label">璁″垝寮�濮嬫椂闂�</span>
-              <span class="info-value">{{ transferCardRowData.planStartTime }}</span>
+              <span class="info-value">{{
+                transferCardRowData.planStartTime
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">璁″垝缁撴潫鏃堕棿</span>
-              <span class="info-value">{{ transferCardRowData.planEndTime }}</span>
+              <span class="info-value">{{
+                transferCardRowData.planEndTime
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">澶囨敞</span>
@@ -126,11 +163,15 @@
           <div class="info-group">
             <div class="info-item">
               <span class="info-label">闇�姹傛暟閲�</span>
-              <span class="info-value">{{ transferCardRowData.planQuantity }}</span>
+              <span class="info-value">{{
+                transferCardRowData.planQuantity
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">瀹屾垚鏁伴噺</span>
-              <span class="info-value">{{ transferCardRowData.completeQuantity }}</span>
+              <span class="info-value">{{
+                transferCardRowData.completeQuantity
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">鑹搧鏁伴噺</span>
@@ -142,111 +183,145 @@
             </div>
             <div class="info-item">
               <span class="info-label">瀹為檯寮�濮嬫椂闂�</span>
-              <span class="info-value">{{ transferCardRowData.actualStartTime }}</span>
+              <span class="info-value">{{
+                transferCardRowData.actualStartTime
+              }}</span>
             </div>
             <div class="info-item">
               <span class="info-label">瀹為檯缁撴潫鏃堕棿</span>
-              <span class="info-value">{{ transferCardRowData.actualEndTime }}</span>
+              <span class="info-value">{{
+                transferCardRowData.actualEndTime
+              }}</span>
             </div>
           </div>
         </div>
         <div class="transfer-card-qr">
           <div class="qr-container">
-            <img :src="transferCardQrUrl"
-                 alt="娴佽浆鍗′簩缁寸爜"
-                 style="width: 200px; height: 200px;"/>
+            <img
+              :src="transferCardQrUrl"
+              alt="娴佽浆鍗′簩缁寸爜"
+              style="width: 200px; height: 200px"
+            />
             <!-- <div class="qr-tip"
                  style="margin-top: 10px; text-align: center;">娴佽浆鍗′簩缁寸爜</div> -->
           </div>
         </div>
       </div>
-      <div class="print-button-container"
-           style=" text-align: center;
-      margin-bottom: 40px;">
-        <el-button type="primary"
-                   style="margin-top: 20px;"
-                   @click="printTransferCard">鎵撳嵃娴佽浆鍗�
+      <div
+        class="print-button-container"
+        style="text-align: center; margin-bottom: 40px"
+      >
+        <el-button
+          type="primary"
+          style="margin-top: 20px"
+          @click="printTransferCard"
+          >鎵撳嵃娴佽浆鍗�
         </el-button>
       </div>
     </el-dialog>
-    <el-dialog v-model="reportDialogVisible"
-               title="鎶ュ伐"
-               width="500px">
-      <el-form ref="reportFormRef"
-               :model="reportForm"
-               :rules="reportFormRules"
-               label-width="120px">
-        <el-form-item label="寰呯敓浜ф暟閲�">
-          <el-input v-model="reportForm.planQuantity"
-                    readonly
-                    style="width: 300px"/>
-        </el-form-item>
-        <el-form-item label="鏈鐢熶骇鏁伴噺" prop="quantity">
-          <el-input v-model.number="reportForm.quantity"
-                    type="number"
-                    min="1"
-                    step="1"
-                    style="width: 300px"
-                    placeholder="璇疯緭鍏ユ湰娆$敓浜ф暟閲�"
-                    @input="handleQuantityInput"/>
-        </el-form-item>
-        <el-form-item label="鎶ュ簾鏁伴噺" prop="scrapQty">
-          <el-input v-model.number="reportForm.scrapQty"
-                    type="number"
-                    min="0"
-                    step="1"
-                    style="width: 300px"
-                    placeholder="璇疯緭鍏ユ姤搴熸暟閲�"
-                    @input="handleScrapQtyInput"/>
-        </el-form-item>
-        <el-form-item label="鐝粍淇℃伅">
-          <el-select v-model="reportForm.userId"
-                     style="width: 300px"
-                     placeholder="璇烽�夋嫨鐝粍淇℃伅"
-                     clearable
-                     filterable
-                     @change="handleUserChange">
-            <el-option v-for="user in userOptions"
-                       :key="user.userId"
-                       :label="user.userName"
-                       :value="user.userId"/>
-          </el-select>
-        </el-form-item>
-        <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/>
+    <el-dialog v-model="reportDialogVisible" title="鎶ュ伐" width="800px">
+      <el-form
+        ref="reportFormRef"
+        :model="reportForm"
+        :rules="reportFormRules"
+        label-width="120px"
+      >
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="寰呯敓浜ф暟閲�">
+              <el-input
+                v-model="reportForm.planQuantity"
+                readonly
+                style="width: 100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鏈鐢熶骇鏁伴噺" prop="quantity">
+              <el-input
+                v-model.number="reportForm.quantity"
+                type="number"
+                min="1"
+                step="1"
+                style="width: 100%"
+                placeholder="璇疯緭鍏ユ湰娆$敓浜ф暟閲�"
+                @input="handleQuantityInput"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎶ュ簾鏁伴噺" prop="scrapQty">
+              <el-input
+                v-model.number="reportForm.scrapQty"
+                type="number"
+                min="0"
+                step="1"
+                style="width: 100%"
+                placeholder="璇疯緭鍏ユ姤搴熸暟閲�"
+                @input="handleScrapQtyInput"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鐝粍淇℃伅">
+              <el-select
+                v-model="reportForm.userId"
+                style="width: 100%"
+                placeholder="璇烽�夋嫨鐝粍淇℃伅"
+                clearable
+                filterable
+                @change="handleUserChange"
+              >
+                <el-option
+                  v-for="user in userOptions"
+                  :key="user.userId"
+                  :label="user.userName"
+                  :value="user.userId"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <ProductionRecordForm
+          ref="productionRecordFormRef"
+          :list="processParamList"
+        />
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="primary"
-                     @click="handleReport">纭畾</el-button>
+          <el-button type="primary" @click="handleReport">纭畾</el-button>
           <el-button @click="reportDialogVisible = false">鍙栨秷</el-button>
         </span>
       </template>
     </el-dialog>
-    <FilesDia ref="workOrderFilesRef"/>
+    <FilesDia ref="workOrderFilesRef" />
     <CopperPrintingForm
-        v-if="copperPrintingFormVisible"
-        v-model:isShow="copperPrintingFormVisible"
-        :isEdit="true"
-        :row="currentReportRowData"
-        @refreshData="getList"/>
+      v-if="copperPrintingFormVisible"
+      v-model:isShow="copperPrintingFormVisible"
+      :isEdit="true"
+      :row="currentReportRowData"
+      @refreshData="getList"
+    />
     <VoltageSortingForm
-        v-if="voltageSortingFormVisible"
-        v-model:isShow="voltageSortingFormVisible"
-        :isEdit="true"
-        :row="currentReportRowData"
-        @refreshData="getList"/>
+      v-if="voltageSortingFormVisible"
+      v-model:isShow="voltageSortingFormVisible"
+      :isEdit="true"
+      :row="currentReportRowData"
+      @refreshData="getList"
+    />
     <GranulationForm
-        v-if="granulationFormVisible"
-        v-model:isShow="granulationFormVisible"
-        :isEdit="true"
-        :row="currentReportRowData"
-        @refreshData="getList"/>
+      v-if="granulationFormVisible"
+      v-model:isShow="granulationFormVisible"
+      :isEdit="true"
+      :row="currentReportRowData"
+      @refreshData="getList"
+    />
   </div>
 </template>
 
 <script setup>
-import {onMounted, ref, nextTick} from "vue";
-import {ElMessageBox} from "element-plus";
+import { onMounted, ref, nextTick } from "vue";
+import { ElMessageBox } from "element-plus";
 import dayjs from "dayjs";
 import {
   productWorkOrderPage,
@@ -254,33 +329,39 @@
   addProductMain,
   downProductWorkOrder,
 } from "@/api/productionManagement/workOrder.js";
-import {getUserProfile, userListNoPageByTenantId} from "@/api/system/user.js";
+import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js";
 import QRCode from "qrcode";
-import {getCurrentInstance, reactive, toRefs} from "vue";
+import { getCurrentInstance, reactive, toRefs } from "vue";
 import FilesDia from "./components/filesDia.vue";
-import {
-  listPage as listProcessParamPage,
-} from "@/api/productionManagement/productProcessParameter.js";
+import { listPage as listProcessParamPage } from "@/api/productionManagement/productProcessParameter.js";
 
-const {proxy} = getCurrentInstance();
-const {priority_type} = proxy.useDict("priority_type");
+const { proxy } = getCurrentInstance();
+const { priority_type } = proxy.useDict("priority_type");
 
-const CopperPrintingForm = defineAsyncComponent(() => import("./components/CopperPrintingForm.vue"));
-const VoltageSortingForm = defineAsyncComponent(() => import("./components/VoltageSortingForm.vue"));
-const ProductionRecordForm = defineAsyncComponent(() => import("./components/ProductionRecordForm.vue"));
-const GranulationForm = defineAsyncComponent(() => import("./components/GranulationForm.vue"));
+const CopperPrintingForm = defineAsyncComponent(() =>
+  import("./components/CopperPrintingForm.vue")
+);
+const VoltageSortingForm = defineAsyncComponent(() =>
+  import("./components/VoltageSortingForm.vue")
+);
+const ProductionRecordForm = defineAsyncComponent(() =>
+  import("./components/ProductionRecordForm.vue")
+);
+const GranulationForm = defineAsyncComponent(() =>
+  import("./components/GranulationForm.vue")
+);
 const tableColumn = ref([
   {
     label: "浼樺厛绾�",
     prop: "priority",
-    width: '100px',
+    width: "100px",
     dataType: "tag",
-    formatData: val => proxy.selectDictLabel(priority_type.value, val),
-    formatType: val => {
+    formatData: (val) => proxy.selectDictLabel(priority_type.value, val),
+    formatType: (val) => {
       const v = Number(val);
-      if (v === 0) return "danger";   // 绾㈣壊
-      if (v === 1) return "warning";  // 榛勮壊
-      if (v === 2) return "success";  // 缁胯壊
+      if (v === 0) return "danger"; // 绾㈣壊
+      if (v === 1) return "warning"; // 榛勮壊
+      if (v === 2) return "success"; // 缁胯壊
       return "";
     },
   },
@@ -290,7 +371,7 @@
   //   width: "80",
   // },
   {
-    label: "宸ュ崟缂栧彿1",
+    label: "宸ュ崟缂栧彿",
     prop: "workOrderNo",
     width: "140",
   },
@@ -307,6 +388,10 @@
   {
     label: "瑙勬牸",
     prop: "model",
+  },
+  {
+    label: "鏂欏彿",
+    prop: "materialCode",
   },
   {
     label: "鍗曚綅",
@@ -362,29 +447,29 @@
     operation: [
       {
         name: "缂栬緫",
-        clickFun: row => {
+        clickFun: (row) => {
           handleEdit(row);
           handleEdit(row);
         },
       },
       {
         name: "娴佽浆鍗�",
-        clickFun: row => {
+        clickFun: (row) => {
           downloadAndPrintWorkOrder(row);
         },
       },
       {
         name: "闄勪欢",
-        clickFun: row => {
+        clickFun: (row) => {
           openWorkOrderFiles(row);
         },
       },
       {
         name: "鎶ュ伐",
-        clickFun: row => {
+        clickFun: (row) => {
           showReportDialog(row);
         },
-        disabled: row => !row.isCanReport || row.planQuantity <= 0,
+        disabled: (row) => !row.isCanReport || row.planQuantity <= 0,
       },
     ],
   },
@@ -415,22 +500,23 @@
   productProcessRouteItemId: "",
   userId: "",
   productMainId: null,
+  batchNo: "",
   otherData: {
     rows: [],
-  }
+  },
 });
 const productionRecordFormRef = ref();
 
 // 鏈鐢熶骇鏁伴噺楠岃瘉瑙勫垯
 const validateQuantity = (rule, value, callback) => {
-  if (value === null || value === undefined || value === '') {
-    callback(new Error('璇疯緭鍏ユ湰娆$敓浜ф暟閲�'));
+  if (value === null || value === undefined || value === "") {
+    callback(new Error("璇疯緭鍏ユ湰娆$敓浜ф暟閲�"));
     return;
   }
   const num = Number(value);
   // 鏁存暟涓斿ぇ浜庣瓑浜�1
   if (isNaN(num) || !Number.isInteger(num) || num < 1) {
-    callback(new Error('鏈鐢熶骇鏁伴噺蹇呴』澶т簬绛変簬1'));
+    callback(new Error("鏈鐢熶骇鏁伴噺蹇呴』澶т簬绛変簬1"));
     return;
   }
   callback();
@@ -438,14 +524,14 @@
 
 // 鎶ュ簾鏁伴噺楠岃瘉瑙勫垯
 const validateScrapQty = (rule, value, callback) => {
-  if (value === null || value === undefined || value === '') {
+  if (value === null || value === undefined || value === "") {
     callback();
     return;
   }
   const num = Number(value);
   // 鏁存暟涓斿ぇ浜庣瓑浜�0
   if (isNaN(num) || !Number.isInteger(num) || num < 0) {
-    callback(new Error('鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0'));
+    callback(new Error("鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0"));
     return;
   }
   callback();
@@ -453,24 +539,23 @@
 
 // 楠岃瘉瑙勫垯
 const reportFormRules = {
-  quantity: [
-    {required: true, validator: validateQuantity, trigger: 'blur'}
-  ],
-  scrapQty: [
-    {validator: validateScrapQty, trigger: 'blur'}
-  ]
+  quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }],
+  scrapQty: [{ validator: validateScrapQty, trigger: "blur" }],
 };
 
-const rowClassName = ({row}) => {
-  if (Number(row.completionStatus) > 0 && Number(row.actualQualifiedRate) < Number(row.processQualifiedRate)) {
-    return 'danger-row';
+const rowClassName = ({ row }) => {
+  if (
+    Number(row.completionStatus) > 0 &&
+    Number(row.actualQualifiedRate) < Number(row.processQualifiedRate)
+  ) {
+    return "danger-row";
   }
-  return '';
+  return "";
 };
 
 // 澶勭悊鏈鐢熶骇鏁伴噺杈撳叆锛岄檺鍒跺繀椤诲ぇ浜庣瓑浜�1
 const handleQuantityInput = (value) => {
-  if (value === '' || value === null || value === undefined) {
+  if (value === "" || value === null || value === undefined) {
     reportForm.quantity = null;
     return;
   }
@@ -499,7 +584,7 @@
 
 // 澶勭悊鎶ュ簾鏁伴噺
 const handleScrapQtyInput = (value) => {
-  if (value === '' || value === null || value === undefined) {
+  if (value === "" || value === null || value === undefined) {
     reportForm.scrapQty = null;
     return;
   }
@@ -531,17 +616,18 @@
 const data = reactive({
   searchForm: {
     workOrderNo: "",
+    productOrderNpsNo: "",
   },
 });
-const {searchForm} = toRefs(data);
-const toProgressPercentage = val => {
+const { searchForm } = toRefs(data);
+const toProgressPercentage = (val) => {
   const n = Number(val);
   if (!Number.isFinite(n)) return 0;
   if (n <= 0) return 0;
   if (n >= 100) return 100;
   return Math.round(n);
 };
-const progressColor = percentage => {
+const progressColor = (percentage) => {
   const p = toProgressPercentage(percentage);
   if (p < 30) return "#f56c6c";
   if (p < 50) return "#e6a23c";
@@ -556,34 +642,34 @@
   page.current = 1;
   getList();
 };
-const pagination = obj => {
+const pagination = (obj) => {
   page.current = obj.page;
   page.size = obj.limit;
   getList();
 };
 const getList = () => {
   tableLoading.value = true;
-  const params = {...searchForm.value, ...page};
+  const params = { ...searchForm.value, ...page };
   productWorkOrderPage(params)
-      .then(res => {
-        tableLoading.value = false;
-        tableData.value = res.data.records;
-        page.total = res.data.total;
-      })
-      .catch(() => {
-        tableLoading.value = false;
-      });
+    .then((res) => {
+      tableLoading.value = false;
+      tableData.value = res.data.records;
+      page.total = res.data.total;
+    })
+    .catch(() => {
+      tableLoading.value = false;
+    });
 };
 
 // 涓嬭浇骞舵墦鍗板伐鍗曟祦杞崱锛堟枃浠舵祦锛�
-const downloadAndPrintWorkOrder = async row => {
+const downloadAndPrintWorkOrder = async (row) => {
   if (!row || !row.id) {
     proxy.$modal.msgError("缂哄皯宸ュ崟ID锛屾棤娉曚笅杞芥祦杞崱");
     return;
   }
   const fileName = row.workOrderNo
-      ? `宸ュ崟娴佽浆鍗${row.workOrderNo}.xlsx`
-      : "宸ュ崟娴佽浆鍗�.xlsx";
+    ? `宸ュ崟娴佽浆鍗${row.workOrderNo}.xlsx`
+    : "宸ュ崟娴佽浆鍗�.xlsx";
   try {
     // 璋冪敤鎺ュ彛锛屼互 responseType: 'blob' 鑾峰彇鏂囦欢娴�
     const blob = await downProductWorkOrder(row.id);
@@ -595,7 +681,9 @@
 
     // 鍒涘缓 Blob URL
     const fileBlob =
-        blob instanceof Blob ? blob : new Blob([blob], {type: blob.type || "application/octet-stream"});
+      blob instanceof Blob
+        ? blob
+        : new Blob([blob], { type: blob.type || "application/octet-stream" });
     const url = window.URL.createObjectURL(fileBlob);
 
     // 鍒涘缓闅愯棌 iframe锛岀敤浜庤Е鍙戞祻瑙堝櫒鎵撳嵃
@@ -625,7 +713,7 @@
   }
 };
 
-const showTransferCard = async row => {
+const showTransferCard = async (row) => {
   transferCardRowData.value = row;
   const qrContent = String(row.id);
 
@@ -637,23 +725,23 @@
   window.print();
 };
 
-const handleEdit = row => {
+const handleEdit = (row) => {
   editrow.value = JSON.parse(JSON.stringify(row));
   editDialogVisible.value = true;
 };
 
 const handleUpdate = () => {
   updateProductWorkOrder(editrow.value)
-      .then(res => {
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-        editDialogVisible.value = false;
-        getList();
-      })
-      .catch(() => {
-        ElMessageBox.alert("淇敼澶辫触", "鎻愮ず", {
-          confirmButtonText: "纭畾",
-        });
+    .then((res) => {
+      proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+      editDialogVisible.value = false;
+      getList();
+    })
+    .catch(() => {
+      ElMessageBox.alert("淇敼澶辫触", "鎻愮ず", {
+        confirmButtonText: "纭畾",
       });
+    });
 };
 
 const processParamPage = reactive({
@@ -666,57 +754,63 @@
     processId: row.processId,
     ...processParamPage,
   };
-  const res = await listProcessParamPage(params)
-  return res.data.records
+  const res = await listProcessParamPage(params);
+  return res.data.records;
 };
 
-const processParamList = ref([])
-const showReportDialog = async row => {
+const processParamList = ref([]);
+const showReportDialog = async (row) => {
   currentReportRowData.value = row;
-  if (row.processName === '鍗伴摐' || row.processName === '鍗伴摱') {
-    copperPrintingFormVisible.value = true
-    return
-  }
-  if (row.processName === '鐢靛帇鍒嗛��') {
-    voltageSortingFormVisible.value = true
+  if (row.processName === "鍗伴摐" || row.processName === "鍗伴摱") {
+    copperPrintingFormVisible.value = true;
     return;
   }
-  if (row.processName === '閫犵矑') {
-    granulationFormVisible.value = true
+  if (row.processName === "鐢靛帇鍒嗛��") {
+    voltageSortingFormVisible.value = true;
     return;
   }
-  processParamList.value = await getProcessParamList(row)
+  if (row.processName === "閫犵矑") {
+    granulationFormVisible.value = true;
+    return;
+  }
+  processParamList.value = await getProcessParamList(row);
   reportForm.planQuantity = row.planQuantity;
-  reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
+  reportForm.quantity =
+    row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
   reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
+  reportForm.batchNo = row.batchNo;
   reportForm.workOrderId = row.id;
   reportForm.reportWork = row.reportWork;
   reportForm.productMainId = row.productMainId;
-  reportForm.scrapQty = row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
+  reportForm.scrapQty =
+    row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
   nextTick(() => {
     reportFormRef.value?.clearValidate();
   });
   // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅锛岃缃负榛樿閫変腑
   getUserProfile()
-      .then(res => {
-        if (res.code === 200) {
-          reportForm.userId = res.data.userId;
-          reportForm.userName = res.data.userName;
-        }
-      })
-      .catch(err => {
-        console.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触", err);
-      });
+    .then((res) => {
+      if (res.code === 200) {
+        reportForm.userId = res.data.userId;
+        reportForm.userName = res.data.userName;
+      }
+    })
+    .catch((err) => {
+      console.error("鑾峰彇鐢ㄦ埛淇℃伅澶辫触", err);
+    });
 
   reportDialogVisible.value = true;
 };
 
-const openWorkOrderFiles = row => {
+const openWorkOrderFiles = (row) => {
   workOrderFilesRef.value?.openDialog(row);
 };
 
 const handleReport = async () => {
-  const data = await productionRecordFormRef.value.submitData()
+  const data = await productionRecordFormRef.value.submitData();
+  if (!data) {
+    return;
+  }
   reportForm.otherData.rows = data || [];
   reportFormRef.value?.validate((valid) => {
     if (!valid) {
@@ -731,7 +825,11 @@
     }
 
     // 楠岃瘉鏈鐢熶骇鏁伴噺
-    if (reportForm.quantity === null || reportForm.quantity === undefined || reportForm.quantity === '') {
+    if (
+      reportForm.quantity === null ||
+      reportForm.quantity === undefined ||
+      reportForm.quantity === ""
+    ) {
       ElMessageBox.alert("璇疯緭鍏ユ湰娆$敓浜ф暟閲�", "鎻愮ず", {
         confirmButtonText: "纭畾",
       });
@@ -739,7 +837,10 @@
     }
 
     const quantity = Number(reportForm.quantity);
-    const scrapQty = reportForm.scrapQty === null || reportForm.scrapQty === undefined || reportForm.scrapQty === ''
+    const scrapQty =
+      reportForm.scrapQty === null ||
+      reportForm.scrapQty === undefined ||
+      reportForm.scrapQty === ""
         ? 0
         : Number(reportForm.scrapQty);
 
@@ -770,11 +871,11 @@
       ...reportForm,
       quantity: quantity,
       scrapQty: scrapQty,
-      otherData: JSON.stringify(reportForm.otherData)
+      otherData: JSON.stringify(reportForm.otherData),
     };
 
     // console.log(submitData);
-    addProductMain(submitData).then(res => {
+    addProductMain(submitData).then((res) => {
       if (res.code === 200) {
         proxy.$modal.msgSuccess("鎶ュ伐鎴愬姛");
         reportDialogVisible.value = false;
@@ -791,20 +892,22 @@
 // 鑾峰彇鐢ㄦ埛鍒楄〃
 const getUserList = () => {
   userListNoPageByTenantId()
-      .then(res => {
-        if (res.code === 200) {
-          userOptions.value = res.data || [];
-        }
-      })
-      .catch(err => {
-        console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触", err);
-      });
+    .then((res) => {
+      if (res.code === 200) {
+        userOptions.value = res.data || [];
+      }
+    })
+    .catch((err) => {
+      console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触", err);
+    });
 };
 
 // 鐢ㄦ埛閫夋嫨鍙樺寲鏃舵洿鏂� userName
 const handleUserChange = (userId) => {
   if (userId) {
-    const selectedUser = userOptions.value.find(user => user.userId === userId);
+    const selectedUser = userOptions.value.find(
+      (user) => user.userId === userId
+    );
     if (selectedUser) {
       reportForm.userName = selectedUser.userName;
     }

--
Gitblit v1.9.3