From 5cfebd7e46c0c53f79b5fb4a917e926194ab4398 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期五, 24 四月 2026 14:19:14 +0800
Subject: [PATCH] feat(生产订单): 完善绑定工艺路线弹窗功能及文件预览组件

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

diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 3af5008..d2cf5f1 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -11,7 +11,7 @@
                     style="width: 160px;"
                     @change="handleQuery" />
         </el-form-item>
-        <el-form-item label="鍚堝悓鍙�:">
+        <el-form-item label="璁㈠崟缂栧彿:">
           <el-input v-model="searchForm.salesContractNo"
                     placeholder="璇疯緭鍏�"
                     clearable
@@ -41,7 +41,8 @@
         </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>
@@ -52,6 +53,8 @@
                 :page="page"
                 :tableLoading="tableLoading"
                 :row-class-name="tableRowClassName"
+                :isSelection="true"
+                @selection-change="handleSelectionChange"
                 @pagination="pagination">
         <template #completionStatus="{ row }">
           <el-progress
@@ -62,32 +65,14 @@
         </template>
       </PIMTable>
     </div>
-    <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>
-        </el-form-item>
-      </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>
-        </span>
-      </template>
-    </el-dialog>
 
+    <BindRouteDialog
+        ref="BindRouteDialogRef"
+        v-model="bindRouteDialogVisible"
+        :type="bindDialogType"
+        :rowData="rowData"
+        @confirm="handleBindRouteSubmit"
+    />
     <new-product-order v-if="isShowNewModal"
                          v-model:visible="isShowNewModal"
                          @completed="handleQuery" />
@@ -95,23 +80,45 @@
 </template>
 
 <script setup>
-  import { onMounted, ref } from "vue";
+  import { defineAsyncComponent, getCurrentInstance, onMounted, reactive, ref, toRefs } from "vue";
   import { ElMessageBox } from "element-plus";
   import dayjs from "dayjs";
   import { useRouter } from "vue-router";
   import {
     productOrderListPage,
-    listProcessRoute,
     bindingRoute,
-    listProcessBom,
+    delProductOrder,
+    saveProductionProductInput,
+    viewGetByProductWordId
   } from "@/api/productionManagement/productionOrder.js";
   import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
+  import PIMTable from "@/components/PIMTable/PIMTable.vue";
+  import BindRouteDialog from "./BindRouteDialog.vue";
+  import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js";
   const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue"));
 
   const { proxy } = getCurrentInstance();
 
   const router = useRouter();
   const isShowNewModal = ref(false);
+  const MOCK_MODE = true;
+
+  const loading = ref(false)
+  const dialogVisible = ref(false)
+  const bindDialogType = ref('add')
+  const BindRouteDialogRef = ref(null)
+
+  const handleBindRouteSubmit =async (data)=>{
+    const res = await saveProductionProductInput(data)
+    if(res.code === 200){
+      proxy.$modal.msgSuccess("缁戝畾鎴愬姛");
+      bindRouteDialogVisible.value = false
+      handleQuery()
+    }else{
+      proxy.$modal.msgError(res.msg || "缁戝畾澶辫触")
+    }
+
+  }
 
   const tableColumn = ref([
     {
@@ -120,7 +127,7 @@
       width: '120px',
     },
     {
-      label: "閿�鍞悎鍚屽彿",
+      label: "璁㈠崟缂栧彿",
       prop: "salesContractNo",
       width: '150px',
     },
@@ -182,21 +189,22 @@
       label: "鎿嶄綔",
       align: "center",
       fixed: "right",
-      width: 200,
+      width: 300,
       operation: [
-        {
-          name: "宸ヨ壓璺嚎",
-          type: "text",
-          clickFun: row => {
-            showRouteItemModal(row);
-          },
-        },
         {
           name: "缁戝畾宸ヨ壓璺嚎",
           type: "text",
           showHide: row => !row.processRouteCode,
           clickFun: row => {
             openBindRouteDialog(row);
+          },
+        },
+        {
+          name: "鏌ョ湅宸ヨ壓璺嚎",
+          type: "text",
+          showHide: row => row.processRouteCode,
+          clickFun: row => {
+            openBindRouteDialog(row,"view");
           },
         },
         {
@@ -216,6 +224,7 @@
     size: 100,
     total: 0,
   });
+  const selectedRows = ref([]);
 
   const data = reactive({
     searchForm: {
@@ -247,6 +256,7 @@
 
   // 娣诲姞琛ㄨ绫诲悕鏂规硶
   const tableRowClassName = ({ row }) => {
+    if (!row.deliveryDate) return '';
     if (row.isFh) return '';
 
     const diff = row.deliveryDaysDiff;
@@ -266,25 +276,29 @@
   const bindRouteLoading = ref(false);
   const bindRouteSaving = ref(false);
   const routeOptions = ref([]);
+  const rowData = ref(null)
   const bindForm = reactive({
     orderId: null,
     routeId: null,
   });
 
-  const openBindRouteDialog = async row => {
+  const openBindRouteDialog = async (row,type) => {
     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 || [];
+      BindRouteDialogRef.value?.resetForm?.()
+      if (type === "view") {
+        bindDialogType.value = "detail"
+        const res = await viewGetByProductWordId(row.id)
+        rowData.value = res?.data || res
+      } else {
+        bindDialogType.value = "add"
+        rowData.value = row
+        rowData.value.finishedSize = row.specificationModel
+      }
+      bindRouteDialogVisible.value = true;
     } catch (e) {
       console.error("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触锛�", e);
       proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎鍒楄〃澶辫触");
@@ -394,6 +408,33 @@
     });
   };
 
+  // 琛ㄦ牸閫夋嫨鏁版嵁
+  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("宸插彇娑�");
+    });
+  };
+
   // 瀵煎嚭
   const handleOut = () => {
     ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
@@ -408,8 +449,6 @@
         proxy.$modal.msg("宸插彇娑�");
       });
   };
-
-  const handleConfirmRoute = () => {};
 
   onMounted(() => {
     getList();
@@ -430,10 +469,20 @@
 }
 
 ::v-deep .red {
-  background-color: #f80202;
+  background-color: #ffe5e5;
 }
 
 ::v-deep .purple{
   background-color: #F4DEFA;
 }
+
+:deep(.fixed-desc .el-descriptions__table) {
+  table-layout: fixed;
+  width: 100%;
+}
+
+:deep(.fixed-desc .el-descriptions__cell) {
+  width: 25%;
+  word-break: break-word;
+}
 </style>

--
Gitblit v1.9.3