cnhis-design-vue 2.1.141 → 2.1.144
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 +62 -21
- 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 +197 -157
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +2557 -255
- 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/card-reader-sdk/index.js +1 -1
- 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/direct/index.js +16 -16
- 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/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +291 -156
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +74 -74
- package/es/full-calendar/index.js +4 -4
- package/es/index/index.js +3827 -978
- 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 +76 -76
- package/es/multi-chat-client/index.js +70 -70
- 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 +22 -22
- 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-container/index.js +9 -9
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +23 -20
- package/es/select-person/style.css +1 -1
- package/es/select-tag/index.js +4 -4
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/slider-tree/index.js +9 -9
- 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 +8617 -5918
- 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 +3963 -1111
- package/lib/cui.umd.js +3963 -1111
- package/lib/cui.umd.min.js +68 -68
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +5 -4
- package/packages/big-table/src/utils/headerFilter.js +54 -18
- package/packages/button/src/ButtonPrint/index.vue +33 -689
- package/packages/button/src/ButtonPrint/js/print.es.min.js +1 -1
- package/packages/button/src/ButtonPrint/js/print.es.min1.js +1 -1
- package/packages/button/src/ButtonPrint/new.vue +1417 -0
- package/packages/button/src/ButtonPrint/old.vue +838 -0
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +175 -85
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +4 -3
- package/packages/fabric-chart/src/mixins/eventCommon.js +1 -1
- package/packages/select-person/select-person.vue +3 -0
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +21 -71
- package/packages/table-filter/src/mixins/printNew.js +184 -0
|
@@ -0,0 +1,1417 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="newprint-button-outer" ref='newprintButtonOuterRef' v-clickoutside="handleAllClickOutside">
|
|
3
|
+
<!-- 外部按钮集合 -->
|
|
4
|
+
<a-button-group>
|
|
5
|
+
<a-dropdown
|
|
6
|
+
:getPopupContainer="getPopupContainerNode"
|
|
7
|
+
v-for="outer in outerPrintItems"
|
|
8
|
+
:key="outer.key"
|
|
9
|
+
class="c-dropdown"
|
|
10
|
+
:trigger="dropOuter"
|
|
11
|
+
>
|
|
12
|
+
<a-button
|
|
13
|
+
class="operation-li"
|
|
14
|
+
style="display: flex;align-items: center;"
|
|
15
|
+
:disabled="!printParams[outer.templateCode]"
|
|
16
|
+
:loading="outer.isLoading"
|
|
17
|
+
@click="handleOneTypePrint(outer.templateCode, outer.templateId, outer.key, true)"
|
|
18
|
+
>
|
|
19
|
+
<a-icon type="printer" v-if="!outer.isLoading"/>
|
|
20
|
+
<span class="label" >{{ outer.label }}</span>
|
|
21
|
+
</a-button>
|
|
22
|
+
<template #overlay>
|
|
23
|
+
<a-menu>
|
|
24
|
+
<a-menu-item
|
|
25
|
+
class="operation-li"
|
|
26
|
+
v-for="operation in operations"
|
|
27
|
+
:key="operation.key"
|
|
28
|
+
@click="handleSelect(operation.key, outer)"
|
|
29
|
+
>
|
|
30
|
+
<span class="label" >{{ operation.label }}</span>
|
|
31
|
+
</a-menu-item>
|
|
32
|
+
</a-menu>
|
|
33
|
+
</template>
|
|
34
|
+
</a-dropdown>
|
|
35
|
+
</a-button-group>
|
|
36
|
+
|
|
37
|
+
<!-- 外显设置按钮 -->
|
|
38
|
+
<a-dropdown
|
|
39
|
+
v-if="outerPrintItems.length > 0 && outerPrintItems.length == options.length && isShowOutSettingBtn"
|
|
40
|
+
overlayClassName="newprint-button-menu"
|
|
41
|
+
:getPopupContainer="getPopupContainerNode"
|
|
42
|
+
id="dropdown-outer-setting-btn"
|
|
43
|
+
:visible="outSettingVisible"
|
|
44
|
+
:trigger="dropOperation"
|
|
45
|
+
>
|
|
46
|
+
<a-button @click="toggleSettingVisible('outSettingVisible')">
|
|
47
|
+
外显设置
|
|
48
|
+
<a-icon type="setting" />
|
|
49
|
+
</a-button>
|
|
50
|
+
<a-menu slot="overlay">
|
|
51
|
+
<a-menu-item
|
|
52
|
+
v-for="sItem in options"
|
|
53
|
+
:key="sItem.key"
|
|
54
|
+
class="dropdown-between operation-li"
|
|
55
|
+
>
|
|
56
|
+
<span class="label bold">{{ sItem.label }}</span>
|
|
57
|
+
<a-checkbox :checked="sItem.selected" @change="onSettingChange(sItem)">外显</a-checkbox>
|
|
58
|
+
</a-menu-item>
|
|
59
|
+
<a-menu-item class="print-divider"><a-divider /></a-menu-item>
|
|
60
|
+
<a-menu-item class="dropdown-between">
|
|
61
|
+
<a-button type="primary" size="small" @click="savePrintOutSetting('outSettingVisible')">保存</a-button>
|
|
62
|
+
<a-checkbox v-if="options && options.length > 1" :checked="isSelectedAll" @change="onSelectedAllChange">全选</a-checkbox>
|
|
63
|
+
</a-menu-item>
|
|
64
|
+
</a-menu>
|
|
65
|
+
</a-dropdown>
|
|
66
|
+
|
|
67
|
+
<!-- 打印全部按钮 -->
|
|
68
|
+
<a-button-group v-else>
|
|
69
|
+
<a-button style="display: flex;align-items: center;" :loading="this.spinning" @click.stop="printAllButtonClick">
|
|
70
|
+
<a-icon type="printer" v-if="!this.spinning"/>
|
|
71
|
+
{{ isShowPrintAllBtn ? '打印全部' : defaultFormatTitle ? defaultFormatTitle : btnText }}
|
|
72
|
+
</a-button>
|
|
73
|
+
<a-button
|
|
74
|
+
v-if="innerPrintItems.length == 0"
|
|
75
|
+
@click.stop="handleClickBtn"><a-icon type="down"/></a-button>
|
|
76
|
+
<a-dropdown v-else :visible="visible" :getPopupContainer="getPopupContainerNode" overlayClassName="newprint-button-menu" :trigger="dropOperation">
|
|
77
|
+
<a-button
|
|
78
|
+
@click.stop="handleClickBtn"><a-icon type="down"/></a-button>
|
|
79
|
+
<a-menu slot="overlay">
|
|
80
|
+
<a-menu-item
|
|
81
|
+
class="dropdown-between operation-li"
|
|
82
|
+
v-for="option in innerPrintItems"
|
|
83
|
+
:key="option.key"
|
|
84
|
+
>
|
|
85
|
+
<span class="label bold" :class="!printParams[option.templateCode] ? 'isDisabled' : ''" @click="handleOneTypePrint(option.templateCode, option.templateId, option.key, true)"><a-icon type="loading" v-if="option.isLoading" style="margin-right: 6px;"/>{{ option.label }} </span>
|
|
86
|
+
<a-dropdown :getPopupContainer="getPopupContainerNode" :trigger="dropOperation">
|
|
87
|
+
<!-- 点击唤起操作弹窗 -->
|
|
88
|
+
<span class="operation-icon" style="margin-left: 8px;"><a-icon type="right" /></span>
|
|
89
|
+
|
|
90
|
+
<a-menu slot="overlay">
|
|
91
|
+
<a-menu-item
|
|
92
|
+
class="operation-li"
|
|
93
|
+
v-for="operation in operations"
|
|
94
|
+
:key="operation.key"
|
|
95
|
+
@click="handleSelect(operation.key, option)"
|
|
96
|
+
>
|
|
97
|
+
<span class="label">{{ operation.label }}</span>
|
|
98
|
+
</a-menu-item>
|
|
99
|
+
</a-menu>
|
|
100
|
+
</a-dropdown>
|
|
101
|
+
</a-menu-item>
|
|
102
|
+
<!-- 分割线 -->
|
|
103
|
+
<a-menu-item v-if="isShowOutSettingBtn" class="print-divider"><a-divider /></a-menu-item>
|
|
104
|
+
<!-- 外显设置 -->
|
|
105
|
+
<a-menu-item class="operation-li" v-if="isShowOutSettingBtn">
|
|
106
|
+
<a-dropdown :visible="innerSettingVisible" :trigger="dropOperation" :getPopupContainer="getPopupContainerNode" overlayClassName="newprint-button-menu">
|
|
107
|
+
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;" @click="toggleSettingVisible('innerSettingVisible')">
|
|
108
|
+
<span class="label bold" style="margin-right: 12px;">外显设置 </span>
|
|
109
|
+
<a-icon type="setting" :class='outerPrintItems.length > 0 ? "hasOuterItem":""'/>
|
|
110
|
+
</div>
|
|
111
|
+
<a-menu slot="overlay">
|
|
112
|
+
<a-menu-item
|
|
113
|
+
class="dropdown-between operation-li"
|
|
114
|
+
v-for="sItem in options"
|
|
115
|
+
:key="sItem.key"
|
|
116
|
+
>
|
|
117
|
+
<span class="label bold"> {{ sItem.label }} </span>
|
|
118
|
+
<a-checkbox :checked="sItem.selected" @change="onSettingChange(sItem)">外显</a-checkbox>
|
|
119
|
+
</a-menu-item>
|
|
120
|
+
<!-- 分割线 -->
|
|
121
|
+
<a-menu-item class="print-divider"><a-divider /></a-menu-item>
|
|
122
|
+
<a-menu-item class="dropdown-between">
|
|
123
|
+
<a-button type="primary" size="small" @click="savePrintOutSetting('innerSettingVisible')">保存</a-button>
|
|
124
|
+
<a-checkbox v-if="options && options.length > 1" :checked="isSelectedAll" @change="onSelectedAllChange">全选</a-checkbox>
|
|
125
|
+
</a-menu-item>
|
|
126
|
+
</a-menu>
|
|
127
|
+
</a-dropdown>
|
|
128
|
+
</a-menu-item>
|
|
129
|
+
</a-menu>
|
|
130
|
+
</a-dropdown>
|
|
131
|
+
</a-button-group>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<IdentityVerification
|
|
135
|
+
:printConfig="printConfig"
|
|
136
|
+
:baseUrl="baseUrl"
|
|
137
|
+
:verifyUserUrl="verifyUserUrl"
|
|
138
|
+
:visible.sync="identityVerification.visible"
|
|
139
|
+
:identityVerificationTitle="identityVerificationTitle"
|
|
140
|
+
:authorizationKey="authorizationKey"
|
|
141
|
+
@success="verifiySuccess"
|
|
142
|
+
></IdentityVerification>
|
|
143
|
+
</div>
|
|
144
|
+
</template>
|
|
145
|
+
<script>
|
|
146
|
+
/**
|
|
147
|
+
* @author ruanlin
|
|
148
|
+
* @desc 全继承antd按钮组件,后期再扩展
|
|
149
|
+
* @time 2021-06-08
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
let httpFn = null;
|
|
153
|
+
import Print from './js/print.es.min';
|
|
154
|
+
import IdentityVerification from './components/IdentityVerification';
|
|
155
|
+
import Clickoutside from '@/utils/clickoutside';
|
|
156
|
+
import Vue from 'vue';
|
|
157
|
+
import { Button, Dropdown, Menu, Icon, Divider, Checkbox, Popover } from 'ant-design-vue';
|
|
158
|
+
import create from '@/core/create';
|
|
159
|
+
import axios from 'axios';
|
|
160
|
+
import moment from 'moment';
|
|
161
|
+
import vexutils from '@/utils/vexutils';
|
|
162
|
+
|
|
163
|
+
const downloadPdfCode = 'RY7.2.21.1.M2.G94181E';
|
|
164
|
+
const formatEditTextCode = 'RY7.2.21.1.M2.G33633A';
|
|
165
|
+
export default create({
|
|
166
|
+
name: 'button-print',
|
|
167
|
+
components: {
|
|
168
|
+
IdentityVerification
|
|
169
|
+
},
|
|
170
|
+
directives: { Clickoutside },
|
|
171
|
+
props: {
|
|
172
|
+
baseUrl: {
|
|
173
|
+
type: String
|
|
174
|
+
},
|
|
175
|
+
/* */
|
|
176
|
+
btnText: {
|
|
177
|
+
type: String,
|
|
178
|
+
default: '打印'
|
|
179
|
+
},
|
|
180
|
+
printText: {
|
|
181
|
+
type: String,
|
|
182
|
+
default: '直接打印'
|
|
183
|
+
},
|
|
184
|
+
previewText: {
|
|
185
|
+
type: String,
|
|
186
|
+
default: '打印预览'
|
|
187
|
+
},
|
|
188
|
+
pdfLoadText: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: '下载pdf'
|
|
191
|
+
},
|
|
192
|
+
formatEditText: {
|
|
193
|
+
type: String,
|
|
194
|
+
default: '格式编辑'
|
|
195
|
+
},
|
|
196
|
+
identityVerificationTitle: {
|
|
197
|
+
type: String,
|
|
198
|
+
default: '打印服务身份校验'
|
|
199
|
+
},
|
|
200
|
+
/* */
|
|
201
|
+
authorizationKey: {
|
|
202
|
+
type: String,
|
|
203
|
+
require: true
|
|
204
|
+
},
|
|
205
|
+
templateNumber: {
|
|
206
|
+
type: [Number, String],
|
|
207
|
+
require: true
|
|
208
|
+
},
|
|
209
|
+
/* 格式化打印参数,需的原始数据 */
|
|
210
|
+
params: {
|
|
211
|
+
type: Array
|
|
212
|
+
},
|
|
213
|
+
hisParams: {
|
|
214
|
+
type: Object
|
|
215
|
+
},
|
|
216
|
+
/* */
|
|
217
|
+
prevFn: {
|
|
218
|
+
type: Function,
|
|
219
|
+
default() {
|
|
220
|
+
return Promise.resolve();
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
/** */
|
|
224
|
+
verifyUserUrl: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: '/verifyUser'
|
|
227
|
+
},
|
|
228
|
+
/** */
|
|
229
|
+
getPrintFormatByNumberUrl: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: '/getPrintFormatByNumber'
|
|
232
|
+
},
|
|
233
|
+
/** */
|
|
234
|
+
getTemplateParamsUrl: {
|
|
235
|
+
type: String,
|
|
236
|
+
default: '/getTemplateParams'
|
|
237
|
+
},
|
|
238
|
+
/* 打印策略,默认多条打印 */
|
|
239
|
+
strategy: {
|
|
240
|
+
type: String,
|
|
241
|
+
default: 'MULTI'
|
|
242
|
+
},
|
|
243
|
+
printConfig: {
|
|
244
|
+
type: Object,
|
|
245
|
+
default: () => ({})
|
|
246
|
+
},
|
|
247
|
+
// 1 为his老版,2 为新版 3为his更老版本
|
|
248
|
+
versionType: { type: [Number, String], default: '2' },
|
|
249
|
+
// 用于获取用户信息的token
|
|
250
|
+
token: {
|
|
251
|
+
type: String,
|
|
252
|
+
default: ''
|
|
253
|
+
},
|
|
254
|
+
// 打印弹窗设置,1弹0不弹,默认不弹
|
|
255
|
+
printdlgshow: {
|
|
256
|
+
type: [String, Number],
|
|
257
|
+
default: '0'
|
|
258
|
+
},
|
|
259
|
+
// 没有模板提示
|
|
260
|
+
noformatTips: {
|
|
261
|
+
type: String,
|
|
262
|
+
default: ''
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
getOnceParamsAfter: {
|
|
266
|
+
type: Function
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
getPrintParamsAfter: {
|
|
270
|
+
type: Function
|
|
271
|
+
},
|
|
272
|
+
// 隐藏默认按钮配置。printText: 直接打印;previewText: 打印预览;downloadPdf:下载pdf;formatEditText:格式编辑。示例:hideButtons = ['formatEditText']
|
|
273
|
+
hideButtons: {
|
|
274
|
+
type: Array,
|
|
275
|
+
default: () => []
|
|
276
|
+
},
|
|
277
|
+
// 新版打印配置(新)
|
|
278
|
+
newPrintSetting: {
|
|
279
|
+
type: Object,
|
|
280
|
+
default: () => ({
|
|
281
|
+
// 是否显示打印全部
|
|
282
|
+
isShowPrintAll: true,
|
|
283
|
+
// 是否展示外显设置
|
|
284
|
+
isShowOutSetting: true,
|
|
285
|
+
// 打印自定义属性
|
|
286
|
+
customProps: {},
|
|
287
|
+
// 外显打印(formatId)值集合,用于初始化展示外显按钮
|
|
288
|
+
outerPrintKeys: [],
|
|
289
|
+
// 默认需要打印的格式(formatId)
|
|
290
|
+
defaultFormatId: ''
|
|
291
|
+
})
|
|
292
|
+
},
|
|
293
|
+
// 获取模板数据(新)
|
|
294
|
+
printFormatByNumberData: {
|
|
295
|
+
type: Object,
|
|
296
|
+
default: () => (null)
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
computed: {
|
|
300
|
+
currentFormatItem() {
|
|
301
|
+
if (!this.currentFormatId) return {};
|
|
302
|
+
let id = this.currentFormatId;
|
|
303
|
+
return this.formatList.find(item => item.id === id);
|
|
304
|
+
},
|
|
305
|
+
formatTitle() {
|
|
306
|
+
return this.currentFormatItem?.name || '格式选择';
|
|
307
|
+
},
|
|
308
|
+
printExtraParams() {
|
|
309
|
+
return this?.printConfig?.printExtraParams || {};
|
|
310
|
+
},
|
|
311
|
+
queryParams() {
|
|
312
|
+
return {
|
|
313
|
+
formatId: this.currentFormatId,
|
|
314
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId)
|
|
315
|
+
};
|
|
316
|
+
},
|
|
317
|
+
// 是否展示全部打印按钮
|
|
318
|
+
isShowPrintAllBtn() {
|
|
319
|
+
return this.newPrintSetting?.isShowPrintAll;
|
|
320
|
+
},
|
|
321
|
+
// 是否展示外显设置
|
|
322
|
+
isShowOutSettingBtn() {
|
|
323
|
+
return this.newPrintSetting?.isShowOutSetting;
|
|
324
|
+
},
|
|
325
|
+
// 打印自定义属性
|
|
326
|
+
printCustomProps() {
|
|
327
|
+
return this.newPrintSetting?.customProps || {};
|
|
328
|
+
},
|
|
329
|
+
// 默认打印的formatId
|
|
330
|
+
defaultPrintFormatId() {
|
|
331
|
+
let dFormatId = this.newPrintSetting?.defaultFormatId || ''
|
|
332
|
+
// 如果在内显中没有找到对应项,则返回空
|
|
333
|
+
const isFindInnerItem = this.innerPrintItems.find(item => item.key == dFormatId)
|
|
334
|
+
if (!isFindInnerItem) {
|
|
335
|
+
dFormatId = '';
|
|
336
|
+
}
|
|
337
|
+
// 如果为空时,再去看当前下拉项中是否只有一项
|
|
338
|
+
if (!dFormatId) {
|
|
339
|
+
if (this.innerPrintItems.length == 1) {
|
|
340
|
+
return this.innerPrintItems[0]?.key;
|
|
341
|
+
}
|
|
342
|
+
return '';
|
|
343
|
+
}
|
|
344
|
+
return dFormatId;
|
|
345
|
+
},
|
|
346
|
+
isSelectedAll() {
|
|
347
|
+
return this.options.every(option => option.selected);
|
|
348
|
+
},
|
|
349
|
+
// 设置默认format的标题
|
|
350
|
+
defaultFormatTitle() {
|
|
351
|
+
const curFormat = this.innerPrintItems.find(option => option.key == this.defaultPrintFormatId);
|
|
352
|
+
if (curFormat) {
|
|
353
|
+
return `打印${curFormat.label}`;
|
|
354
|
+
}
|
|
355
|
+
// 如果innerPrintItems长度只有一项,则默认选中它
|
|
356
|
+
if (this.innerPrintItems.length == 1) {
|
|
357
|
+
return `打印${this.innerPrintItems[0].label}`;
|
|
358
|
+
}
|
|
359
|
+
return ''
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
data() {
|
|
363
|
+
return {
|
|
364
|
+
spinning: false,
|
|
365
|
+
visible: false,
|
|
366
|
+
// 内部设置弹窗的展示状态
|
|
367
|
+
innerSettingVisible: false,
|
|
368
|
+
// 外部设置弹窗展示状态
|
|
369
|
+
outSettingVisible: false,
|
|
370
|
+
formatList: [],
|
|
371
|
+
templateParams: {},
|
|
372
|
+
// 打印参数汇总
|
|
373
|
+
printParams: [],
|
|
374
|
+
// 原始参数汇总
|
|
375
|
+
originParams: [],
|
|
376
|
+
currentFormatId: '',
|
|
377
|
+
/* */
|
|
378
|
+
identityVerification: {
|
|
379
|
+
visible: false
|
|
380
|
+
},
|
|
381
|
+
isInited: false,
|
|
382
|
+
watchPrintParamsReformatFn: null,
|
|
383
|
+
spinTimer: null,
|
|
384
|
+
printInstance: null,
|
|
385
|
+
dropOperation: ['click'],
|
|
386
|
+
dropOuter: ['hover'],
|
|
387
|
+
// 内显打印项
|
|
388
|
+
innerPrintItems: [],
|
|
389
|
+
// 外显打印项
|
|
390
|
+
outerPrintItems: [],
|
|
391
|
+
// 下拉数据
|
|
392
|
+
options: [],
|
|
393
|
+
// 操作按钮集合
|
|
394
|
+
operations: [
|
|
395
|
+
{
|
|
396
|
+
label: this.previewText, // 打印预览
|
|
397
|
+
key: 'previewText'
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
label: this.pdfLoadText, // 下载pdf
|
|
401
|
+
key: 'downloadPdf'
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
label: this.formatEditText, // 格式编辑
|
|
405
|
+
key: 'formatEditText'
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
label: '重置打印机', // 重置打印机
|
|
409
|
+
key: 'resetPrinter'
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
// 当前打印参数列表
|
|
413
|
+
curPrintParamList: [],
|
|
414
|
+
// 当前是否为点击单个打印
|
|
415
|
+
isClickSinglePrint: false
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
beforeCreate() {
|
|
419
|
+
Vue.use(Button)
|
|
420
|
+
.use(Dropdown)
|
|
421
|
+
.use(Menu)
|
|
422
|
+
.use(Icon)
|
|
423
|
+
.use(Divider)
|
|
424
|
+
.use(Checkbox)
|
|
425
|
+
.use(Popover)
|
|
426
|
+
},
|
|
427
|
+
mounted() {
|
|
428
|
+
this.isInited = false;
|
|
429
|
+
},
|
|
430
|
+
beforeDestroy() {
|
|
431
|
+
// 创建Print实例的时候会在webview中注册一个事件, 需要调用printInstance.destroy()手动清除
|
|
432
|
+
this.printInstance?.destroy?.();
|
|
433
|
+
this.printInstance = null;
|
|
434
|
+
},
|
|
435
|
+
watch: {
|
|
436
|
+
// 监听变化, 重新格式化printParams
|
|
437
|
+
params: {
|
|
438
|
+
deep: true,
|
|
439
|
+
immediate: true,
|
|
440
|
+
handler(val) {
|
|
441
|
+
// if (!val?.length) return false;
|
|
442
|
+
const keys = Object.keys(this.templateParams);
|
|
443
|
+
if (keys?.length > 0) {
|
|
444
|
+
this.reformatPrintParams();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
newPrintSetting: {
|
|
449
|
+
immediate: true,
|
|
450
|
+
async handler(val) {
|
|
451
|
+
const keys = val?.outerPrintKeys || [];
|
|
452
|
+
const defFormatId = val?.defaultFormatId || '';
|
|
453
|
+
// if (keys.length > 0 || defFormatId) {}
|
|
454
|
+
// 解决innerPrintItems只有一项的时候也要默认选中的问题,初始化执行一次即可
|
|
455
|
+
await this.handleClickBtn(false, true);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
methods: {
|
|
460
|
+
getPopupContainerNode() {
|
|
461
|
+
// const node = document.getElementById('newprint-button-outer');
|
|
462
|
+
return this.$refs.newprintButtonOuterRef;
|
|
463
|
+
},
|
|
464
|
+
// 重置所有的弹窗
|
|
465
|
+
handleAllClickOutside() {
|
|
466
|
+
this.outSettingVisible = this.innerSettingVisible = this.visible = false;
|
|
467
|
+
},
|
|
468
|
+
// 外显勾选
|
|
469
|
+
onSettingChange(sItem) {
|
|
470
|
+
sItem.selected = !sItem.selected;
|
|
471
|
+
},
|
|
472
|
+
// 勾选(取消勾选)全部
|
|
473
|
+
onSelectedAllChange(e) {
|
|
474
|
+
const isChecked = e.target.checked;
|
|
475
|
+
this.options.forEach(option => {
|
|
476
|
+
option.selected = isChecked;
|
|
477
|
+
})
|
|
478
|
+
},
|
|
479
|
+
async printAllButtonClick() {
|
|
480
|
+
// 如果显示打印全部按钮,直接打印全部;否则如果配置了默认格式,则打印默认格式,否则直接下拉
|
|
481
|
+
this.isShowPrintAllBtn ? await this.directPrint() : this.defaultPrintFormatId ? await this.directDefaultFormatPrint(this.defaultPrintFormatId) : await this.handleClickBtn();
|
|
482
|
+
},
|
|
483
|
+
// 打印全部
|
|
484
|
+
async directPrint() {
|
|
485
|
+
await this.handleClickBtn(false);
|
|
486
|
+
this.handleClickPrintAll();
|
|
487
|
+
},
|
|
488
|
+
// 打印全部
|
|
489
|
+
handleClickPrintAll() {
|
|
490
|
+
const templateNumbers = Object.keys(this.printParams);
|
|
491
|
+
this.isClickSinglePrint = false;
|
|
492
|
+
const originParamsClone = this.originParams;
|
|
493
|
+
for (let i = 0; i < templateNumbers.length; i++) {
|
|
494
|
+
const templateCode = templateNumbers[i];
|
|
495
|
+
const tmpParam = this.printParams[templateCode];
|
|
496
|
+
const printToParam = originParamsClone[templateCode] || [];
|
|
497
|
+
// 一个templateCode可能会对应多个类型
|
|
498
|
+
const formatTypeList = this.formatList.filter((format) => format.number == templateCode);
|
|
499
|
+
if (formatTypeList && formatTypeList.length > 0) {
|
|
500
|
+
formatTypeList.forEach(format => {
|
|
501
|
+
this.currentFormatId = format.id;
|
|
502
|
+
this.handleClickPrint(tmpParam, format.number, format.templateId, format.id, printToParam, true);
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
// 打印默认模板格式
|
|
508
|
+
async directDefaultFormatPrint(defaultFormatId) {
|
|
509
|
+
await this.handleClickBtn(false);
|
|
510
|
+
const curFormat = this.innerPrintItems.find(option => option.key == defaultFormatId);
|
|
511
|
+
if (curFormat) {
|
|
512
|
+
this.handleOneTypePrint(curFormat.templateCode, curFormat.templateId, curFormat.key, false);
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
// 点击某类型打印
|
|
516
|
+
handleOneTypePrint(templateCode, templateId, formatId, isSingleClick) {
|
|
517
|
+
const tmpParam = this.printParams[templateCode];
|
|
518
|
+
// 当前模板下没有传入打印的数据
|
|
519
|
+
if (!tmpParam) return;
|
|
520
|
+
this.isClickSinglePrint = isSingleClick;
|
|
521
|
+
this.currentFormatId = formatId;
|
|
522
|
+
const printToParam = this.originParams[templateCode] || [];
|
|
523
|
+
this.handleClickPrint(tmpParam, templateCode, templateId, formatId, printToParam);
|
|
524
|
+
},
|
|
525
|
+
toggleSettingVisible(key) {
|
|
526
|
+
this[key] = !this[key];
|
|
527
|
+
},
|
|
528
|
+
// 修改设置
|
|
529
|
+
savePrintOutSetting(key) {
|
|
530
|
+
this.visible = false;
|
|
531
|
+
this[key] = false;
|
|
532
|
+
this.innerPrintItems = this.options.filter(option => !option.selected);
|
|
533
|
+
this.outerPrintItems = this.options.filter(option => option.selected);
|
|
534
|
+
this.$emit('saveOuterPrint', this.outerPrintItems);
|
|
535
|
+
},
|
|
536
|
+
handleSelect(type, { templateCode, templateId, key }) {
|
|
537
|
+
const tmpParam = this.printParams[templateCode];
|
|
538
|
+
// 当前模板下没有传入打印的数据
|
|
539
|
+
if (!tmpParam) return;
|
|
540
|
+
this.isClickSinglePrint = true;
|
|
541
|
+
this.currentFormatId = key;
|
|
542
|
+
switch (type) {
|
|
543
|
+
// 打印预览
|
|
544
|
+
case 'previewText':
|
|
545
|
+
this.handleClickPreview(tmpParam, templateCode, templateId, key);
|
|
546
|
+
break;
|
|
547
|
+
// 格式编辑
|
|
548
|
+
case 'formatEditText':
|
|
549
|
+
this.handleClickEdit(tmpParam, templateCode, templateId, key);
|
|
550
|
+
break;
|
|
551
|
+
// 下载pdf
|
|
552
|
+
case 'downloadPdf':
|
|
553
|
+
this.handleClickPdf(tmpParam, templateCode, templateId, key);
|
|
554
|
+
break;
|
|
555
|
+
// 重置打印机
|
|
556
|
+
case 'resetPrinter':
|
|
557
|
+
this.handleResetPrinter(tmpParam, templateCode, templateId, key);
|
|
558
|
+
break;
|
|
559
|
+
default:
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
// 重置打印机
|
|
564
|
+
async handleResetPrinter(curPrintParamList=[], templateCode, templateId, formatId) {
|
|
565
|
+
if (this.getCurrentLoading()) return;
|
|
566
|
+
this.toggleExpandLoading(true, formatId);
|
|
567
|
+
const data = await this.printInstance.resetPrinter(formatId);
|
|
568
|
+
this.toggleExpandLoading(false);
|
|
569
|
+
if (data?.result == 'success') {
|
|
570
|
+
this.$message.success(data.message || '重置打印机成功');
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.$message.warning('重置打印机失败');
|
|
574
|
+
},
|
|
575
|
+
/* visible为true时,展示下拉 */
|
|
576
|
+
async handleClickBtn(visible = true, isNoPopup = false) {
|
|
577
|
+
if (!this.visible) {
|
|
578
|
+
let result = await this.init(isNoPopup);
|
|
579
|
+
if (!result) return false;
|
|
580
|
+
}
|
|
581
|
+
if (visible) {
|
|
582
|
+
this.visible = !this.visible;
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
/* isNoPopup:是否需要弹出获取打印格式失败,请联系管理员的提示 */
|
|
586
|
+
async init(isNoPopup = false) {
|
|
587
|
+
if (this.isInited) return true;
|
|
588
|
+
this.isInited = true;
|
|
589
|
+
|
|
590
|
+
this.setTimeoutSpin();
|
|
591
|
+
|
|
592
|
+
this.instantiatePrintSDK();
|
|
593
|
+
let config = {
|
|
594
|
+
withCredentials: false,
|
|
595
|
+
timeout: 5000
|
|
596
|
+
};
|
|
597
|
+
let printUrlPrefix = this?.printConfig?.printUrlPrefix;
|
|
598
|
+
let customCofing = this?.printConfig?.customCofing || {};
|
|
599
|
+
let cCofing = this.getCustomCofing(customCofing);
|
|
600
|
+
if (axios !== this.axios && printUrlPrefix) {
|
|
601
|
+
config.baseURL = printUrlPrefix;
|
|
602
|
+
}
|
|
603
|
+
httpFn = axios.create({
|
|
604
|
+
...config,
|
|
605
|
+
...cCofing
|
|
606
|
+
});
|
|
607
|
+
let formatListResult = null;
|
|
608
|
+
if (this.printFormatByNumberData) {
|
|
609
|
+
formatListResult = this.printFormatByNumberData;
|
|
610
|
+
} else {
|
|
611
|
+
formatListResult = await this.queryFormatList();
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// 获取模板参数接口
|
|
615
|
+
if (!formatListResult) {
|
|
616
|
+
this.isInited = false;
|
|
617
|
+
this.$message.error('获取模板参数失败,请联系管理员');
|
|
618
|
+
return false
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (!isNoPopup && (!formatListResult?.obj || formatListResult?.obj?.length == 0)) {
|
|
622
|
+
this.options = [];
|
|
623
|
+
this.$message.error(this.noformatTips || '获取打印格式失败,请联系管理员!');
|
|
624
|
+
return this.requestError();
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
628
|
+
this.initHIS(formatListResult);
|
|
629
|
+
} else {
|
|
630
|
+
await this.initCRM(formatListResult, isNoPopup);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
this.isInited = false;
|
|
634
|
+
this.setLoaded();
|
|
635
|
+
|
|
636
|
+
return true;
|
|
637
|
+
},
|
|
638
|
+
// 设置基础数据
|
|
639
|
+
setOptions() {
|
|
640
|
+
this.options = [];
|
|
641
|
+
const children = this.formatList.map(v => {
|
|
642
|
+
return {
|
|
643
|
+
templateCode: v.number,
|
|
644
|
+
templateId: v.templateId,
|
|
645
|
+
label: v.name,
|
|
646
|
+
key: v.id,
|
|
647
|
+
selected: false,
|
|
648
|
+
isLoading: false
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
this.options.unshift(...children);
|
|
652
|
+
|
|
653
|
+
// 自动设置外显的数据
|
|
654
|
+
if (this.newPrintSetting?.outerPrintKeys?.length > 0) {
|
|
655
|
+
this.options.forEach(option => {
|
|
656
|
+
if (this.newPrintSetting?.outerPrintKeys.includes(option.key)) {
|
|
657
|
+
option.selected = true;
|
|
658
|
+
}
|
|
659
|
+
})
|
|
660
|
+
this.outerPrintItems = this.options.filter(option => option.selected);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
this.innerPrintItems = this.options.filter(option => !option.selected);
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
// 1、通过业务传入的参数hideButtons隐藏按钮
|
|
667
|
+
if (this.hideButtons.length > 0) {
|
|
668
|
+
this.operations = this.operations.filter(operation => !this.hideButtons.includes(operation.key));
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// 2、通过全局缓存portal隐藏按钮
|
|
672
|
+
const portalStr = sessionStorage.getItem('portal');
|
|
673
|
+
if (portalStr) {
|
|
674
|
+
const portal = JSON.parse(portalStr);
|
|
675
|
+
const limitObj = portal?.user?.currentRoleResourceObj || {};
|
|
676
|
+
const limitList = Object.keys(limitObj);
|
|
677
|
+
console.log('limitList>>>', limitList);
|
|
678
|
+
|
|
679
|
+
// 下载pdf全局控制
|
|
680
|
+
if (!limitList.includes(downloadPdfCode)) {
|
|
681
|
+
this.operations = this.operations.filter(option => option.key != 'downloadPdf');
|
|
682
|
+
}
|
|
683
|
+
// 格式编辑按钮全局控制
|
|
684
|
+
if (!limitList.includes(formatEditTextCode)) {
|
|
685
|
+
this.operations = this.operations.filter(option => option.key != 'formatEditText');
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
initHIS(formatListResult) {
|
|
690
|
+
this.formatList = formatListResult ? formatListResult.list.filter(item => item.printmark == 1) : [];
|
|
691
|
+
this.currentFormatId = this.getDefaultFormatId(this.formatList, 'printmark');
|
|
692
|
+
this.templateParams = this.formatList[0] || {};
|
|
693
|
+
},
|
|
694
|
+
async initCRM(formatListResult, isNoPopup) {
|
|
695
|
+
this.formatList = formatListResult ? this.formatFormatList(formatListResult.obj) : [];
|
|
696
|
+
// this.currentFormatId = this.getDefaultFormatId(this.formatList, 'defaultFlag');
|
|
697
|
+
|
|
698
|
+
if (!isNoPopup && this.formatList.length == 0) {
|
|
699
|
+
this.options = [];
|
|
700
|
+
this.$message.error(this.noformatTips || '获取打印格式失败,请联系管理员!');
|
|
701
|
+
return this.requestError();
|
|
702
|
+
}
|
|
703
|
+
// if (!this.currentFormatId) {
|
|
704
|
+
// this.$message.error(this.noformatTips || '获取打印格式失败,请联系管理员!');
|
|
705
|
+
// return this.requestError();
|
|
706
|
+
// }
|
|
707
|
+
// if (!this.currentFormatId) {
|
|
708
|
+
// this.requestError();
|
|
709
|
+
// return;
|
|
710
|
+
// }
|
|
711
|
+
// 如果第一遍已经请求到格式数据,则不需要再拼接数据(防止让已勾选的外显selected重置)
|
|
712
|
+
if (this.options.length > 0) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
this.setOptions();
|
|
716
|
+
|
|
717
|
+
// this.templateParams = await this.queryTemplateParams();
|
|
718
|
+
this.templateParams = await this.mergeTemplateList(formatListResult.obj);
|
|
719
|
+
|
|
720
|
+
// if (templateParamsResult) {
|
|
721
|
+
// this.templateParams = templateParamsResult;
|
|
722
|
+
// } else {
|
|
723
|
+
// return this.requestError();
|
|
724
|
+
// }
|
|
725
|
+
|
|
726
|
+
// this.printParams = this.formatParams(this.templateParams, this.params);
|
|
727
|
+
this.printParams = this.formatSomeTypeParams(this.templateParams, this.params);
|
|
728
|
+
this.originParams = this.formatSomeOriginParams(this.templateParams, this.params);
|
|
729
|
+
},
|
|
730
|
+
formatSomeTypeParams(templateParams=[], params= []) {
|
|
731
|
+
let mergeParams = {};
|
|
732
|
+
params = params ? params : [];
|
|
733
|
+
params.forEach(paramObj => {
|
|
734
|
+
mergeParams = Object.assign({}, this.findTemplateAndInsertData(mergeParams, paramObj, templateParams));
|
|
735
|
+
});
|
|
736
|
+
return mergeParams;
|
|
737
|
+
},
|
|
738
|
+
// 格式化原始params映射值
|
|
739
|
+
formatSomeOriginParams(templateParams=[], params=[]) {
|
|
740
|
+
let mergeOriginParams = {};
|
|
741
|
+
params = params ? params : [];
|
|
742
|
+
params.forEach(paramObj => {
|
|
743
|
+
mergeOriginParams = Object.assign({}, this.findTemplateAndInsertParams(mergeOriginParams, paramObj, templateParams));
|
|
744
|
+
});
|
|
745
|
+
return mergeOriginParams;
|
|
746
|
+
},
|
|
747
|
+
// 查找模板并插入数据
|
|
748
|
+
findTemplateAndInsertData(mergeData, paramItem, templateParams) {
|
|
749
|
+
// 判断当前数据有没有指定模板
|
|
750
|
+
// 1. 有模板,则插入数据
|
|
751
|
+
if (paramItem.templateNumbers) {
|
|
752
|
+
for (let i = 0; i < paramItem.templateNumbers.length; i++) {
|
|
753
|
+
const tempNumber = paramItem.templateNumbers[i];
|
|
754
|
+
const templateObj = templateParams[tempNumber];
|
|
755
|
+
if (!templateObj) {
|
|
756
|
+
this.$message.error('当前勾选的数据没有匹配的模板');
|
|
757
|
+
return mergeData;
|
|
758
|
+
}
|
|
759
|
+
if (!mergeData[tempNumber]) {
|
|
760
|
+
mergeData[tempNumber] = [];
|
|
761
|
+
}
|
|
762
|
+
mergeData[tempNumber].push(this.formatItemParam(templateObj, paramItem));
|
|
763
|
+
}
|
|
764
|
+
return mergeData;
|
|
765
|
+
}
|
|
766
|
+
// 2. 将当前数据循环模板参数
|
|
767
|
+
const templateParamKeys = Object.keys(templateParams);
|
|
768
|
+
for (let i = 0; i < templateParamKeys.length; i++) {
|
|
769
|
+
const tempNumber = templateParamKeys[i];
|
|
770
|
+
const templateObj = templateParams[tempNumber];
|
|
771
|
+
if (!templateObj) {
|
|
772
|
+
this.$message.error('当前勾选的数据没有匹配的模板');
|
|
773
|
+
return mergeData;
|
|
774
|
+
}
|
|
775
|
+
if (!mergeData[tempNumber]) {
|
|
776
|
+
mergeData[tempNumber] = [];
|
|
777
|
+
}
|
|
778
|
+
mergeData[tempNumber].push(this.formatItemParam(templateObj, paramItem));
|
|
779
|
+
}
|
|
780
|
+
return mergeData;
|
|
781
|
+
},
|
|
782
|
+
// 查找模板并插入数据
|
|
783
|
+
findTemplateAndInsertParams(mergeData, paramItem, templateParams) {
|
|
784
|
+
// 判断当前数据有没有指定模板
|
|
785
|
+
// 1. 有模板,则插入数据
|
|
786
|
+
if (paramItem.templateNumbers) {
|
|
787
|
+
for (let i = 0; i < paramItem.templateNumbers.length; i++) {
|
|
788
|
+
const tempNumber = paramItem.templateNumbers[i];
|
|
789
|
+
const templateObj = templateParams[tempNumber];
|
|
790
|
+
if (!templateObj) {
|
|
791
|
+
this.$message.error('当前勾选的数据没有匹配的模板');
|
|
792
|
+
return mergeData;
|
|
793
|
+
}
|
|
794
|
+
if (!mergeData[tempNumber]) {
|
|
795
|
+
mergeData[tempNumber] = [];
|
|
796
|
+
}
|
|
797
|
+
mergeData[tempNumber].push(paramItem);
|
|
798
|
+
}
|
|
799
|
+
return mergeData;
|
|
800
|
+
}
|
|
801
|
+
// 2. 将当前数据循环模板参数
|
|
802
|
+
const templateParamKeys = Object.keys(templateParams);
|
|
803
|
+
for (let i = 0; i < templateParamKeys.length; i++) {
|
|
804
|
+
const tempNumber = templateParamKeys[i];
|
|
805
|
+
const templateObj = templateParams[tempNumber];
|
|
806
|
+
if (!templateObj) {
|
|
807
|
+
this.$message.error('当前勾选的数据没有匹配的模板');
|
|
808
|
+
return mergeData;
|
|
809
|
+
}
|
|
810
|
+
if (!mergeData[tempNumber]) {
|
|
811
|
+
mergeData[tempNumber] = [];
|
|
812
|
+
}
|
|
813
|
+
mergeData[tempNumber].push(paramItem);
|
|
814
|
+
}
|
|
815
|
+
return mergeData;
|
|
816
|
+
},
|
|
817
|
+
// 单条数据转换,通过getPrintFormatByNumber接口获取到的数据没有customizeDataset
|
|
818
|
+
formatItemParam(param = [], paramObj={}) {
|
|
819
|
+
let res = {};
|
|
820
|
+
// 自定义结果集
|
|
821
|
+
// customizeDataset.forEach((dataSetItem) => {
|
|
822
|
+
// const selectFieldList = dataSetItem.dataSetting[0].selectFieldList;
|
|
823
|
+
// if (!res['datasetData']) {
|
|
824
|
+
// res['datasetData'] = {};
|
|
825
|
+
// }
|
|
826
|
+
// res['datasetData'][dataSetItem.name] = JSON.stringify(this.formatPrintParams(paramObj, selectFieldList, 'fieldName'))
|
|
827
|
+
// });
|
|
828
|
+
|
|
829
|
+
// 参数
|
|
830
|
+
res = Object.assign({}, res, this.formatPrintParams(paramObj, param, 'key'));
|
|
831
|
+
return res;
|
|
832
|
+
},
|
|
833
|
+
// 合并所有的模板
|
|
834
|
+
mergeTemplateList(list) {
|
|
835
|
+
let templateObj = {};
|
|
836
|
+
list && list.forEach(item => {
|
|
837
|
+
if (!item.param) return false;
|
|
838
|
+
templateObj[item.number] = item.param;
|
|
839
|
+
});
|
|
840
|
+
return templateObj;
|
|
841
|
+
},
|
|
842
|
+
|
|
843
|
+
setTimeoutSpin() {
|
|
844
|
+
this.spinTimer = setTimeout(() => {
|
|
845
|
+
this.spinning = true;
|
|
846
|
+
}, 1500);
|
|
847
|
+
},
|
|
848
|
+
setLoaded() {
|
|
849
|
+
this.spinning = false;
|
|
850
|
+
if (!this.spinTimer) return false;
|
|
851
|
+
clearTimeout(this.spinTimer);
|
|
852
|
+
this.spinTimer = null;
|
|
853
|
+
},
|
|
854
|
+
// 展开模式下按钮loading状态
|
|
855
|
+
toggleExpandLoading(isLoading, formatId) {
|
|
856
|
+
// 点击单个打印
|
|
857
|
+
if (this.isClickSinglePrint) {
|
|
858
|
+
if (isLoading && formatId) {
|
|
859
|
+
const curOption = this.options.find(outer => outer.key == formatId);
|
|
860
|
+
if (curOption) curOption.isLoading = isLoading;
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
// 让所有单个打印按钮都停止loading
|
|
864
|
+
this.options.forEach(outer => {
|
|
865
|
+
outer.isLoading = false;
|
|
866
|
+
})
|
|
867
|
+
} else {
|
|
868
|
+
// 全部按钮打印
|
|
869
|
+
this.spinning = isLoading;
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
getCurrentLoading() {
|
|
873
|
+
if (this.isClickSinglePrint) {
|
|
874
|
+
return this.options.some(outer => outer.isLoading);
|
|
875
|
+
}
|
|
876
|
+
return this.spinning;
|
|
877
|
+
},
|
|
878
|
+
requestError() {
|
|
879
|
+
this.isInited = false;
|
|
880
|
+
this.setLoaded();
|
|
881
|
+
setTimeout(() => {
|
|
882
|
+
this.visible = false;
|
|
883
|
+
}, 0);
|
|
884
|
+
|
|
885
|
+
return false;
|
|
886
|
+
},
|
|
887
|
+
getDefaultFormatId(list, key) {
|
|
888
|
+
if (!list?.length) return '';
|
|
889
|
+
let findDefault = list.find(item => item[key] == 1);
|
|
890
|
+
return findDefault?.id || list[0].id;
|
|
891
|
+
},
|
|
892
|
+
/* */
|
|
893
|
+
instantiatePrintSDK() {
|
|
894
|
+
if (this.printInstance) return false;
|
|
895
|
+
this.printInstance = new Print();
|
|
896
|
+
},
|
|
897
|
+
/* */
|
|
898
|
+
queryFormatList() {
|
|
899
|
+
const { templateNumber, authorizationKey, baseUrl, getPrintFormatByNumberUrl, versionType } = this;
|
|
900
|
+
const suffix = [1, 3].includes(versionType) ? `jsessionids=${vexutils.cookie.get('jsessionids') || '31e5fc0e-955f-4c89-9679-39c43d0171321636163291241'}` : `authorizationKey=${authorizationKey}`;
|
|
901
|
+
const url = `${baseUrl}${getPrintFormatByNumberUrl}?number=${templateNumber}&${suffix}`;
|
|
902
|
+
return httpFn
|
|
903
|
+
.get(url)
|
|
904
|
+
.then(async ({ data }) => {
|
|
905
|
+
if (data.result !== 'SUCCESS') {
|
|
906
|
+
this.$message.error(data.resultMsg || '参数异常,请联系管理员');
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
return data;
|
|
910
|
+
})
|
|
911
|
+
.catch(e => {
|
|
912
|
+
return false;
|
|
913
|
+
});
|
|
914
|
+
},
|
|
915
|
+
formatFormatList(list) {
|
|
916
|
+
let formatList = [];
|
|
917
|
+
|
|
918
|
+
list.forEach(item => {
|
|
919
|
+
if (!item.format) return false;
|
|
920
|
+
formatList.push(...item.format);
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
return formatList;
|
|
924
|
+
},
|
|
925
|
+
/* */
|
|
926
|
+
queryTemplateParams() {
|
|
927
|
+
const { templateNumber, authorizationKey, baseUrl, getTemplateParamsUrl } = this;
|
|
928
|
+
const { templateId } = this.formatList[0] || {};
|
|
929
|
+
const url = `${baseUrl}${getTemplateParamsUrl}?number=${templateNumber}&templateId=${templateId}&authorizationKey=${authorizationKey}`;
|
|
930
|
+
|
|
931
|
+
return httpFn
|
|
932
|
+
.get(url)
|
|
933
|
+
.then(async ({ data }) => {
|
|
934
|
+
if (data.result !== 'SUCCESS') {
|
|
935
|
+
this.$message.error(data.resultMsg || '参数异常,请联系管理员');
|
|
936
|
+
return false;
|
|
937
|
+
}
|
|
938
|
+
return data?.obj || {};
|
|
939
|
+
})
|
|
940
|
+
.catch(e => {
|
|
941
|
+
return false;
|
|
942
|
+
});
|
|
943
|
+
},
|
|
944
|
+
formatDefaultVal(i, tableVal) {
|
|
945
|
+
const formatMap = {
|
|
946
|
+
DATE: 'YYYY-MM-DD',
|
|
947
|
+
DATETIME: 'YYYY-MM-DD HH:mm:ss'
|
|
948
|
+
};
|
|
949
|
+
let tVal = tableVal;
|
|
950
|
+
if (Object.keys(formatMap).includes(i.type) && tableVal) {
|
|
951
|
+
tVal = moment(tableVal).format(formatMap[i.type]);
|
|
952
|
+
}
|
|
953
|
+
if (i.type === 'TEXT') {
|
|
954
|
+
tVal = String(tableVal) || '';
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
return i?.defaultValue || tVal || '';
|
|
958
|
+
},
|
|
959
|
+
// formatParams({ customizeDataset = [], param = [] }, params = []) {
|
|
960
|
+
// return params.map(paramObj => {
|
|
961
|
+
// let res = {};
|
|
962
|
+
|
|
963
|
+
// // 自定义结果集
|
|
964
|
+
// customizeDataset.forEach(dataSetItem => {
|
|
965
|
+
// const selectFieldList = dataSetItem.dataSetting[0].selectFieldList;
|
|
966
|
+
// res['datasetData'] = {
|
|
967
|
+
// [dataSetItem.name]: JSON.stringify(this.formatPrintParams(paramObj, selectFieldList, 'fieldName'))
|
|
968
|
+
// };
|
|
969
|
+
// });
|
|
970
|
+
|
|
971
|
+
// // 参数
|
|
972
|
+
// res = Object.assign({}, res, this.formatPrintParams(paramObj, param, 'key'));
|
|
973
|
+
// return res;
|
|
974
|
+
// });
|
|
975
|
+
// },
|
|
976
|
+
reformatPrintParams() {
|
|
977
|
+
this.watchPrintParamsReformatFn && this.watchPrintParamsReformatFn();
|
|
978
|
+
/*
|
|
979
|
+
还没初始化完毕时(还没获取到模板格式配置等..)
|
|
980
|
+
触发再格式化逻辑,需等待初始化完毕,再重新执行格式化
|
|
981
|
+
*/
|
|
982
|
+
if (!this.isInited) {
|
|
983
|
+
this.watchPrintParamsReformatFn = this.$watch('isInited', val => {
|
|
984
|
+
if (!val) return false;
|
|
985
|
+
this.reformatPrintParams();
|
|
986
|
+
});
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// this.printParams = this.formatParams(this.templateParams, this.params);
|
|
991
|
+
this.printParams = this.formatSomeTypeParams(this.templateParams, this.params);
|
|
992
|
+
this.originParams = this.formatSomeOriginParams(this.templateParams, this.params);
|
|
993
|
+
},
|
|
994
|
+
formatPrintParams(paramObj, fieldList, keyName) {
|
|
995
|
+
const obj = {};
|
|
996
|
+
fieldList.forEach(i => {
|
|
997
|
+
let defaultVal = this.formatDefaultVal(i, paramObj[i[keyName]]);
|
|
998
|
+
if (paramObj[i[keyName]] && defaultVal) {
|
|
999
|
+
obj[i[keyName]] = defaultVal;
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
return obj;
|
|
1004
|
+
},
|
|
1005
|
+
/* */
|
|
1006
|
+
handleClickFormat(id) {
|
|
1007
|
+
this.currentFormatId = id;
|
|
1008
|
+
},
|
|
1009
|
+
/* */
|
|
1010
|
+
getPrintParams() {
|
|
1011
|
+
const extraParams = this?.printExtraParams || {};
|
|
1012
|
+
let res = {
|
|
1013
|
+
...(this.token ? { token: this.token } : {}),
|
|
1014
|
+
...extraParams
|
|
1015
|
+
};
|
|
1016
|
+
if (typeof this.getPrintParamsAfter === 'function') {
|
|
1017
|
+
let t = this.getPrintParamsAfter(res);
|
|
1018
|
+
return t || res;
|
|
1019
|
+
}
|
|
1020
|
+
return JSON.stringify(res);
|
|
1021
|
+
},
|
|
1022
|
+
getTemplateIdByFormatId(id) {
|
|
1023
|
+
let find = this.formatList.find(item => item.id === id);
|
|
1024
|
+
return find?.templateId || '';
|
|
1025
|
+
},
|
|
1026
|
+
getTemplateCodeByFormatId(id) {
|
|
1027
|
+
let find = this.formatList.find(item => item.id === id);
|
|
1028
|
+
return find?.number || '';
|
|
1029
|
+
},
|
|
1030
|
+
getOnceParams(curPrintParamList=[], templateCode) {
|
|
1031
|
+
// 聚合一条
|
|
1032
|
+
let params = {};
|
|
1033
|
+
let obj = {};
|
|
1034
|
+
// let cur = this.printParams?.[0] || {};
|
|
1035
|
+
if (this.templateParams[templateCode]?.customizeDataset?.length) {
|
|
1036
|
+
// 有模板数据
|
|
1037
|
+
const key = Object.keys(curPrintParamList[0]?.datasetData || {})?.[0] || '';
|
|
1038
|
+
const datasetDataKeyVal = JSON.stringify(curPrintParamList.map(v => JSON.parse(v.datasetData[key])));
|
|
1039
|
+
obj = {
|
|
1040
|
+
datasetData: {}
|
|
1041
|
+
};
|
|
1042
|
+
obj.datasetData[key] = datasetDataKeyVal;
|
|
1043
|
+
} else {
|
|
1044
|
+
// 无模板数据
|
|
1045
|
+
Object.keys(curPrintParamList[0]).forEach(v => {
|
|
1046
|
+
obj[v] = [];
|
|
1047
|
+
curPrintParamList.forEach(k => {
|
|
1048
|
+
if(!obj[v].includes(k[v])) {
|
|
1049
|
+
obj[v].push(k[v]);
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
obj[v] = obj[v].join(',');
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
params = Object.assign({}, JSON.parse(this.getPrintParams()), this.printCustomProps, obj);
|
|
1056
|
+
if (typeof this.getOnceParamsAfter === 'function') {
|
|
1057
|
+
let res = this.getOnceParamsAfter(params, obj);
|
|
1058
|
+
return res || params;
|
|
1059
|
+
}
|
|
1060
|
+
return JSON.stringify(params);
|
|
1061
|
+
},
|
|
1062
|
+
handleClickPrint(curPrintParamList, templateCode, templateId, formatId, printToParam=[], needContinuePrint) {
|
|
1063
|
+
let len = curPrintParamList.length;
|
|
1064
|
+
const callLocalServicesSuccessCb = async data => {
|
|
1065
|
+
try {
|
|
1066
|
+
if (--len <= 0) {
|
|
1067
|
+
this.callLocalServicesSuccessCb(data, 'print');
|
|
1068
|
+
}
|
|
1069
|
+
} catch (error) {
|
|
1070
|
+
console.log('error', error);
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
if (this.getCurrentLoading() && !needContinuePrint) return;
|
|
1074
|
+
this.toggleExpandLoading(true, formatId);
|
|
1075
|
+
this.prevFn()
|
|
1076
|
+
.catch(() => {
|
|
1077
|
+
this.prevFnError();
|
|
1078
|
+
return Promise.reject();
|
|
1079
|
+
})
|
|
1080
|
+
.then(() => {
|
|
1081
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
1082
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint';
|
|
1083
|
+
if (this.strategy === 'MULTI') {
|
|
1084
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
1085
|
+
const params = this.getHisParams(i);
|
|
1086
|
+
this.printInstance[printFn](7, params)
|
|
1087
|
+
.then(res => {
|
|
1088
|
+
console.log(res, '777777777777');
|
|
1089
|
+
})
|
|
1090
|
+
.catch(error => {
|
|
1091
|
+
console.log(error, 'error777');
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
} else {
|
|
1095
|
+
const params = this.getOnceHisParams();
|
|
1096
|
+
this.printInstance[printFn](7, params)
|
|
1097
|
+
.then(res => {
|
|
1098
|
+
console.log(res, '777777777777');
|
|
1099
|
+
})
|
|
1100
|
+
.catch(error => {
|
|
1101
|
+
console.log(error, 'error777');
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
} else {
|
|
1105
|
+
this.curPrintParamList = curPrintParamList;
|
|
1106
|
+
const queryParams = {
|
|
1107
|
+
// ...this.queryParams,
|
|
1108
|
+
formatId,
|
|
1109
|
+
templateId,
|
|
1110
|
+
printdlgshow: this.printdlgshow
|
|
1111
|
+
};
|
|
1112
|
+
if (this.strategy === 'MULTI') {
|
|
1113
|
+
// 循环多条
|
|
1114
|
+
for (let i = 0; i < curPrintParamList.length; i++) {
|
|
1115
|
+
if (i > 0) queryParams.printdlgshow = '0';
|
|
1116
|
+
const params = JSON.stringify(Object.assign({}, JSON.parse(this.getPrintParams()), this.printCustomProps, curPrintParamList[i]));
|
|
1117
|
+
this.printInstance.printDirect(
|
|
1118
|
+
{
|
|
1119
|
+
...queryParams,
|
|
1120
|
+
params
|
|
1121
|
+
},
|
|
1122
|
+
callLocalServicesSuccessCb,
|
|
1123
|
+
this.callLocalServicesErrorCb,
|
|
1124
|
+
this.callLocalServicesCancelCb
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1128
|
+
// 聚合一条
|
|
1129
|
+
this.printInstance.printDirect(
|
|
1130
|
+
{
|
|
1131
|
+
...queryParams,
|
|
1132
|
+
params: this.getOnceParams(curPrintParamList, templateCode)
|
|
1133
|
+
},
|
|
1134
|
+
res => {
|
|
1135
|
+
res.params = printToParam;
|
|
1136
|
+
res.templateCode = templateCode;
|
|
1137
|
+
res.templateId = templateId;
|
|
1138
|
+
this.callLocalServicesSuccessCb(res, 'print');
|
|
1139
|
+
},
|
|
1140
|
+
this.callLocalServicesErrorCb,
|
|
1141
|
+
this.callLocalServicesCancelCb
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
})
|
|
1146
|
+
},
|
|
1147
|
+
getHisParams(index = 0) {
|
|
1148
|
+
const { templateParams, hisParams, params } = this;
|
|
1149
|
+
const { reportid = '280' } = hisParams;
|
|
1150
|
+
const { id, name } = templateParams;
|
|
1151
|
+
return {
|
|
1152
|
+
reportid,
|
|
1153
|
+
formatid: this.currentFormatId || id,
|
|
1154
|
+
formatname: name,
|
|
1155
|
+
param: params[index]
|
|
1156
|
+
};
|
|
1157
|
+
},
|
|
1158
|
+
getOnceHisParams() {
|
|
1159
|
+
const { templateParams, hisParams, params } = this;
|
|
1160
|
+
const { reportid = '280' } = hisParams;
|
|
1161
|
+
const { id, name } = templateParams;
|
|
1162
|
+
const obj = {};
|
|
1163
|
+
Object.keys(params[0]).forEach(v => {
|
|
1164
|
+
obj[v] = [];
|
|
1165
|
+
params.forEach(k => {
|
|
1166
|
+
obj[v].push(k[v]);
|
|
1167
|
+
});
|
|
1168
|
+
obj[v] = obj[v].join(',');
|
|
1169
|
+
});
|
|
1170
|
+
return {
|
|
1171
|
+
reportid,
|
|
1172
|
+
formatid: this.currentFormatId || id,
|
|
1173
|
+
formatname: name,
|
|
1174
|
+
param: obj
|
|
1175
|
+
};
|
|
1176
|
+
},
|
|
1177
|
+
async handleClickPreview(curPrintParamList=[], templateCode, templateId, formatId) {
|
|
1178
|
+
if (this.getCurrentLoading()) return;
|
|
1179
|
+
this.toggleExpandLoading(true, formatId);
|
|
1180
|
+
this.prevFn()
|
|
1181
|
+
.catch(() => {
|
|
1182
|
+
this.prevFnError();
|
|
1183
|
+
return Promise.reject();
|
|
1184
|
+
})
|
|
1185
|
+
.then(() => {
|
|
1186
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
1187
|
+
const params = this.strategy === 'MULTI' ? this.getHisParams() : this.getOnceHisParams();
|
|
1188
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint';
|
|
1189
|
+
this.printInstance[printFn](8, params)
|
|
1190
|
+
.then(res => {
|
|
1191
|
+
console.log(res, 88888888);
|
|
1192
|
+
})
|
|
1193
|
+
.catch(error => {
|
|
1194
|
+
console.log(error, 'error888');
|
|
1195
|
+
});
|
|
1196
|
+
} else {
|
|
1197
|
+
this.curPrintParamList = curPrintParamList;
|
|
1198
|
+
const IS_MULTI = this.strategy === 'MULTI';
|
|
1199
|
+
const queryParams = {
|
|
1200
|
+
formatId,
|
|
1201
|
+
templateId
|
|
1202
|
+
};
|
|
1203
|
+
const paramsFirst = JSON.stringify(Object.assign({}, JSON.parse(this.getPrintParams()), this.printCustomProps.value, curPrintParamList[0]));
|
|
1204
|
+
this.printInstance.preview(
|
|
1205
|
+
{
|
|
1206
|
+
// ...this.queryParams,
|
|
1207
|
+
...queryParams,
|
|
1208
|
+
params: IS_MULTI ? paramsFirst : this.getOnceParams(curPrintParamList, templateCode)
|
|
1209
|
+
},
|
|
1210
|
+
res => {
|
|
1211
|
+
this.callLocalServicesSuccessCb(res, 'preview');
|
|
1212
|
+
},
|
|
1213
|
+
this.callLocalServicesErrorCb
|
|
1214
|
+
);
|
|
1215
|
+
}
|
|
1216
|
+
})
|
|
1217
|
+
},
|
|
1218
|
+
// 下载pdf
|
|
1219
|
+
async handleClickPdf(curPrintParamList=[], templateCode, templateId, formatId) {
|
|
1220
|
+
if (this.getCurrentLoading()) return;
|
|
1221
|
+
this.toggleExpandLoading(true, formatId);
|
|
1222
|
+
this.prevFn()
|
|
1223
|
+
.catch(() => {
|
|
1224
|
+
this.prevFnError();
|
|
1225
|
+
return Promise.reject();
|
|
1226
|
+
})
|
|
1227
|
+
.then(() => {
|
|
1228
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
1229
|
+
console.log('下载pdf>>>');
|
|
1230
|
+
} else {
|
|
1231
|
+
this.curPrintParamList = curPrintParamList;
|
|
1232
|
+
const IS_MULTI = this.strategy === 'MULTI';
|
|
1233
|
+
// const queryParams = {
|
|
1234
|
+
// ...this.queryParams,
|
|
1235
|
+
// print: { print: '1', type: '1', callback: '1' },
|
|
1236
|
+
// };
|
|
1237
|
+
const queryParams = {
|
|
1238
|
+
formatId,
|
|
1239
|
+
templateId,
|
|
1240
|
+
print: { print: '1', type: '1', callback: '1' },
|
|
1241
|
+
};
|
|
1242
|
+
const paramsFirst = JSON.stringify(Object.assign({}, JSON.parse(this.getPrintParams()), this.printCustomProps.value, curPrintParamList[0]));
|
|
1243
|
+
this.printInstance.downloadPDF(
|
|
1244
|
+
{
|
|
1245
|
+
...queryParams,
|
|
1246
|
+
params: IS_MULTI ? paramsFirst : this.getOnceParams(curPrintParamList, templateCode)
|
|
1247
|
+
},
|
|
1248
|
+
res => {
|
|
1249
|
+
this.callLocalServicesSuccessCb(res, 'download');
|
|
1250
|
+
},
|
|
1251
|
+
this.callLocalServicesErrorCb
|
|
1252
|
+
);
|
|
1253
|
+
}
|
|
1254
|
+
})
|
|
1255
|
+
},
|
|
1256
|
+
handleClickEdit(curPrintParamList=[], templateCode, templateId, formatId) {
|
|
1257
|
+
if (this.getCurrentLoading()) return;
|
|
1258
|
+
this.toggleExpandLoading(true, formatId);
|
|
1259
|
+
this.prevFn()
|
|
1260
|
+
.catch(() => {
|
|
1261
|
+
this.prevFnError();
|
|
1262
|
+
return Promise.reject();
|
|
1263
|
+
})
|
|
1264
|
+
.then(() => {
|
|
1265
|
+
if (this.versionType == 1 || this.versionType == 3) {
|
|
1266
|
+
const params = this.strategy === 'MULTI' ? this.getHisParams() : this.getOnceHisParams();
|
|
1267
|
+
const printFn = this.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint';
|
|
1268
|
+
this.printInstance[printFn](9, params)
|
|
1269
|
+
.then(res => {
|
|
1270
|
+
console.log(res, 999999);
|
|
1271
|
+
})
|
|
1272
|
+
.catch(error => {
|
|
1273
|
+
console.log(error, 'error999');
|
|
1274
|
+
});
|
|
1275
|
+
} else {
|
|
1276
|
+
this.toggleExpandLoading(false);
|
|
1277
|
+
this.curPrintParamList = curPrintParamList;
|
|
1278
|
+
this.currentFormatId = formatId;
|
|
1279
|
+
this.identityVerification.visible = true;
|
|
1280
|
+
}
|
|
1281
|
+
})
|
|
1282
|
+
},
|
|
1283
|
+
verifiySuccess(token) {
|
|
1284
|
+
this.identityVerification.visible = false;
|
|
1285
|
+
const paramsFirst = JSON.stringify(Object.assign({}, JSON.parse(this.getPrintParams()), this.printCustomProps.value, this.curPrintParamList[0]));
|
|
1286
|
+
const params = this.strategy === 'MULTI' ? paramsFirst : this.getOnceParams(this.curPrintParamList, this.getTemplateCodeByFormatId(this.currentFormatId));
|
|
1287
|
+
const queryParams = {
|
|
1288
|
+
// ...this.queryParams,
|
|
1289
|
+
formatId: this.currentFormatId,
|
|
1290
|
+
templateId: this.getTemplateIdByFormatId(this.currentFormatId),
|
|
1291
|
+
params,
|
|
1292
|
+
token
|
|
1293
|
+
};
|
|
1294
|
+
this.printInstance.editPrintFormat(
|
|
1295
|
+
queryParams,
|
|
1296
|
+
res => {
|
|
1297
|
+
this.callLocalServicesSuccessCb(res, 'edit');
|
|
1298
|
+
},
|
|
1299
|
+
this.callLocalServicesErrorCb
|
|
1300
|
+
);
|
|
1301
|
+
},
|
|
1302
|
+
/* */
|
|
1303
|
+
prevFnError() {
|
|
1304
|
+
// 前置条件执行错误这里不弹提示,“前置条件”事件内有弹提示了
|
|
1305
|
+
// let error = {
|
|
1306
|
+
// message: '前置条件执行错误'
|
|
1307
|
+
// };
|
|
1308
|
+
// this.$emit('error', error);
|
|
1309
|
+
this.toggleExpandLoading(false);
|
|
1310
|
+
this.visible = false;
|
|
1311
|
+
},
|
|
1312
|
+
/* */
|
|
1313
|
+
callLocalServicesSuccessCb(res, type) {
|
|
1314
|
+
this.toggleExpandLoading(false);
|
|
1315
|
+
let info = {
|
|
1316
|
+
type,
|
|
1317
|
+
formatId: this.currentFormatId,
|
|
1318
|
+
templateId: res?.templateId || this.getTemplateIdByFormatId(this.currentFormatId),
|
|
1319
|
+
templateCode: res?.templateCode || this.getTemplateCodeByFormatId(this.currentFormatId),
|
|
1320
|
+
};
|
|
1321
|
+
this.$emit('success', res, info);
|
|
1322
|
+
},
|
|
1323
|
+
callLocalServicesErrorCb(res) {
|
|
1324
|
+
this.toggleExpandLoading(false);
|
|
1325
|
+
this.$emit('error', res);
|
|
1326
|
+
},
|
|
1327
|
+
callLocalServicesCancelCb(res) {
|
|
1328
|
+
this.toggleExpandLoading(false);
|
|
1329
|
+
this.$emit('cancel', res);
|
|
1330
|
+
},
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* 获取 axios 自定义配置
|
|
1334
|
+
*/
|
|
1335
|
+
getCustomCofing(customCofing) {
|
|
1336
|
+
let cCofing = {};
|
|
1337
|
+
let type = typeof customCofing;
|
|
1338
|
+
if (type === 'function') {
|
|
1339
|
+
cCofing = customCofing();
|
|
1340
|
+
} else if (type === 'object') {
|
|
1341
|
+
cCofing = customCofing;
|
|
1342
|
+
}
|
|
1343
|
+
return cCofing;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
</script>
|
|
1348
|
+
|
|
1349
|
+
<style lang="less" scoped>
|
|
1350
|
+
.newprint-button-outer {
|
|
1351
|
+
display: inline-flex;
|
|
1352
|
+
align-items: center;
|
|
1353
|
+
.ant-btn-group{
|
|
1354
|
+
display: inline-flex;
|
|
1355
|
+
}
|
|
1356
|
+
.ant-popover-inner-content{
|
|
1357
|
+
padding: 0;
|
|
1358
|
+
}
|
|
1359
|
+
.bold{
|
|
1360
|
+
font-weight: 700;
|
|
1361
|
+
}
|
|
1362
|
+
.hasOuterItem{
|
|
1363
|
+
color: rgba(37, 99, 244, 1);
|
|
1364
|
+
}
|
|
1365
|
+
.operation-icon{
|
|
1366
|
+
margin-left: 8px;
|
|
1367
|
+
width: 32px;
|
|
1368
|
+
height: 32px;
|
|
1369
|
+
display: flex;
|
|
1370
|
+
justify-content: center;
|
|
1371
|
+
align-items: center;
|
|
1372
|
+
opacity: 0;
|
|
1373
|
+
.anticon{
|
|
1374
|
+
margin-right: 0 !important;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
.operation-li{
|
|
1378
|
+
&:hover{
|
|
1379
|
+
background: rgba(37, 99, 244, 0.10);
|
|
1380
|
+
.label, .anticon-right{
|
|
1381
|
+
color: rgba(37, 99, 244, 1);
|
|
1382
|
+
}
|
|
1383
|
+
.operation-icon{
|
|
1384
|
+
opacity: 1;
|
|
1385
|
+
background: rgba(37, 99, 244, 0.15);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
.newprint-button-menu{
|
|
1392
|
+
.print-divider{
|
|
1393
|
+
.ant-divider{
|
|
1394
|
+
margin: 0;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
.isDisabled{
|
|
1398
|
+
color: #999;
|
|
1399
|
+
cursor: default;
|
|
1400
|
+
}
|
|
1401
|
+
.dropdown-between{
|
|
1402
|
+
display: flex;
|
|
1403
|
+
justify-content: space-between;
|
|
1404
|
+
align-items: center;
|
|
1405
|
+
padding: 0;
|
|
1406
|
+
margin: 0 6px;
|
|
1407
|
+
.label{
|
|
1408
|
+
flex: 1;
|
|
1409
|
+
padding: 5px 12px 5px 6px;
|
|
1410
|
+
}
|
|
1411
|
+
.ant-btn{
|
|
1412
|
+
margin: 5px 12px 5px 6px;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
</style>
|