From 7de17bdd69eb8700e5e74f17b265afdaca80c32c Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期二, 06 八月 2024 16:59:54 +0800
Subject: [PATCH] 1.工单批量派发实现

---
 src/views/produceManager/workOrder.vue |  573 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 475 insertions(+), 98 deletions(-)

diff --git a/src/views/produceManager/workOrder.vue b/src/views/produceManager/workOrder.vue
index 3e881ca..f93eb06 100644
--- a/src/views/produceManager/workOrder.vue
+++ b/src/views/produceManager/workOrder.vue
@@ -5,10 +5,10 @@
       <div class="bodyTopButtonGroup" style="justify-content: space-between">
         <div style="display: flex">
           <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
-          <el-button v-waves type="primary" icon="el-icon-connection" @click="send('send')">娲惧彂</el-button>
+          <el-button v-waves type="primary" icon="el-icon-connection" @click="batchSend()">鎵归噺娲惧彂</el-button>
         </div>
 
-        <el-button v-waves icon="el-icon-switch-button" @click="orderClose">鍏抽棴宸ュ崟</el-button>
+        <!--        <el-button v-waves icon="el-icon-switch-button" @click="orderClose">鍏抽棴宸ュ崟</el-button>-->
       </div>
 
       <div class="bodyTopFormGroup">
@@ -138,24 +138,25 @@
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
           @row-click="rowClick"
+          @selection-change="handleSelectionChange"
         >
-          <!--          <el-table-column-->
-          <!--            type="selection"-->
-          <!--            width="50"-->
-          <!--          />-->
           <el-table-column
+            type="selection"
             width="50"
-            fixed
-          >
-            <template slot-scope="{row}">
-              <el-radio
-                v-model="radioSelected"
-                :label="row.wo_code"
-                style="color: transparent;padding-left: 10px;"
-              />
-              <!--              @change.native="getCurrentRow(row.wo_code)"-->
-            </template>
-          </el-table-column>
+            :selectable="selected"
+          />
+          <!--          <el-table-column-->
+          <!--            width="50"-->
+          <!--            fixed-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <el-radio-->
+          <!--                v-model="radioSelected"-->
+          <!--                :label="row.wo_code"-->
+          <!--                style="color: transparent;padding-left: 10px;"-->
+          <!--              />-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
           <el-table-column
             prop="RowNum"
             width="50"
@@ -176,8 +177,8 @@
               <div v-if="row.status==='ALLO'">宸叉淳鍙�</div>
               <div v-if="row.status==='START'">寮�宸�</div>
               <div v-if="row.status==='CLOSED'">瀹屽伐</div>
-              <div v-if="row.status==='NOSCHED'">寰呮帓绋�</div>
-              <div v-if="row.status==='SCHED'">宸叉帓绋�</div>
+              <!--              <div v-if="row.status==='NOSCHED'">寰呮帓绋�</div>-->
+              <!--              <div v-if="row.status==='SCHED'">宸叉帓绋�</div>-->
             </template>
           </el-table-column>
           <el-table-column
@@ -224,6 +225,13 @@
               <div v-else>/</div>
             </template>
           </el-table-column>
+          <el-table-column
+            prop="printcount"
+            label="鎵撳嵃娆℃暟"
+            show-tooltip-when-overflow
+            sortable="custom"
+            min-width="120"
+          />
           <el-table-column
             prop="partcode"
             label="浜у搧缂栫爜"
@@ -345,11 +353,27 @@
           />
           <el-table-column
             label="鎿嶄綔"
-            width="120"
+            width="140"
             fixed="right"
           >
             <template slot-scope="{row}">
               <div class="operationClass">
+                <el-tooltip class="item" effect="dark" content="娲惧彂" placement="top">
+                  <i
+                    :style="{color:$store.state.settings.theme}"
+                    class="el-icon-connection"
+                    style="cursor: pointer;margin-right: 15px"
+                    @click="send('send',row)"
+                  />
+                </el-tooltip>
+                <el-tooltip class="item" effect="dark" content="宸ュ崟鍏抽棴" placement="top">
+                  <i
+                    :style="{color:$store.state.settings.theme}"
+                    class="el-icon-switch-button"
+                    style="cursor: pointer;margin-right: 15px"
+                    @click="orderClose(row.wo_code)"
+                  />
+                </el-tooltip>
                 <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ崟" placement="top">
                   <!--                  <i-->
                   <!--                    class="el-icon-tickets"-->
