From 6697f708b99c9b63e00a7e490f91d1cb4fa64450 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 28 四月 2026 16:33:45 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' of http://114.132.189.42:9002/r/product-inventory-management into dev_NEW_pro

---
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   96 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index b78caad..fd1a6a8 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -38,6 +38,15 @@
             <span class="info-value">{{ routeInfo.bomNo || '-' }}</span>
           </div>
         </div>
+        <div class="info-item"
+             v-if="routeInfo.quantity && routeInfo.quantity !== 0">
+          <div class="info-label-wrapper">
+            <span class="info-label">闇�姹傛暟閲�</span>
+          </div>
+          <div class="info-value-wrapper">
+            <span class="info-value">{{ routeInfo.quantity || '-' }}</span>
+          </div>
+        </div>
         <div class="info-item full-width"
              v-if="routeInfo.description">
           <div class="info-label-wrapper">
@@ -80,7 +89,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 +167,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">
@@ -293,6 +302,7 @@
                                      :step="1"
                                      controls-position="right"
                                      style="width: 100%"
+                                     @change="handleUnitQuantityChange(row)"
                                      :disabled="!bomDataValue.isEdit || bomDataValue.dataList.some(item => (item).tempId === row.tempId)" />
                   </el-form-item>
                 </template>
@@ -369,6 +379,7 @@
                :rules="rules"
                label-width="120px">
         <el-form-item label="宸ュ簭"
+                      v-if="operationType === 'add' || pageType === 'route'"
                       prop="technologyOperationId">
           <el-select v-model="form.technologyOperationId"
                      placeholder="璇烽�夋嫨宸ュ簭"
@@ -381,7 +392,12 @@
                        :value="process.id" />
           </el-select>
         </el-form-item>
+        <el-form-item label="宸ュ簭"
+                      v-else>
+          <span>{{ getProcessName(form.technologyOperationId) }}</span>
+        </el-form-item>
         <el-form-item label="浜у搧鍚嶇О"
+                      v-if="operationType === 'add' || pageType === 'route'"
                       prop="productModelId">
           <el-button type="primary"
                      @click="showProductSelectDialog = true">
@@ -390,12 +406,21 @@
               : '閫夋嫨浜у搧' }}
           </el-button>
         </el-form-item>
+        <el-form-item label="浜у搧鍚嶇О"
+                      v-else>
+          <span>{{ form.productName }}{{ form.model ? ' - ' + form.model : '' }}</span>
+        </el-form-item>
         <el-form-item label="鍗曚綅"
+                      v-if="operationType === 'add' || pageType === 'route'"
                       prop="unit">
           <el-input v-model="form.unit"
                     :placeholder="form.productModelId ? '鏍规嵁閫夋嫨鐨勪骇鍝佽嚜鍔ㄥ甫鍑�' : '璇峰厛閫夋嫨浜у搧'"
                     clearable
                     :disabled="true" />
+        </el-form-item>
+        <el-form-item label="鍗曚綅"
+                      v-else>
+          <span>{{ form.unit }}</span>
         </el-form-item>
         <el-form-item label="鏄惁璐ㄦ"
                       prop="isQuality">
@@ -424,7 +449,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"
@@ -470,7 +495,8 @@
   import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
   import {
     queryList,
-    addBomDetail,
+    queryList2,
+    add2,
   } from "@/api/productionManagement/productStructure.js";
 
   import { useRoute } from "vue-router";
@@ -500,6 +526,7 @@
     model: "",
     bomNo: "",
     description: "",
+    quantity: 0,
   });
 
   const processOptions = ref([]);
@@ -630,6 +657,7 @@
       bomNo: route.query.bomNo || "",
       bomId: route.query.bomId || "",
       description: route.query.description || "",
+      quantity: route.query.quantity || 0,
       status: !(route.query.status == 1 || route.query.status === "false"),
     };
     bomTableData.value[0].productName = routeInfo.value.productName;
