From 36b909e117c3ccc22dd266a94479e2a02335d261 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 18:03:34 +0800
Subject: [PATCH] 军泰伟业 1.生产订单新增编辑逻辑重写

---
 src/views/productionManagement/productionOrder/index.vue |  116 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 65 insertions(+), 51 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 761139e..8ba6699 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,32 +3,8 @@
     <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-item label="浜у搧鍚嶇О:">
           <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"
@@ -93,6 +69,7 @@
 
     <new-product-order v-if="isShowNewModal"
                          v-model:visible="isShowNewModal"
+                         type="qualified"
                          @completed="handleQuery" />
   </div>
 </template>
@@ -106,7 +83,7 @@
     productOrderListPage,
     listProcessRoute,
     bindingRoute,
-    listProcessBom, delProductOrder,
+    listProcessBom, delProductOrder, startOrPause,
   } from "@/api/productionManagement/productionOrder.js";
   import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
   import {fileDel} from "@/api/financialManagement/revenueManagement.js";
@@ -125,24 +102,14 @@
       width: '120px',
     },
     {
-      label: "閿�鍞悎鍚屽彿",
-      prop: "salesContractNo",
-      width: '150px',
-    },
-    {
-      label: "瀹㈡埛鍚嶇О",
-      prop: "customerName",
-      width: '200px',
-    },
-    {
       label: "浜у搧鍚嶇О",
       prop: "productCategory",
       width: '120px',
     },
     {
-      label: "瑙勬牸",
+      label: "鍥剧焊缂栧彿",
       prop: "specificationModel",
-      width: '120px',
+      width: '160px',
     },
     {
       label: "宸ヨ壓璺嚎缂栧彿",
@@ -156,6 +123,10 @@
     {
       label: "瀹屾垚鏁伴噺",
       prop: "completeQuantity",
+    },
+    {
+      label: "搴撳瓨鏁伴噺",
+      prop: "inventoryQuantity",
     },
     {
       dataType: "slot",
@@ -187,8 +158,24 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 240,
       operation: [
+        {
+          name: "寮�濮�",
+          type: "text",
+          showHide: row => row.status === '寰呯敓浜�',
+          clickFun: row => {
+            handleStartOrPause(row);
+          },
+        },
+        {
+          name: "鏆傚仠",
+          type: "text",
+          showHide: row => row.status === '鐢熶骇涓�',
+          clickFun: row => {
+            handleStartOrPause(row);
+          },
+        },
         {
           name: "宸ヨ壓璺嚎",
           type: "text",
@@ -205,7 +192,7 @@
           },
         },
         {
-          name: "浜у搧缁撴瀯",
+          name: "鐗╂枡娓呭崟",
           type: "text",
           clickFun: row => {
             showProductStructure(row);
@@ -225,11 +212,8 @@
 
   const data = reactive({
     searchForm: {
-      customerName: "",
-      salesContractNo: "",
       projectName: "",
       productCategory: "",
-      specificationModel: "",
     },
   });
   const { searchForm } = toRefs(data);
@@ -257,6 +241,8 @@
     if (row.isFh) return '';
 
     const diff = row.deliveryDaysDiff;
+    if (diff === undefined || diff === null || diff === '' || diff < 0) return '';
+    
     if (diff === 15) {
       return 'yellow';
     } else if (diff === 10) {
@@ -363,17 +349,19 @@
     const orderId = row.id;
     try {
       const res = await getOrderProcessRouteMain(orderId);
-      const data = res.data || {};
-      if (!data || !data.id) {
+      const dataList = res.data || [];
+      if (!dataList || dataList.length === 0 || !dataList[0].id) {
         proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
         return;
       }
+      const data = dataList[0];
       router.push({
         path: "/productionManagement/processRouteItem",
         query: {
           id: data.id,
           processRouteCode: data.processRouteCode || "",
           productName: data.productName || "",
+          drawingNumber: data.drawingNumber || "",
           model: data.model || "",
           bomNo: data.bomNo || "",
           description: data.description || "",
@@ -387,12 +375,38 @@
     }
   };
 
-  const showProductStructure = row => {
+  const handleStartOrPause = async (row) => {
+    const operation = row.status === '寰呯敓浜�' ? 1 : 2;
+    const operationText = operation === 1 ? "寮�濮�" : "鏆傚仠";
+    try {
+      await startOrPause({ id: row.id, operation });
+      proxy.$modal.msgSuccess(`${operationText}鎴愬姛`);
+      getList();
+    } catch (e) {
+      console.error(`${operationText}澶辫触锛歚, e);
+      proxy.$modal.msgError(`${operationText}澶辫触`);
+    }
+  };
+
+  const showProductStructure = async row => {
+    let bomNo = row.bomNo || "";
+    if (!bomNo && row.id) {
+      try {
+        const res = await getOrderProcessRouteMain(row.id);
+        const dataList = res.data || [];
+        if (dataList && dataList.length > 0 && dataList[0].bomNo) {
+          bomNo = dataList[0].bomNo;
+        }
+      } catch (e) {
+        console.error("鑾峰彇BOM缂栧彿澶辫触锛�", e);
+      }
+    }
     router.push({
       path: "/productionManagement/productStructureDetail",
       query: {
         id: row.id,
-        bomNo: row.bomNo || "",
+        bomNo: bomNo,
+        drawingNumber: row.drawingNumber || "",
         productName: row.productCategory || "",
         productModelName: row.specificationModel || "",
         orderId: row.id,
@@ -455,19 +469,19 @@
   align-items: start;
 }
 
-::v-deep .yellow {
+:deep(.yellow) {
   background-color: #FAF0DE;
 }
 
-::v-deep .pink {
+:deep(.pink) {
   background-color: #FAE1DE;
 }
 
-::v-deep .red {
-  background-color: #f80202;
+:deep(.red) {
+  background-color: #FFCCCC;
 }
 
-::v-deep .purple{
+:deep(.purple){
   background-color: #F4DEFA;
 }
 </style>

--
Gitblit v1.9.3