From 8be895639f0250ced67a4437e7ebf6854d054749 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 24 八月 2022 17:36:20 +0800
Subject: [PATCH] 1.修改小标签打印

---
 src/views/scgl/gd.vue |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 200 insertions(+), 10 deletions(-)

diff --git a/src/views/scgl/gd.vue b/src/views/scgl/gd.vue
index 42658ff..829dbfb 100644
--- a/src/views/scgl/gd.vue
+++ b/src/views/scgl/gd.vue
@@ -124,7 +124,7 @@
               <el-radio
                 v-model="radioSelected"
                 :label="row.wo_code"
-                style="color: #fff;padding-left: 10px; margin-right: -25px;"
+                style="color: transparent;padding-left: 10px; margin-right: -25px;"
                 @change.native="getCurrentRow(row.wo_code)"
               />
             </template>
@@ -173,7 +173,12 @@
             label="浜у搧瑙勬牸"
             sortable="custom"
             width="110"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.partspec">{{ row.partspec }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="plan_qty"
             label="宸ュ崟鏁�"
@@ -185,26 +190,46 @@
             label="鐢熶骇杞﹂棿"
             sortable="custom"
             width="120"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="route_name"
             label="宸ヨ壓璺嚎"
             sortable="custom"
             min-width="130"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.route_name">{{ row.route_name }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
 
           <el-table-column
             prop="plan_startdate"
             label="璁″垝寮�濮嬫椂闂�"
             sortable="custom"
             width="160"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="plan_enddate"
             label="璁″垝缁撴潫鏃堕棿"
             sortable="custom"
             width="160"
-          />
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.plan_enddate">{{ row.plan_enddate }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="piroque"
             label="宸ュ崟绛夌骇"
@@ -215,6 +240,7 @@
               <div v-if="row.piroque==='1'">鐗圭骇</div>
               <div v-if="row.piroque==='2'">绱ф��</div>
               <div v-if="row.piroque==='3'">姝e父</div>
+              <div v-else>/</div>
             </template>
           </el-table-column>
           <el-table-column
@@ -551,8 +577,15 @@
         <el-table-column
           prop="ng_qty"
           label="涓嶈壇鏁伴噺"
-          fixed="right"
         />
+        <el-table-column
+          label="鎿嶄綔"
+          fixed="right"
+        >
+          <template slot-scope="{row}">
+            <el-button type="text" style="padding: 0;" @click="supplementSmallClick(row)">琛ユ墦</el-button>
+          </template>
+        </el-table-column>
       </el-table>
 
       <span slot="footer" class="dialog-footer">
@@ -563,7 +596,7 @@
       </span>
     </el-dialog>
 
-    <!--        鎵撳嵃棰勮瀵硅瘽妗�-->
+    <!--鎵撳嵃棰勮瀵硅瘽妗�  澶ф爣绛�-->
     <el-dialog
       title=""
       :visible.sync="dialogVisibleApprove"
@@ -702,6 +735,81 @@
         </div>
       </span>
     </el-dialog>
+
+    <!--鎵撳嵃棰勮椤甸潰  灏忔爣绛�-->
+    <el-dialog
+      title="棰勮"
+      :visible.sync="dialogVisible2"
+      width="1140"
+      top="10vh"
+      :close-on-click-modal="false"
+      @close="dialogVisible2Close"
+    >
+      <!-- 瑕佹墦鍗扮殑鍖哄煙 -->
+      <div id="printMe2" style="padding: 30px;">
+        <div
+          style="display: flex;width: 280px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
+        >
+
+          <div style="width: 90px;display: flex;flex-direction: column;border-right: 1px solid #000">
+            <div
+              style="display: flex;height: 90px;border-bottom:1px solid #000;
+              justify-content: center;align-items: center;position: relative"
+            >
+              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height:60px;position: absolute;left: 14px;" />
+            </div>
+            <div style="display: flex;height: 30px;justify-content: flex-start;border-bottom:1px solid #000;align-items: center">
+              <div style="margin-left: 5px;width: 28px">鏁伴噺:</div>
+              {{ qrForm.startqty }}
+            </div>
+            <div style="display: flex;height: 30px;justify-content: flex-start;align-items: center">
+              <div style="margin-left: 5px;width: 42px">澶勭悊浜�:</div>
+              {{ qrForm.operator }}
+            </div>
+          </div>
+
+          <div style="width:190px;display: flex;flex-direction: column">
+            <div
+              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center;text-align: left"
+            >
+              <div style="width: 60px;margin-left: 5px;">宸ュ崟缂栧彿:</div>
+              <div>{{ qrForm.wo_code }}</div>
+            </div>
+            <div
+              style="display: flex;height: 20%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center ;text-align: left"
+            >
+              <div style="width: 60px;margin-left: 5px;">浜у搧缂栫爜:</div>
+              <div>{{ qrForm.partcode }}</div>
+            </div>
+            <div
+              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
+            >
+              <div style="width:60px;margin-left: 5px;">浜у搧鍚嶇О:</div>
+              <div>{{ qrForm.partname }}</div>
+            </div>
+            <div
+              style="display: flex;height: 20%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
+            >
+              <div style="width:60px;margin-left: 5px;">涓嬮亾宸ュ簭:</div>
+              <div>{{ qrForm.nextstepname }}</div>
+            </div>
+            <div style="display: flex;height: 20%;justify-content: flex-start;align-items: center;text-align: left">
+              <div style="width: 60px;margin-left: 5px;">澶勭悊鏃堕棿:</div>
+              <div>{{ qrForm.operatorTime }}</div>
+            </div>
+
+          </div>
+
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button @click="dialogVisible2 = false">鍙� 娑�</el-button>
+          <el-button v-print="printObj2" type="primary">纭� 瀹�</el-button>
+        </div>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -715,7 +823,7 @@
   SelectRouteStep
 } from '@/api/scgl'
 import { PartSelect } from '@/api/zzmx'
