From 93d2a0bd19ffb1d86c6807a4d93d0eff580c14f1 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期六, 25 四月 2026 16:39:26 +0800
Subject: [PATCH] 生产计划和生产订单一些修改

---
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   57 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index b78caad..44fef19 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">
@@ -206,7 +206,7 @@
     <div class="section-header"
          style="margin-top: 20px;">
       <div class="section-title">BOM 缁撴瀯</div>
-      <div class="section-actions"
+      <!-- <div class="section-actions"
            v-if="pageType === 'order'">
         <el-button v-if="!bomDataValue.isEdit"
                    type="primary"
@@ -223,7 +223,7 @@
                    :loading="bomDataValue.loading">
           淇濆瓨BOM
         </el-button>
-      </div>
+      </div> -->
     </div>
     <el-table :data="bomTableData"
               border
@@ -369,6 +369,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 +382,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 +396,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 +439,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,6 +485,7 @@
   import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
   import {
     queryList,
+    queryList2,
     addBomDetail,
   } from "@/api/productionManagement/productStructure.js";
 
@@ -720,9 +736,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 +775,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,
@@ -994,7 +1013,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 +1026,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 +1065,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) {
@@ -1153,7 +1180,8 @@
         productModelId: undefined,
         processId: "",
         processName: "",
-        operationId: "",
+        [pageType.value === "order" ? "technologyOperationId" : "operationId"]:
+          "",
         operationName: "",
         unitQuantity: 1,
         demandedQuantity: 0,
@@ -1188,7 +1216,8 @@
           productModelId: undefined,
           processId: "",
           processName: "",
-          operationId: "",
+          [pageType.value === "order" ? "technologyOperationId" : "operationId"]:
+            "",
           operationName: "",
           unitQuantity: 1,
           demandedQuantity: 0,
@@ -1260,12 +1289,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