From 78278ebbdaf110363ecdde4fb25a5bc40e4fe1fd Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期六, 25 四月 2026 17:03:00 +0800
Subject: [PATCH] 文件上传修改

---
 src/views/productionManagement/productionOrder/index.vue |  227 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 153 insertions(+), 74 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 260b2c3..02e75eb 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -3,6 +3,14 @@
     <div class="search_form">
       <el-form :model="searchForm"
                :inline="true">
+        <el-form-item label="鐢熶骇璁㈠崟鍙�:">
+          <el-input v-model="searchForm.npsNo"
+                    placeholder="璇疯緭鍏�"
+                    clearable
+                    prefix-icon="Search"
+                    style="width: 160px;"
+                    @change="handleQuery" />
+        </el-form-item>
         <el-form-item label="瀹㈡埛鍚嶇О:">
           <el-input v-model="searchForm.customerName"
                     placeholder="璇疯緭鍏�"
@@ -20,7 +28,7 @@
                     @change="handleQuery" />
         </el-form-item>
         <el-form-item label="浜у搧鍚嶇О:">
-          <el-input v-model="searchForm.productCategory"
+          <el-input v-model="searchForm.productName"
                     placeholder="璇疯緭鍏�"
                     clearable
                     prefix-icon="Search"
@@ -28,7 +36,7 @@
                     @change="handleQuery" />
         </el-form-item>
         <el-form-item label="瑙勬牸:">
-          <el-input v-model="searchForm.specificationModel"
+          <el-input v-model="searchForm.model"
                     placeholder="璇疯緭鍏�"
                     clearable
                     prefix-icon="Search"
@@ -40,9 +48,11 @@
                      @click="handleQuery">鎼滅储</el-button>
         </el-form-item>
       </el-form>
-      <div>
-        <el-button type="primary" @click="isShowNewModal = true">鏂板</el-button>
-        <el-button type="danger" @click="handleDelete">鍒犻櫎</el-button>
+      <div class="action-buttons">
+        <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>
@@ -57,11 +67,9 @@
                 @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' : ''"
-          />
+          <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
+                       :color="progressColor(toProgressPercentage(row?.completionStatus))"
+                       :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
         </template>
       </PIMTable>
     </div>
@@ -90,15 +98,28 @@
         </span>
       </template>
     </el-dialog>
-
+    <MaterialLedgerDialog v-model="materialDialogVisible"
+                          :order-row="currentMaterialOrder"
+                          @saved="getList" />
+    <MaterialDetailDialog v-model="materialDetailDialogVisible"
+                          :order-row="currentMaterialDetailOrder"
+                          @confirmed="getList" />
     <new-product-order v-if="isShowNewModal"
-                         v-model:visible="isShowNewModal"
-                         @completed="handleQuery" />
+                       v-model:visible="isShowNewModal"
+                       @completed="handleQuery" />
   </div>
 </template>
 
 <script setup>
-  import { onMounted, ref } from "vue";
+  import {
+    computed,
+    defineAsyncComponent,
+    getCurrentInstance,
+    onMounted,
+    reactive,
+    ref,
+    toRefs,
+  } from "vue";
   import { ElMessageBox } from "element-plus";
   import dayjs from "dayjs";
   import { useRouter } from "vue-router";
@@ -106,12 +127,17 @@
     productOrderListPage,
     listProcessRoute,
     bindingRoute,
-    listProcessBom, delProductOrder,
+    listProcessBom,
+    delProductOrder,
   } from "@/api/productionManagement/productionOrder.js";
   import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
-  import {fileDel} from "@/api/financialManagement/revenueManagement.js";
+  import MaterialLedgerDialog from "@/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue";
+  import MaterialDetailDialog from "@/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue";
   import PIMTable from "@/components/PIMTable/PIMTable.vue";
-  const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue"));
+  import { listPage } from "@/api/productionManagement/processRoute.js";
+  const NewProductOrder = defineAsyncComponent(() =>
+    import("@/views/productionManagement/productionOrder/New.vue")
+  );
 
   const { proxy } = getCurrentInstance();
 
