From d961ee85e246dc7e4e3f113a5083b4e96eac96f8 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期六, 25 四月 2026 11:39:06 +0800
Subject: [PATCH] change

---
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   94 +++++++++++++++++++++++++++++++---------------
 1 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 42fd4b2..734d34c 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -80,7 +80,7 @@
                        prop="technologyOperationId"
                        width="200">
         <template #default="scope">
-          {{ getProcessName(scope.row.technologyOperationId) || '-' }}
+          {{ scope.row.technologyOperationName || scope.row.operationName || '-' }}
         </template>
       </el-table-column>
       <el-table-column label="鍙傛暟鍒楄〃"
@@ -158,7 +158,7 @@
             <!-- 搴忓彿鍦嗗湀 -->
             <div class="card-header">
               <div class="card-number">{{ index + 1 }}</div>
-              <div class="card-process-name">{{ getProcessName(item.technologyOperationId) || '-' }}</div>
+              <div class="card-process-name">{{ item.technologyOperationName || item.operationName || '-' }}</div>
             </div>
             <!-- 浜у搧淇℃伅 -->
             <div class="card-content">
@@ -232,7 +232,7 @@
               style="width: 100%">
       <el-table-column type="expand">
         <template #default>
-          <el-form ref="form"
+          <el-form ref="bomFormRef"
                    :model="bomDataValue">
             <el-table :data="bomDataValue.dataList"
                       row-key="tempId"
@@ -356,7 +356,7 @@
                        prop="model" />
     </el-table>
     <ProductSelectDialog v-if="bomDataValue.showProductDialog"
-                         v-model:model-value="bomDataValue.showProductDialog"
+                         v-model="bomDataValue.showProductDialog"
                          :single="true"
                          @confirm="handleBomProduct" />
     <!-- 鏂板/缂栬緫寮圭獥 -->
@@ -385,8 +385,8 @@
                       prop="productModelId">
           <el-button type="primary"
                      @click="showProductSelectDialog = true">
-            {{ form.productName && form.model 
-              ? `${form.productName} - ${form.model}` 
+            {{ form.productName
+              ? (form.model ? `${form.productName} - ${form.model}` : form.productName)
               : '閫夋嫨浜у搧' }}
           </el-button>
         </el-form-item>
@@ -401,13 +401,13 @@
                       prop="isQuality">
           <el-switch v-model="form.isQuality"
                      :active-value="true"
-                     inactive-value="false" />
+                     :inactive-value="false" />
         </el-form-item>
         <el-form-item label="鏄惁鐢熶骇"
                       prop="isProduction">
           <el-switch v-model="form.isProduction"
                      :active-value="true"
-                     inactive-value="false" />
+                     :inactive-value="false" />
         </el-form-item>
       </el-form>
       <template #footer>
@@ -424,7 +424,7 @@
     <!-- 鍙傛暟鍒楄〃瀵硅瘽妗� -->
     <!-- :editable="!routeInfo.status" -->
     <ProcessParamListDialog v-model="showParamListDialog"
-                            :title="`${currentProcess ? (currentProcess.processName || getProcessName(currentProcess.technologyOperationId)) : ''} - 鍙傛暟鍒楄〃`"
+                            :title="`${currentProcess ? (currentProcess.processName || currentProcess.technologyOperationName || currentProcess.operationName) : ''} - 鍙傛暟鍒楄〃`"
                             :route-id="routeId"
                             :order-id="orderId"
                             :process="currentProcess"
@@ -454,7 +454,10 @@
     batchDeleteProcessRouteItem,
     getProcessParamList,
   } from "@/api/productionManagement/processRouteItem.js";
-  import { syncProcessParamItem } from "@/api/productionManagement/processRouteItem.js";
+  import {
+    syncProcessParamItem,
+    syncProcessParamItemOrder,
+  } from "@/api/productionManagement/processRouteItem.js";
   import {
     findProductProcessRouteItemList,
     deleteRouteItem,
@@ -467,8 +470,10 @@
   import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
   import {
     queryList,
+    queryList2,
     addBomDetail,
   } from "@/api/productionManagement/productStructure.js";
+
   import { useRoute } from "vue-router";
   import { ElMessageBox, ElMessage } from "element-plus";
   import Sortable from "sortablejs";
@@ -485,6 +490,7 @@
   const dialogVisible = ref(false);
   const operationType = ref("add"); // add | edit
   const formRef = ref(null);
+  const bomFormRef = ref(null);
   const submitLoading = ref(false);
   const cardsContainer = ref(null);
   const tableRef = ref(null);
@@ -542,17 +548,31 @@
       type: "warning",
     })
       .then(() => {
-        syncProcessParamItem({
-          replaceExisting: true,
-          technologyRoutingOperationId: currentProcess.value.id,
-        }).then(res => {
-          if (res.code === 200) {
-            ElMessage.success("鍚屾鎴愬姛");
-            refreshParamList();
-          } else {
-            ElMessage.error(res.msg || "鍚屾澶辫触");
-          }
-        });
+        if (pageType.value === "order") {
+          syncProcessParamItemOrder({
+            replaceExisting: true,
+            technologyRoutingOperationId: currentProcess.value.id,
+          }).then(res => {
+            if (res.code === 200) {
+              ElMessage.success("鍚屾鎴愬姛");
+              refreshParamList();
+            } else {
+              ElMessage.error(res.msg || "鍚屾澶辫触");
+            }
+          });
+        } else {
+          syncProcessParamItem({
+            replaceExisting: true,
+            technologyRoutingOperationId: currentProcess.value.id,
+          }).then(res => {
+            if (res.code === 200) {
+              ElMessage.success("鍚屾鎴愬姛");
+              refreshParamList();
+            } else {
+              ElMessage.error(res.msg || "鍚屾澶辫触");
+            }
+          });
+        }
       })
       .catch(() => {});
   };
