From 4a2c6fb2773adf8b5e28351021b79aebaf2af5e4 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期三, 25 三月 2026 17:16:03 +0800
Subject: [PATCH] 1.生产工单  批量绑定工艺   修改

---
 src/views/workOrder/workOrderList.vue |  100 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 67 insertions(+), 33 deletions(-)

diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index faf51a1..3c41914 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -533,6 +533,7 @@
 
       <div class="elTableDiv">
         <el-table
+          ref="tableDataRef2"
           :data="tableDataDetail"
           border
           height="210px"
@@ -1587,6 +1588,7 @@
             </div>
             <div
               id="qrCode0"
+              :key="formApprove.mesordercode"
               style="width: 22%;height:90px;
                         margin-top: 20px;
                         overflow-y: scroll;display: flex;
@@ -1723,6 +1725,7 @@
             </div>
             <div
               id="qrCode1"
+              :key="formApprove.mesordercode"
               style="width: 22%;height:90px;
                         margin-top: 20px;
                         overflow-y: scroll;display: flex;
@@ -2495,9 +2498,8 @@
       </div>
 
       <div v-for="(i,index) in formData3" :key="index" class="customDiv">
-
+        <!--        ref="dialogForm"-->
         <el-form
-          ref="dialogForm"
           inline
           :model="i"
           label-width="110px"
@@ -2755,7 +2757,7 @@
   AddUpdateMesOrder, AddUpdateMesOrderList, DeleteMesOrder,
   MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent, MesOrderProcessSopSearch,
   MesOrderSearch, MesOrderSopSearch, UpdateMesOrderStepListSearch,
-  UpdateMesOrderStepSearch
+  UpdateMesOrderStepSearch, MesOrderNewStepListContent
 } from '@/api/WorkOrder'
 import { PartSelect } from '@/api/ProductModel'
 import { PrentOrganization, PrentOrganizationNoCompany, StepData } from '@/api/GeneralBasicData'
@@ -2763,7 +2765,12 @@
 import ElDragSelect from '@/components/DragSelect'
 import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
 import DateType from '@/components/DateType'
-import { PartSelectRpute, PartSelectRputeList, RouteSelectStep, RouteSelectStepList } from '@/api/basicSettings'
+import {
+  PartSelectRpute,
+  PartSelectRputeList,
+  RouteSelectStep,
+  RouteSelectStepList
+} from '@/api/basicSettings'
 import { DeviceSopSearch } from '@/api/DeviceManager'
 
 export default {
@@ -2795,7 +2802,7 @@
         // createdate: '', // 鍒涘缓鏃堕棿
         datatype: 'ED', // 鏃ユ湡绫诲瀷(璁″垝寮�宸�(PS)銆佽鍒掑畬宸�(PE)銆侀璁′氦浠�(ED)銆佸垱寤烘棩鏈�(CT))
         timeValue: [], // 鏌ヨ鏃ユ湡
-        prop: 'lm_date', // 鎺掑簭瀛楁
+        prop: 'partspec', // 鎺掑簭瀛楁  lm_date
         order: 'desc', // 鎺掑簭瀛楁
         page: 1, // 绗嚑椤�
         rows: 20 // 姣忛〉澶氬皯鏉�
@@ -3045,7 +3052,7 @@
 
       routecodeArr: [], //
 
-      sourceType: false, // 宸ュ簭鐨勬暟鎹潵婧�
+      sourceType: true, // 宸ュ簭鐨勬暟鎹潵婧�
 
       mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
 
@@ -3190,6 +3197,8 @@
           stepTableData: []// 宸ュ簭琛ㄥ��
         })
       })
+
+      const tempArr = []
       const { data: res3 } = await UpdateMesOrderStepListSearch(data3)
       console.log(res3, 321)
       res3.forEach((i, index) => {
@@ -3200,40 +3209,61 @@
           })
           this.formData3[index].stepTableData = i.stepdata
           this.formData3[index].stepSelectedValue = i.stepdata.map(j => j.stepcode)
+        } else {
+          tempArr.push({
+            'wkshopcode': this.formData3[index].wkshopcode,
+            'routecode': this.formData3[index].routecode,
+            'partcode': this.formData3[index].partcode
+          })
         }
       })
