safecheck-client 3.0.30-7 → 3.0.30-71
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/examples/SafePlan-liaoyuan/App.vue +3 -1
- package/package.json +4 -3
- package/src/components/Util.js +15 -0
- package/src/components/android/AddPlanItem.vue +5 -2
- package/src/components/android/AreaPlan.vue +2 -2
- package/src/components/android/CurrentCreate.vue +3 -2
- package/src/components/android/CurrentCreate_new.vue +563 -559
- package/src/components/android/PhoneotherInfo.vue +132 -132
- package/src/components/android/SafecheckOrderV.vue +2 -2
- package/src/components/android/UploadPage.vue +13 -123
- package/src/components/paper/PlanChooser.vue +8 -6
- package/src/components/pc/Edit.vue +126 -0
- package/src/components/pc/LodopFuncs.js +159 -0
- package/src/components/pc/NewCheckpaper.vue +9 -5
- package/src/components/pc/PaperEdit.vue +151 -0
- package/src/components/pc/PrintData.vue +243 -0
- package/src/components/pc/PrintTable.vue +241 -0
- package/src/components/pc/SelectCheckPlanAndNoPLan.vue +281 -278
- package/src/components/querycheckpaper/CheckSearchUser.vue +1067 -1067
- package/src/components/report/NoCheckplanSafecheck.vue +0 -2
- package/src/filiale/bayan/android/SafecheckDevices.vue +1303 -1303
- package/src/filiale/bayan/android/SafecheckOrderV.vue +2850 -2850
- package/src/filiale/bayan/android/SafecheckUserInfo.vue +806 -806
- package/src/filiale/fugou/android/AddPlanItem.vue +413 -0
- package/src/filiale/fugou/android.js +10 -0
- package/src/filiale/hanzhong/android/PaperFeedback.vue +1477 -1477
- package/src/filiale/hanzhong/android/SafecheckDevices.vue +1313 -1294
- package/src/filiale/hanzhong/android/SafecheckOrderV.vue +2683 -2683
- package/src/filiale/hanzhong/android.js +16 -16
- package/src/filiale/hanzhong/pc/NewCheckpaper.vue +1923 -0
- package/src/filiale/hanzhong/pc.js +4 -1
- package/src/filiale/huatong/android/CurrentCreate.vue +564 -564
- package/src/filiale/huatong/android/SafecheckOrderV.vue +8 -0
- package/src/filiale/jingyang/android/PhoneUpUserinfo.vue +34 -34
- package/src/filiale/jingyang/pc/PaperList.vue +1 -2
- package/src/filiale/kelai/android/AddPlanItem.vue +488 -0
- package/src/filiale/kelai/android.js +1 -0
- package/src/filiale/pingxiang/pc/DefectPaperNew.vue +1 -1
- package/src/filiale/qianneng/android/PaperFeedback.vue +40 -0
- package/src/filiale/qingjian/android/PhoneUpUserinfo.vue +6 -0
- package/src/filiale/tianke/pc/checkScreen.vue +781 -781
- package/src/filiale/tianke/pc/cq.jpg +0 -0
- package/src/filiale/tianke/pc/qy.jpg +0 -0
- package/src/filiale/tongchuan/android/SafecheckDevices.vue +1 -0
- package/src/filiale/tongchuan/pc/PaperDefectMain.vue +1095 -1090
- package/src/filiale/wensu/android/AndroidDefectDeal.vue +321 -366
- package/src/filiale/wensu/android/AndroidDefectDealItems.vue +480 -0
- package/src/filiale/wensu/android.js +1 -0
- package/src/filiale/wensu/pc/CheckSearchUser.vue +64 -0
- package/src/filiale/wensu/pc/DefectPaperNew.vue +16 -10
- package/src/filiale/wensu/pc/NewCheckpaper.vue +1936 -0
- package/src/filiale/wensu/pc/RoleSelector.vue +4 -1
- package/src/filiale/wensu/pc/checkUserList.vue +50 -0
- package/src/filiale/wensu/pc.js +2 -1
- package/src/filiale/wenxi/pc/DefectPaper.vue +1 -1
- package/src/filiale/wuhai/android/SafecheckOrderV.vue +2069 -2041
- package/src/filiale/yangchunboneng/android/PaperFeedback.vue +20 -0
- package/src/filiale/yangchunboneng/pc/CheckBookDetails.vue +19 -0
- package/src/filiale/yongzhou/pc/CheckSearchUser.vue +1092 -0
- package/src/filiale/yongzhou/pc/LodopFuncs.js +159 -0
- package/src/filiale/yongzhou/pc/NoCheckplanSafecheck.vue +252 -0
- package/src/filiale/yongzhou/pc/PaperList.vue +798 -0
- package/src/filiale/yongzhou/pc/PrintData.vue +243 -0
- package/src/filiale/yongzhou/pc/PrintTable.vue +241 -0
- package/src/filiale/yongzhou/pc/communityDetail.vue +35 -12
- package/src/filiale/yongzhou/pc/communityTypeDetailG.vue +28 -14
- package/src/filiale/yongzhou/pc/communityTypeDetailM.vue +28 -14
- package/src/filiale/yongzhou/pc/safeDetail.vue +43 -15
- package/src/filiale/yongzhou/pc/safeStatistics.vue +16 -6
- package/src/filiale/yongzhou/pc/safeStatisticsDay.vue +88 -29
- package/src/filiale/yongzhou/pc/safeStatisticsMonth.vue +63 -27
- package/src/filiale/yongzhou/pc/safeStatisticsYear.vue +16 -6
- package/src/filiale/yongzhou/pc/safeTable.vue +10 -2
- package/src/filiale/yongzhou/pc.js +17 -12
- package/src/filiale/zhongsheng/android/CurrentCreate.vue +540 -536
- package/src/filiale/zhongsheng/android/SafecheckUserInfo.vue +151 -53
- package/src/filiale/zhongsheng/pc/NewCheckpaper.vue +14 -0
- package/src/safecheck-android.js +290 -290
- package/src/safecheck.js +12 -0
@@ -0,0 +1,243 @@
|
|
1
|
+
<template>
|
2
|
+
<button class="button_export button_spacing" @click='printData()'>打印</button>
|
3
|
+
<modal :show.sync="printshow" v-ref:modal backdrop="false">
|
4
|
+
<header slot="modal-header" class="modal-header text-center">
|
5
|
+
<h4 class="modal-title">打印列选择</h4>
|
6
|
+
<input type="checkbox" class="" id="f_generations" v-model="all">
|
7
|
+
<label for="f_generations" class="font-size">全选</label>
|
8
|
+
</header>
|
9
|
+
<article slot="modal-body">
|
10
|
+
<div class="auto col-sm-11 col-md-offset-1" style="margin-top: 10px;">
|
11
|
+
<div class="col-sm-3" v-for="f in fields">
|
12
|
+
<input type="checkbox" class="" :id="'water-owe-details-'+$index" v-model="modelval" :value="$key">
|
13
|
+
<label :for="'water-owe-details-'+$index" class="font-size">{{f}}</label>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</article>
|
17
|
+
<footer slot="modal-footer" class="modal-footer">
|
18
|
+
<center>
|
19
|
+
<button v-show="printshow" type="button" class="btn btn-default" @click='close()'>取消</button>
|
20
|
+
<button v-show="printshow" type="button" class="btn btn-success" @click='print()'>打印</button>
|
21
|
+
<print-table-safe :model='model' v-show="false" v-ref:print
|
22
|
+
:printview="printview"
|
23
|
+
:xyprint="xyprint"
|
24
|
+
:top='40' :left='40' :right='40' :bottom='40' :print-name="printName"
|
25
|
+
:thead="thead" :tfoot='tfoot' :attach="attach" :sumhtml="sumhtml"
|
26
|
+
:fields="modelval" :is-selected="isSelected" :printpage="printpage">
|
27
|
+
</print-table-safe>
|
28
|
+
</center>
|
29
|
+
</footer>
|
30
|
+
</modal>
|
31
|
+
</template>
|
32
|
+
|
33
|
+
<script>
|
34
|
+
import co from 'co'
|
35
|
+
|
36
|
+
export default {
|
37
|
+
// data:sql需要的替换字段
|
38
|
+
// sqlurl:导出Excel查询的sql语句
|
39
|
+
// field:需要导出Excel的字段名和对应中文名或hbm配置文件名(全名)
|
40
|
+
// total:统计字段(统计行)
|
41
|
+
// props: ['data', 'sqlurl', 'field', 'total', 'bean', 'chooseCol'],
|
42
|
+
data () {
|
43
|
+
return {
|
44
|
+
printshow: false,
|
45
|
+
all: false,
|
46
|
+
fields: {},
|
47
|
+
modelval: [],
|
48
|
+
thead: '',
|
49
|
+
tfoot: '',
|
50
|
+
//合计数据
|
51
|
+
sumsmodel: {},
|
52
|
+
// 合计超文本
|
53
|
+
sumhtml: ''
|
54
|
+
}
|
55
|
+
},
|
56
|
+
props: {
|
57
|
+
model: {},
|
58
|
+
field: {},
|
59
|
+
printview:{},
|
60
|
+
xyprint:{},
|
61
|
+
starthead: {
|
62
|
+
type:String,
|
63
|
+
default:''
|
64
|
+
},
|
65
|
+
titletable: {
|
66
|
+
type:String,
|
67
|
+
default:''
|
68
|
+
},
|
69
|
+
printName: {},
|
70
|
+
// 默认列
|
71
|
+
defaultfield: {},
|
72
|
+
// 合计数据
|
73
|
+
sumsmodel: {},
|
74
|
+
// 合计数据的列名称配置(当没有找到对应合计的名称时,会从field中找)
|
75
|
+
sumField: {},
|
76
|
+
// 单页合计
|
77
|
+
pageSum: null,
|
78
|
+
isSelected: {
|
79
|
+
type:Boolean,
|
80
|
+
default:false
|
81
|
+
},
|
82
|
+
//设置打印底部信息 如制表人:审核人:。。。
|
83
|
+
footinfo: [],
|
84
|
+
// 设置打印底部信息 其他信息 格式为二维数组 如:[['1','','','4'],['5','','','8']]
|
85
|
+
footmsg: [],
|
86
|
+
printpage: {
|
87
|
+
type:Boolean,
|
88
|
+
default:false
|
89
|
+
},
|
90
|
+
// 全表汇总信息只在最后一页显示
|
91
|
+
sumone: {
|
92
|
+
type:Boolean,
|
93
|
+
default:true
|
94
|
+
},
|
95
|
+
attach: {
|
96
|
+
type: String,
|
97
|
+
default: 'name'
|
98
|
+
},
|
99
|
+
chooserow: {
|
100
|
+
type: Boolean,
|
101
|
+
default: false
|
102
|
+
}
|
103
|
+
},
|
104
|
+
methods: {
|
105
|
+
|
106
|
+
async printData () {
|
107
|
+
console.log('打印。。。', this.model, this.field, this.printName, this.sumsmodel)
|
108
|
+
|
109
|
+
if (this.model.rows.length === 0) {
|
110
|
+
this.$showAlert('请查询需要打印的数据!!', 'warning', 2000)
|
111
|
+
return
|
112
|
+
}
|
113
|
+
this.all = false
|
114
|
+
//默认选择要打印的列
|
115
|
+
this.modelval = this.defaultfield
|
116
|
+
this.fields = this.field
|
117
|
+
console.log('所有打印字段',this.fields)
|
118
|
+
this.printshow = true
|
119
|
+
await this.put()
|
120
|
+
if(this.chooserow){
|
121
|
+
this.print()
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
put () {
|
126
|
+
// 对Modelval进行排序
|
127
|
+
this.sortModelval()
|
128
|
+
this.getfield()
|
129
|
+
// 组织头数据
|
130
|
+
if(this.titletable!=''){
|
131
|
+
this.thead = `<tr><th colspan=${this.modelval.length}><h1>${this.titletable}</h1></th></tr><tr>`
|
132
|
+
}else{
|
133
|
+
this.thead = `<tr><th colspan=${this.modelval.length}><h1>${this.printName}统计报表</h1></th></tr><tr>`
|
134
|
+
}
|
135
|
+
if(this.starthead!=''){
|
136
|
+
this.thead += `<tr><th colspan=${this.modelval.length}>${this.starthead}</th></tr><tr>`
|
137
|
+
}
|
138
|
+
for (let key of this.modelval) {
|
139
|
+
this.thead += '<th>' + this.fields[key] + '</th>'
|
140
|
+
}
|
141
|
+
this.thead += '</tr>'
|
142
|
+
},
|
143
|
+
// 对选择的列进行排序
|
144
|
+
sortModelval () {
|
145
|
+
console.log('选择列进行排序。。。', this.fields, this.modelval)
|
146
|
+
let sortModel = []
|
147
|
+
Object.keys(this.fields).forEach((key) => {
|
148
|
+
if (this.modelval.includes(key)) {
|
149
|
+
sortModel.push(key)
|
150
|
+
}
|
151
|
+
})
|
152
|
+
this.modelval = sortModel
|
153
|
+
console.log('选择的打印的字段', this.modelval)
|
154
|
+
},
|
155
|
+
|
156
|
+
close () {
|
157
|
+
this.all = false
|
158
|
+
this.modelval = []
|
159
|
+
this.printshow = false
|
160
|
+
this.$dispatch('print-close')
|
161
|
+
},
|
162
|
+
|
163
|
+
print () {
|
164
|
+
if (this.$login.r.includes('限制打印')) {
|
165
|
+
this.$showMessage('你被限制打印, 请联系管理员')
|
166
|
+
return
|
167
|
+
}
|
168
|
+
this.$refs.print.PrintAsFile()
|
169
|
+
this.printshow = false
|
170
|
+
this.$dispatch('print-data')
|
171
|
+
},
|
172
|
+
getfield(){
|
173
|
+
//合计字段打印
|
174
|
+
this.tfoot = ''
|
175
|
+
if(this.sumsmodel){
|
176
|
+
if (this.sumone) {
|
177
|
+
this.sumhtml = `<tr><th colspan=${this.modelval.length} style="border-width: 0;">全表汇总信息: `
|
178
|
+
Object.keys(this.sumsmodel).forEach((key) => {
|
179
|
+
let keyName = this.sumField[key] ? this.sumField[key] : this.fields[key]
|
180
|
+
this.sumhtml += keyName + '合计: ' + `<font color="blue">${this.sumsmodel[key]} </font>`
|
181
|
+
})
|
182
|
+
this.sumhtml += '</th></tr>'
|
183
|
+
} else {
|
184
|
+
this.tfoot = `<tr><th colspan=${this.modelval.length} style="border-width: 0;">全表汇总信息: `
|
185
|
+
Object.keys(this.sumsmodel).forEach((key) => {
|
186
|
+
let keyName = this.sumField[key] ? this.sumField[key] : this.fields[key]
|
187
|
+
this.tfoot += keyName + '合计: ' + `<font color="blue">${this.sumsmodel[key]} </font>`
|
188
|
+
})
|
189
|
+
this.tfoot += '</th></tr>'
|
190
|
+
}
|
191
|
+
}
|
192
|
+
if (this.pageSum) {
|
193
|
+
this.tfoot += `<tr>`
|
194
|
+
for (let row of this.modelval) {
|
195
|
+
let format = this.pageSum[row]
|
196
|
+
if (format) {
|
197
|
+
this.tfoot += `<td tdata="SubSum" format="${format}" style="border-width: 0;">######</td>`
|
198
|
+
} else {
|
199
|
+
this.tfoot += `<td style="border-width: 0;"></td>`
|
200
|
+
}
|
201
|
+
}
|
202
|
+
this.tfoot += `</tr>`
|
203
|
+
}
|
204
|
+
this.tfoot += `<tr><th colspan=${this.modelval.length} style="border-width: 0;">打印时间: ${this.$login.toStandardTimeString()}</th></tr>`
|
205
|
+
//设置打印底部信息 如制表人:审核人:。。。
|
206
|
+
if(this.footinfo!=null && this.footinfo.length!=0){
|
207
|
+
this.tfoot += `<tr><td colspan=${this.modelval.length} style="border-width: 0;"></td></tr><tr>`
|
208
|
+
for(let i=0;i<this.footinfo.length;i++){
|
209
|
+
this.tfoot += `<th colspan=${this.modelval.length/this.footinfo.length} style="border-width: 0;text-align: left;">${this.footinfo[i]}:</th>`
|
210
|
+
}
|
211
|
+
this.tfoot += `</tr>`
|
212
|
+
}
|
213
|
+
// 设置打印底部信息 其他信息 格式为二维数组 如:[['1','','','4'],['5','','','8']]
|
214
|
+
if (this.footmsg != null && this.footmsg.length != 0) {
|
215
|
+
for (let i = 0; i < this.footmsg.length; i++) {
|
216
|
+
this.tfoot += `<tr style="padding: 0 2px 0 2px"><th style="border: 0" colspan=${this.modelval.length} ><table style="width: 100%;border-width: 0;text-align: left;"><tr>`
|
217
|
+
for (let j = 0; j < this.footmsg[i].length; j++) {
|
218
|
+
// 如果this.footsmg[i]有三个元素 则每个占比 33.33%
|
219
|
+
// 如果this.footsmg[i]有四个元素 则每个占比 25%
|
220
|
+
this.tfoot += `<td style="border-width: 0;text-align: left;width: ${(Number(1) / Number(this.footmsg[i].length) * 100).toFixed(2)}%">${this.footmsg[i][j]}</td>`
|
221
|
+
}
|
222
|
+
this.tfoot += `</tr></table></th></tr>`
|
223
|
+
}
|
224
|
+
}
|
225
|
+
},
|
226
|
+
},
|
227
|
+
watch: {
|
228
|
+
'all' (val) {
|
229
|
+
if (val) {
|
230
|
+
this.modelval = Object.keys(this.fields)
|
231
|
+
} else {
|
232
|
+
this.modelval = []
|
233
|
+
}
|
234
|
+
},
|
235
|
+
'modelval.length' () {
|
236
|
+
this.put()
|
237
|
+
}
|
238
|
+
},
|
239
|
+
computed: {
|
240
|
+
|
241
|
+
}
|
242
|
+
}
|
243
|
+
</script>
|
@@ -0,0 +1,241 @@
|
|
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:15px;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
|
+
}
|
127
|
+
},
|
128
|
+
methods: {
|
129
|
+
PrintAsFile () {
|
130
|
+
console.log(this.model)
|
131
|
+
let gen = printGen(this,this.printpage)
|
132
|
+
co(gen)
|
133
|
+
},
|
134
|
+
async PrintSinglePage(){
|
135
|
+
let lodop = getLodop()
|
136
|
+
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
137
|
+
var style
|
138
|
+
if (!this.style) {
|
139
|
+
style = '<style>table{font-size:15px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}' +
|
140
|
+
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
141
|
+
} else {
|
142
|
+
style = this.style
|
143
|
+
}
|
144
|
+
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
145
|
+
|
146
|
+
//所有数据全部打印,打印任务结束
|
147
|
+
if(this.loop+1>this.model.totalPage){
|
148
|
+
this.printinit()
|
149
|
+
console.log('打印结束')
|
150
|
+
return
|
151
|
+
}
|
152
|
+
console.log('获取数据pageIndex = ' + (this.loop+1))
|
153
|
+
await this.model.loadPage(this.loop+1)
|
154
|
+
for (let row of this.model.rows) {
|
155
|
+
tHtml += '<tr>'
|
156
|
+
for (let field of this.fields) {
|
157
|
+
if (field && (row[field] || row[field] === 0) ) {
|
158
|
+
tHtml += '<td>' + row[field] + '</td>'
|
159
|
+
} else {
|
160
|
+
tHtml += '<td></td>'
|
161
|
+
}
|
162
|
+
}
|
163
|
+
tHtml += '</tr>'
|
164
|
+
}
|
165
|
+
//插入页码
|
166
|
+
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>页`
|
167
|
+
// 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
168
|
+
if (this.tfoot) {
|
169
|
+
tHtml += `</tbody><tfoot>${this.tfoot}${page}</tfoot></table>`
|
170
|
+
} else {
|
171
|
+
tHtml += '</tbody></table>'
|
172
|
+
}
|
173
|
+
|
174
|
+
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
175
|
+
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
176
|
+
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
177
|
+
//设置打印机为默认打印机
|
178
|
+
lodop.SET_PRINTER_INDEX(-1)
|
179
|
+
|
180
|
+
this.P_ID=lodop.PRINT()
|
181
|
+
if(this.P_ID){
|
182
|
+
this.loop+=1
|
183
|
+
console.log("正打印第"+this.loop+"个任务(JOB代码"+this.P_ID)
|
184
|
+
}
|
185
|
+
//延迟循环缓解压力
|
186
|
+
await this.timeout(1500)
|
187
|
+
this.PrintSinglePage()
|
188
|
+
},
|
189
|
+
|
190
|
+
async PrintSelectedPage () {
|
191
|
+
console.log('选择列打印开始', this.model)
|
192
|
+
|
193
|
+
if (this.model.rows.length > 100) {
|
194
|
+
this.$showAlert('您选择的数据过大,请选择少于100条数据进行打印', 'warning', 3000)
|
195
|
+
return
|
196
|
+
}
|
197
|
+
|
198
|
+
let lodop = getLodop()
|
199
|
+
lodop.PRINT_INIT('打印表格'+(this.loop+1))
|
200
|
+
var style
|
201
|
+
if (!this.style) {
|
202
|
+
style = '<style>table{font-size:15px;border-width: 2px;border-collapse: collapse;border:solid 2px ; border-color:black;}' +
|
203
|
+
'table th {border-width: 1px;padding: 2px;border-style: solid;}table td {border-width: 1px;padding: 2px;border-style: solid;}</style>'
|
204
|
+
} else {
|
205
|
+
style = this.style
|
206
|
+
}
|
207
|
+
let tHtml = style + '<table class="table table-hover"><thead>' + this.thead + '</thead><tbody>'
|
208
|
+
for (let row of this.model.rows) {
|
209
|
+
tHtml += '<tr>'
|
210
|
+
for (let field of this.fields) {
|
211
|
+
tHtml += '<td style="text-align: center;">' + row[field] + '</td>'
|
212
|
+
}
|
213
|
+
tHtml += '</tr>'
|
214
|
+
}
|
215
|
+
// // 如果有表尾,则添加表尾,如果内容翻页的话,表尾每一页都要打印
|
216
|
+
if (this.tfoot) {
|
217
|
+
tHtml += `</tbody><tfoot>${this.tfoot}</tfoot></table>`
|
218
|
+
} else {
|
219
|
+
tHtml += '</tbody></table>'
|
220
|
+
}
|
221
|
+
console.log('选择列打印的html', tHtml)
|
222
|
+
lodop.ADD_PRINT_TABLE(this.left, this.top, 'RightMargin:' + this.right, 'BottomMargin:' + this.bottom, tHtml)
|
223
|
+
lodop.SET_PRINT_STYLEA(0, 'HOrient', 3)
|
224
|
+
lodop.SET_PRINT_STYLEA(0, 'VOrient', 3)
|
225
|
+
//设置打印机为默认打印机
|
226
|
+
lodop.SET_PRINTER_INDEX(-1)
|
227
|
+
console.log('开始调用打印。。')
|
228
|
+
this.P_ID=lodop.PRINT()
|
229
|
+
},
|
230
|
+
printinit(){
|
231
|
+
this.P_ID="",
|
232
|
+
this.loop=0
|
233
|
+
},
|
234
|
+
async timeout(ms){
|
235
|
+
return new Promise((resolve, reject) => {
|
236
|
+
setTimeout(resolve, ms)
|
237
|
+
})
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
</script>
|