manage-client 3.3.211-by → 3.3.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dev-server.js +190 -193
- package/package.json +111 -111
- package/src/components/sale/common/PrintTableManage.vue +242 -242
- package/src/main.js +68 -76
- package/src/plugins/LodopFuncs.js +124 -159
|
@@ -1,242 +1,242 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button class="btn btn-default" @click='PrintAsFile()' :id="'vc-printtable-'+attach">打印表格</button>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import co from 'co'
|
|
7
|
-
import getLodop from '
|
|
8
|
-
|
|
9
|
-
let printGen = function * (self, pageNo) {
|
|
10
|
-
|
|
11
|
-
console.log('开始打印', self.isSelected, self.model, self.tfoot)
|
|
12
|
-
//是否分页打印
|
|
13
|
-
if(pageNo){
|
|
14
|
-
self.PrintSinglePage()
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
if (self.isSelected) {
|
|
18
|
-
// 判断是否选择行数据进行打印
|
|
19
|
-
self.PrintSelectedPage()
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let lodop = getLodop()
|
|
24
|
-
lodop.PRINT_INIT(self.printName+'打印')
|
|
25
|
-
var style
|
|
26
|
-
if (!self.style) {
|
|
27
|
-
style = `<style>table{font-size:${self.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
28
|
-
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
29
|
-
} else {
|
|
30
|
-
style = self.style
|
|
31
|
-
}
|
|
32
|
-
let tHtml = style + '<table class="table table-hover"><thead>' + self.thead + '</thead><tbody>'
|
|
33
|
-
|
|
34
|
-
for (var i = 1; i <= self.model.totalPage; i++) {
|
|
35
|
-
console.log('pageIndex = ' + i)
|
|
36
|
-
yield self.model.loadPage(i)
|
|
37
|
-
for (let row of self.model.rows) {
|
|
38
|
-
tHtml += '<tr>'
|
|
39
|
-
for (let field of self.fields) {
|
|
40
|
-
if (field && (row[field] || row[field] === 0) ) {
|
|
41
|
-
tHtml += '<td>' + row[field] + '</td>'
|
|
42
|
-
} else {
|
|
43
|
-
tHtml += '<td></td>'
|
|
44
|
-
}
|
|
45
|
-
// console.log(row[field])
|
|
46
|
-
}
|
|
47
|
-
tHtml += '</tr>'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// 加入合计数据 (最后一页显示)
|
|
51
|
-
if (self.sumhtml) {
|
|
52
|
-
tHtml += self.sumhtml
|
|
53
|
-
}
|
|
54
|
-
// 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
55
|
-
if (self.tfoot) {
|
|
56
|
-
self.tfoot += `<tr><td width="100%" colspan=${self.fields.length} style="text-align: center;border-width: 0;">第<font tdata="PageNO" format="#" color="blue">#</font>页</span>/共<font tdata="PageCount" format="#" color="blue">##</font></span>页</td></tr>`
|
|
57
|
-
tHtml += `</tbody><tfoot>${self.tfoot}</tfoot></table>`
|
|
58
|
-
} else {
|
|
59
|
-
tHtml += '</tbody></table>'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
lodop.ADD_PRINT_TABLE(self.top, self.left, 'RightMargin:' + self.right, 'BottomMargin:' + self.bottom, tHtml)
|
|
63
|
-
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
64
|
-
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
65
|
-
// 指定打印方向 0--可通过打印机选择纵向或横向,1--锁定为纵向打印,2---锁定为横向打印
|
|
66
|
-
LODOP.SET_PRINT_PAGESIZE(self.xyprint, 0, 0, "A4");
|
|
67
|
-
|
|
68
|
-
if(self.printview==null){
|
|
69
|
-
// 打印维护
|
|
70
|
-
lodop.PRINT_SETUP()
|
|
71
|
-
}else if(self.printview){
|
|
72
|
-
// 使用打印预览是为了方便调整打印格式。例如:横向打印
|
|
73
|
-
lodop.PREVIEW()
|
|
74
|
-
}else if(!self.printview){
|
|
75
|
-
// 直接打印
|
|
76
|
-
lodop.PRINT()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default {
|
|
82
|
-
// props: ['model', 'thead', 'fields', 'top', 'left', 'right', 'bottom', 'tfoot'],
|
|
83
|
-
props: {
|
|
84
|
-
model: Object,
|
|
85
|
-
thead: String,
|
|
86
|
-
tfoot: String,
|
|
87
|
-
sumhtml: String,
|
|
88
|
-
fields: Array,
|
|
89
|
-
//null 打印维护, true 打印预览 false 直接打印
|
|
90
|
-
printview:{},
|
|
91
|
-
// 指定打印方向 0--可通过打印机选择纵向或横向,1--锁定为纵向打印,2---锁定为横向打印
|
|
92
|
-
xyprint:{
|
|
93
|
-
default : 0
|
|
94
|
-
},
|
|
95
|
-
top: {},
|
|
96
|
-
left: {},
|
|
97
|
-
right: {},
|
|
98
|
-
bottom: {},
|
|
99
|
-
attach: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: 'name'
|
|
102
|
-
},
|
|
103
|
-
style: {
|
|
104
|
-
type: String
|
|
105
|
-
},
|
|
106
|
-
isSelected: {
|
|
107
|
-
type:Boolean,
|
|
108
|
-
default:false
|
|
109
|
-
},
|
|
110
|
-
//是否分页打印
|
|
111
|
-
printpage:{
|
|
112
|
-
type:Boolean,
|
|
113
|
-
default:false
|
|
114
|
-
},
|
|
115
|
-
// 打印名称,在同一个名称下的打印可以统一风格(打印维护界面点击应用即可)
|
|
116
|
-
printName: {
|
|
117
|
-
type: String
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
data(){
|
|
121
|
-
return{
|
|
122
|
-
//打印任务的JOB代码,用于获得打印状态信息及最终结果。
|
|
123
|
-
P_ID:"",
|
|
124
|
-
//第几次任务
|
|
125
|
-
loop:0,
|
|
126
|
-
fontSize: this.$appdata.getSingleValue('打印字体大小') ? this.$appdata.getSingleValue('打印字体大小') : 15
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
methods: {
|
|
130
|
-
PrintAsFile () {
|
|
131
|
-
console.log(this.model)
|
|
132
|
-
let gen = printGen(this,this.printpage)
|
|
133
|
-
co(gen)
|
|
134
|
-
},
|
|
135
|
-
async PrintSinglePage(){
|
|
136
|
-
let lodop = getLodop()
|
|
137
|
-
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
|
138
|
-
var style
|
|
139
|
-
if (!this.style) {
|
|
140
|
-
style = `<style>table{font-size:${this.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
141
|
-
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
142
|
-
} else {
|
|
143
|
-
style = this.style
|
|
144
|
-
}
|
|
145
|
-
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
|
146
|
-
|
|
147
|
-
//所有数据全部打印,打印任务结束
|
|
148
|
-
if(this.loop+1>this.model.totalPage){
|
|
149
|
-
this.printinit()
|
|
150
|
-
console.log('打印结束')
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
console.log('获取数据pageIndex = ' + (this.loop+1))
|
|
154
|
-
await this.model.loadPage(this.loop+1)
|
|
155
|
-
for (let row of this.model.rows) {
|
|
156
|
-
tHtml += '<tr>'
|
|
157
|
-
for (let field of this.fields) {
|
|
158
|
-
if (field && (row[field] || row[field] === 0) ) {
|
|
159
|
-
tHtml += '<td>' + row[field] + '</td>'
|
|
160
|
-
} else {
|
|
161
|
-
tHtml += '<td></td>'
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
tHtml += '</tr>'
|
|
165
|
-
}
|
|
166
|
-
//插入页码
|
|
167
|
-
let page = `<tr><th width="100%" colspan=${this.fields.length} style="border-width: 0;">当前是第<font format="ChineseNum" color="blue">${this.loop+1}</font>页/共<font format="ChineseNum" color="blue">${this.model.totalPage}</font>页`
|
|
168
|
-
// 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
169
|
-
if (this.tfoot) {
|
|
170
|
-
tHtml += `</tbody><tfoot>${this.tfoot}${page}</tfoot></table>`
|
|
171
|
-
} else {
|
|
172
|
-
tHtml += '</tbody></table>'
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
|
176
|
-
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
177
|
-
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
178
|
-
//设置打印机为默认打印机
|
|
179
|
-
lodop.SET_PRINTER_INDEX(-1)
|
|
180
|
-
|
|
181
|
-
this.P_ID=lodop.PRINT()
|
|
182
|
-
if(this.P_ID){
|
|
183
|
-
this.loop+=1
|
|
184
|
-
console.log("正打印第"+this.loop+"个任务(JOB代码"+this.P_ID)
|
|
185
|
-
}
|
|
186
|
-
//延迟循环缓解压力
|
|
187
|
-
await this.timeout(1500)
|
|
188
|
-
this.PrintSinglePage()
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
async PrintSelectedPage () {
|
|
192
|
-
console.log('选择列打印开始', this.model)
|
|
193
|
-
|
|
194
|
-
if (this.model.rows.length > 100) {
|
|
195
|
-
this.$showAlert('您选择的数据过大,请选择少于100条数据进行打印', 'warning', 3000)
|
|
196
|
-
return
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
let lodop = getLodop()
|
|
200
|
-
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
|
201
|
-
var style
|
|
202
|
-
if (!this.style) {
|
|
203
|
-
style = `<style>table{font-size:${this.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
204
|
-
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
205
|
-
} else {
|
|
206
|
-
style = this.style
|
|
207
|
-
}
|
|
208
|
-
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
|
209
|
-
for (let row of this.model.rows) {
|
|
210
|
-
tHtml += '<tr>'
|
|
211
|
-
for (let field of this.fields) {
|
|
212
|
-
tHtml += '<td style="text-align: center;">' + row[field] + '</td>'
|
|
213
|
-
}
|
|
214
|
-
tHtml += '</tr>'
|
|
215
|
-
}
|
|
216
|
-
// // 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
217
|
-
if (this.tfoot) {
|
|
218
|
-
tHtml += `</tbody><tfoot>${this.tfoot}</tfoot></table>`
|
|
219
|
-
} else {
|
|
220
|
-
tHtml += '</tbody></table>'
|
|
221
|
-
}
|
|
222
|
-
console.log('选择列打印的html', tHtml)
|
|
223
|
-
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
|
224
|
-
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
225
|
-
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
226
|
-
//设置打印机为默认打印机
|
|
227
|
-
lodop.SET_PRINTER_INDEX(-1)
|
|
228
|
-
console.log('开始调用打印。。')
|
|
229
|
-
this.P_ID=lodop.PRINT()
|
|
230
|
-
},
|
|
231
|
-
printinit(){
|
|
232
|
-
this.P_ID="",
|
|
233
|
-
this.loop=0
|
|
234
|
-
},
|
|
235
|
-
async timeout(ms){
|
|
236
|
-
return new Promise((resolve, reject) => {
|
|
237
|
-
setTimeout(resolve, ms)
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<button class="btn btn-default" @click='PrintAsFile()' :id="'vc-printtable-'+attach">打印表格</button>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import co from 'co'
|
|
7
|
+
import getLodop from '../LodopFuncs'
|
|
8
|
+
|
|
9
|
+
let printGen = function * (self, pageNo) {
|
|
10
|
+
|
|
11
|
+
console.log('开始打印', self.isSelected, self.model, self.tfoot)
|
|
12
|
+
//是否分页打印
|
|
13
|
+
if(pageNo){
|
|
14
|
+
self.PrintSinglePage()
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
if (self.isSelected) {
|
|
18
|
+
// 判断是否选择行数据进行打印
|
|
19
|
+
self.PrintSelectedPage()
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let lodop = getLodop()
|
|
24
|
+
lodop.PRINT_INIT(self.printName+'打印')
|
|
25
|
+
var style
|
|
26
|
+
if (!self.style) {
|
|
27
|
+
style = `<style>table{font-size:${self.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
28
|
+
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
29
|
+
} else {
|
|
30
|
+
style = self.style
|
|
31
|
+
}
|
|
32
|
+
let tHtml = style + '<table class="table table-hover"><thead>' + self.thead + '</thead><tbody>'
|
|
33
|
+
|
|
34
|
+
for (var i = 1; i <= self.model.totalPage; i++) {
|
|
35
|
+
console.log('pageIndex = ' + i)
|
|
36
|
+
yield self.model.loadPage(i)
|
|
37
|
+
for (let row of self.model.rows) {
|
|
38
|
+
tHtml += '<tr>'
|
|
39
|
+
for (let field of self.fields) {
|
|
40
|
+
if (field && (row[field] || row[field] === 0) ) {
|
|
41
|
+
tHtml += '<td>' + row[field] + '</td>'
|
|
42
|
+
} else {
|
|
43
|
+
tHtml += '<td></td>'
|
|
44
|
+
}
|
|
45
|
+
// console.log(row[field])
|
|
46
|
+
}
|
|
47
|
+
tHtml += '</tr>'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// 加入合计数据 (最后一页显示)
|
|
51
|
+
if (self.sumhtml) {
|
|
52
|
+
tHtml += self.sumhtml
|
|
53
|
+
}
|
|
54
|
+
// 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
55
|
+
if (self.tfoot) {
|
|
56
|
+
self.tfoot += `<tr><td width="100%" colspan=${self.fields.length} style="text-align: center;border-width: 0;">第<font tdata="PageNO" format="#" color="blue">#</font>页</span>/共<font tdata="PageCount" format="#" color="blue">##</font></span>页</td></tr>`
|
|
57
|
+
tHtml += `</tbody><tfoot>${self.tfoot}</tfoot></table>`
|
|
58
|
+
} else {
|
|
59
|
+
tHtml += '</tbody></table>'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
lodop.ADD_PRINT_TABLE(self.top, self.left, 'RightMargin:' + self.right, 'BottomMargin:' + self.bottom, tHtml)
|
|
63
|
+
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
64
|
+
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
65
|
+
// 指定打印方向 0--可通过打印机选择纵向或横向,1--锁定为纵向打印,2---锁定为横向打印
|
|
66
|
+
LODOP.SET_PRINT_PAGESIZE(self.xyprint, 0, 0, "A4");
|
|
67
|
+
|
|
68
|
+
if(self.printview==null){
|
|
69
|
+
// 打印维护
|
|
70
|
+
lodop.PRINT_SETUP()
|
|
71
|
+
}else if(self.printview){
|
|
72
|
+
// 使用打印预览是为了方便调整打印格式。例如:横向打印
|
|
73
|
+
lodop.PREVIEW()
|
|
74
|
+
}else if(!self.printview){
|
|
75
|
+
// 直接打印
|
|
76
|
+
lodop.PRINT()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
// props: ['model', 'thead', 'fields', 'top', 'left', 'right', 'bottom', 'tfoot'],
|
|
83
|
+
props: {
|
|
84
|
+
model: Object,
|
|
85
|
+
thead: String,
|
|
86
|
+
tfoot: String,
|
|
87
|
+
sumhtml: String,
|
|
88
|
+
fields: Array,
|
|
89
|
+
//null 打印维护, true 打印预览 false 直接打印
|
|
90
|
+
printview:{},
|
|
91
|
+
// 指定打印方向 0--可通过打印机选择纵向或横向,1--锁定为纵向打印,2---锁定为横向打印
|
|
92
|
+
xyprint:{
|
|
93
|
+
default : 0
|
|
94
|
+
},
|
|
95
|
+
top: {},
|
|
96
|
+
left: {},
|
|
97
|
+
right: {},
|
|
98
|
+
bottom: {},
|
|
99
|
+
attach: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: 'name'
|
|
102
|
+
},
|
|
103
|
+
style: {
|
|
104
|
+
type: String
|
|
105
|
+
},
|
|
106
|
+
isSelected: {
|
|
107
|
+
type:Boolean,
|
|
108
|
+
default:false
|
|
109
|
+
},
|
|
110
|
+
//是否分页打印
|
|
111
|
+
printpage:{
|
|
112
|
+
type:Boolean,
|
|
113
|
+
default:false
|
|
114
|
+
},
|
|
115
|
+
// 打印名称,在同一个名称下的打印可以统一风格(打印维护界面点击应用即可)
|
|
116
|
+
printName: {
|
|
117
|
+
type: String
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
data(){
|
|
121
|
+
return{
|
|
122
|
+
//打印任务的JOB代码,用于获得打印状态信息及最终结果。
|
|
123
|
+
P_ID:"",
|
|
124
|
+
//第几次任务
|
|
125
|
+
loop:0,
|
|
126
|
+
fontSize: this.$appdata.getSingleValue('打印字体大小') ? this.$appdata.getSingleValue('打印字体大小') : 15
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
methods: {
|
|
130
|
+
PrintAsFile () {
|
|
131
|
+
console.log(this.model)
|
|
132
|
+
let gen = printGen(this,this.printpage)
|
|
133
|
+
co(gen)
|
|
134
|
+
},
|
|
135
|
+
async PrintSinglePage(){
|
|
136
|
+
let lodop = getLodop()
|
|
137
|
+
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
|
138
|
+
var style
|
|
139
|
+
if (!this.style) {
|
|
140
|
+
style = `<style>table{font-size:${this.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
141
|
+
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
142
|
+
} else {
|
|
143
|
+
style = this.style
|
|
144
|
+
}
|
|
145
|
+
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
|
146
|
+
|
|
147
|
+
//所有数据全部打印,打印任务结束
|
|
148
|
+
if(this.loop+1>this.model.totalPage){
|
|
149
|
+
this.printinit()
|
|
150
|
+
console.log('打印结束')
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
console.log('获取数据pageIndex = ' + (this.loop+1))
|
|
154
|
+
await this.model.loadPage(this.loop+1)
|
|
155
|
+
for (let row of this.model.rows) {
|
|
156
|
+
tHtml += '<tr>'
|
|
157
|
+
for (let field of this.fields) {
|
|
158
|
+
if (field && (row[field] || row[field] === 0) ) {
|
|
159
|
+
tHtml += '<td>' + row[field] + '</td>'
|
|
160
|
+
} else {
|
|
161
|
+
tHtml += '<td></td>'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
tHtml += '</tr>'
|
|
165
|
+
}
|
|
166
|
+
//插入页码
|
|
167
|
+
let page = `<tr><th width="100%" colspan=${this.fields.length} style="border-width: 0;">当前是第<font format="ChineseNum" color="blue">${this.loop+1}</font>页/共<font format="ChineseNum" color="blue">${this.model.totalPage}</font>页`
|
|
168
|
+
// 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
169
|
+
if (this.tfoot) {
|
|
170
|
+
tHtml += `</tbody><tfoot>${this.tfoot}${page}</tfoot></table>`
|
|
171
|
+
} else {
|
|
172
|
+
tHtml += '</tbody></table>'
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
|
176
|
+
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
177
|
+
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
178
|
+
//设置打印机为默认打印机
|
|
179
|
+
lodop.SET_PRINTER_INDEX(-1)
|
|
180
|
+
|
|
181
|
+
this.P_ID=lodop.PRINT()
|
|
182
|
+
if(this.P_ID){
|
|
183
|
+
this.loop+=1
|
|
184
|
+
console.log("正打印第"+this.loop+"个任务(JOB代码"+this.P_ID)
|
|
185
|
+
}
|
|
186
|
+
//延迟循环缓解压力
|
|
187
|
+
await this.timeout(1500)
|
|
188
|
+
this.PrintSinglePage()
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
async PrintSelectedPage () {
|
|
192
|
+
console.log('选择列打印开始', this.model)
|
|
193
|
+
|
|
194
|
+
if (this.model.rows.length > 100) {
|
|
195
|
+
this.$showAlert('您选择的数据过大,请选择少于100条数据进行打印', 'warning', 3000)
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let lodop = getLodop()
|
|
200
|
+
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
|
201
|
+
var style
|
|
202
|
+
if (!this.style) {
|
|
203
|
+
style = `<style>table{font-size:${this.fontSize}px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}` +
|
|
204
|
+
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
|
205
|
+
} else {
|
|
206
|
+
style = this.style
|
|
207
|
+
}
|
|
208
|
+
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
|
209
|
+
for (let row of this.model.rows) {
|
|
210
|
+
tHtml += '<tr>'
|
|
211
|
+
for (let field of this.fields) {
|
|
212
|
+
tHtml += '<td style="text-align: center;">' + row[field] + '</td>'
|
|
213
|
+
}
|
|
214
|
+
tHtml += '</tr>'
|
|
215
|
+
}
|
|
216
|
+
// // 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
|
217
|
+
if (this.tfoot) {
|
|
218
|
+
tHtml += `</tbody><tfoot>${this.tfoot}</tfoot></table>`
|
|
219
|
+
} else {
|
|
220
|
+
tHtml += '</tbody></table>'
|
|
221
|
+
}
|
|
222
|
+
console.log('选择列打印的html', tHtml)
|
|
223
|
+
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
|
224
|
+
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
|
225
|
+
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
|
226
|
+
//设置打印机为默认打印机
|
|
227
|
+
lodop.SET_PRINTER_INDEX(-1)
|
|
228
|
+
console.log('开始调用打印。。')
|
|
229
|
+
this.P_ID=lodop.PRINT()
|
|
230
|
+
},
|
|
231
|
+
printinit(){
|
|
232
|
+
this.P_ID="",
|
|
233
|
+
this.loop=0
|
|
234
|
+
},
|
|
235
|
+
async timeout(ms){
|
|
236
|
+
return new Promise((resolve, reject) => {
|
|
237
|
+
setTimeout(resolve, ms)
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
</script>
|
package/src/main.js
CHANGED
|
@@ -1,76 +1,68 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import App from './App'
|
|
3
|
-
import { all } from 'vue-client'
|
|
4
|
-
|
|
5
|
-
// import { sale } from 'sale-client'
|
|
6
|
-
import { system } from 'system-clients'
|
|
7
|
-
import { ldap } from 'ldap-clients'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import webmeterManage from './webmeterManage'
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
AMap.
|
|
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
|
-
require('system-clients/src/styles/less/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// require('system-clients/src/styles/less/manageStyle/safeStyle.less')
|
|
70
|
-
// require('system-clients/src/styles/less/manageStyle/manageStyle.less')
|
|
71
|
-
|
|
72
|
-
new Vue({
|
|
73
|
-
el: 'body',
|
|
74
|
-
components: { App }
|
|
75
|
-
})
|
|
76
|
-
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import App from './App'
|
|
3
|
+
import { all } from 'vue-client'
|
|
4
|
+
|
|
5
|
+
// import { sale } from 'sale-client'
|
|
6
|
+
import { system } from 'system-clients'
|
|
7
|
+
import { ldap } from 'ldap-clients'
|
|
8
|
+
import saleManage from './saleManage'
|
|
9
|
+
import ShanXianSaleManage from './filiale/meihekou/sale'
|
|
10
|
+
import webmeterManage from './webmeterManage'
|
|
11
|
+
import reportManage from './reportManage'
|
|
12
|
+
import newmanage from './newmanage'
|
|
13
|
+
import ManageHome from './ManageHome'
|
|
14
|
+
import echarts from 'echarts'
|
|
15
|
+
import AMap from 'vue-amap'
|
|
16
|
+
|
|
17
|
+
Vue.config.silent = true
|
|
18
|
+
// Vue.mmType = 'AES'
|
|
19
|
+
|
|
20
|
+
Vue.use(AMap);
|
|
21
|
+
|
|
22
|
+
// 初始化vue-amap
|
|
23
|
+
AMap.initAMapApiLoader({
|
|
24
|
+
// 高德key
|
|
25
|
+
key: '3cec9ae8e2349207f7ac29279e3f4abe',
|
|
26
|
+
// 插件集合 (插件按需引入)
|
|
27
|
+
plugin: [
|
|
28
|
+
"AMap.Autocomplete", //输入提示插件
|
|
29
|
+
"AMap.PlaceSearch", //POI搜索插件
|
|
30
|
+
"AMap.Scale", //右下角缩略图插件 比例尺
|
|
31
|
+
"AMap.OverView", //地图鹰眼插件
|
|
32
|
+
"AMap.ToolBar", //地图工具条0
|
|
33
|
+
"AMap.MapType", //类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
|
|
34
|
+
"AMap.PolyEditor", //编辑 折线多,边形
|
|
35
|
+
"AMap.CircleEditor", //圆形编辑器插件
|
|
36
|
+
"AMap.Geolocation" //定位控件,用来获取和展示用户主机所在的经纬度位置
|
|
37
|
+
],
|
|
38
|
+
uiVersion: "1.0"
|
|
39
|
+
});
|
|
40
|
+
/** **************************通用组件******************************/
|
|
41
|
+
|
|
42
|
+
Vue.prototype.$echarts = echarts
|
|
43
|
+
all()
|
|
44
|
+
// sale()
|
|
45
|
+
ldap()
|
|
46
|
+
system(false)
|
|
47
|
+
|
|
48
|
+
saleManage()
|
|
49
|
+
ShanXianSaleManage()
|
|
50
|
+
webmeterManage()
|
|
51
|
+
ManageHome()
|
|
52
|
+
newmanage()
|
|
53
|
+
reportManage()
|
|
54
|
+
require('system-clients/src/styles/less/bootstrap.less')
|
|
55
|
+
require('./components/qinhua/Style/qinhuaStyle.less')
|
|
56
|
+
// require('./bootstrap/less/manageStyle/manageChile.less')
|
|
57
|
+
// require('./bootstrap/less/manageStyle/safeStyle.less')
|
|
58
|
+
|
|
59
|
+
//大屏展示要放开的样式
|
|
60
|
+
// require('system-clients/src/styles/less/manageStyle/manageChile.less')
|
|
61
|
+
// require('system-clients/src/styles/less/manageStyle/safeStyle.less')
|
|
62
|
+
// require('system-clients/src/styles/less/manageStyle/manageStyle.less')
|
|
63
|
+
|
|
64
|
+
new Vue({
|
|
65
|
+
el: 'body',
|
|
66
|
+
components: { App }
|
|
67
|
+
})
|
|
68
|
+
|