@@ -467,37 +491,38 @@
             show-tooltip-when-overflow
             prop="ng_qty"
           />
-          <el-table-column
-            label="鎿嶄綔"
-            width="120"
-            fixed="right"
-          >
-            <template slot-scope="{row}">
-              <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ簭" placement="top">
-                  <i
-                    v-if="tableDataDetail.length!==row.seq"
-                    class="el-icon-printer"
-                    :style="{color:$store.state.settings.theme}"
-                    style="cursor: pointer;margin-right: 15px"
-                    @click="supplementSmallClick(row)"
-                  />
-                </el-tooltip>
-                <el-tooltip class="item" effect="dark" content="琛ユ墦鐢熶骇鍏ュ簱鏉$爜" placement="top">
-                  <i
-                    v-if="tableDataDetail.length===row.seq"
-                    class="  el-icon-camera"
-                    :style="{color:$store.state.settings.theme}"
-                    style="cursor: pointer;margin-right: 15px"
-                    @click="getProductInHouseLabCode(row.wo_code)"
-                  />
-                </el-tooltip>
-              </div>
-            </template>
-          </el-table-column>
+          <!--          <el-table-column-->
+          <!--            label="鎿嶄綔"-->
+          <!--            width="120"-->
+          <!--            fixed="right"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div class="operationClass">-->
+          <!--                <el-tooltip class="item" effect="dark" content="鎵撳嵃宸ュ簭" placement="top">-->
+          <!--                  <i-->
+          <!--                    v-if="tableDataDetail.length!==row.seq"-->
+          <!--                    class="el-icon-printer"-->
+          <!--                    :style="{color:$store.state.settings.theme}"-->
+          <!--                    style="cursor: pointer;margin-right: 15px"-->
+          <!--                    @click="supplementSmallClick(row)"-->
+          <!--                  />-->
+          <!--                </el-tooltip>-->
+          <!--                <el-tooltip class="item" effect="dark" content="琛ユ墦鐢熶骇鍏ュ簱鏉$爜" placement="top">-->
+          <!--                  <i-->
+          <!--                    v-if="tableDataDetail.length===row.seq"-->
+          <!--                    class="  el-icon-camera"-->
+          <!--                    :style="{color:$store.state.settings.theme}"-->
+          <!--                    style="cursor: pointer;margin-right: 15px"-->
+          <!--                    @click="getProductInHouseLabCode(row.wo_code)"-->
+          <!--                  />-->
+          <!--                </el-tooltip>-->
+          <!--              </div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
         </el-table>
       </div>
     </div>
+
     <!--鏂板娲惧彂瀵硅瘽妗�-->
     <el-dialog
       v-el-drag-dialog
@@ -662,7 +687,14 @@
             />
           </el-select>
         </el-form-item>
-
+        <el-form-item label="宸ヤ环绠℃帶" required>
+          <el-switch
+            v-model="dialogForm.is_steprice"
+            active-color="#13ce66"
+            inactive-color="#eee"
+            @change="routecodeChange"
+          />
+        </el-form-item>
         <!--        <el-form-item label="鏄惁鎺掔▼" prop="isAps">-->
         <!--          <el-radio-group v-model="dialogForm.isAps" style="width:200px" @change="changeIsAps">-->
         <!--            <el-radio key="Y" label="Y" value="Y">鏄�</el-radio>-->
@@ -726,7 +758,7 @@
         <!--        </el-form-item>-->
 
       </el-form>
-      <div style="display: flex;justify-content: flex-end">
+      <div style="display: flex;justify-content: flex-end;margin-top: -50px;">
         {{ routeStepArr }}
       </div>
 
@@ -1396,7 +1428,7 @@
           <el-button v-waves @click="dialogVisibleBackPreview">杩� 鍥�</el-button>
           <!--            <el-button v-waves v-if="operation==='add'" type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>-->
           <!--            <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�/鎵� 鍗�</el-button>-->
