-
admin
2024-06-01 a846f28bef985e7671f0b469fb73541cbfb08a93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
  <div class="app-container">
    <el-row>
      <el-col :span="8">
        <div>
          <div id="printMe">
            <p style="margin-left: 30px">9900166410</p>
            <p style="margin-left: 30px">HW.001.001</p>
            <p style="margin-left: 30px">SW.001.001</p>
            <br>
            <br>
            <br>
            <br>
            <br>
            <span style="font-size: 20px;font-weight: bold;margin-left: 40px">GEELY</span><br>
            <span style="font-size: 10px;margin-left: 15px">COMMERCIAL VEHICLE</span><br>
            <span style="margin-left: 43px">H2155D</span><br>
            <span style="margin-left: 43px">993083</span><br>
            <span style="margin-left: 20px">9900166410</span><br>
            <span style="font-size: 10px;margin-right: 7px">0RSPBFAA1A2E3ADC40000027</span>
            <br>
            <br>
            <br>
            <br>
            <br>
            <div ref="canvasWrapper" id="canvasWrapper" style="display: flex;justify-content: center;margin-top: -30px"></div>
            <span style="font-size: 7px;word-break: break-all;display: flex;justify-content: center;">{{text1}}</span>
          </div>
          <el-button @click="print1">打印</el-button>
          <el-button @click="test1">生成二维码</el-button>
 
        </div>
      </el-col>
      <el-col :span="8">
        <div>
          <div style="text-align: center" id="printMe1">
            <p>9900166410</p>
            <p>HW.001.001</p>
            <p>SW.001.001</p>
          </div>
          <el-button @click="print2">打印</el-button>
        </div>
      </el-col>
      <el-col :span="8">
        <div>
          <div id="printMe2">
            <span style="font-size: 20px;font-weight: bold;margin-left: 40px">GEELY</span><br>
            <span style="font-size: 10px;margin-left: 15px">COMMERCIAL VEHICLE</span><br>
            <span style="margin-left: 43px">H2155D</span><br>
            <span style="margin-left: 43px">993083</span><br>
            <span style="margin-left: 20px">9900166410</span><br>
            <span style="font-size: 10px;margin-right: 7px">0RSPBFAA1A2E3ADC40000027</span>
          </div>
          <el-button @click="print3">打印</el-button>
        </div>
      </el-col>
    </el-row>
 
  </div>
</template>
 
<script>
 
import QRCode from "qrcodejs2";
 
export default {
  name: "Instructions",
  data() {
    return {
      text1: 'P9900166410#T0RSPBFAA1A2E3ADC40000027#V993983#SSW001.001#HHW001.001#NBMS#',
      text2: '1234',
      text3: '1234',
 
 
    };
  },
  created() {
  },
  mounted() {
    this.test1()
  },
  methods: {
    print1() {
      // 新开页面打印
      let newStr = document.getElementById('printMe').innerHTML;
      let newWin = window.open('', '_blank');
      newWin.document.body.innerHTML = newStr;
      newWin.print();
      return false;
    },
    test1(){
      document.getElementById('canvasWrapper').innerHTML = '';
      this.$nextTick(() => {
        let qrCode = new QRCode('canvasWrapper',{
          width: 120,
          height: 120,
          text: this.text1,
          colorDark: '#000',
          colorLight: '#fff'
        })
      })
    },
    print2() {
      // 新开页面打印
      let newStr = document.getElementById('printMe1').innerHTML;
      let newWin = window.open('', '_blank');
      newWin.document.body.innerHTML = newStr;
      newWin.print();
      return false;
    },
    print3() {
      // 新开页面打印
      let newStr = document.getElementById('printMe2').innerHTML;
      let newWin = window.open('', '_blank');
      newWin.document.body.innerHTML = newStr;
      newWin.print();
      return false;
    },
  },
}
</script>
 
<style scoped>
.outerDiv {
  width: fit-content;
  min-width: 100%;
  /*width: 300px;*/
  height: 50px;
  margin-bottom: 10px;
}
 
.innerDiv1 {
  /*width: 79%;*/
  height: 100%;
  display: flex;
  align-items: center;
  border: 1px solid black;
}
 
.innerDiv2 {
  /*width: 20%;*/
  width: 50px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid black;
}
 
.content_left {
  font-weight: bold;
}
.content_right {
  white-space: nowrap;
  padding-left: 5px;
  padding-right: 5px;
}
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px; /* 设置div的高度,可根据实际情况调整 */
}
 
.centered {
  text-align: center;
}
 
</style>