From 55199a22f3db67b6cee66e8fd5b461809d0f610a Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 27 四月 2026 14:07:12 +0800
Subject: [PATCH] 工作订单:新增报告状态功能并优化工作订单管理界面

---
 src/views/productionManagement/productionOrder/index.vue |  320 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 186 insertions(+), 134 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index b1d5ab1..9c35bee 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -41,6 +41,8 @@
         </el-form-item>
       </el-form>
       <div>
+        <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>
@@ -51,6 +53,8 @@
                 :page="page"
                 :tableLoading="tableLoading"
                 :row-class-name="tableRowClassName"
+                :isSelection="true"
+                @selection-change="handleSelectionChange"
                 @pagination="pagination">
         <template #completionStatus="{ row }">
           <el-progress
@@ -61,7 +65,8 @@
         </template>
       </PIMTable>
     </div>
-    <el-dialog v-model="bindRouteDialogVisible"
+    <!-- 宸ヨ壓璺嚎缁戝畾寮圭獥鏆傛椂娉ㄩ噴 -->
+    <!-- <el-dialog v-model="bindRouteDialogVisible"
                title="缁戝畾宸ヨ壓璺嚎"
                width="500px">
       <el-form label-width="90px">
@@ -79,13 +84,17 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button @click="bindRouteDialogVisible = false">鍙� 娑�</el-button>
           <el-button type="primary"
                      :loading="bindRouteSaving"
                      @click="handleBindRouteConfirm">纭� 璁�</el-button>
+          <el-button @click="bindRouteDialogVisible = false">鍙� 娑�</el-button>
         </span>
       </template>
-    </el-dialog>
+    </el-dialog> -->
+
+    <new-product-order v-if="isShowNewModal"
+                         v-model:visible="isShowNewModal"
+                         @completed="handleQuery" />
   </div>
 </template>
 
@@ -96,14 +105,16 @@
   import { useRouter } from "vue-router";
   import {
     productOrderListPage,
-    listProcessRoute,
-    bindingRoute,
-    listProcessBom,
+    listProcessBom, delProductOrder,
   } from "@/api/productionManagement/productionOrder.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 { proxy } = getCurrentInstance();
 
   const router = useRouter();
+  const isShowNewModal = ref(false);
 
   const tableColumn = ref([
     {
@@ -131,11 +142,11 @@
       prop: "specificationModel",
       width: '120px',
     },
-    {
-      label: "宸ヨ壓璺嚎缂栧彿",
-      prop: "processRouteCode",
-      width: '200px',
-    },
+    // {
+    //   label: "宸ヨ壓璺嚎缂栧彿",
+    //   prop: "processRouteCode",
+    //   width: '200px',
+    // },
     {
       label: "闇�姹傛暟閲�",
       prop: "quantity",
@@ -169,37 +180,37 @@
       formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
       width: 120,
     },
-    {
-      dataType: "action",
-      label: "鎿嶄綔",
-      align: "center",
-      fixed: "right",
-      width: 200,
-      operation: [
-        {
-          name: "宸ヨ壓璺嚎",
-          type: "text",
-          clickFun: row => {
-            showRouteItemModal(row);
-          },
-        },
-        {
-          name: "缁戝畾宸ヨ壓璺嚎",
-          type: "text",
-          showHide: row => !row.processRouteCode,
-          clickFun: row => {
-            openBindRouteDialog(row);
-          },
-        },
-        {
-          name: "浜у搧缁撴瀯",
-          type: "text",
-          clickFun: row => {
-            showProductStructure(row);
-          },
-        },
-      ],
-    },
+   // {
+   //   dataType: "action",
+   //   label: "鎿嶄綔",
+   //   align: "center",
+   //   fixed: "right",
+   //   width: 200,
+   //   operation: [
+        // {
+        //   name: "宸ヨ壓璺嚎",
+        //   type: "text",
+        //   clickFun: row => {
+        //     showRouteItemModal(row);
+        //   },
+        // },
+        // {
+        //   name: "缁戝畾宸ヨ壓璺嚎",
+        //   type: "text",
+        //   showHide: row => !row.processRouteCode,
+        //   clickFun: row => {
+        //     openBindRouteDialog(row);
+        //   },
+        // },
+        // {
+        //   name: "浜у搧缁撴瀯",
+        //   type: "text",
+        //   clickFun: row => {
+        //     showProductStructure(row);
+        //   },
+        // },
+      //],
+    //},
   ]);
   const tableData = ref([]);
   const tableLoading = ref(false);