-          <el-button v-waves v-print="printObj" type="primary">鎵� 鍗�</el-button>
+          <el-button v-waves v-print="printObj" type="primary" @click="printObjGetApi">鎵� 鍗�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -1990,6 +2022,196 @@
       </span>
     </el-dialog>
 
+    <!--    鎵归噺娲惧彂瀵硅瘽妗�-->
+    <el-dialog
+      v-el-drag-dialog
+      title="鎵归噺娲惧彂"
+      :visible.sync="dialogVisible3"
+      width="900px"
+      top="10vh"
+      :close-on-click-modal="false"
+      @closed="handleClose3"
+      @close="handleClose3"
+    >
+
+      <div style="height: 600px;padding-right: 20px;overflow: auto">
+        <el-alert
+          v-if="multipleSelection.length-formData3.length>0"
+          :title="'褰撳墠閫変腑'+multipleSelection.length+'涓伐鍗曪紝鏈�'+(multipleSelection.length-formData3.length)+'涓伐鍗曟湭鎸囧畾宸ヨ壓璺嚎锛屽凡杩囨护锛�'"
+          type="error"
+        />
+        <div v-for="(i,index) in formData3" :key="index">
+          <el-divider content-position="left">绗瑊{ index+1 }}涓伐鍗�</el-divider>
+
+          <el-form
+            ref="dialogForm"
+            inline
+            :model="i"
+            label-width="110px"
+          >
+            <el-form-item
+              label="宸ュ崟鐘舵��"
+              prop="mesorderstus"
+            >
+              <el-select
+                v-model="i.mesorderstus"
+                disabled
+                filterable
+                :popper-append-to-body="false"
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in erporderstusArr"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+            </el-form-item>
+
+            <el-form-item label="宸ュ崟缂栧彿" prop="mesordercode">
+              <el-input v-model="i.mesordercode" disabled style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="宸ュ崟绫诲瀷" prop="mesorderstus">
+              <el-select
+                v-model="i.ordertype"
+                :popper-append-to-body="false"
+                style="width: 200px"
+                :disabled="operation!=='add'"
+                placeholder="璇烽�夋嫨"
+                @change="mesordertypeChange"
+              >
+                <el-option
+                  v-for="item in ordertypeArr"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="婧愬崟鍗曞彿">
+              <el-input
+                v-model="i.sourceorder"
+                :disabled="i.ordertype==='PO'"
+                style="width: 200px"
+              >
+                <!--            <el-button-->
+                <!--              slot="append"-->
+                <!--              icon="el-icon-search"-->
+                <!--              :disabled="operation!=='add'||dialogForm.ordertype==='PO'"-->
+                <!--              @click="mesordertsourcesearchclick"-->
+                <!--            />-->
+              </el-input>
+            </el-form-item>
+            <el-form-item label="宸ュ崟鏁伴噺" prop="mesqty">
+              <el-input
+                v-model="i.mesqty"
+                oninput="value=value.replace(/[^0-9.]/g,'')"
+                :disabled="operation!=='add'"
+                style="width: 200px"
+              />
+            </el-form-item>
+            <el-form-item
+              v-if="operation==='add'"
+              label="浜у搧鍚嶇О/缂栫爜"
+              prop="partcode"
+            >
+              <el-select
+                v-model="i.partcode"
+                filterable
+                :disabled="operation!=='add'"
+                :popper-append-to-body="false"
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+                @change="partcodeChangeDialog"
+              >
+                <el-option
+                  v-for="item in partArr"
+                  :key="item.partcode"
+                  :label="item.partname+'/'+item.partcode"
+                  :value="item.partcode"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item v-if="operation!=='add'" label="浜у搧鍚嶇О" prop="partname">
+              <el-input v-model="i.partname" disabled style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="浜у搧缂栫爜">
+              <el-input v-model="i.partcode" disabled style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="浜у搧瑙勬牸" prop="partspec">
+              <el-input v-model="i.partspec" disabled style="width: 200px" />
+            </el-form-item>
+            <!--        <div style="display: flex">-->
+            <el-form-item label="鐢熶骇杞﹂棿" prop="wkshopcode">
+              <el-input v-model="i.wkshopname" disabled style="width: 200px" />
+
+              <!--              <el-select-->
+              <!--                v-model="i.wkshopcode"-->
+              <!--                filterable-->
+              <!--                :popper-append-to-body="false"-->
+              <!--                style="width: 200px;"-->
+              <!--                placeholder="璇烽�夋嫨"-->
+              <!--                disabled-->
+              <!--              >-->
+              <!--                <el-option-->
+              <!--                  v-for="item in wkshopArr"-->
+              <!--                  :key="item.org_code"-->
+              <!--                  :label="item.org_name"-->
+              <!--                  :value="item.org_code"-->
+              <!--                />-->
+              <!--              </el-select>-->
+            </el-form-item>
+
+            <el-form-item label="宸ヨ壓璺嚎" prop="routecode">
+              <el-select
+                v-model="i.routecode"
+                filterable
+                :popper-append-to-body="false"
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+                :disabled="i.wkshopcode===''"
+              >
+                <el-option
+                  v-for="item in i.children"
+                  :key="item.routecode"
+                  :label="item.routename"
+                  :value="item.routecode"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="宸ヤ环绠℃帶" required>
+              <el-switch
+                v-model="i.is_steprice"
+                active-color="#13ce66"
+                inactive-color="#eee"
+                @change="routecodeChange2(i)"
+              />
+            </el-form-item>
+
+          </el-form>
+
+          <div style="display: flex;justify-content: flex-end;margin-top: -50px;margin-right: 50px">
+            {{ i.children.find(it=>it.routecode===i.routecode).stepname }}
+          </div>
+        </div>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button v-waves @click="dialogVisible3=false">鍙� 娑�</el-button>
+          <el-button
+            v-waves
+
+            type="primary"
+            :disabled="submitButtonIsDisabled"
+            @click="dialogVisibleConfirm3"
+          >纭� 瀹�</el-button>
+        </div>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -1998,9 +2220,20 @@
 import {
   AddUpdateMesOrder,
   ClosedMesOrder,
-  DeleteMesOrder, MesBadOrderSearch, JobCreationSonAddVison,
-  MesOrderSearch, PartSelectRoute, RouteSelectWkshop, SearchWorkStep, SelectRouteOrWkshop,
-  SelectRouteStep, AddMesOrderCodeSearch, ProductInHouseLabCode
+  DeleteMesOrder,
+  MesBadOrderSearch,
+  JobCreationSonAddVison,
+  MesOrderSearch,
+  PartSelectRoute,
+  RouteSelectWkshop,
+  SearchWorkStep,
+  SelectRouteOrWkshop,
+  SelectRouteStep,
+  AddMesOrderCodeSearch,
+  ProductInHouseLabCode,
+  UpdateMesOrderPrintCount,
+  BatchSearchRouteStep,
+  BatchWorkSave
 } from '@/api/produceManager'
 import { InventoryFileAssociationRoute, PartSelect, SaveInventoryFile } from '@/api/makeModel'
 import { handleDatetime, handleDatetime2, validateCode } from '@/utils/global'
