safecheck-client 3.0.30-48 → 3.0.30-49

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.
@@ -1,243 +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>
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>