Browse Source

打印条码

695593266@qq.com 9 tháng trước cách đây
mục cha
commit
b52ed033ba

+ 7 - 2
src/views/produce/components/jobBooking/components/batchSemiProductJobBom.vue

@@ -1933,9 +1933,14 @@
           weightUnit
           weightUnit
         } = this.printData;
         } = this.printData;
 
 
+        // if (this.printStyle == 'juRen1') {
+        //   const query = `?batchNo=${batchNo}&createDate=${createDate}&enforceStandards=${enforceStandards}&layBy=${layBy}&level=${level}&netWeight=${netWeight}&notice=${notice}&productName=${productName}&purchaseOrigins=${purchaseOrigins}&specification=${specification}&warrantyPeriod=${warrantyPeriod}&warrantyPeriodUnit=${warrantyPeriodUnit}&weightUnit=${weightUnit}`;
+        //   window.open('/printJuren' + query, '_blank');
+        // }
+
         if (this.printStyle == 'juRen1') {
         if (this.printStyle == 'juRen1') {
-          const query = `?batchNo=${batchNo}&createDate=${createDate}&enforceStandards=${enforceStandards}&layBy=${layBy}&level=${level}&netWeight=${netWeight}&notice=${notice}&productName=${productName}&purchaseOrigins=${purchaseOrigins}&specification=${specification}&warrantyPeriod=${warrantyPeriod}&warrantyPeriodUnit=${warrantyPeriodUnit}&weightUnit=${weightUnit}`;
-          window.open('/printJuren' + query, '_blank');
+          const query = `?batchNo=${batchNo}&createDate=${createDate}&enforceStandards=${enforceStandards}&layBy=${layBy}&level=${level}&netWeight=${netWeight}&notice=${notice}&productName=${productName}&purchaseOrigins=${purchaseOrigins}&specification=${specification}&warrantyPeriod=${warrantyPeriod}&warrantyPeriodUnit=${warrantyPeriodUnit}&weightUnit=${weightUnit}&workOrderId=${this.item.workOrderId}`;
+          window.open('/printJuRenOne' + query, '_blank');
         }
         }
       }
       }
     },
     },

+ 49 - 2
src/views/produce/components/juRenPackOne.vue

@@ -43,10 +43,15 @@
     <div class="ju_ren_four_level">
     <div class="ju_ren_four_level">
       <span>{{ enforceStandards ? enforceStandards : ' ' }}</span>
       <span>{{ enforceStandards ? enforceStandards : ' ' }}</span>
     </div>
     </div>
+
+    <div class="qr_code">
+      <img :src="url" />
+    </div>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
+  import QRCode from 'qrcode';
   export default {
   export default {
     data() {
     data() {
       return {
       return {
@@ -62,7 +67,10 @@
         specification: '',
         specification: '',
         warrantyPeriod: '',
         warrantyPeriod: '',
         warrantyPeriodUnit: '',
         warrantyPeriodUnit: '',
-        weightUnit: ''
+        weightUnit: '',
+        url: '',
+        workOrderId: '',
+        qrCodeUrl: ''
       };
       };
     },
     },
     mounted() {
     mounted() {
@@ -79,7 +87,8 @@
         specification,
         specification,
         warrantyPeriod,
         warrantyPeriod,
         warrantyPeriodUnit,
         warrantyPeriodUnit,
-        weightUnit
+        weightUnit,
+        workOrderId
       } = this.$route.query;
       } = this.$route.query;
       this.productName = productName ? productName : '';
       this.productName = productName ? productName : '';
       this.batchNo = batchNo ? batchNo : '';
       this.batchNo = batchNo ? batchNo : '';
@@ -95,6 +104,7 @@
         warrantyPeriod && !warrantyPeriod ? warrantyPeriod : '';
         warrantyPeriod && !warrantyPeriod ? warrantyPeriod : '';
       this.warrantyPeriodUnit = warrantyPeriodUnit ? warrantyPeriodUnit : '';
       this.warrantyPeriodUnit = warrantyPeriodUnit ? warrantyPeriodUnit : '';
       this.weightUnit = weightUnit ? weightUnit : '';
       this.weightUnit = weightUnit ? weightUnit : '';
+      this.workOrderId = workOrderId ? workOrderId : '';
 
 
       if (this.warrantyPeriodUnit === '1') {
       if (this.warrantyPeriodUnit === '1') {
         this.warrantyPeriodUnit = '分钟';
         this.warrantyPeriodUnit = '分钟';
@@ -110,15 +120,39 @@
         this.warrantyPeriodUnit = '';
         this.warrantyPeriodUnit = '';
       }
       }
 
 
+      this.qrCodeUrl =
+        window.location.origin + `/traceability?id=${this.workOrderId}`;
+
+      // console.log(window.location.origin, 'window.location.origin');
+
       this.$nextTick(() => {
       this.$nextTick(() => {
+        this.generateQRCodes();
         window.print();
         window.print();
       });
       });
+    },
+
+    methods: {
+      generateQRCodes() {
+        if (this.workOrderId) {
+          QRCode.toDataURL(this.qrCodeUrl)
+            .then((url) => {
+              // item.qrcode = url;
+              this.url = url;
+              console.log(url, 'url');
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        }
+      }
     }
     }
   };
   };
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">
   .label-container {
   .label-container {
+    position: relative;
     width: 90mm;
     width: 90mm;
     height: 70mm;
     height: 70mm;
     box-sizing: border-box;
     box-sizing: border-box;
@@ -186,5 +220,18 @@
         margin-left: 42px;
         margin-left: 42px;
       }
       }
     }
     }
+
+    .qr_code {
+      position: absolute;
+      top: 0;
+      right: 15px;
+      width: 60px;
+      height: 60px;
+
+      img {
+        width: 100%;
+        height: 100%;
+      }
+    }
   }
   }
 </style>
 </style>

+ 5 - 5
src/views/produce/components/outsourcing/index.vue

@@ -1,13 +1,13 @@
 <template>
 <template>
   <div class="index_box">
   <div class="index_box">
     <div class="c_header_title">
     <div class="c_header_title">
-      <!-- <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
+      <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
         <el-tab-pane label="委外记录" name="1"></el-tab-pane>
         <el-tab-pane label="委外记录" name="1"></el-tab-pane>
-        <el-tab-pane label="请托记录" name="2"></el-tab-pane> -->
-      <!-- </el-tabs> -->
-      <div class="c_title">委外记录</div>
+        <el-tab-pane label="请托记录" name="2"></el-tab-pane>
+      </el-tabs>
+      <!-- <div class="c_title">委外记录</div> -->
     </div>
     </div>
-    <div style="overflow: auto">
+    <div style="overflow: auto" activeName="1">
       <el-form
       <el-form
         label-width="100px"
         label-width="100px"
         :rules="rules"
         :rules="rules"