cnhis-design-vue 2.1.16 → 2.1.17
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/CHANGELOG.md +2219 -2219
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +124 -111
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +59 -53
- package/es/button/style.css +1 -1
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +95 -104
- package/es/fabric-chart/style.css +1 -1
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +62 -62
- package/es/index/index.js +666 -656
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +92 -92
- package/es/multi-chat-client/index.js +86 -86
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +27 -27
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-view/index.js +33 -33
- package/es/select/index.js +11 -11
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +20 -20
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +145 -139
- package/es/table-filter/style.css +1 -1
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +644 -634
- package/lib/cui.umd.js +644 -634
- package/lib/cui.umd.min.js +72 -72
- package/package.json +107 -107
- package/packages/big-table/src/BigTable.vue +3038 -3038
- package/packages/big-table/src/assets/style/table-base.less +370 -370
- package/packages/big-table/src/components/AutoLayoutButton.vue +270 -270
- package/packages/big-table/src/utils/batchEditing.js +34 -27
- package/packages/big-table/src/utils/bigTableProps.js +95 -95
- package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +181 -181
- package/packages/button/src/ButtonPrint/index.vue +728 -724
- package/packages/fabric-chart/src/FabricChart.vue +15 -36
- package/packages/fabric-chart/src/components/TimeScaleValue.vue +117 -117
- package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
- package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +4 -3
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +960 -960
- package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +135 -133
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +558 -558
- package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +172 -172
- package/packages/multi-chat/chat/chatFooter.vue +1598 -1598
- package/packages/multi-chat/chat/chatMain.vue +1442 -1442
- package/packages/multi-chat/chat/quickReply.vue +439 -439
- package/packages/multi-chat/chat/scrollList.vue +1232 -1232
- package/packages/multi-chat/setting/baseInfo/index.vue +1302 -1302
- package/packages/multi-chat/store/actions.js +448 -448
- package/packages/multi-chat/store/state.js +112 -112
- package/packages/scale-view/formitem/r-choice.vue +714 -714
- package/packages/scale-view/scaleView.vue +2010 -2010
- package/packages/select-person/select-person.vue +1658 -1658
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +2462 -2462
- package/packages/table-filter/src/components/c-tree-select/tree-select.vue +336 -336
- package/packages/table-filter/src/components/multi-select/multi-select.vue +219 -219
- package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +340 -340
- package/packages/table-filter/src/const/dataOptions.js +43 -43
- package/packages/table-filter/src/mixins/mixins.js +695 -695
- package/packages/table-filter/src/quick-search/QuickSearch.vue +2083 -2083
- package/src/directive/preventReClick.js +12 -12
|
@@ -1,724 +1,728 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span v-clickoutside="handleClickOutside" @click="handleClickWrap">
|
|
3
|
-
<a-dropdown :visible="visible" overlayClassName="rowFoldHideBtnList-dropdown">
|
|
4
|
-
<a-menu slot="overlay">
|
|
5
|
-
<a-sub-menu class="format-name" key="format" :title="formatTitle">
|
|
6
|
-
<a-menu-item v-for="item in formatList" :key="item.id" :class="{ active: item.id === currentFormatId }" @click="handleClickFormat(item.id)">
|
|
7
|
-
{{ item.name }}
|
|
8
|
-
</a-menu-item>
|
|
9
|
-
</a-sub-menu>
|
|
10
|
-
<a-menu-divider />
|
|
11
|
-
<a-menu-item @click="e => handleClickPrint(e)">
|
|
12
|
-
{{ printText }}
|
|
13
|
-
</a-menu-item>
|
|
14
|
-
<a-menu-item @click="e => handleClickPreview(e)">
|
|
15
|
-
{{ previewText }}
|
|
16
|
-
</a-menu-item>
|
|
17
|
-
<a-menu-item @click="e => handleClickEdit(e)">
|
|
18
|
-
{{ formatEditText }}
|
|
19
|
-
</a-menu-item>
|
|
20
|
-
</a-menu>
|
|
21
|
-
<slot name="button" :handleClickPrintBtn="handleClickBtn" :printSpinning="spinning" :printbtnText="btnText" :printVisible="visible">
|
|
22
|
-
<a-button class="dropdown-button" style="margin: 0 8px 8px 0" @click.stop="handleClickBtn">
|
|
23
|
-
<a-icon v-if="spinning" type="loading" style="line-height: 10px" />
|
|
24
|
-
{{ btnText }}
|
|
25
|
-
<a-icon type="down" />
|
|
26
|
-
</a-button>
|
|
27
|
-
</slot>
|
|
28
|
-
</a-dropdown>
|
|
29
|
-
|
|
30
|
-
<IdentityVerification
|
|
31
|
-
:printConfig="printConfig"
|
|
32
|
-
:baseUrl="baseUrl"
|
|
33
|
-
:verifyUserUrl="verifyUserUrl"
|
|
34
|
-
:visible.sync="identityVerification.visible"
|
|
35
|
-
:identityVerificationTitle="identityVerificationTitle"
|
|
36
|
-
:authorizationKey="authorizationKey"
|
|
37
|
-
@success="verifiySuccess"
|
|
38
|
-
></IdentityVerification>
|
|
39
|
-
</span>
|
|
40
|
-
</template>
|
|
41
|
-
<script>
|
|
42
|
-
/**
|
|
43
|
-
* @author ruanlin
|
|
44
|
-
* @desc 全继承antd按钮组件,后期再扩展
|
|
45
|
-
* @time 2021-06-08
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
let printInstance = null;
|
|
49
|
-
let httpFn = null;
|
|
50
|
-
import Print from './js/print.es.min';
|
|
51
|
-
import IdentityVerification from './components/IdentityVerification';
|
|
52
|
-
import Clickoutside from '@/utils/clickoutside';
|
|
53
|
-
import Vue from 'vue';
|
|
54
|
-
import { Button, Dropdown, Menu, Icon } from 'ant-design-vue';
|
|
55
|
-
import create from '@/core/create';
|
|
56
|
-
import axios from 'axios';
|
|
57
|
-
import moment from 'moment';
|
|
58
|
-
import vexutils from '@/utils/vexutils';
|
|
59
|
-
|
|
60
|
-
export default create({
|
|
61
|
-
name: 'button-print',
|
|
62
|
-
components: {
|
|
63
|
-
IdentityVerification
|
|
64
|
-
},
|
|
65
|
-
directives: { Clickoutside },
|
|
66
|
-
props: {
|
|
67
|
-
baseUrl: {
|
|
68
|
-
type: String
|
|
69
|
-
},
|
|
70
|
-
/* */
|
|
71
|
-
btnText: {
|
|
72
|
-
type: String,
|
|
73
|
-
default: '打印'
|
|
74
|
-
},
|
|
75
|
-
printText: {
|
|
76
|
-
type: String,
|
|
77
|
-
default: '直接打印'
|
|
78
|
-
},
|
|
79
|
-
previewText: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: '打印预览'
|
|
82
|
-
},
|
|
83
|
-
formatEditText: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: '格式编辑'
|
|
86
|
-
},
|
|
87
|
-
identityVerificationTitle: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: '打印服务身份校验'
|
|
90
|
-
},
|
|
91
|
-
/* */
|
|
92
|
-
authorizationKey: {
|
|
93
|
-
type: String,
|
|
94
|
-
require: true
|
|
95
|
-
},
|
|
96
|
-
templateNumber: {
|
|
97
|
-
type: [Number, String],
|
|
98
|
-
require: true
|
|
99
|
-
},
|
|
100
|
-
/* 格式化打印参数,需的原始数据 */
|
|
101
|
-
params: {
|
|
102
|
-
type: Array
|
|
103
|
-
},
|
|
104
|
-
hisParams: {
|
|
105
|
-
type: Object
|
|
106
|
-
},
|
|
107
|
-
/* */
|
|
108
|
-
prevFn: {
|
|
109
|
-
type: Function,
|
|
110
|
-
default() {
|
|
111
|
-
return Promise.resolve();
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
/** */
|
|
115
|
-
verifyUserUrl: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: '/verifyUser'
|
|
118
|
-
},
|
|
119
|
-
/** */
|
|
120
|
-
getPrintFormatByNumberUrl: {
|
|
121
|
-
type: String,
|
|
122
|
-
default: '/getPrintFormatByNumber'
|
|
123
|
-
},
|
|
124
|
-
/** */
|
|
125
|
-
getTemplateParamsUrl: {
|
|
126
|
-
type: String,
|
|
127
|
-
default: '/getTemplateParams'
|
|
128
|
-
},
|
|
129
|
-
/* 打印策略,默认多条打印 */
|
|
130
|
-
strategy: {
|
|
131
|
-
type: String,
|
|
132
|
-
default: 'MULTI'
|
|
133
|
-
},
|
|
134
|
-
printConfig: {
|
|
135
|
-
type: Object,
|
|
136
|
-
default: () => ({})
|
|
137
|
-
},
|
|
138
|
-
// 1 为his老版,2 为新版 3为his更老版本
|
|
139
|
-
versionType: { type: [Number, String], default: '2' }
|
|
140
|
-
},
|
|
141
|
-
computed: {
|
|
142
|
-
currentFormatItem() {
|
|
143
|
-
if (!this.currentFormatId) return {};
|
|
144
|
-
let id = this.currentFormatId;
|
|
145
|
-
return this.formatList.find(item => item.id === id);
|
|
146
|
-
},
|
|
147
|
-
formatTitle() {
|
|
148
|
-
return this.currentFormatItem?.name || '格式选择';
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
data() {
|
|
152
|
-
return {
|
|
153
|
-
spinning: false,
|
|
154
|
-
visible: false,
|
|
155
|
-
formatList: [],
|
|
156
|
-
templateParams: {},
|
|
157
|
-
printParams: [],
|
|
158
|
-
currentFormatId: '',
|
|
159
|
-
/* */
|
|
160
|
-
identityVerification: {
|
|
161
|
-
visible: false
|
|
162
|
-
},
|
|
163
|
-
isInited: false,
|
|
164
|
-
watchPrintParamsReformatFn: null,
|
|
165
|
-
spinTimer: null
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
beforeCreate() {
|
|
169
|
-
Vue.use(Button).use(Dropdown).use(Menu).use(Icon);
|
|
170
|
-
},
|
|
171
|
-
mounted() {
|
|
172
|
-
this.isInited = false;
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
let
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.
|
|
245
|
-
this.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (!this.currentFormatId) {
|
|
252
|
-
this.
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
this.
|
|
278
|
-
this.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
},
|
|
405
|
-
/* */
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
obj[v] =
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
obj[v] =
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
.
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
.ant-dropdown-menu
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
.ant-dropdown-menu-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<span v-clickoutside="handleClickOutside" @click="handleClickWrap">
|
|
3
|
+
<a-dropdown :visible="visible" overlayClassName="rowFoldHideBtnList-dropdown">
|
|
4
|
+
<a-menu slot="overlay">
|
|
5
|
+
<a-sub-menu class="format-name" key="format" :title="formatTitle">
|
|
6
|
+
<a-menu-item v-for="item in formatList" :key="item.id" :class="{ active: item.id === currentFormatId }" @click="handleClickFormat(item.id)">
|
|
7
|
+
{{ item.name }}
|
|
8
|
+
</a-menu-item>
|
|
9
|
+
</a-sub-menu>
|
|
10
|
+
<a-menu-divider />
|
|
11
|
+
<a-menu-item @click="e => handleClickPrint(e)">
|
|
12
|
+
{{ printText }}
|
|
13
|
+
</a-menu-item>
|
|
14
|
+
<a-menu-item @click="e => handleClickPreview(e)">
|
|
15
|
+
{{ previewText }}
|
|
16
|
+
</a-menu-item>
|
|
17
|
+
<a-menu-item @click="e => handleClickEdit(e)">
|
|
18
|
+
{{ formatEditText }}
|
|
19
|
+
</a-menu-item>
|
|
20
|
+
</a-menu>
|
|
21
|
+
<slot name="button" :handleClickPrintBtn="handleClickBtn" :printSpinning="spinning" :printbtnText="btnText" :printVisible="visible">
|
|
22
|
+
<a-button class="dropdown-button" style="margin: 0 8px 8px 0" @click.stop="handleClickBtn">
|
|
23
|
+
<a-icon v-if="spinning" type="loading" style="line-height: 10px" />
|
|
24
|
+
{{ btnText }}
|
|
25
|
+
<a-icon type="down" />
|
|
26
|
+
</a-button>
|
|
27
|
+
</slot>
|
|
28
|
+
</a-dropdown>
|
|
29
|
+
|
|
30
|
+
<IdentityVerification
|
|
31
|
+
:printConfig="printConfig"
|
|
32
|
+
:baseUrl="baseUrl"
|
|
33
|
+
:verifyUserUrl="verifyUserUrl"
|
|
34
|
+
:visible.sync="identityVerification.visible"
|
|
35
|
+
:identityVerificationTitle="identityVerificationTitle"
|
|
36
|
+
:authorizationKey="authorizationKey"
|
|
37
|
+
@success="verifiySuccess"
|
|
38
|
+
></IdentityVerification>
|
|
39
|
+
</span>
|
|
40
|
+
</template>
|
|
41
|
+
<script>
|
|
42
|
+
/**
|
|
43
|
+
* @author ruanlin
|
|
44
|
+
* @desc 全继承antd按钮组件,后期再扩展
|
|
45
|
+
* @time 2021-06-08
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
let printInstance = null;
|
|
49
|
+
let httpFn = null;
|
|
50
|
+
import Print from './js/print.es.min';
|
|
51
|
+
import IdentityVerification from './components/IdentityVerification';
|
|
52
|
+
import Clickoutside from '@/utils/clickoutside';
|
|
53
|
+
import Vue from 'vue';
|
|
54
|
+
import { Button, Dropdown, Menu, Icon } from 'ant-design-vue';
|
|
55
|
+
import create from '@/core/create';
|
|
56
|
+
import axios from 'axios';
|
|
57
|
+
import moment from 'moment';
|
|
58
|
+
import vexutils from '@/utils/vexutils';
|
|
59
|
+
|
|
60
|
+
export default create({
|
|
61
|
+
name: 'button-print',
|
|
62
|
+
components: {
|
|
63
|
+
IdentityVerification
|
|
64
|
+
},
|
|
65
|
+
directives: { Clickoutside },
|
|
66
|
+
props: {
|
|
67
|
+
baseUrl: {
|
|
68
|
+
type: String
|
|
69
|
+
},
|
|
70
|
+
/* */
|
|
71
|
+
btnText: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '打印'
|
|
74
|
+
},
|
|
75
|
+
printText: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '直接打印'
|
|
78
|
+
},
|
|
79
|
+
previewText: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: '打印预览'
|
|
82
|
+
},
|
|
83
|
+
formatEditText: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: '格式编辑'
|
|
86
|
+
},
|
|
87
|
+
identityVerificationTitle: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '打印服务身份校验'
|
|
90
|
+
},
|
|
91
|
+
/* */
|
|
92
|
+
authorizationKey: {
|
|
93
|
+
type: String,
|
|
94
|
+
require: true
|
|
95
|
+
},
|
|
96
|
+
templateNumber: {
|
|
97
|
+
type: [Number, String],
|
|
98
|
+
require: true
|
|
99
|
+
},
|
|
100
|
+
/* 格式化打印参数,需的原始数据 */
|
|
101
|
+
params: {
|
|
102
|
+
type: Array
|
|
103
|
+
},
|
|
104
|
+
hisParams: {
|
|
105
|
+
type: Object
|
|
106
|
+
},
|
|
107
|
+
/* */
|
|
108
|
+
prevFn: {
|
|
109
|
+
type: Function,
|
|
110
|
+
default() {
|
|
111
|
+
return Promise.resolve();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
/** */
|
|
115
|
+
verifyUserUrl: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: '/verifyUser'
|
|
118
|
+
},
|
|
119
|
+
/** */
|
|
120
|
+
getPrintFormatByNumberUrl: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: '/getPrintFormatByNumber'
|
|
123
|
+
},
|
|
124
|
+
/** */
|
|
125
|
+
getTemplateParamsUrl: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: '/getTemplateParams'
|
|
128
|
+
},
|
|
129
|
+
/* 打印策略,默认多条打印 */
|
|
130
|
+
strategy: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: 'MULTI'
|
|
133
|
+
},
|
|
134
|
+
printConfig: {
|
|
135
|
+
type: Object,
|
|
136
|
+
default: () => ({})
|
|
137
|
+
},
|
|
138
|
+
// 1 为his老版,2 为新版 3为his更老版本
|
|
139
|
+
versionType: { type: [Number, String], default: '2' }
|
|
140
|
+
},
|
|
141
|
+
computed: {
|
|
142
|
+
currentFormatItem() {
|
|
143
|
+
if (!this.currentFormatId) return {};
|
|
144
|
+
let id = this.currentFormatId;
|
|
145
|
+
return this.formatList.find(item => item.id === id);
|
|
146
|
+
},
|
|
147
|
+
formatTitle() {
|
|
148
|
+
return this.currentFormatItem?.name || '格式选择';
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
data() {
|
|
152
|
+
return {
|
|
153
|
+
spinning: false,
|
|
154
|
+
visible: false,
|
|
155
|
+
formatList: [],
|
|
156
|
+
templateParams: {},
|
|
157
|
+
printParams: [],
|
|
158
|
+
currentFormatId: '',
|
|
159
|
+
/* */
|
|
160
|
+
identityVerification: {
|
|
161
|
+
visible: false
|
|
162
|
+
},
|
|
163
|
+
isInited: false,
|
|
164
|
+
watchPrintParamsReformatFn: null,
|
|
165
|
+
spinTimer: null
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
beforeCreate() {
|
|
169
|
+
Vue.use(Button).use(Dropdown).use(Menu).use(Icon);
|
|
170
|
+
},
|
|
171
|
+
mounted() {
|
|
172
|
+
this.isInited = false;
|
|
173
|
+
},
|
|
174
|
+
beforeDestroy() {
|
|
175
|
+
// 创建Print实例的时候会在webview中注册一个事件, 需要调用printInstance.destroy()手动清除
|
|
176
|
+
printInstance?.destroy?.()
|
|
177
|
+
},
|
|
178
|
+
watch: {
|
|
179
|
+
// 监听变化, 重新格式化printParams
|
|
180
|
+
params: {
|
|
181
|
+
deep: true,
|
|
182
|
+
handler(val) {
|
|
183
|
+
if (!val?.length) return false;
|
|
184
|
+
this.reformatPrintParams();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
methods: {
|
|
189
|
+
// getPopupContainer(triggerNode) {
|
|
190
|
+
// return triggerNode.parentNode;
|
|
191
|
+
// },
|
|
192
|
+
handleClickOutside() {
|
|
193
|
+
this.visible = false;
|
|
194
|
+
},
|
|
195
|
+
handleClickWrap() {
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
this.visible = true;
|
|
198
|
+
}, 0);
|
|
199
|
+
},
|
|
200
|
+
/* */
|
|
201
|
+
async handleClickBtn() {
|
|
202
|
+
if (!this.visible) {
|
|
203
|
+
let result = await this.init();
|
|
204
|
+
if (!result) return false;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
this.visible = !this.visible;
|
|
208
|
+
},
|
|
209
|
+
/* */
|
|
210
|
+
async init() {
|
|
211
|
+
if (this.isInited) return true;
|
|
212
|
+
this.isInited = true;
|
|
213
|
+
|
|
214
|
+
this.setTimeoutSpin();
|
|
215
|
+
|
|
216
|
+
this.instantiatePrintSDK();
|
|
217
|
+
let config = {
|
|
218
|
+
withCredentials: false,
|
|
219
|
+
timeout: 5000
|
|
220
|
+
};
|
|
221
|
+
let printUrlPrefix = this?.printConfig?.printUrlPrefix;
|
|
222
|
+
let customCofing = this?.printConfig?.customCofing || {};
|
|
223
|
+
let cCofing = this.getCustomCofing(customCofing);
|
|
224
|
+
if (axios !== this.axios && printUrlPrefix) {
|
|
225
|
+
config.baseURL = printUrlPrefix;
|
|
226
|
+
}
|
|
227
|
+
httpFn = axios.create({
|
|
228
|
+
...config,
|
|
229
|
+
...cCofing
|
|
230
|
+
});
|
|
231
|
+
const formatListResult = await this.queryFormatList();
|
|
232
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
233
|
+
this.initHIS(formatListResult);
|
|
234
|
+
} else {
|
|
235
|
+
await this.initCRM(formatListResult);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
this.setLoaded();
|
|
239
|
+
|
|
240
|
+
return true;
|
|
241
|
+
},
|
|
242
|
+
initHIS(formatListResult) {
|
|
243
|
+
this.formatList = formatListResult ? formatListResult.list.filter(item => item.printmark == 1) : [];
|
|
244
|
+
this.currentFormatId = this.getDefaultFormatId(this.formatList, 'printmark');
|
|
245
|
+
this.templateParams = this.formatList[0] || {};
|
|
246
|
+
},
|
|
247
|
+
async initCRM(formatListResult) {
|
|
248
|
+
this.formatList = formatListResult ? this.formatFormatList(formatListResult.obj) : [];
|
|
249
|
+
this.currentFormatId = this.getDefaultFormatId(this.formatList, 'defaultFlag');
|
|
250
|
+
|
|
251
|
+
if (!this.currentFormatId) {
|
|
252
|
+
this.$message.error('获取打印格式失败,请联系管理员!');
|
|
253
|
+
return this.requestError();
|
|
254
|
+
}
|
|
255
|
+
if (!this.currentFormatId) {
|
|
256
|
+
this.requestError();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
let templateParamsResult = await this.queryTemplateParams();
|
|
260
|
+
|
|
261
|
+
if (templateParamsResult) {
|
|
262
|
+
this.templateParams = templateParamsResult;
|
|
263
|
+
} else {
|
|
264
|
+
return this.requestError();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this.printParams = this.formatParams(this.templateParams, this.params);
|
|
268
|
+
},
|
|
269
|
+
setTimeoutSpin() {
|
|
270
|
+
this.spinTimer = setTimeout(() => {
|
|
271
|
+
this.spinning = true;
|
|
272
|
+
}, 1500);
|
|
273
|
+
},
|
|
274
|
+
setLoaded() {
|
|
275
|
+
this.spinning = false;
|
|
276
|
+
if (!this.spinTimer) return false;
|
|
277
|
+
clearTimeout(this.spinTimer);
|
|
278
|
+
this.spinTimer = null;
|
|
279
|
+
},
|
|
280
|
+
requestError() {
|
|
281
|
+
this.isInited = false;
|
|
282
|
+
this.setLoaded();
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
this.visible = false;
|
|
285
|
+
}, 0);
|
|
286
|
+
|
|
287
|
+
return false;
|
|
288
|
+
},
|
|
289
|
+
getDefaultFormatId(list, key) {
|
|
290
|
+
if (!list?.length) return '';
|
|
291
|
+
let findDefault = list.find(item => item[key] == 1);
|
|
292
|
+
return findDefault?.id || list[0].id;
|
|
293
|
+
},
|
|
294
|
+
/* */
|
|
295
|
+
instantiatePrintSDK() {
|
|
296
|
+
if (printInstance) return false;
|
|
297
|
+
printInstance = new Print();
|
|
298
|
+
},
|
|
299
|
+
/* */
|
|
300
|
+
queryFormatList() {
|
|
301
|
+
const { templateNumber, authorizationKey, baseUrl, getPrintFormatByNumberUrl, versionType } = this;
|
|
302
|
+
const suffix = [1, 3].includes(versionType) ? `jsessionids=${vexutils.cookie.get('jsessionids') || '31e5fc0e-955f-4c89-9679-39c43d0171321636163291241'}` : `authorizationKey=${authorizationKey}`;
|
|
303
|
+
const url = `${baseUrl}${getPrintFormatByNumberUrl}?number=${templateNumber}&${suffix}`;
|
|
304
|
+
return httpFn
|
|
305
|
+
.get(url)
|
|
306
|
+
.then(async ({ data }) => {
|
|
307
|
+
if (data.result !== 'SUCCESS') {
|
|
308
|
+
this.$message.error(data.resultMsg || '参数异常,请联系管理员');
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
return data;
|
|
312
|
+
})
|
|
313
|
+
.catch(e => {
|
|
314
|
+
return false;
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
formatFormatList(list) {
|
|
318
|
+
let formatList = [];
|
|
319
|
+
|
|
320
|
+
list.forEach(item => {
|
|
321
|
+
if (!item.format) return false;
|
|
322
|
+
formatList.push(...item.format);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
return formatList;
|
|
326
|
+
},
|
|
327
|
+
/* */
|
|
328
|
+
queryTemplateParams() {
|
|
329
|
+
const { templateNumber, authorizationKey, baseUrl, getTemplateParamsUrl } = this;
|
|
330
|
+
const { templateId } = this.formatList[0] || {};
|
|
331
|
+
const url = `${baseUrl}${getTemplateParamsUrl}?number=${templateNumber}&templateId=${templateId}&authorizationKey=${authorizationKey}`;
|
|
332
|
+
|
|
333
|
+
return httpFn
|
|
334
|
+
.get(url)
|
|
335
|
+
.then(async ({ data }) => {
|
|
336
|
+
if (data.result !== 'SUCCESS') {
|
|
337
|
+
this.$message.error(data.resultMsg || '参数异常,请联系管理员');
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
return data?.obj || {};
|
|
341
|
+
})
|
|
342
|
+
.catch(e => {
|
|
343
|
+
return false;
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
formatDefaultVal(i, tableVal) {
|
|
347
|
+
let val = i.defaultValue || '';
|
|
348
|
+
let tVal = tableVal;
|
|
349
|
+
if (i.type === 'NUMBER') {
|
|
350
|
+
tVal = Number(tableVal) || 0;
|
|
351
|
+
}
|
|
352
|
+
if (i.type === 'DATE') {
|
|
353
|
+
tVal = tableVal ? moment(tableVal).format('YYYY-MM-DD') : '';
|
|
354
|
+
}
|
|
355
|
+
if (i.type === 'DATETIME') {
|
|
356
|
+
tVal = tableVal ? moment(tableVal).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return val ? val : tVal;
|
|
360
|
+
},
|
|
361
|
+
formatParams({ customizeDataset = [], param = [] }, params = []) {
|
|
362
|
+
return params.map(paramObj => {
|
|
363
|
+
let res = {};
|
|
364
|
+
|
|
365
|
+
// 自定义结果集
|
|
366
|
+
customizeDataset.forEach(dataSetItem => {
|
|
367
|
+
const selectFieldList = dataSetItem.dataSetting[0].selectFieldList;
|
|
368
|
+
res['datasetData'] = {
|
|
369
|
+
[dataSetItem.name]: JSON.stringify(this.formatPrintParams(paramObj, selectFieldList, 'fieldName'))
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// 参数
|
|
374
|
+
res = Object.assign({}, res, this.formatPrintParams(paramObj, param, 'key'));
|
|
375
|
+
return res;
|
|
376
|
+
});
|
|
377
|
+
},
|
|
378
|
+
reformatPrintParams() {
|
|
379
|
+
this.watchPrintParamsReformatFn && this.watchPrintParamsReformatFn();
|
|
380
|
+
/*
|
|
381
|
+
还没初始化完毕时(还没获取到模板格式配置等..)
|
|
382
|
+
触发再格式化逻辑,需等待初始化完毕,再重新执行格式化
|
|
383
|
+
*/
|
|
384
|
+
if (!this.isInited) {
|
|
385
|
+
this.watchPrintParamsReformatFn = this.$watch('isInited', val => {
|
|
386
|
+
if (!val) return false;
|
|
387
|
+
this.reformatPrintParams();
|
|
388
|
+
});
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
this.printParams = this.formatParams(this.templateParams, this.params);
|
|
393
|
+
},
|
|
394
|
+
formatPrintParams(paramObj, fieldList, keyName) {
|
|
395
|
+
const obj = {};
|
|
396
|
+
fieldList.forEach(i => {
|
|
397
|
+
let defaultVal = this.formatDefaultVal(i, paramObj[i[keyName]]);
|
|
398
|
+
if (paramObj[i[keyName]] && defaultVal) {
|
|
399
|
+
obj[i[keyName]] = defaultVal;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
return obj;
|
|
404
|
+
},
|
|
405
|
+
/* */
|
|
406
|
+
handleClickFormat(id) {
|
|
407
|
+
this.currentFormatId = id;
|
|
408
|
+
},
|
|
409
|
+
/* */
|
|
410
|
+
getPrintParams(index = 0) {
|
|
411
|
+
const params = this.printParams[index];
|
|
412
|
+
return JSON.stringify(params);
|
|
413
|
+
},
|
|
414
|
+
getTemplateIdByFormatId(id) {
|
|
415
|
+
let find = this.formatList.find(item => item.id === id);
|
|
416
|
+
return find.templateId;
|
|
417
|
+
},
|
|
418
|
+
getOnceParams() {
|
|
419
|
+
// 聚合一条
|
|
420
|
+
let params = {};
|
|
421
|
+
let obj = {};
|
|
422
|
+
if (this.templateParams?.customizeDataset?.length) {
|
|
423
|
+
// 有模板数据
|
|
424
|
+
const key = Object.keys(this.printParams[0]?.datasetData || {})?.[0] || '';
|
|
425
|
+
const datasetDataKeyVal = JSON.stringify(this.printParams.map(v => JSON.parse(v.datasetData[key])));
|
|
426
|
+
obj = {
|
|
427
|
+
datasetData: {}
|
|
428
|
+
};
|
|
429
|
+
obj.datasetData[key] = datasetDataKeyVal;
|
|
430
|
+
} else {
|
|
431
|
+
// 无模板数据
|
|
432
|
+
Object.keys(this.printParams[0]).forEach(v => {
|
|
433
|
+
obj[v] = [];
|
|
434
|
+
this.printParams.forEach(k => {
|
|
435
|
+
obj[v].push(k[v]);
|
|
436
|
+
});
|
|
437
|
+
obj[v] = obj[v].join(',');
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
params = Object.assign({}, JSON.parse(this.getPrintParams(0)), obj);
|
|
441
|
+
return JSON.stringify(params);
|
|
442
|
+
},
|
|
443
|
+
handleClickPrint(e) {
|
|
444
|
+
e.domEvent.stopPropagation();
|
|
445
|
+
let len = this.printParams.length;
|
|
446
|
+
const callLocalServicesSuccessCb = async data => {
|
|
447
|
+
try {
|
|
448
|
+
if (--len <= 0) {
|
|
449
|
+
this.callLocalServicesSuccessCb(data, 'print');
|
|
450
|
+
}
|
|
451
|
+
} catch (error) {
|
|
452
|
+
console.log('error', error);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
this.prevFn()
|
|
457
|
+
.catch(() => {
|
|
458
|
+
this.prevFnError();
|
|
459
|
+
return Promise.reject();
|
|
460
|
+
})
|
|
461
|
+
.then(() => {
|
|
462
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
463
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
|
|
464
|
+
if (this.strategy === 'MULTI') {
|
|
465
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
466
|
+
const params = this.getHisParams(i);
|
|
467
|
+
printInstance[printFn](7, params)
|
|
468
|
+
.then(res => {
|
|
469
|
+
console.log(res, '777777777777');
|
|
470
|
+
})
|
|
471
|
+
.catch(error => {
|
|
472
|
+
console.log(error, 'error777');
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
} else {
|
|
476
|
+
const params = this.getOnceHisParams();
|
|
477
|
+
printInstance[printFn](7, params)
|
|
478
|
+
.then(res => {
|
|
479
|
+
console.log(res, '777777777777');
|
|
480
|
+
})
|
|
481
|
+
.catch(error => {
|
|
482
|
+
console.log(error, 'error777');
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
} else {
|
|
486
|
+
if (this.strategy === 'MULTI') {
|
|
487
|
+
// 循环多条
|
|
488
|
+
for (let i = 0; i < this.printParams.length; i++) {
|
|
489
|
+
const queryParams = {
|
|
490
|
+
formatId: this.currentFormatId,
|
|
491
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
492
|
+
params: this.getPrintParams(i)
|
|
493
|
+
};
|
|
494
|
+
printInstance.printDirect(queryParams, callLocalServicesSuccessCb, this.callLocalServicesErrorCb);
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
// 聚合一条
|
|
498
|
+
const queryParams = {
|
|
499
|
+
formatId: this.currentFormatId,
|
|
500
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
501
|
+
params: this.getOnceParams()
|
|
502
|
+
};
|
|
503
|
+
printInstance.printDirect(
|
|
504
|
+
queryParams,
|
|
505
|
+
res => {
|
|
506
|
+
this.callLocalServicesSuccessCb(res, 'print');
|
|
507
|
+
},
|
|
508
|
+
this.callLocalServicesErrorCb
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
})
|
|
513
|
+
.finally(() => {
|
|
514
|
+
this.visible = false;
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
getHisParams(index = 0) {
|
|
518
|
+
const { templateParams, hisParams, params } = this;
|
|
519
|
+
const { reportid = '280' } = hisParams;
|
|
520
|
+
const { id, name } = templateParams;
|
|
521
|
+
return {
|
|
522
|
+
reportid,
|
|
523
|
+
formatid: this.currentFormatId || id,
|
|
524
|
+
formatname: name,
|
|
525
|
+
param: params[index]
|
|
526
|
+
};
|
|
527
|
+
},
|
|
528
|
+
getOnceHisParams() {
|
|
529
|
+
const { templateParams, hisParams, params } = this;
|
|
530
|
+
const { reportid = '280' } = hisParams;
|
|
531
|
+
const { id, name } = templateParams;
|
|
532
|
+
const obj = {}
|
|
533
|
+
Object.keys(params[0]).forEach(v => {
|
|
534
|
+
obj[v] = [];
|
|
535
|
+
params.forEach(k => {
|
|
536
|
+
obj[v].push(k[v]);
|
|
537
|
+
});
|
|
538
|
+
obj[v] = obj[v].join(',');
|
|
539
|
+
});
|
|
540
|
+
return {
|
|
541
|
+
reportid,
|
|
542
|
+
formatid: this.currentFormatId || id,
|
|
543
|
+
formatname: name,
|
|
544
|
+
param: obj
|
|
545
|
+
};
|
|
546
|
+
},
|
|
547
|
+
async handleClickPreview(e) {
|
|
548
|
+
e.domEvent.stopPropagation();
|
|
549
|
+
|
|
550
|
+
this.prevFn()
|
|
551
|
+
.catch(() => {
|
|
552
|
+
this.prevFnError();
|
|
553
|
+
return Promise.reject();
|
|
554
|
+
})
|
|
555
|
+
.then(() => {
|
|
556
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
557
|
+
const params = this.strategy === 'MULTI' ? this.getHisParams() : this.getOnceHisParams();
|
|
558
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
|
|
559
|
+
printInstance[printFn](8, params)
|
|
560
|
+
.then(res => {
|
|
561
|
+
console.log(res, 88888888);
|
|
562
|
+
})
|
|
563
|
+
.catch(error => {
|
|
564
|
+
console.log(error, 'error888');
|
|
565
|
+
});
|
|
566
|
+
} else {
|
|
567
|
+
const IS_MULTI = this.strategy === 'MULTI';
|
|
568
|
+
if(IS_MULTI){
|
|
569
|
+
// 循环多条
|
|
570
|
+
for (let i = 0; i < this.printParams.length; i++) {
|
|
571
|
+
const queryParams = {
|
|
572
|
+
formatId: this.currentFormatId,
|
|
573
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
574
|
+
params: this.getPrintParams(i)
|
|
575
|
+
};
|
|
576
|
+
printInstance.preview(
|
|
577
|
+
queryParams,
|
|
578
|
+
res => {
|
|
579
|
+
this.callLocalServicesSuccessCb(res, 'preview');
|
|
580
|
+
},
|
|
581
|
+
this.callLocalServicesErrorCb
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
const queryParams = {
|
|
586
|
+
formatId: this.currentFormatId,
|
|
587
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
588
|
+
params: this.getOnceParams()
|
|
589
|
+
};
|
|
590
|
+
printInstance.preview(
|
|
591
|
+
queryParams,
|
|
592
|
+
res => {
|
|
593
|
+
this.callLocalServicesSuccessCb(res, 'preview');
|
|
594
|
+
},
|
|
595
|
+
this.callLocalServicesErrorCb
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
})
|
|
600
|
+
.finally(() => {
|
|
601
|
+
this.visible = false;
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
handleClickEdit(e) {
|
|
605
|
+
e.domEvent.stopPropagation();
|
|
606
|
+
|
|
607
|
+
this.prevFn()
|
|
608
|
+
.catch(() => {
|
|
609
|
+
this.prevFnError();
|
|
610
|
+
return Promise.reject();
|
|
611
|
+
})
|
|
612
|
+
.then(() => {
|
|
613
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
614
|
+
const params = this.strategy === 'MULTI' ? this.getHisParams() : this.getOnceHisParams();
|
|
615
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
|
|
616
|
+
printInstance[printFn](9, params)
|
|
617
|
+
.then(res => {
|
|
618
|
+
console.log(res, 999999);
|
|
619
|
+
})
|
|
620
|
+
.catch(error => {
|
|
621
|
+
console.log(error, 'error999');
|
|
622
|
+
});
|
|
623
|
+
} else {
|
|
624
|
+
this.identityVerification.visible = true;
|
|
625
|
+
}
|
|
626
|
+
})
|
|
627
|
+
.finally(() => {
|
|
628
|
+
this.visible = false;
|
|
629
|
+
});
|
|
630
|
+
},
|
|
631
|
+
verifiySuccess(token) {
|
|
632
|
+
this.identityVerification.visible = false;
|
|
633
|
+
|
|
634
|
+
const queryParams = {
|
|
635
|
+
formatId: this.currentFormatId,
|
|
636
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
637
|
+
params: this.getPrintParams(),
|
|
638
|
+
token
|
|
639
|
+
};
|
|
640
|
+
printInstance.editPrintFormat(
|
|
641
|
+
queryParams,
|
|
642
|
+
res => {
|
|
643
|
+
this.callLocalServicesSuccessCb(res, 'edit');
|
|
644
|
+
},
|
|
645
|
+
this.callLocalServicesErrorCb
|
|
646
|
+
);
|
|
647
|
+
},
|
|
648
|
+
/* */
|
|
649
|
+
prevFnError() {
|
|
650
|
+
// 前置条件执行错误这里不弹提示,“前置条件”事件内有弹提示了
|
|
651
|
+
// let error = {
|
|
652
|
+
// message: '前置条件执行错误'
|
|
653
|
+
// };
|
|
654
|
+
// this.$emit('error', error);
|
|
655
|
+
},
|
|
656
|
+
/* */
|
|
657
|
+
callLocalServicesSuccessCb(res, type) {
|
|
658
|
+
let info = {
|
|
659
|
+
type,
|
|
660
|
+
formatId: this.currentFormatId,
|
|
661
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId)
|
|
662
|
+
};
|
|
663
|
+
this.$emit('success', res, info);
|
|
664
|
+
},
|
|
665
|
+
callLocalServicesErrorCb(res) {
|
|
666
|
+
this.$emit('error', res);
|
|
667
|
+
},
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* 获取 axios 自定义配置
|
|
671
|
+
*/
|
|
672
|
+
getCustomCofing(customCofing){
|
|
673
|
+
let cCofing = {}
|
|
674
|
+
let type = typeof customCofing;
|
|
675
|
+
if(type === 'function'){
|
|
676
|
+
cCofing = customCofing();
|
|
677
|
+
} else if(type === 'object'){
|
|
678
|
+
cCofing = customCofing;
|
|
679
|
+
}
|
|
680
|
+
return cCofing;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
</script>
|
|
685
|
+
|
|
686
|
+
<style lang="less" scoped>
|
|
687
|
+
.dropdown-button {
|
|
688
|
+
color: #212121;
|
|
689
|
+
border-color: #d5d5d5 !important;
|
|
690
|
+
margin-left: 8px;
|
|
691
|
+
margin-bottom: 8px;
|
|
692
|
+
/deep/ .svg-icon {
|
|
693
|
+
margin-right: 4px;
|
|
694
|
+
}
|
|
695
|
+
&.ant-dropdown-trigger {
|
|
696
|
+
i.anticon.anticon-down {
|
|
697
|
+
color: #969696;
|
|
698
|
+
font-size: 14px;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
</style>
|
|
703
|
+
|
|
704
|
+
<style lang="less">
|
|
705
|
+
.rowFoldHideBtnList-dropdown {
|
|
706
|
+
min-width: 150px !important;
|
|
707
|
+
.ant-dropdown-menu {
|
|
708
|
+
overflow-y: auto;
|
|
709
|
+
max-height: 99vh;
|
|
710
|
+
}
|
|
711
|
+
.ant-dropdown-menu-item-group {
|
|
712
|
+
.ant-dropdown-menu-item-group-title {
|
|
713
|
+
display: none;
|
|
714
|
+
}
|
|
715
|
+
border-bottom: 1px solid #d5d5d5;
|
|
716
|
+
&:last-child {
|
|
717
|
+
border-color: transparent;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
.format-name .ant-dropdown-menu-submenu-title {
|
|
721
|
+
font-weight: bold;
|
|
722
|
+
color: #000;
|
|
723
|
+
}
|
|
724
|
+
.ant-dropdown-menu-item.active {
|
|
725
|
+
color: #5585f5;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
</style>
|