@@ -122,32 +148,32 @@
     {
       label: "鐢熶骇璁㈠崟鍙�",
       prop: "npsNo",
-      width: '120px',
+      width: "150px",
     },
     {
       label: "閿�鍞悎鍚屽彿",
       prop: "salesContractNo",
-      width: '150px',
+      width: "150px",
     },
     {
       label: "瀹㈡埛鍚嶇О",
       prop: "customerName",
-      width: '200px',
+      width: "200px",
     },
     {
       label: "浜у搧鍚嶇О",
-      prop: "productCategory",
-      width: '120px',
+      prop: "productName",
+      width: "120px",
     },
     {
       label: "瑙勬牸",
-      prop: "specificationModel",
-      width: '120px',
+      prop: "model",
+      width: "120px",
     },
     {
       label: "宸ヨ壓璺嚎缂栧彿",
       prop: "processRouteCode",
-      width: '200px',
+      width: "200px",
     },
     {
       label: "闇�姹傛暟閲�",
@@ -177,8 +203,8 @@
       width: 120,
     },
     {
-      label: "浜や粯鏃ユ湡",
-      prop: "deliveryDate",
+      label: "璁″垝瀹屾垚鏃堕棿",
+      prop: "planCompleteTime",
       formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
       width: 120,
     },
@@ -187,7 +213,7 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 340,
       operation: [
         {
           name: "宸ヨ壓璺嚎",
@@ -201,16 +227,38 @@
           type: "text",
           showHide: row => !row.processRouteCode,
           clickFun: row => {
-            openBindRouteDialog(row);
+            openBindRouteDialog(row, "add");
           },
         },
         {
-          name: "浜у搧缁撴瀯",
+          name: "鏇存崲宸ヨ壓璺嚎",
           type: "text",
+          showHide: row => row.processRouteCode,
           clickFun: row => {
-            showProductStructure(row);
+            openBindRouteDialog(row, "change");
           },
         },
+        // {
+        //   name: "浜у搧缁撴瀯",
+        //   type: "text",
+        //   clickFun: row => {
+        //     showProductStructure(row);
+        //   },
+        // },
+        // {
+        //   name: "棰嗘枡",
+        //   type: "text",
+        //   clickFun: row => {
+        //     openMaterialDialog(row);
+        //   },
+        // },
+        // {
+        //   name: "棰嗘枡璇︽儏",
+        //   type: "text",
+        //   clickFun: row => {
+        //     openMaterialDetailDialog(row);
+        //   },
+        // },
       ],
     },
   ]);
@@ -225,11 +273,12 @@
 
   const data = reactive({
     searchForm: {
+      npsNo: "",
       customerName: "",
       salesContractNo: "",
       projectName: "",
-      productCategory: "",
-      specificationModel: "",
+      productName: "",
+      model: "",
     },
   });
   const { searchForm } = toRefs(data);
@@ -253,18 +302,18 @@
 
   // 娣诲姞琛ㄨ绫诲悕鏂规硶
   const tableRowClassName = ({ row }) => {
-    if (!row.deliveryDate) return '';
-    if (row.isFh) return '';
+    if (!row.planCompleteTime) 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";
     }
   };
 
@@ -277,10 +326,14 @@
     orderId: null,
     routeId: null,
   });
+  const materialDialogVisible = ref(false);
+  const currentMaterialOrder = ref(null);
+  const materialDetailDialogVisible = ref(false);
+  const currentMaterialDetailOrder = ref(null);
 
