cnhis-design-vue 2.1.14 → 2.1.15

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