-import { handleDatetime } from '@/utils/global'
+import { handleDatetime, handleDatetime2 } from '@/utils/global'
 import { getCookie } from '@/utils/auth'
 import { MesOrderPrintSearch1, PrintOrder } from '@/api/utils'
 import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
@@ -864,7 +972,39 @@
         routename: '',
         lm_date: ''
       },
-      number: ''
+      number: '',
+      dialogVisible2: false,
+      printObj2: {
+        id: 'printMe2',
+        popTitle: '鎵撳嵃妯℃澘',
+        preview: false,
+        extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>',
+        closeCallback(vue) { // 鍏抽棴鎵撳嵃鐨勫洖璋冧簨浠讹紙鏃犳硶纭畾鐐瑰嚮鐨勬槸纭杩樻槸鍙栨秷锛�
+          console.log('11212', vue)
+          // vue.dialogVisible = false
+          vue.dialogVisible2 = false
+          // vue.dialogVisible = false
+        },
+        beforeOpenCallback(vue) {
+          vue.printLoading = true
+          console.log('鎵撳紑涔嬪墠')
+          console.log()
+        },
+        openCallback(vue) {
+          vue.printLoading = false
+          console.log('鎵ц浜嗘墦鍗�')
+        }
+      },
+      qrForm: {
+        qrvalue: '',
+        startqty: '',
+        wo_code: '',
+        partcode: '',
+        partname: '',
+        nextstepname: '',
+        operator: '', // 鎿嶄綔浜�
+        operatorTime: ''// 鎿嶄綔鏃堕棿
+      }
     }
   },
   created() {
@@ -1324,6 +1464,56 @@
     supplementClick() {
       this.dialogVisibleTask = false
       this.handlePrint()
+    },
+    // 琛ユ墦灏忔爣绛�
+    supplementSmallClick(row) {
+      // let obj = {}
+
+      this.taskTableData.forEach((item, index) => {
+        if (item.seq === row.seq) {
+          console.log(item)
+          this.qrForm = {
+            qrvalue: item.seq === this.taskTableData.length ? item.wo_code + ';' + item.stepcode : item.wo_code + ';' + this.taskTableData[item.seq].stepcode,
+            startqty: item.seq === this.taskTableData.length ? item.plan_qty : this.taskTableData[item.seq].plan_qty,
+            wo_code: item.wo_code,
+            partcode: item.partcode,
+            partname: item.partname,
+            nextstepname: item.seq === this.taskTableData.length ? item.stepname : this.taskTableData[item.seq].stepname,
+            operator: getCookie('username'),
+            operatorTime: handleDatetime2(new Date())
+          }
+          this.$nextTick(() => {
+            console.log(this.qrForm.qrvalue, 3333)
+            this.bindQRCode2(this.qrForm.qrvalue)
+          })
+        }
+      })
+
+      // this.dialogVisibleTask = false
+      this.dialogVisible2 = true
+      console.log(this.qrForm, 1111)
+    },
+    dialogVisible2Close() {
+      this.qrForm.qrvalue = ''
+      this.qrForm.startqty = ''
+      this.qrForm.wo_code = ''
+      this.qrForm.partcode = ''
+      this.qrForm.partname = ''
+      this.qrForm.nextstepname = ''
+      this.qrForm.operator = ''
+      this.qrForm.operatorTime = ''
+      // this.$refs.qrCodeDiv2 = ''
+    },
+    // 鐢熸垚浜岀淮鐮�
+    bindQRCode2(text) {
+      new QRCode(this.$refs.qrCodeDiv2, {
+        text: text,
+        width: 60,
+        height: 60,
+        colorDark: '#000', // 浜岀淮鐮侀鑹�
+        colorLight: '#ffffff', // 浜岀淮鐮佽儗鏅壊
+        correctLevel: QRCode.CorrectLevel.L// 瀹归敊鐜囷紝L/M/H
+      })
     }
 
   }

--
Gitblit v1.9.3