From eb5aca176bf68e13be87c98eb1ead8aa72adee28 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期二, 09 七月 2024 15:36:54 +0800
Subject: [PATCH] 1.工单打印新增销售订单号2.综合看板修改

---
 src/views/workOrder/workOrderList.vue |  327 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 253 insertions(+), 74 deletions(-)

diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index 7d4fab9..94ff178 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -351,6 +351,16 @@
           >
             <template slot-scope="{row}">
               <div class="operationClass">
+
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="SOP棰勮" placement="top">
+                  <i
+                    v-if="mesSetting.workOrder"
+                    class="el-icon-files"
+                    style="cursor: pointer;color:#42b983;margin-right: 15px"
+                    @click="pre(row,1)"
+                  />
+                </el-tooltip>
+
                 <el-tooltip class="item" effect="dark" content="淇敼" placement="top">
                   <i
                     class="el-icon-edit-outline"
@@ -373,7 +383,7 @@
                     :style="{color:$store.state.settings.theme}"
                     class="el-icon-printer"
                     style="cursor: pointer;margin-right: 15px"
-                    @click.stop="handlePrint(row.wo_code)"
+                    @click.stop="handlePrint(row.wo_code,row.saleOrderCod)"
                   />
                 </el-tooltip>
 
@@ -491,34 +501,42 @@
             show-tooltip-when-overflow
             prop="delive_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 v-del-tab-index class="item" effect="dark" content="SOP棰勮" placement="top">
+                  <i
+                    v-if="mesSetting.tech"
+                    class="el-icon-files"
+                    style="cursor: pointer;color:#42b983;margin-right: 15px"
+                    @click="pre(row,2)"
+                  />
+                </el-tooltip>
+                <!--                          <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>
@@ -629,7 +647,7 @@
             placeholder="璇烽�夋嫨杞﹂棿"
             @change="getMesOrderNewStepContent"
           >
-
+            <!--            @change="sourceType? getMesOrderNewStepContent():routecodeChange()"-->
             <el-option
               v-for="item in wkshopArr"
               :key="item.torg_code"
@@ -671,7 +689,7 @@
         </el-form-item>
         <!--        :disabled="dialogForm.partcode===''"-->
 
-        <el-form-item label="宸ヨ壓璺嚎" prop="wkshopcode">
+        <el-form-item v-if="mesSetting.route" label="宸ヨ壓璺嚎" prop="wkshopcode">
           <el-select
             v-model="dialogForm.routecode"
             filterable
@@ -1313,6 +1331,9 @@
               style="display: flex;justify-content: space-between"
             >
               <div class="elForm">
+                <el-form-item label="閿�鍞崟鍙�:" class="formContent">
+                  {{ formApprove.saleOrderCode ?formApprove.saleOrderCode :'/' }}
+                </el-form-item>
                 <el-form-item label="宸ュ崟缂栧彿:" class="formContent">
                   {{ formApprove.mesordercode }}
                 </el-form-item>
@@ -2024,6 +2045,64 @@
       </span>
     </el-dialog>
 
+    <!--    宸ュ崟sop/宸ュ簭sop-->
+    <el-dialog
+      v-el-drag-dialog
+      class="sop"
+      title="璁惧SOP棰勮"
+      :visible.sync="SopDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      top="15vh"
+      @closed="handleSopClose"
+      @close="handleSopClose"
+    >
+
+      <el-form inline label-width="110px" style="display:flex">
+        <el-form-item label="宸ュ崟SOP">
+          <el-select
+            v-model="dialogSopForm.sop"
+            style="width:200px"
+            placeholder="璇烽�夋嫨"
+            filterable
+            :popper-append-to-body="false"
+            @change="sopChange"
+          >
+            <el-option
+              v-for="item in sopArr"
+              :key="item.filepath"
+              :label="item.filename"
+              :value="item.filepath"
+            />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="Sop鐗堟湰">
+          <el-input v-model="dialogSopForm.v" disabled style="width: 200px" />
+        </el-form-item>
+      </el-form>
+
+      <el-button
+        v-waves
+        type="primary"
+        style="margin-left: 37px"
+        @click="view"
+      >棰� 瑙�/涓� 杞�</el-button>
+
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button v-waves @click="handleSopClose">鍙� 娑�</el-button>
+          <!--          <el-button-->
+          <!--            v-waves-->
+          <!--            type="primary"-->
+          <!--            :loading="$store.state.app.buttonIsDisabled"-->
+          <!--            :disabled="$store.state.app.buttonIsDisabled"-->
+          <!--            @click="handleSopConfirm"-->
+          <!--          >纭� 瀹�</el-button>-->
+        </div>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -2038,8 +2117,8 @@
 import {
   AddMesOrderCodeSearch,
   AddUpdateMesOrder, DeleteMesOrder,
-  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent,
-  MesOrderSearch,
+  MesBadOrderSearch, MesOrderDistribution, MesOrderNewStepContent, MesOrderProcessSopSearch,
+  MesOrderSearch, MesOrderSopSearch,
   UpdateMesOrderStepSearch
 } from '@/api/WorkOrder'
 import { PartSelect } from '@/api/ProductModel'
