From 53499f59c890387d8077ff3a9e81ee18e389e0e8 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 15 四月 2026 15:16:35 +0800
Subject: [PATCH] fix:生产-质量-库存(合格,不合格批号,供应商)

---
 src/views/productionManagement/productionOrder/index.vue |  310 +++++++++++++++++++++++++++------------------------
 1 files changed, 165 insertions(+), 145 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 788d5d6..2e86842 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -1,100 +1,104 @@
 <template>
   <div class="app-container">
     <div class="search_form">
-      <el-form :model="searchForm"
-               :inline="true">
-        <el-form-item label="瀹㈡埛鍚嶇О:">
-          <el-input v-model="searchForm.customerName"
-                    placeholder="璇疯緭鍏�"
-                    clearable
-                    prefix-icon="Search"
-                    style="width: 160px;"
-                    @change="handleQuery"/>
-        </el-form-item>
-        <el-form-item label="鍚堝悓鍙�:">
-          <el-input v-model="searchForm.salesContractNo"
-                    placeholder="璇疯緭鍏�"
-                    clearable
-                    prefix-icon="Search"
-                    style="width: 160px;"
-                    @change="handleQuery"/>
-        </el-form-item>
+      <el-form :model="searchForm" :inline="true">
         <el-form-item label="浜у搧鍚嶇О:">
-          <el-input v-model="searchForm.productCategory"
-                    placeholder="璇疯緭鍏�"
-                    clearable
-                    prefix-icon="Search"
-                    style="width: 160px;"
-                    @change="handleQuery"/>
+          <el-input
+            v-model="searchForm.productCategory"
+            placeholder="璇疯緭鍏�"
+            clearable
+            prefix-icon="Search"
+            style="width: 160px"
+            @change="handleQuery"
+          />
         </el-form-item>
         <el-form-item label="瑙勬牸:">
-          <el-input v-model="searchForm.specificationModel"
-                    placeholder="璇疯緭鍏�"
-                    clearable
-                    prefix-icon="Search"
-                    style="width: 160px;"
-                    @change="handleQuery"/>
+          <el-input
+            v-model="searchForm.specificationModel"
+            placeholder="璇疯緭鍏�"
+            clearable
+            prefix-icon="Search"
+            style="width: 160px"
+            @change="handleQuery"
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="primary"
-                     @click="handleQuery">鎼滅储
-          </el-button>
+          <el-button type="primary" @click="handleQuery">鎼滅储 </el-button>
         </el-form-item>
       </el-form>
       <div>
-        <el-button type="primary" @click="isShowNewModal = true">鏂板</el-button>
+        <el-button type="primary" @click="isShowNewModal = true"
+          >鏂板</el-button
+        >
         <el-button type="danger" @click="handleDelete">鍒犻櫎</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
       </div>
     </div>
     <div class="table_list">
-      <PIMTable rowKey="id"
-                :column="tableColumn"
-                :tableData="tableData"
-                :page="page"
-                :tableLoading="tableLoading"
-                :row-class-name="tableRowClassName"
-                :isSelection="true"
-                @selection-change="handleSelectionChange"
-                @pagination="pagination">
+      <PIMTable
+        rowKey="id"
+        :column="tableColumn"
+        :tableData="tableData"
+        :page="page"
+        :tableLoading="tableLoading"
+        :row-class-name="tableRowClassName"
+        :isSelection="true"
+        @selection-change="handleSelectionChange"
+        @pagination="pagination"
+      >
         <template #completionStatus="{ row }">
           <el-progress
-              :percentage="toProgressPercentage(row?.completionStatus)"
-              :color="progressColor(toProgressPercentage(row?.completionStatus))"
-              :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"
+            :percentage="toProgressPercentage(row?.completionStatus)"
+            :color="progressColor(toProgressPercentage(row?.completionStatus))"
+            :status="
+              toProgressPercentage(row?.completionStatus) >= 100
+                ? 'success'
+                : ''
+            "
           />
         </template>
       </PIMTable>
     </div>
-    <el-dialog v-model="bindRouteDialogVisible"
-               title="缁戝畾宸ヨ壓璺嚎"
-               width="500px">
+    <el-dialog
+      v-model="bindRouteDialogVisible"
+      title="缁戝畾宸ヨ壓璺嚎"
+      width="500px"
+    >
       <el-form label-width="90px">
         <el-form-item label="宸ヨ壓璺嚎">
