郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
 
<template>
    <el-dialog
        :visible.sync="licenseInfoVisible"
        append-to-body
        :close-on-click-modal="false"
        width="60%"
    >
        <div id="printMe2">
            <el-row>
                <el-col :span="8" style="margin-top:660px;margin-left: 180px">
                    <el-row >
                        <el-col :span="24">
                            {{name}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 45px">
                        <el-col :span="24">
                            {{address}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 45px">
                        <el-col :span="24">
                            {{storageaddress}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 48px">
                        <el-col :span="24" style="padding-right: 100px;">
                            {{dealingrange}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 48px">
                        <el-col :span="12">
                            {{effectdate}}
                        </el-col>
                        <el-col :span="8">
                            {{noeffectdate}}
                        </el-col>
                    </el-row>
                </el-col>
                <el-col :span="8" style="margin-top: 385px;">
                    <el-row>
                        <el-col :span="10">
                            <el-row>
                                <el-col :span="24">
                                    <span>{{value}}</span>
                                </el-col>
                            </el-row>
                            <el-row style="margin-top: 17px;margin-left: 5px">
                                <el-col :span="24">
                                    <span>{{code}}</span>
                                </el-col>
                            </el-row>
                        </el-col>
                        <el-col :span="12">
                                <div style="width:20px;height:20px;" class="qrcode" id="qrcode" ref="qrcode"/>
                        </el-col>
                    </el-row>
 
                    <el-row style="margin-top: 92px;margin-left: 100px">
                        <el-col :span="12">
                            {{mainpersonname}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 48px;margin-left: 100px">
                        <el-col :span="12">
                            {{area}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 48px;margin-left: 100px">
                        <el-col :span="12">
                            {{storagearea}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 48px;margin-left: 100px">
                        <el-col :span="12">
                            {{powder}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 150px;margin-left: 100px">
                        <el-col :span="12">
                            {{issuingunit}}
                        </el-col>
                    </el-row>
                    <el-row style="margin-top: 30px;margin-left: 100px">
                        <el-col :span="2" >
                            <span>{{year}}</span>
                        </el-col>
                        <el-col :span="1"  style="margin-left:60px">
                            <span>{{month}}</span>
                        </el-col>
                        <el-col :span="1"  style="margin-left:40px">
                            <span>{{day}}</span>
                        </el-col>
                    </el-row>
                </el-col>
            </el-row>
        </div>
        <div  align="right" style="margin-top:30px;">
            <el-button type="primary"  v-print="printObj2">打印</el-button>
        </div>
    </el-dialog>
</template>
 
<script>
import QRCode from "qrcodejs2"
export default {
    name: "printForm",
    data(){
        return{
            code:'',
            name:'',
            mainpersonname:'',
            address:'',
            area:'',
            storageaddress:'',
            storagearea:'',
            dealingrange:'',
            powder:'',
            effectdate:'',
            noeffectdate:'',
            issuingunit:'',
            year:'',
            month:'',
            day:'',
            licenseInfoVisible:false,
            printObj2:{
                id:'printMe1',
                extraHead:'<meta  http-equiv="Content-Language" content="zh-cn"/>'
            },
            value:'',
        }
    },
    mounted(){
        this.$nextTick(() => {
            this.qrcode()
        })
    },
    methods:{
        show(val){
            this.code = val.code
            this.licenseInfoVisible = true
            this.name =val.name
            this.mainpersonname = val.mainpersonname
            this.address = val.address
            this.area = JSON.parse(val.licenseStorage)[0].area
            this.storageaddress =val.storageaddress
            this.storagearea = JSON.parse(val.licenseStorage)[0].storagearea
            this.dealingrange = val.dealingRangeStr
            this.powder =  JSON.parse(val.licenseStorage)[0].powder
            this.effectdate = val.effectdate
            this.noeffectdate = val.noeffectdate
            this.issuingunit = val.issuingunit
            this.value = val.licensecode
            this.year = val.issuingdate.split('-')[0]
            this.month = val.issuingdate.split('-')[1]
            this.day= val.issuingdate.split('-')[2]
            this.$nextTick(() => {
                this.qrcode()
            })
        },
        qrcode(){
            if(this.value === ''){
 
            }else{
                document.getElementById("qrcode").innerHTML = ""
                let qrcode = new QRCode('qrcode', {
                    width: 100,
                    height: 100,        // 高度
                    text:  this.value,   // 二维码内容
                    // render: 'canvas' ,   // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
                    background: '#f0f',   // 背景色
                    // foreground: '#ff0'    // 前景色
                })
            }
        }
 
    }
}
</script>
 
<style scoped>
</style>