@@ -2049,9 +2282,9 @@
         // { code: 'CREATED', name: '宸插叧闂�' }
         { code: 'ALLO', name: '宸叉淳鍙�' },
         { code: 'START', name: '寮�宸�' },
-        { code: 'CLOSED', name: '瀹屽伐' },
-        { code: 'NOSCHED', name: '寰呮帓绋�' },
-        { code: 'SCHED', name: '宸叉帓绋�' }
+        { code: 'CLOSED', name: '瀹屽伐' }
+        // { code: 'NOSCHED', name: '寰呮帓绋�' },
+        // { code: 'SCHED', name: '宸叉帓绋�' }
       ],
       total: 10,
       radioSelected: '',
@@ -2072,6 +2305,9 @@
         mesqty: '', // 宸ュ崟鏁伴噺
 
         routecode: '', // 宸ヨ壓璺嚎缂栫爜
+
+        is_steprice: false, // 鏄惁宸ヤ环绠$悊
+
         wkshopcode: '', // 鐢熶骇杞﹂棿缂栫爜
         planstartdate: '', // 璁″垝寮�濮嬫椂闂�
         planenddate: '', // 璁″垝瀹屾垚鏃堕棿
@@ -2149,12 +2385,15 @@
         },
         beforeOpenCallback(vue) {
           vue.printLoading = true
-          console.log('鎵撳紑涔嬪墠')
-          console.log()
+          console.log('鎵撳紑涔嬪墠8888')
         },
         openCallback(vue) {
           vue.printLoading = false
-          console.log('鎵ц浜嗘墦鍗�')
+          console.log('鎵ц浜嗘墦鍗�9999')
+        },
+        clickMounted(vue) {
+          console.log('鐐瑰嚮浜嗘墦鍗版寜閽�1223451')
+          // vue.printContent.popTitle = vue.tableHead // 鍔ㄦ�佽缃〉鐪�
         }
       },
 