-  const openBindRouteDialog = async row => {
+  const openBindRouteDialog = async (row, type) => {
     bindForm.orderId = row.id;
-    bindForm.routeId = null;
+    bindForm.routeId = type === "add" ? null : row.processRouteCode;
     bindRouteDialogVisible.value = true;
     routeOptions.value = [];
     if (!row.productModelId) {
@@ -290,8 +343,8 @@
     }
     bindRouteLoading.value = true;
     try {
-      const res = await listProcessRoute({ productModelId: row.productModelId });
-      routeOptions.value = res.data || [];
+      const res = await listPage({ productModelId: row.productModelId });
+      routeOptions.value = res.data.records || [];
     } catch (e) {
       console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
       proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触");
@@ -309,7 +362,7 @@
     try {
       await bindingRoute({
         id: bindForm.orderId,
-        routeId: bindForm.routeId,
+        technologyRoutingId: bindForm.routeId,
       });
       proxy.$modal.msgSuccess("缁戝畾鎴愬姛");
       bindRouteDialogVisible.value = false;
@@ -320,6 +373,16 @@
     } finally {
       bindRouteSaving.value = false;
     }
+  };
+
+  const openMaterialDialog = row => {
+    currentMaterialOrder.value = row;
+    materialDialogVisible.value = true;
+  };
+
+  const openMaterialDetailDialog = async row => {
+    currentMaterialDetailOrder.value = row;
+    materialDetailDialogVisible.value = true;
   };
 
   // 鏌ヨ鍒楄〃
@@ -372,10 +435,11 @@
         path: "/productionManagement/processRouteItem",
         query: {
           id: data.id,
+          bomId: data.orderBomId,
           processRouteCode: data.processRouteCode || "",
-          productName: data.productName || "",
-          model: data.model || "",
-          bomNo: data.bomNo || "",
+          productName: row.productName || "",
+          model: row.model || "",
+          bomNo: row.bomNo || "",
           description: data.description || "",
           orderId,
           type: "order",
@@ -393,8 +457,8 @@
       query: {
         id: row.id,
         bomNo: row.bomNo || "",
-        productName: row.productCategory || "",
-        productModelName: row.specificationModel || "",
+        productName: row.productName || "",
+        productModelName: row.model || "",
         orderId: row.id,
         type: "order",
       },
@@ -402,14 +466,14 @@
   };
 
   // 琛ㄦ牸閫夋嫨鏁版嵁
-  const handleSelectionChange = (selection) => {
+  const handleSelectionChange = selection => {
     selectedRows.value = selection;
   };
 
   const handleDelete = () => {
     let ids = [];
     if (selectedRows.value.length > 0) {
-      ids = selectedRows.value.map((item) => item.id);
+      ids = selectedRows.value.map(item => item.id);
     } else {
       proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
       return;
@@ -418,14 +482,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("宸插彇娑�");
-    });
   };
 
   // 瀵煎嚭
@@ -436,7 +502,11 @@
       type: "warning",
     })
       .then(() => {
-        proxy.download("/productOrder/export", {...searchForm.value}, "鐢熶骇璁㈠崟.xlsx");
+        proxy.download(
+          "/productOrder/export",
+          { ...searchForm.value },
+          "鐢熶骇璁㈠崟.xlsx"
+        );
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
@@ -451,23 +521,32 @@
 </script>
 
 <style scoped lang="scss">
-.search_form{
-  align-items: start;
-}
+  .search_form {
+    align-items: start;
+  }
 
-:deep(.yellow) {
-  background-color: #FAF0DE;
-}
+  .action-buttons {
+    display: flex;
+    flex-wrap: nowrap;
+    gap: 8px;
+  }
 
-:deep(.pink) {
-  background-color: #FAE1DE;
-}
+  :deep(.yellow) {
+    background-color: #faf0de;
+  }
 
-:deep(.red) {
-  background-color: #f80202;
-}
+  :deep(.pink) {
+    background-color: #fae1de;
+  }
 
-:deep(.purple){
-  background-color: #F4DEFA;
-}
+  :deep(.red) {
+    background-color: #f80202;
+  }
+
+  :deep(.purple) {
+    background-color: #f4defa;
+  }
+  .table_list {
+    margin-top: unset;
+  }
 </style>

--
Gitblit v1.9.3