From 2a3bfb3cb8a3752776affc621474dc61ee021b08 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 21 八月 2026 10:54:00 +0800
Subject: [PATCH] 湟水峡 1.生产工单添加订单号查询条件 2.检验弹框不要分页展示

---
 src/views/productionManagement/productionOrder/index.vue |  199 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 166 insertions(+), 33 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index b1d5ab1..1932e2b 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="璇疯緭鍏�"
@@ -40,7 +48,9 @@
                      @click="handleQuery">鎼滅储</el-button>
         </el-form-item>
       </el-form>
-      <div>
+      <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>
@@ -51,6 +61,8 @@
                 :page="page"
                 :tableLoading="tableLoading"
                 :row-class-name="tableRowClassName"
+                :isSelection="true"
+                @selection-change="handleSelectionChange"
                 @pagination="pagination">
         <template #completionStatus="{ row }">
           <el-progress
@@ -58,6 +70,20 @@
             :color="progressColor(toProgressPercentage(row?.completionStatus))"
             :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"
           />
+        </template>
+        <template #salesContractNo="{ row }">
+          <template v-if="row.salesContractNos && row.salesContractNos.length > 0">
+            <el-tag v-for="(no, idx) in row.salesContractNos" :key="idx" size="small" style="margin: 2px;">{{ no }}</el-tag>
+          </template>
+          <span v-else-if="row.salesContractNo">{{ row.salesContractNo }}</span>
+          <span v-else>-</span>
+        </template>
+        <template #customerName="{ row }">
+          <template v-if="row.customerNames && row.customerNames.length > 0">
+            <el-tag v-for="(name, idx) in row.customerNames" :key="idx" size="small" style="margin: 2px;">{{ name }}</el-tag>
+          </template>
+          <span v-else-if="row.customerName">{{ row.customerName }}</span>
+          <span v-else>-</span>
         </template>
       </PIMTable>
     </div>
@@ -79,18 +105,33 @@
       </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>
+
+    <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" />
   </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";
@@ -98,28 +139,38 @@
     productOrderListPage,
     listProcessRoute,
     bindingRoute,
-    listProcessBom,
+    listProcessBom, delProductOrder,
   } from "@/api/productionManagement/productionOrder.js";
   import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.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"));
+
   const { proxy } = getCurrentInstance();
 
   const router = useRouter();
+  const isShowNewModal = ref(false);
 
   const tableColumn = ref([
     {
       label: "鐢熶骇璁㈠崟鍙�",
       prop: "npsNo",
-      width: '120px',
+      width: '150px',
     },
     {
       label: "閿�鍞悎鍚屽彿",
       prop: "salesContractNo",
       width: '150px',
+      dataType: "slot",
+      slot: "salesContractNo",
     },
     {
       label: "瀹㈡埛鍚嶇О",
       prop: "customerName",
       width: '200px',
+      dataType: "slot",
+      slot: "customerName",
     },
     {
       label: "浜у搧鍚嶇О",
@@ -163,18 +214,18 @@
       formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
       width: 120,
     },
-    {
-      label: "浜や粯鏃ユ湡",
-      prop: "deliveryDate",
-      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
-      width: 120,
-    },
+    // {
+    //   label: "浜や粯鏃ユ湡",
+    //   prop: "deliveryDate",
+    //   formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
+    //   width: 120,
+    // },
     {
       dataType: "action",
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 340,
       operation: [
         {
           name: "宸ヨ壓璺嚎",
@@ -191,13 +242,27 @@
             openBindRouteDialog(row);
           },
         },
-        {
-          name: "浜у搧缁撴瀯",
-          type: "text",
-          clickFun: row => {
-            showProductStructure(row);
-          },
-        },
+        // {
+        //   name: "浜у搧缁撴瀯",
+        //   type: "text",
+        //   clickFun: row => {
+        //     showProductStructure(row);
+        //   },
+        // },
+        // {
+        //   name: "棰嗘枡",
+        //   type: "text",
+        //   clickFun: row => {
+        //     openMaterialDialog(row);
+        //   },
+        // },
+        // {
+        //   name: "棰嗘枡璇︽儏",
+        //   type: "text",
+        //   clickFun: row => {
+        //     openMaterialDetailDialog(row);
+        //   },
+        // },
       ],
     },
   ]);
@@ -208,9 +273,11 @@
     size: 100,
     total: 0,
   });
+  const selectedRows = ref([]);
 
   const data = reactive({
     searchForm: {
+      npsNo: "",
       customerName: "",
       salesContractNo: "",
       projectName: "",
@@ -239,13 +306,18 @@
 
   // 娣诲姞琛ㄨ绫诲悕鏂规硶
   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';
     }
   };
 
@@ -258,6 +330,10 @@
     orderId: null,
     routeId: null,
   });
+  const materialDialogVisible = ref(false);
+  const currentMaterialOrder = ref(null);
+  const materialDetailDialogVisible = ref(false);
+  const currentMaterialDetailOrder = ref(null);
 
   const openBindRouteDialog = async row => {
     bindForm.orderId = row.id;
@@ -303,6 +379,16 @@
     }
   };
 
+  const openMaterialDialog = row => {
+    currentMaterialOrder.value = row;
+    materialDialogVisible.value = true;
+  };
+
+  const openMaterialDetailDialog = async row => {
+    currentMaterialDetailOrder.value = row;
+    materialDetailDialogVisible.value = true;
+  };
+
   // 鏌ヨ鍒楄〃
   /** 鎼滅储鎸夐挳鎿嶄綔 */
   const handleQuery = () => {
@@ -332,7 +418,12 @@
     productOrderListPage(params)
       .then(res => {
         tableLoading.value = false;
-        tableData.value = res.data.records;
+        const records = res.data.records || [];
+        records.forEach(row => {
+          row.salesContractNos = row.salesContractNo ? row.salesContractNo.split(',').filter(Boolean) : [];
+          row.customerNames = row.customerName ? row.customerName.split(',').filter(Boolean) : [];
+        });
+        tableData.value = records;
         page.total = res.data.total;
       })
       .catch(() => {
@@ -353,6 +444,7 @@
         path: "/productionManagement/processRouteItem",
         query: {
           id: data.id,
+          bomId: data.bomId,
           processRouteCode: data.processRouteCode || "",
           productName: data.productName || "",
           model: data.model || "",
@@ -379,6 +471,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 +528,29 @@
   align-items: start;
 }
 
-::v-deep .yellow {
-  background-color: #e8b183;
+.action-buttons {
+  display: flex;
+  flex-wrap: nowrap;
+  gap: 8px;
 }
 
-::v-deep .red {
-  background-color: #e35050;
+:deep(.yellow) {
+  background-color: #FAF0DE;
 }
 
-::v-deep .purple{
-  background-color: #c484dd;
+:deep(.pink) {
+  background-color: #FAE1DE;
 }
+
+:deep(.red) {
+  background-color: #f80202;
+}
+
+:deep(.purple){
+  background-color: #F4DEFA;
+}
+.table_list {
+	margin-top: unset;
+}
+
 </style>

--
Gitblit v1.9.3