-          <el-select v-model="bindForm.routeId"
-                     placeholder="璇烽�夋嫨宸ヨ壓璺嚎"
-                     style="width: 100%;"
-                     :loading="bindRouteLoading">
-            <el-option v-for="item in routeOptions"
-                       :key="item.id"
-                       :label="`${item.processRouteCode || ''}`"
-                       :value="item.id"/>
+          <el-select
+            v-model="bindForm.routeId"
+            placeholder="璇烽�夋嫨宸ヨ壓璺嚎"
+            style="width: 100%"
+            :loading="bindRouteLoading"
+          >
+            <el-option
+              v-for="item in routeOptions"
+              :key="item.id"
+              :label="`${item.processRouteCode || ''}`"
+              :value="item.id"
+            />
           </el-select>
         </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="primary"
-                     :loading="bindRouteSaving"
-                     @click="handleBindRouteConfirm">纭� 璁�</el-button>
+          <el-button
+            type="primary"
+            :loading="bindRouteSaving"
+            @click="handleBindRouteConfirm"
+            >纭� 璁�</el-button
+          >
           <el-button @click="bindRouteDialogVisible = false">鍙� 娑�</el-button>
         </span>
       </template>
     </el-dialog>
 
-    <new-product-order v-if="isShowNewModal"
-                       v-model:visible="isShowNewModal"
-                       @completed="handleQuery"/>
+    <new-product-order
+      v-if="isShowNewModal"
+      v-model:visible="isShowNewModal"
+      @completed="handleQuery"
+    />
 
     <!-- 娓呭満璁板綍寮规 -->
     <clearance-record-dialog
@@ -113,26 +117,37 @@
 </template>
 
 <script setup>
-import {onMounted, ref} from "vue";
-import {ElMessageBox} from "element-plus";
+import { onMounted, ref } from "vue";
+import { ElMessageBox } from "element-plus";
 import dayjs from "dayjs";
-import {useRouter} from "vue-router";
+import { useRouter } from "vue-router";
 import {
   productOrderListPage,
   listProcessRoute,
   bindingRoute,
-  delProductOrder, finishOrder,
+  delProductOrder,
+  finishOrder,
   saveCleanRecord,
 } from "@/api/productionManagement/productionOrder.js";
-import {listMain as getOrderProcessRouteMain} from "@/api/productionManagement/productProcessRoute.js";
-import {fileDel} from "@/api/financialManagement/revenueManagement.js";
+import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
+import { fileDel } from "@/api/financialManagement/revenueManagement.js";
 import PIMTable from "@/components/PIMTable/PIMTable.vue";
 
-const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue"));
-const ClearanceRecordDialog = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/ClearanceRecordDialog.vue"));
-const MaterialRequisitionDialog = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue"));
+const NewProductOrder = defineAsyncComponent(() =>
+  import("@/views/productionManagement/productionOrder/New.vue")
+);
+const ClearanceRecordDialog = defineAsyncComponent(() =>
+  import(
+    "@/views/productionManagement/productionOrder/ClearanceRecordDialog.vue"
+  )
+);
+const MaterialRequisitionDialog = defineAsyncComponent(() =>
+  import(
+    "@/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue"
+  )
+);
 
-const {proxy} = getCurrentInstance();
+const { proxy } = getCurrentInstance();
 
 const router = useRouter();
 const isShowNewModal = ref(false);