@@ -670,15 +690,20 @@
 
   // 浜у搧閫夋嫨
   const handleProductSelect = products => {
+    console.log(products, "===products===");
     if (products && products.length > 0) {
       const product = products[0];
-      form.value.productModelId = product.id;
-      form.value.productName = product.productName;
-      form.value.model = product.model;
-      form.value.unit = product.unit || "";
+      console.log(product, "product");
+      form.value = {
+        ...form.value,
+        productModelId: product.id,
+        productName: product.productName,
+        model: product.model,
+        unit: product.unit || "",
+      };
       showProductSelectDialog.value = false;
       // 瑙﹀彂琛ㄥ崟楠岃瘉
-      formRef.value?.validateField("productModelId");
+      // formRef.value?.validateField("productModelId");
     }
   };
 
@@ -696,8 +721,8 @@
 
           const addPromise = isOrderPage
             ? addRouteItem({
-                productOrderId: orderId.value,
-                productRouteId: routeId.value,
+                productOrderId: Number(orderId.value),
+                productRouteId: Number(routeId.value),
                 technologyOperationId: form.value.technologyOperationId,
                 productModelId: form.value.productModelId,
                 isQuality: form.value.isQuality,
@@ -773,6 +798,8 @@
       productName: "",
       model: "",
       unit: "",
+      isQuality: false,
+      isProduction: false,
     };
     formRef.value?.resetFields();
   };
@@ -788,7 +815,7 @@
     currentProcess.value = row;
     const query = {
       technologyRoutingOperationId: row.id,
-      orderId: orderId.value,
+      productionOrderId: orderId.value,
     };
 
     const apiPromise =
@@ -1015,7 +1042,10 @@
 
   const fetchBomData = async () => {
     try {
-      const { data } = await queryList(routeInfo.value.bomId);
+      const isOrderPage = pageType.value === "order";
+      const { data } = await (isOrderPage ? queryList2 : queryList)(
+        routeInfo.value.bomId
+      );
       bomDataValue.value.dataList = data || [];
       normalizeTreeData(bomDataValue.value.dataList);
     } catch (err) {
@@ -1234,12 +1264,14 @@
 
   const handleSaveBom = () => {
     bomDataValue.value.loading = true;
+    console.log(bomDataValue.value.dataList, "bomDataValue.value.dataList");
+
     normalizeTreeData(bomDataValue.value.dataList);
 
     const valid = validateAllBom();
     if (valid) {
       addBomDetail({
-        bomId: routeInfo.value.bomId,
+        bomId: Number(routeInfo.value.bomId),
         children: buildSubmitTree(bomDataValue.value.dataList || []),
       })
         .then(() => {

--
Gitblit v1.9.3