FinishProductManageModalShow.vue
3.8 KB
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
<template>
<j-modal :title="title" :width="width" :visible="visible" :confirmLoading="confirmLoading" :maskClosable="false"
switchFullscreen @cancel="handleCancel" cancelText="关闭" :okButtonProps="{ class: { 'jee-hidden': true } }">
<a-button @click="getQRCode" type="primary" :disabled="buttonFlag">
二维码
</a-button>
<a-spin :spinning="confirmLoading">
<a-tree :tree-data="treeData" @select="select" defaultExpandAll showLine />
</a-spin>
<div>
<j-modal :width="250" :visible="printVisible" :maskClosable="false" switchFullscreen
@cancel="printDandleCancel" okText="打印完成" @ok="handleCancel">
<a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
<section id="printContent">
<vue-qr :text="imgUrl" :size="200" :margin="21" :logoScale="0.2"> </vue-qr>
</section>
</j-modal>
</div>
</j-modal>
</template>
<script>
import { getAction } from '@/api/manage'
import VueQr from 'vue-qr'
export default {
components: {
VueQr,
},
data() {
return {
title: '',
width: 800,
visible: false,
confirmLoading: true,
model: {},
validatorRules: {},
treeData: [
{
title: 'parent 1',
key: '0-0',
children: [
{
title: 'parent 1-0',
key: '0-0-0',
children: [
{ title: 'leaf', key: '0-0-0-0' },
{ title: 'leaf', key: '0-0-0-1' },
],
},
{
title: 'parent 1-1',
key: '0-0-1',
children: [{ key: '0-0-1-0', title: 'sss' }],
},
],
},
],
expandedKeys: ['0-0-0', '0-0-1'],
selectedKeys: ['0-0-0', '0-0-1'],
checkedKeys: ['0-0-0', '0-0-1'],
printVisible: false,
imgUrl: '',
buttonFlag: true,
treeId: ''
}
},
methods: {
show(record) {
this.model = Object.assign({}, record)
const that = this;
let params = {
id: this.model.id
}
console.log('params', params)
getAction("/baseLibrary/baseLibraryInfo/tree", params)
.then((res) => {
console.log('res', res)
if (res.success) {
this.treeData = res.result
this.visible = true
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
})
.finally(() => {
that.confirmLoading = false
})
},
handleOk() {
},
handleCancel() {
this.close();
},
close() {
this.$emit('close')
this.visible = false
// this.$refs.form.clearValidate()
},
select(a, b) {
if (a.length === 0) {
this.buttonFlag = true;
return;
}
this.treeId = a[0]
this.buttonFlag = false;
},
getQRCode() {
this.printVisible = true
this.imgUrl = this.treeId;
},
printDandleCancel() {
this.$emit('close')
this.printVisible = false
},
}
}
</script>