@@ -141,37 +156,37 @@
   {
     label: "鐢熶骇璁㈠崟鍙�",
     prop: "npsNo",
-    width: '120px',
+    width: "120px",
   },
   {
     label: "浜у搧鍚嶇О",
     prop: "productCategory",
-    width: '120px',
+    width: "120px",
   },
   {
     label: "瑙勬牸",
     prop: "specificationModel",
-    width: '120px',
+    width: "120px",
   },
   {
     label: "UID鐮�",
     prop: "uidNo",
-    width: '120px',
+    width: "120px",
   },
   {
     label: "鎵瑰彿",
     prop: "batchNo",
-    width: '120px',
+    width: "120px",
   },
   {
     label: "宸ヨ壓璺嚎缂栧彿",
     prop: "processRouteCode",
-    width: '200px',
+    width: "200px",
   },
   {
     label: "棰勮鐢熶骇鏁伴噺",
     prop: "quantity",
-    width: '140px',
+    width: "140px",
   },
   {
     label: "瀹屾垚鏁伴噺",
@@ -187,19 +202,19 @@
   {
     label: "寮�濮嬫棩鏈�",
     prop: "startTime",
-    formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+    formatData: (val) => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
     width: 120,
   },
   {
     label: "缁撴潫鏃ユ湡",
     prop: "endTime",
-    formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+    formatData: (val) => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
     width: 120,
   },
   {
     label: "浜や粯鏃ユ湡",
     prop: "deliveryDate",
-    formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+    formatData: (val) => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
     width: 120,
   },
   {
@@ -222,46 +237,46 @@
       {
         name: "宸ヨ壓璺嚎",
         type: "text",
-        clickFun: row => {
+        clickFun: (row) => {
           showRouteItemModal(row);
         },
       },
       {
         name: "缁戝畾宸ヨ壓璺嚎",
         type: "text",
-        showHide: row => !row.processRouteCode,
-        clickFun: row => {
+        showHide: (row) => !row.processRouteCode,
+        clickFun: (row) => {
           openBindRouteDialog(row);
         },
       },
       {
         name: "浜у搧缁撴瀯",
         type: "text",
-        clickFun: row => {
+        clickFun: (row) => {
           showProductStructure(row);
         },
       },
       {
         name: "缁撴潫鐢熶骇",
         type: "text",
-        showHide: row => !row.isEnd,
-        clickFun: row => {
+        showHide: (row) => !row.isEnd,
+        clickFun: (row) => {
           handleFinishOrder(row);
         },
       },
       {
         name: "娓呭満璁板綍",
         type: "text",
-        showHide: row => !row.isEnd,
-        clickFun: row => {
+        showHide: (row) => !row.isEnd,
+        clickFun: (row) => {
           handleClearanceRecord(row);
         },
       },
       {
         name: "棰嗘枡",
         type: "text",
-        showHide: row => !row.isEnd,
-        clickFun: row => {
+        showHide: (row) => !row.isEnd,
+        clickFun: (row) => {
           handleMaterialRequisition(row);
         },
       },
@@ -286,9 +301,9 @@
     specificationModel: "",
   },
 });
-const {searchForm} = toRefs(data);
+const { searchForm } = toRefs(data);
 
-const toProgressPercentage = val => {
+const toProgressPercentage = (val) => {
   const n = Number(val);
   if (!Number.isFinite(n)) return 0;
   if (n <= 0) return 0;
@@ -297,7 +312,7 @@
 };
 
 // 30/50/80/100 鍒嗘棰滆壊锛氱孩/姗�/钃�/缁�
-const progressColor = percentage => {
+const progressColor = (percentage) => {
   const p = toProgressPercentage(percentage);
   if (p < 30) return "#f56c6c";
   if (p < 50) return "#e6a23c";
@@ -306,19 +321,19 @@
 };
 
 // 娣诲姞琛ㄨ绫诲悕鏂规硶
-const tableRowClassName = ({row}) => {
-  if (!row.deliveryDate) return '';
-  if (row.isFh) return '';
+const tableRowClassName = ({ row }) => {
+  if (!row.deliveryDate) return "";
+  if (row.isFh) return "";
 
   const diff = row.deliveryDaysDiff;
   if (diff === 15) {
-    return 'yellow';
+    return "yellow";
   } else if (diff === 10) {
-    return 'pink';
+    return "pink";
   } else if (diff === 2) {
-    return 'purple';
+    return "purple";
   } else if (diff < 2) {
-    return 'red';
+    return "red";
   }
 };
 
@@ -339,7 +354,7 @@
   routeId: null,
 });
 
-const openBindRouteDialog = async row => {
+const openBindRouteDialog = async (row) => {
   bindForm.orderId = row.id;
   bindForm.routeId = null;
   bindRouteDialogVisible.value = true;
@@ -351,7 +366,7 @@
   }
   bindRouteLoading.value = true;
   try {
-    const res = await listProcessRoute({productModelId: row.productModelId});
+    const res = await listProcessRoute({ productModelId: row.productModelId });
     routeOptions.value = res.data || [];
   } catch (e) {
     console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
@@ -389,12 +404,12 @@
   page.current = 1;
   getList();
 };
-const pagination = obj => {
+const pagination = (obj) => {
   page.current = obj.page;
   page.size = obj.limit;
   getList();
 };
-const changeDaterange = value => {
+const changeDaterange = (value) => {
   if (value) {
     searchForm.value.entryDateStart = value[0];
     searchForm.value.entryDateEnd = value[1];
@@ -407,20 +422,20 @@
 const getList = () => {
   tableLoading.value = true;
   // 鏋勯�犱竴涓柊鐨勫璞★紝涓嶅寘鍚玡ntryDate瀛楁
-  const params = {...searchForm.value, ...page};
+  const params = { ...searchForm.value, ...page };
   params.entryDate = undefined;
   productOrderListPage(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 showRouteItemModal = async row => {
+const showRouteItemModal = async (row) => {
   const orderId = row.id;
   try {
     const res = await getOrderProcessRouteMain(orderId);
@@ -449,7 +464,7 @@
   }
 };
 
-const showProductStructure = row => {
+const showProductStructure = (row) => {
   router.push({
     path: "/productionManagement/productStructureDetail",
     query: {
@@ -481,14 +496,16 @@
     confirmButtonText: "纭",
     cancelButtonText: "鍙栨秷",
     type: "warning",
-  }).then(() => {
-    delProductOrder(ids).then((res) => {
-      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      getList();
+  })
+    .then(() => {
+      delProductOrder(ids).then((res) => {
+        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        getList();
+      });
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
     });
-  }).catch(() => {
-    proxy.$modal.msg("宸插彇娑�");
-  });
 };
 
 // 瀵煎嚭
@@ -498,16 +515,19 @@
     cancelButtonText: "鍙栨秷",
     type: "warning",
   })
-      .then(() => {
-        proxy.download("/productOrder/export", {...searchForm.value}, "鐢熶骇璁㈠崟.xlsx");
-      })
-      .catch(() => {
-        proxy.$modal.msg("宸插彇娑�");
-      });
+    .then(() => {
+      proxy.download(
+        "/productOrder/export",
+        { ...searchForm.value },
+        "鐢熶骇璁㈠崟.xlsx"
+      );
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
+    });
 };
 
-const handleConfirmRoute = () => {
-};
+const handleConfirmRoute = () => {};
 
 const handleFinishOrder = (row) => {
   ElMessageBox.confirm("鏄惁纭缁撴潫锛�", "缁撴潫", {
@@ -515,15 +535,15 @@
     cancelButtonText: "鍙栨秷",
     type: "warning",
   })
-      .then(() => {
-        finishOrder(row.id).then(res => {
-          proxy.$modal.msgSuccess("缁撴潫鎴愬姛");
-          getList()
-        })
-      })
-      .catch(() => {
-        proxy.$modal.msg("宸插彇娑�");
+    .then(() => {
+      finishOrder(row.id).then((res) => {
+        proxy.$modal.msgSuccess("缁撴潫鎴愬姛");
+        getList();
       });
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
+    });
 };
 
 // 鎵撳紑娓呭満璁板綍寮规
@@ -547,7 +567,7 @@
     if (callback) callback();
     getList();
   } catch (error) {
-    console.error('淇濆瓨娓呭満璁板綍澶辫触:', error);
+    console.error("淇濆瓨娓呭満璁板綍澶辫触:", error);
     proxy.$modal.msgError("娓呭満璁板綍淇濆瓨澶辫触");
   }
 };
@@ -569,11 +589,11 @@
 }
 
 ::v-deep .yellow {
-  background-color: #FAF0DE;
+  background-color: #faf0de;
 }
 
 ::v-deep .pink {
-  background-color: #FAE1DE;
+  background-color: #fae1de;
 }
 
 ::v-deep .red {
@@ -581,6 +601,6 @@
 }
 
 ::v-deep .purple {
-  background-color: #F4DEFA;
+  background-color: #f4defa;
 }
 </style>

--
Gitblit v1.9.3