@@ -2182,13 +2421,17 @@
           // vue.dialogVisible = false
         },
         beforeOpenCallback(vue) {
+          // window.print()
           vue.printLoading = true
-          console.log('鎵撳紑涔嬪墠')
-          console.log()
+          console.log('鎵撳紑涔嬪墠000')
         },
         openCallback(vue) {
           vue.printLoading = false
-          console.log('鎵ц浜嗘墦鍗�')
+          console.log('鎵ц浜嗘墦鍗癳ee')
+        },
+        clickMounted(vue) {
+          console.log('鐐瑰嚮浜嗘墦鍗版寜閽�1111')
+          // vue.printContent.popTitle = vue.tableHead // 鍔ㄦ�佽缃〉鐪�
         }
       },
       qrForm: {
@@ -2256,7 +2499,12 @@
 
       switchButton: false,
 
-      routeStepArr: ''
+      routeStepArr: '',
+
+      dialogVisible3: false,
+      multipleSelection: [],
+      formData3: []
+
     }
   },
   created() {
@@ -2358,6 +2606,7 @@
       this.form.paydate = ''
       this.form.creatuser = ''
       this.form.sourceorder = ''
+      this.form.saleordercode = ''
       this.form.creatuser = ''
       this.form.ordertype = ''
       this.getMesOrderSearch()
@@ -2410,27 +2659,30 @@
     },
     // 宸ヨ壓璺嚎鍊兼敼鍙�
     async routecodeChange() {
-      const data = {
-        partcode: this.dialogForm.partcode,
-        routecode: this.dialogForm.routecode,
-        wkshopcode: this.dialogForm.wkshopcode
-      }
-      await SelectRouteOrWkshop(data).then((res) => {
-        console.log(res, 1)
+      if (this.dialogForm.routecode) {
+        const data = {
+          partcode: this.dialogForm.partcode,
+          routecode: this.dialogForm.routecode,
+          wkshopcode: this.dialogForm.wkshopcode,
+          is_steprice: this.dialogForm.is_steprice ? 'Y' : 'N'
+        }
+        await SelectRouteOrWkshop(data).then((res) => {
+          console.log(res, 1)
 
-        SelectRouteStep({ routecode: this.dialogForm.routecode }).then(res2 => {
-          console.log(res2)
-          this.routeStepArr = res2.data.map(i => i.stepname).join('锛�')
+          SelectRouteStep({ routecode: this.dialogForm.routecode }).then(res2 => {
+            console.log(res2)
+            this.routeStepArr = res2.data.map(i => i.stepname).join('锛�')
+          })
+
+          this.submitButtonIsDisabled = false
+        }).catch(err => {
+          // console.log(err, 2)
+          this.submitButtonIsDisabled = true
         })
-
-        this.submitButtonIsDisabled = false
-      }).catch(err => {
-        // console.log(err, 2)
-        this.submitButtonIsDisabled = true
-      })
+      }
     },
     // 鐢熶骇杞﹂棿鍊兼敼鍙樻椂
-    async  wkshopcodeChange(wkshopcode, partcode) {
+    async wkshopcodeChange(wkshopcode, partcode) {
       const data = {
         partcode,
         wkshopcode
@@ -2485,12 +2737,12 @@
       this.dialogVisibleTask = false
     },
     // 娲惧彂
-    send(operation) {
-      if (this.radioSelected.length < 1) {
-        return this.$message.info('璇峰厛閫夋嫨宸ュ崟锛�')
-      }
-
-      const row = this.tableData.find(item => item.wo_code === this.radioSelected)
+    send(operation, row) {
+      // if (this.radioSelected.length < 1) {
+      //   return this.$message.info('璇峰厛閫夋嫨宸ュ崟锛�')
+      // }
+      //
+      // const row = this.tableData.find(item => item.wo_code === this.radioSelected)
 
       if (row.status !== 'NEW') {
         return this.$message.info('姝ゅ伐鍗曚负闈炴柊宸ュ崟鐘舵�侊紝涓嶅彲娲惧彂锛�')
@@ -2546,16 +2798,17 @@
       })
     },
     // 宸ュ崟鍏抽棴浜嬩欢
-    orderClose() {
-      if (this.radioSelected.length < 1) {
-        return this.$message.info('璇峰厛閫夋嫨宸ュ崟锛�')
-      }
+    orderClose(wo_code) {
+      // if (this.radioSelected.length < 1) {
+      //   return this.$message.info('璇峰厛閫夋嫨宸ュ崟锛�')
+      // }
       console.log('宸ュ崟鍏抽棴浜嬩欢')
       this.tableData.forEach(item => {
-        if (item.wo_code === this.radioSelected) {
-          if (item.status === 'START') {
-            return this.$message.info('褰撳墠宸ュ崟鏈畬宸ワ紝鏃犳硶鍏抽棴锛�')
-          } else if (item.status === 'CLOSED') {
+        if (item.wo_code === wo_code) {
+          // if (item.status === 'START') {
+          //   return this.$message.info('褰撳墠宸ュ崟鏈畬宸ワ紝鏃犳硶鍏抽棴锛�')
+          // } else
+          if (item.status === 'CLOSED') {
             return this.$message.info('宸ュ崟宸插叧闂紝鏃犻渶鍐嶅叧闂紒')
           } else {
             this.$confirm('鏄惁纭鍏抽棴宸ュ崟?', '鎻愮ず', {
@@ -2612,6 +2865,7 @@
 
       this.dialogForm.routecode = '' // 宸ヨ壓璺嚎缂栫爜
       this.dialogForm.wkshopcode = '' // 鐢熶骇杞﹂棿缂栫爜
+      this.dialogForm.is_steprice = false// 鏄惁宸ヤ环绠$悊
       this.dialogForm.planstartdate = '' // 璁″垝寮�濮嬫椂闂�
       this.dialogForm.planenddate = '' // 璁″垝瀹屾垚鏃堕棿
       this.dialogForm.orderlev = '' // 宸ュ崟绛夌骇
@@ -2724,8 +2978,8 @@
       // const number = Math.random() * Math.random()
       // this.number = number === 0 ? (10 + Math.random()) : number
       // console.log(number)
-
-      this.formApprove.saleOrderCode = saleOrderCode
+      console.log(this.formApprove.saleOrderCode, 321)
+      this.formApprove.saleOrderCode = this.formApprove.saleOrderCode !== '' ? this.formApprove.saleOrderCode : saleOrderCode
       const data2 = {
         username: getCookie('admin'),
         mesordercode: wo_code || this.dialogForm.mesordercode
@@ -2827,6 +3081,14 @@
 
       this.tableDataPrint = []
     },
+
+    async  printObjGetApi() {
+      const res = await UpdateMesOrderPrintCount({ wo_code: this.formApprove.mesordercode })
+      if (res.code === '200') {
+        this.getMesOrderSearch()
+      }
+    },
+
     // 琛ユ墦鎸夐挳
     supplementClick() {
       this.dialogVisibleTask = false
@@ -3111,8 +3373,12 @@
     },
     //  琛岀偣鍑讳簨浠�
     async rowClick(row, event, column) {
+      this.formApprove.saleOrderCode = row.saleOrderCode
       this.radioSelected = row.wo_code ? row.wo_code : this.radioSelected
-      const { data: res } = await SearchWorkStep({ wo_code: this.radioSelected, storg_code: this.$store.state.settings.orgType === 'W' ? (this.switchButton ? '' : getCookie('stu_torgcode')) : '' })
+      const { data: res } = await SearchWorkStep({
+        wo_code: this.radioSelected,
+        storg_code: this.$store.state.settings.orgType === 'W' ? (this.switchButton ? '' : getCookie('stu_torgcode')) : ''
+      })
       this.tableDataDetail = res
     },
     // 鎵撳嵃宸ュ崟
@@ -3161,6 +3427,117 @@
 
         this.$forceUpdate()
       }, 500)
+    },
+
+    handleSelectionChange(val) {
+      this.multipleSelection = val
+
+      console.log(this.multipleSelection)
+    },
+    // 鎵归噺娲惧彂
+    async  batchSend() {
+      if (this.multipleSelection.length === 0) {
+        return this.$message.info('璇峰厛鍕鹃�夌浉瀵瑰簲鐨勫伐鍗曪紒')
+      }
+      const data = []
+      this.multipleSelection.forEach(i => {
+        data.push({
+          'wkshopcode': i.wkshp_code,
+          'code': i.partcode,
+          'name': i.wo_code,
+          'flag': ''
+        })
+      })
+
+      const { data: res } = await BatchSearchRouteStep(data)
+      this.formData3 = []
+      this.multipleSelection.forEach((item, index) => {
+        item.stepname = res[index].children.length > 0 ? res[index].children[0].stepname : ''
+        if (item.stepname) {
+          this.formData3.push({
+            'mesorderstus': item.status,
+            'sourceorder': item.m_po,
+            'ordertype': item.wotype,
+            'mesordercode': item.wo_code,
+            'partcode': item.partcode,
+            'mesqty': item.plan_qty,
+            'routecode': res[index].children.length > 0 ? res[index].children[0].routecode : '',
+            'wkshopcode': item.wkshp_code,
+            'wkshopname': item.wkshp_name,
+            'partname': item.partname,
+            'partspec': item.partspec,
+            'planstartdate': item.plan_startdate,
+            'planenddate': item.plan_enddate,
+            'orderlev': item.piroque,
+            children: res[index].children,
+            is_steprice: false,
+
+            'is_aps': '',
+            'bom_id': ''
+          })
+        }
+      })
+
+      if (this.formData3.length === 0) {
+        return this.$message.info('鏈湁绗﹀悎鍙淳鍙戝伐鍗曪紒')
+      }
+
+      this.dialogVisible3 = true
+    },
+    // 鎵归噺娲惧彂纭畾浜嬩欢
+    async dialogVisibleConfirm3() {
+      const data = []
+      this.formData3.forEach(i => {
+        data.push({
+          'mesorderstus': i.mesorderstus,
+          'sourceorder': i.sourceorder,
+          'ordertype': i.ordertype,
+          'mesordercode': i.mesordercode,
+          'partcode': i.partcode,
+          'mesqty': i.mesqty,
+          'routecode': i.routecode,
+          'wkshopcode': i.wkshopcode,
+          'planstartdate': i.planstartdate,
+          'planenddate': i.planenddate,
+          'orderlev': i.orderlev,
+          'is_aps': 'N',
+          'bom_id': ''
+        })
+      })
+
+      const res = await BatchWorkSave(data)
+      if (res.code === '200') {
+        this.dialogVisible3 = false
+        this.$message.success('鎵归噺娲惧彂鎴愬姛锛�')
+        await this.getMesOrderSearch()
+      } else {
+        this.$message.error('鎵归噺娲惧彂澶辫触锛�')
+      }
+    },
+    // 鎵归噺娲惧彂鍏抽棴浜嬩欢
+    handleClose3() {
+      this.formData3 = []
+      this.submitButtonIsDisabled = false
+    },
+    selected(row, index) {
+      return row.status === 'NEW'
+    },
+
+    async  routecodeChange2(val) {
+      if (val.routecode) {
+        const data = {
+          partcode: val.partcode,
+          routecode: val.routecode,
+          wkshopcode: val.wkshopcode,
+          is_steprice: val.is_steprice ? 'Y' : 'N'
+        }
+        await SelectRouteOrWkshop(data).then((res) => {
+          this.submitButtonIsDisabled = false
+        }).catch(err => {
+          // console.log(err, 2)
+          this.submitButtonIsDisabled = true
+        })
+      }
     }
   }
 }

--
Gitblit v1.9.3