@@ -208,6 +219,7 @@
     size: 100,
     total: 0,
   });
+  const selectedRows = ref([]);
 
   const data = reactive({
     searchForm: {
@@ -239,69 +251,74 @@
 
   // 娣诲姞琛ㄨ绫诲悕鏂规硶
   const tableRowClassName = ({ row }) => {
-    switch (row.deliveryDaysDiff) {
-      case 15:
-        return 'yellow'
-      case 10:
-        return 'red'
-      case 2:
-        return 'purple'
+    if (!row.deliveryDate) return '';
+    if (row.isFh) return '';
+
+    const diff = row.deliveryDaysDiff;
+    if (diff === 15) {
+      return 'yellow';
+    } else if (diff === 10) {
+      return 'pink';
+    } else if (diff === 2) {
+      return 'purple';
+    } else if (diff < 2) {
+      return 'red';
     }
   };
 
-  // 缁戝畾宸ヨ壓璺嚎寮规
-  const bindRouteDialogVisible = ref(false);
-  const bindRouteLoading = ref(false);
-  const bindRouteSaving = ref(false);
-  const routeOptions = ref([]);
-  const bindForm = reactive({
-    orderId: null,
-    routeId: null,
-  });
+  // 宸ヨ壓璺嚎缁戝畾鍔熻兘鏆傛椂娉ㄩ噴
+  // const bindRouteDialogVisible = ref(false);
+  // const bindRouteLoading = ref(false);
+  // const bindRouteSaving = ref(false);
+  // const routeOptions = ref([]);
+  // const bindForm = reactive({
+  //   orderId: null,
+  //   routeId: null,
+  // });
 
-  const openBindRouteDialog = async row => {
-    bindForm.orderId = row.id;
-    bindForm.routeId = null;
-    bindRouteDialogVisible.value = true;
-    routeOptions.value = [];
-    if (!row.productModelId) {
-      proxy.$modal.msgWarning("褰撳墠璁㈠崟缂哄皯浜у搧鍨嬪彿锛屾棤娉曟煡璇㈠伐鑹鸿矾绾�");
-      bindRouteDialogVisible.value = false;
-      return;
-    }
-    bindRouteLoading.value = true;
-    try {
-      const res = await listProcessRoute({ productModelId: row.productModelId });
-      routeOptions.value = res.data || [];
-    } catch (e) {
-      console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
-      proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触");
-    } finally {
-      bindRouteLoading.value = false;
-    }
-  };
+  // const openBindRouteDialog = async row => {
+  //   bindForm.orderId = row.id;
+  //   bindForm.routeId = null;
+  //   bindRouteDialogVisible.value = true;
+  //   routeOptions.value = [];
+  //   if (!row.productModelId) {
+  //     proxy.$modal.msgWarning("褰撳墠璁㈠崟缂哄皯浜у搧鍨嬪彿锛屾棤娉曟煡璇㈠伐鑹鸿矾绾�");
+  //     bindRouteDialogVisible.value = false;
+  //     return;
+  //   }
+  //   bindRouteLoading.value = true;
+  //   try {
+  //     const res = await listProcessRoute({ productModelId: row.productModelId });
+  //     routeOptions.value = res.data || [];
+  //   } catch (e) {
+  //     console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
+  //     proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触");
+  //   } finally {
+  //     bindRouteLoading.value = false;
+  //   }
+  // };
 
-  const handleBindRouteConfirm = async () => {
-    if (!bindForm.routeId) {
-      proxy.$modal.msgWarning("璇烽�夋嫨宸ヨ壓璺嚎");
-      return;
-    }
-    bindRouteSaving.value = true;
-    try {
-      await bindingRoute({
-        id: bindForm.orderId,
-        routeId: bindForm.routeId,
-      });
-      proxy.$modal.msgSuccess("缁戝畾鎴愬姛");
-      bindRouteDialogVisible.value = false;
-      getList();
-    } catch (e) {
-      console.error("缁戝畾宸ヨ壓璺嚎澶辫触锛�", e);
-      proxy.$modal.msgError("缁戝畾宸ヨ壓璺嚎澶辫触");
-    } finally {
-      bindRouteSaving.value = false;
-    }
-  };
+  // const handleBindRouteConfirm = async () => {
+  //   if (!bindForm.routeId) {
+  //     proxy.$modal.msgWarning("璇烽�夋嫨宸ヨ壓璺嚎");
+  //     return;
+  //   }
+  //   bindRouteSaving.value = true;
+  //   try {
+  //     await bindingRoute({
+  //       id: bindForm.orderId,
+  //       routeId: bindForm.routeId,
+  //     });
+  //     proxy.$modal.msgSuccess("缁戝畾鎴愬姛");
+  //     bindRouteDialogVisible.value = false;
+  //     getList();
+  //   } catch (e) {
+  //     console.error("缁戝畾宸ヨ壓璺嚎澶辫触锛�", e);
+  //     proxy.$modal.msgError("缁戝畾宸ヨ壓璺嚎澶辫触");
+  //   } finally {
+  //     bindRouteSaving.value = false;
+  //   }
+  // };
 
   // 鏌ヨ鍒楄〃
   /** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -340,33 +357,34 @@
       });
   };
 
-  const showRouteItemModal = async row => {
-    const orderId = row.id;
-    try {
-      const res = await getOrderProcessRouteMain(orderId);
-      const data = res.data || {};
-      if (!data || !data.id) {
-        proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
-        return;
-      }
-      router.push({
-        path: "/productionManagement/processRouteItem",
-        query: {
-          id: data.id,
-          processRouteCode: data.processRouteCode || "",
-          productName: data.productName || "",
-          model: data.model || "",
-          bomNo: data.bomNo || "",
-          description: data.description || "",
-          orderId,
-          type: "order",
-        },
-      });
-    } catch (e) {
-      console.error("鑾峰彇宸ヨ壓璺嚎涓讳俊鎭け璐ワ細", e);
-      proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎淇℃伅澶辫触");
-    }
-  };
+  // 宸ヨ壓璺嚎璇︽儏鍏ュ彛鏆傛椂娉ㄩ噴
+  // const showRouteItemModal = async row => {
+  //   const orderId = row.id;
+  //   try {
+  //     const res = await getOrderProcessRouteMain(orderId);
+  //     const data = res.data || {};
+  //     if (!data || !data.id) {
+  //       proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
+  //       return;
+  //     }
+  //     router.push({
+  //       path: "/productionManagement/processRouteItem",
+  //       query: {
+  //         id: data.id,
+  //         processRouteCode: data.processRouteCode || "",
+  //         productName: data.productName || "",
+  //         model: data.model || "",
+  //         bomNo: data.bomNo || "",
+  //         description: data.description || "",
+  //         orderId,
+  //         type: "order",
+  //       },
+  //     });
+  //   } catch (e) {
+  //     console.error("鑾峰彇宸ヨ壓璺嚎涓讳俊鎭け璐ワ細", e);
+  //     proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎淇℃伅澶辫触");
+  //   }
+  // };
 
   const showProductStructure = row => {
     router.push({
@@ -379,6 +397,33 @@
         orderId: row.id,
         type: "order",
       },
+    });
+  };
+
+  // 琛ㄦ牸閫夋嫨鏁版嵁
+  const handleSelectionChange = (selection) => {
+    selectedRows.value = selection;
+  };
+
+  const handleDelete = () => {
+    let ids = [];
+    if (selectedRows.value.length > 0) {
+      ids = selectedRows.value.map((item) => item.id);
+    } else {
+      proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    }).then(() => {
+      delProductOrder(ids).then((res) => {
+        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        getList();
+      });
+    }).catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
     });
   };
 
@@ -409,15 +454,22 @@
   align-items: start;
 }
 
-::v-deep .yellow {
-  background-color: #e8b183;
+:deep(.yellow) {
+  background-color: #FAF0DE;
 }
 
-::v-deep .red {
-  background-color: #e35050;
+:deep(.pink) {
+  background-color: #FAE1DE;
 }
 
-::v-deep .purple{
-  background-color: #c484dd;
+:deep(.red) {
+  background-color: #f80202;
+}
+
+:deep(.purple){
+  background-color: #F4DEFA;
+}
+.table_list {
+	margin-top: unset;
 }
 </style>

--
Gitblit v1.9.3