@@ -720,9 +748,11 @@
 
           const addPromise = isOrderPage
             ? addRouteItem({
-                productOrderId: orderId.value,
-                productRouteId: routeId.value,
+                productionOrderId: Number(orderId.value),
+                orderRoutingId: Number(routeId.value),
                 technologyOperationId: form.value.technologyOperationId,
+                technologyRoutingId: Number(routeId.value),
+                operationName: getProcessName(form.value.technologyOperationId),
                 productModelId: form.value.productModelId,
                 isQuality: form.value.isQuality,
                 isProduction: form.value.isProduction,
@@ -757,6 +787,7 @@
             ? addOrUpdateProductProcessRouteItem({
                 id: form.value.id,
                 technologyOperationId: form.value.technologyOperationId,
+                operationName: getProcessName(form.value.technologyOperationId),
                 productModelId: form.value.productModelId,
                 isQuality: form.value.isQuality,
                 isProduction: form.value.isProduction,
@@ -812,15 +843,19 @@
   // 鏌ョ湅鍙傛暟鍒楄〃
   const handleViewParams = row => {
     currentProcess.value = row;
-    const query = {
+    const param = {
+      productionOrderRoutingOperationId: row.id,
+      productionOrderId: orderId.value,
+    };
+    const param1 = {
       technologyRoutingOperationId: row.id,
       productionOrderId: orderId.value,
     };
 
     const apiPromise =
       pageType.value === "order"
-        ? findProcessParamListOrder(query)
-        : getProcessParamList(query);
+        ? findProcessParamListOrder(param)
+        : getProcessParamList(param1);
 
     apiPromise
       .then(res => {
@@ -994,7 +1029,8 @@
   });
 
   const syncProcessOperationFields = item => {
-    const processId = item.processId ?? item.operationId ?? "";
+    const processId =
+      item.processId ?? item.operationId ?? item.technologyOperationId ?? "";
     if (!processId) {
       item.processId = "";
       return;
@@ -1006,7 +1042,11 @@
       option?.name || item.processName || item.operationName || "";
 
     item.processId = processId;
-    item.operationId = processId;
+    if (pageType.value === "order") {
+      item.technologyOperationId = processId;
+    } else {
+      item.operationId = processId;
+    }
     item.processName = processName;
     item.operationName = processName;
   };
@@ -1041,7 +1081,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) {
@@ -1139,6 +1182,12 @@
     });
   };
 
+  const handleUnitQuantityChange = row => {
+    if (routeInfo.value.quantity && routeInfo.value.quantity !== 0) {
+      row.demandedQuantity = (row.unitQuantity || 0) * routeInfo.value.quantity;
+    }
+  };
+
   const addchildItem = (item, tempId) => {
     if (item.tempId === tempId) {
       if (!item.children) {
@@ -1153,10 +1202,14 @@
         productModelId: undefined,
         processId: "",
         processName: "",
-        operationId: "",
+        [pageType.value === "order" ? "technologyOperationId" : "operationId"]:
+          "",
         operationName: "",
         unitQuantity: 1,
-        demandedQuantity: 0,
+        demandedQuantity:
+          routeInfo.value.quantity && routeInfo.value.quantity !== 0
+            ? 1 * routeInfo.value.quantity
+            : 0,
         children: [],
         unit: "",
         tempId: new Date().getTime(),
@@ -1188,10 +1241,14 @@
           productModelId: undefined,
           processId: "",
           processName: "",
-          operationId: "",
+          [pageType.value === "order" ? "technologyOperationId" : "operationId"]:
+            "",
           operationName: "",
           unitQuantity: 1,
-          demandedQuantity: 0,
+          demandedQuantity:
+            routeInfo.value.quantity && routeInfo.value.quantity !== 0
+              ? 1 * routeInfo.value.quantity
+              : 0,
           unit: "",
           children: [],
           tempId: new Date().getTime(),
@@ -1260,12 +1317,15 @@
 
   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,
+      add2({
+        // bomId: Number(routeInfo.value.bomId),
+        productionOrderBomId: Number(routeInfo.value.bomId) || null,
         children: buildSubmitTree(bomDataValue.value.dataList || []),
       })
         .then(() => {

--
Gitblit v1.9.3