@@ -2049,6 +2128,7 @@
 import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
 import DateType from '@/components/DateType'
 import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings'
+import { DeviceSopSearch } from '@/api/DeviceManager'
 export default {
   name: 'WorkOrderList',
   components: {
@@ -2316,8 +2396,16 @@
 
       sourceType: false, // 宸ュ簭鐨勬暟鎹潵婧�
 
-      mesSetting: JSON.parse(localStorage.getItem('mesSetting'))
+      mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
 
+      SopDialogVisible: false,
+      dialogSopForm: { // 璁惧SOP琛ㄥ崟
+        sop: '',
+        v: ''
+      },
+      sopArr: [],
+      routeCode: '', // 宸ヨ壓璺嚎code
+      partCode: ''
     }
   },
   watch: {
@@ -2353,12 +2441,54 @@
     // })
   },
   methods: {
+    // 寮瑰嚭妗嗗叧闂�
+    handleSopClose() {
+      this.SopDialogVisible = false
+      this.dialogSopForm = { // 璁惧SOP琛ㄥ崟
+        sop: '',
+        v: ''
+      }
+    },
+    // 棰勮
+    view() {
+      window.open(process.env.VUE_APP_BASE_API_FILE + this.dialogSopForm.sop)
+    },
+    sopChange(val) {
+      this.dialogSopForm.v = this.sopArr.find(i => i.filepath === val).version
+    },
+    async pre(row, type) {
+      if (type === 1) {
+        const data = {
+          wocode: row.wo_code,
+          materielcode: row.partcode
+        }
+        const { data: res } = await MesOrderSopSearch(data)
+        this.sopArr = res
+      }
+
+      if (type === 2) {
+        const data = {
+          materielcode: this.partCode,
+          routecode: this.routeCode ? this.routeCode : '',
+          stepcode: row.step_code
+        }
+        const { data: res } = await MesOrderProcessSopSearch(data)
+        this.sopArr = res
+      }
+
+      this.SopDialogVisible = true
+    },
     // 宸ュ簭鏉ユ簮鍒囨崲
     sourceTypeChange(val) {
+      this.stepTableData = []
       if (val) {
         this.getMesOrderNewStepContent()
       } else {
-        this.routecodeChange()
+        if (this.mesSetting.route) {
+          this.routecodeChange()
+        } else {
+          this.getBasicProcessData()
+        }
       }
     },
 
@@ -2606,16 +2736,6 @@
 
       this.dialogForm.mesqtyinit = row.plan_qty
 
-      // this.sourceTypeChange(false)
-
-      if (!this.dialogForm.routecode) {
-        await this.getPartcodeChangeDialog()
-      }
-
-      // if (row.status === 'NEW') {
-      //
-      // }
-
       const data = {
         sourceid: this.dialogForm.sourceorderid,
         sourcewo: this.dialogForm.sourceorder,
@@ -2625,34 +2745,55 @@
       const { data: res } = await UpdateMesOrderStepSearch(data)
       this.dialogForm.mesmaxqty = res.canupdate_qty
 
-      if (res.stepdata.length > 0) {
-        res.stepdata.forEach(i => {
-          this.stepTableData.push(
-            {
-              stepcode: i.step_code,
-              stepname: i.stepname,
-              stepprice: i.stepprice
-            }
-          )
-        })
-        this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
-      } else {
-        const data2 = {
-          wkshopcode: this.dialogForm.wkshopcode,
-          partcode: this.dialogForm.partcode
+      if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
+        if (!this.dialogForm.routecode) {
+          await this.getPartcodeChangeDialog()
         }
-        const { data: res2 } = await MesOrderNewStepContent(data2)
-        if (res2.length > 0) {
-          res2.forEach(i => {
+
+        if (res.stepdata.length > 0) {
+          res.stepdata.forEach(i => {
             this.stepTableData.push(
               {
                 stepcode: i.step_code,
-                // stepname: i.stepname,
+                stepname: i.stepname,
                 stepprice: i.stepprice
               }
             )
           })
           this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+        } else {
+          const data2 = {
+            wkshopcode: this.dialogForm.wkshopcode,
+            partcode: this.dialogForm.partcode
+          }
+          const { data: res2 } = await MesOrderNewStepContent(data2)
+          if (res2.length > 0) {
+            res2.forEach(i => {
+              this.stepTableData.push(
+                {
+                  stepcode: i.step_code,
+                  // stepname: i.stepname,
+                  stepprice: i.stepprice
+                }
+              )
+            })
+            this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+          }
+        }
+      } else {
+        if (res.stepdata.length > 0) {
+          res.stepdata.forEach(i => {
+            this.stepTableData.push(
+              {
+                stepcode: i.step_code,
+                stepname: i.stepname,
+                stepprice: i.stepprice
+              }
+            )
+          })
+          this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+        } else {
+          await this.getBasicProcessData()
         }
       }
 
@@ -2660,6 +2801,22 @@
       this.$nextTick(() => {
         this.setSort()
       })
+    },
+    // 鎸夊伐搴忔ā寮忚蛋鐨勬椂鍊�  寮曠敤鍩虹璧勬枡 宸ヨ壓
+    async  getBasicProcessData() {
+      const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
+      res.sort((a, b) => a.step_seq - b.step_seq)
+      this.stepTableData = []
+      res.forEach(i => {
+        this.stepTableData.push(
+          {
+            stepcode: i.step_code,
+            stepname: i.step_name,
+            stepprice: i.unprice
+          }
+        )
+      })
+      this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
     },
     // 宸ュ崟鍏抽棴浜嬩欢
     orderClose() {
@@ -2671,26 +2828,33 @@
       this.dialogForm.partname = this.partArr.find(item => item.partcode === val).partname
       this.dialogForm.partcode = this.partArr.find(item => item.partcode === val).partcode
       this.dialogForm.partspec = this.partArr.find(item => item.partcode === val).partspec
-      // if (this.dialogForm.wkshopcode) {
-      //   // this.getMesOrderNewStepContent()
-      // }
+
       this.dialogForm.routecode = ''
-      this.getPartcodeChangeDialog()
+
+      if (this.mesSetting.route) {
+        this.getPartcodeChangeDialog()
+      } else {
+        this.getBasicProcessData()
+      }
     },
 
     async  getPartcodeChangeDialog() {
       const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
       this.routecodeArr = res
 
+      // if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
       this.dialogForm.routecode = this.partArr.find(item => item.partcode === this.dialogForm.partcode).default_route
-
       if (this.dialogForm.routecode && !this.sourceType) {
         await this.routecodeChange()
       } else {
         await this.getMesOrderNewStepContent()
       }
+      // }
+      // else { // 鎸夊伐搴忚蛋妯″紡
+      //   await this.getMesOrderNewStepContent()
+      // }
     },
-
+    // 宸ヨ壓璺嚎鍊兼敼鍙�
     async routecodeChange() {
       const data = {
         partcode: this.dialogForm.partcode,
@@ -2714,7 +2878,12 @@
         this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
       }
     },
+
     async  getMesOrderNewStepContent() {
+      // if (!this.mesSetting.route && this.operation === 'edit') {
+      //   return
+      // }
+
       const data = {
         routecode: this.dialogForm.routecode,
         wkshopcode: this.dialogForm.wkshopcode,
@@ -2824,11 +2993,11 @@
             if (res.code === '200') {
               this.dialogVisible = false
               // this.handlePrint()
-              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '娲惧彂鎴愬姛锛�')
+              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇濆瓨鎴愬姛锛�')
               this.getMesOrderSearch()
               this.$store.state.app.buttonIsDisabled = false
             } else {
-              this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '娲惧彂澶辫触锛�')
+              this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇濆瓨澶辫触锛�')
             }
           })
         }
@@ -2881,11 +3050,11 @@
       this.dialogVisibleSearch = false
     },
     // 澶勭悊鎵撳嵃
-    handlePrint(wo_code) {
+    handlePrint(wo_code, saleOrderCode) {
       // const number = Math.random() * Math.random()
       // this.number = number === 0 ? (10 + Math.random()) : number
       // console.log(number)
-
+      this.formApprove.saleOrderCode = this.formApprove.saleOrderCode !== '' ? this.formApprove.saleOrderCode : saleOrderCode
       const data2 = {
         mesordercode: wo_code || this.dialogForm.mesordercode
       }
@@ -2971,6 +3140,7 @@
     },
 
     dialogVisibleConfirmClose() {
+      this.formApprove.saleOrderCode = ''
       // this.dialogForm.mesordercode = ''
       this.formApprove.mesordercode = ''
       this.formApprove.m_po = ''
@@ -3272,6 +3442,9 @@
     },
     //  琛岀偣鍑讳簨浠�
     async rowClick(row, event, column) {
+      this.formApprove.saleOrderCode = row.saleOrderCode
+      this.routeCode = row.route_code ? row.route_code : ''
+      this.partCode = row.partcode ? row.partcode : ''
       const data = {
         sourceid: row.sourceid,
         sourcewo: row.m_po,
@@ -3431,6 +3604,12 @@
   padding: 20px 100px !important;
 }
 
+.sop {
+  ::v-deep .el-dialog__body {
+    padding: 50px 80px !important;
+  }
+}
+
 .dialogVisibleSearch ::v-deep .el-dialog__body {
   padding: 20px 20px !important;
 }

--
Gitblit v1.9.3