-
-      const { data: res } = await PartSelectRputeList(partcodeArr)
-      if (this.mesSetting.route) {
-        res.forEach((i, index) => {
-          if (i.routedata.length > 0) {
-            this.formData3[index].routecodeArr = i.routedata
-          }
-        })
-      } else {
+      console.log(this.sourceType, '鎵ц1', this.formData3)
+      const tempArr2 = tempArr.filter((item, index) => {
+        return tempArr.findIndex(i => i.partcode === item.partcode) === index
+      })
+      if (this.sourceType) { // 涓簍rue鏃讹紝璋冪敤MesOrderNewStepListContent
+        const { data: res } = await MesOrderNewStepListContent(tempArr2)
         this.formData3.forEach((i, index) => {
           if (i.stepTableData.length === 0) {
-            i.stepTableData = res[index].stepdata
-            i.stepSelectedValue = res[index].stepdata.length > 0 ? res[index].stepdata.map(j => j.stepcode) : []
-          }
-        })
-      }
-      // i.stepdata.forEach(j => {
-      //   j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
-      //   j.sumqty = Math.round(parseFloat(i.canupdate_qty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
-      // })
-      if (this.mesSetting.route) {
-        const { data: res2 } = await RouteSelectStepList(data2)
-        this.formData3.forEach((i, index) => {
-          if (i.stepTableData.length === 0) {
-            res2[index].stepdata.forEach(j => {
+            const ind = res.findIndex(j => j.partcode === this.formData3[index].partcode)
+            res[ind].stepdata.forEach(j => {
               j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
               j.sumqty = Math.round(parseFloat(i.mesqty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
             })
-            i.stepTableData = res2[index].stepdata
-            i.stepSelectedValue = res2[index].stepdata.length > 0 ? res2[index].stepdata.map(j => j.stepcode) : []
+            this.formData3[index].stepTableData = res[ind].stepdata
+            this.formData3[index].stepSelectedValue = res[ind].stepdata.length > 0 ? res[ind].stepdata.map(j => j.stepcode) : []
           }
         })
+      } else { // 璋冪敤PartSelectRputeList
+        const { data: res } = await PartSelectRputeList(partcodeArr)
+        if (this.mesSetting.route) {
+          res.forEach((i, index) => {
+            if (i.routedata.length > 0) {
+              this.formData3[index].routecodeArr = i.routedata
+            }
+          })
+        } else {
+          this.formData3.forEach((i, index) => {
+            if (i.stepTableData.length === 0) {
+              i.stepTableData = res[index].stepdata
+              i.stepSelectedValue = res[index].stepdata.length > 0 ? res[index].stepdata.map(j => j.stepcode) : []
+            }
+          })
+        }
+
+        if (this.mesSetting.route) {
+          const { data: res2 } = await RouteSelectStepList(data2)
+          this.formData3.forEach((i, index) => {
+            if (i.stepTableData.length === 0) {
+              res2[index].stepdata.forEach(j => {
+                j.ratio = parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) : 0
+                j.sumqty = Math.round(parseFloat(i.mesqty) * (1 + (parseFloat(j.ratio) > 0 ? parseFloat(j.ratio) / 100 : 0)))
+              })
+              i.stepTableData = res2[index].stepdata
+              i.stepSelectedValue = res2[index].stepdata.length > 0 ? res2[index].stepdata.map(j => j.stepcode) : []
+            }
+          })
+        }
       }
 
       // this.formData3 = this.multipleSelection
@@ -3841,7 +3871,9 @@
 
           this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
         } else {
-          await this.getBasicProcessData()
+          // await this.getBasicProcessData()
+          console.log('鎵ц')
+          this.sourceTypeChange(this.sourceType)
         }
       }
 
@@ -3988,11 +4020,13 @@
 
       this.dialogForm.routecode = ''
 
-      this.sourceType = false
+      this.sourceType = true
 
       this.stepSelectedValue = []
       this.stepTableData = []
       this.$refs.dialogForm.clearValidate()
+      this.$refs.tableDataRef.doLayout()
+      this.$refs.tableDataRef2.doLayout()
     },
     // 瀵硅瘽妗嗗彇娑�
     dialogVisibleCancel() {

--
Gitblit v1.9.3