super-pages 0.0.2-up → 0.0.4-up
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/README.md +7 -7
- package/index.html +13 -13
- package/lib/super-pages.css +1 -1
- package/lib/super-pages.js +2488 -2559
- package/lib/super-pages.umd.cjs +14 -14
- package/package.json +3 -6
- package/packages/index.js +30 -30
- package/packages/super-page/index.js +9 -9
- package/packages/super-page/src/button-group.vue +294 -294
- package/packages/super-page/src/chart-page.vue +215 -215
- package/packages/super-page/src/chart-query-page.vue +163 -163
- package/packages/super-page/src/export-form-report-dialog.vue +145 -145
- package/packages/super-page/src/form-head.vue +74 -74
- package/packages/super-page/src/form-page.vue +107 -107
- package/packages/super-page/src/group-tag.vue +21 -21
- package/packages/super-page/src/list-page.vue +1454 -1454
- package/packages/super-page/src/list-toolbar-dynamic-source.vue +89 -89
- package/packages/super-page/src/list-toolbar-page.vue +377 -377
- package/packages/super-page/src/my-button-base.vue +438 -438
- package/packages/super-page/src/my-button.vue +196 -196
- package/packages/super-page/src/page-custom-component.vue +56 -56
- package/packages/super-page/src/remove-signer-dialog.vue +103 -103
- package/packages/super-page/src/sub-tab-page.vue +79 -79
- package/packages/super-page/src/super-page-component.vue +86 -86
- package/packages/super-page/src/super-page.vue +162 -162
- package/packages/super-page/src/tab-page.vue +154 -154
- package/packages/super-page/src/task-informition-dialog.vue +82 -82
- package/packages/super-page/src/util/ListButtonEvent.js +896 -896
- package/packages/super-page/src/util/api.js +37 -37
- package/packages/super-page/src/util/callEvents.js +62 -62
- package/packages/super-page/src/util/chartButtonEvent.js +60 -60
- package/packages/super-page/src/util/common-util.js +102 -102
- package/packages/super-page/src/util/commonButtonEvent.js +70 -70
- package/packages/super-page/src/util/eventBus.js +2 -2
- package/packages/super-page/src/util/formButtonEvent.js +509 -509
- package/packages/super-page/src/util/store.js +3 -3
- package/packages/super-page/src/util/super-page.js +29 -29
- package/packages/super-page/src/util/workflowButtonEvent.js +1729 -1729
- package/packages/super-page/src/widget-col-page.vue +339 -339
- package/packages/super-page/src/widget-page.vue +703 -703
- package/packages/super-page/src/widget-sub-tab-pane-page.vue +115 -115
- package/packages/super-page/src/widget-tab-pane-page.vue +135 -135
- package/packages/super-page/src/workflow-button-group.vue +561 -561
- package/packages/super-page-dialog/index.js +9 -9
- package/packages/super-page-dialog/src/super-page-dialog.vue +200 -200
- package/packages/utils/gogocodeTransfer.js +59 -59
- package/src/i18n/langs/cn.js +65 -65
- package/src/i18n/langs/en.js +68 -68
- package/src/utils/common-util.js +9 -9
- package/vite.config.js +36 -36
|
@@ -1,438 +1,438 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span v-if="isCustomVisible" :id="pageCode + '_' + button.code">
|
|
3
|
-
<span
|
|
4
|
-
v-if="!isView || button.code === 'back'"
|
|
5
|
-
v-permission="permission"
|
|
6
|
-
style="margin-right: 10px"
|
|
7
|
-
>
|
|
8
|
-
<span v-if="button.code !== 'exportPDF'">
|
|
9
|
-
<component
|
|
10
|
-
:is="button.customControl"
|
|
11
|
-
v-if="button.customControl"
|
|
12
|
-
:search-form-data="searchFormInfo.data"
|
|
13
|
-
:selections="selections"
|
|
14
|
-
:entity="initFormData"
|
|
15
|
-
:get-entity="myFormDataFun"
|
|
16
|
-
:refresh-list="getSystemRef"
|
|
17
|
-
:class="button.code"
|
|
18
|
-
:custom-params="customParams"
|
|
19
|
-
:button-groups="buttonGroups"
|
|
20
|
-
@workflow-button-click="clickWorkflowButton"
|
|
21
|
-
:additional-param-map="additionalParamMap"
|
|
22
|
-
@refresh="refreshEmit"
|
|
23
|
-
@prohibi-edit="fnProhibitToEdit"
|
|
24
|
-
@refresh-tab="refreshTab"
|
|
25
|
-
@refresh-from="refreshFrom"
|
|
26
|
-
/>
|
|
27
|
-
<el-button
|
|
28
|
-
v-else
|
|
29
|
-
:loading="button.loading === undefined ? false : button.loading"
|
|
30
|
-
:disabled="disabled ? disabled : preventReclick"
|
|
31
|
-
:size="button.size ? button.size : 'small'"
|
|
32
|
-
:type="getButtonType(button)"
|
|
33
|
-
:icon="icon"
|
|
34
|
-
:class="button.code"
|
|
35
|
-
:plain="
|
|
36
|
-
typeof button.isPlain === 'undefined' ? false : button.isPlain
|
|
37
|
-
"
|
|
38
|
-
:round="
|
|
39
|
-
typeof button.isRound === 'undefined' ? false : button.isRound
|
|
40
|
-
"
|
|
41
|
-
:circle="
|
|
42
|
-
typeof button.isCircle === 'undefined' ? false : button.isCircle
|
|
43
|
-
"
|
|
44
|
-
@click="clickMyButton(button)"
|
|
45
|
-
>{{ getButtonLabel(button) }}</el-button
|
|
46
|
-
>
|
|
47
|
-
</span>
|
|
48
|
-
<span v-else>
|
|
49
|
-
<export-pdf-button
|
|
50
|
-
v-if="showPdfButton"
|
|
51
|
-
:pdf-template-code="button.pdfTemplateCode"
|
|
52
|
-
:entity="formData"
|
|
53
|
-
:base-props="button"
|
|
54
|
-
:watermark-setting="watermarkSetting"
|
|
55
|
-
:befoer-open="befoerOpenPdf"
|
|
56
|
-
@closePreview="closePreview"
|
|
57
|
-
/>
|
|
58
|
-
</span>
|
|
59
|
-
</span>
|
|
60
|
-
<export-form-report-dialog
|
|
61
|
-
v-if="showExportForm"
|
|
62
|
-
:button="button"
|
|
63
|
-
:entity="initFormData"
|
|
64
|
-
@close="closeExportFormDialog"
|
|
65
|
-
@preview-export-form-report="previewExportFormReport"
|
|
66
|
-
@before-export-form-report="beforeExportFormReport"
|
|
67
|
-
/>
|
|
68
|
-
</span>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script>
|
|
72
|
-
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
73
|
-
import { mapGetters } from 'vuex'
|
|
74
|
-
import Util from './util/util'
|
|
75
|
-
import { getStoreInfo } from './util/common-util'
|
|
76
|
-
import superPageService from './util/super-page'
|
|
77
|
-
import ExportFormReportDialog from './export-form-report-dialog'
|
|
78
|
-
export default {
|
|
79
|
-
name: 'MyButtonBase',
|
|
80
|
-
components: {
|
|
81
|
-
ExportFormReportDialog,
|
|
82
|
-
},
|
|
83
|
-
props: {
|
|
84
|
-
button: {
|
|
85
|
-
type: Object,
|
|
86
|
-
default: null,
|
|
87
|
-
},
|
|
88
|
-
// 资源编码前缀,例如:系统编码.页面编码.列表组件编码 或 系统编码.页面编码.表单组件编码 或 系统编码.页面编码.按钮组组件编码
|
|
89
|
-
permissionPrefix: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: null,
|
|
92
|
-
},
|
|
93
|
-
// 按钮所在位置,list列表或form表单内
|
|
94
|
-
position: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: null,
|
|
97
|
-
},
|
|
98
|
-
// 数据表名称
|
|
99
|
-
tableName: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: null,
|
|
102
|
-
},
|
|
103
|
-
// 流程表单页面才需要传该设置
|
|
104
|
-
buttonGroups: {
|
|
105
|
-
type: Array,
|
|
106
|
-
default: null,
|
|
107
|
-
},
|
|
108
|
-
// 列表行编辑时编辑的记录下标,行编辑按钮使用
|
|
109
|
-
rowIndex: {
|
|
110
|
-
type: Number,
|
|
111
|
-
default: null,
|
|
112
|
-
},
|
|
113
|
-
// 页面编码
|
|
114
|
-
pageCode: {
|
|
115
|
-
type: String,
|
|
116
|
-
default: null,
|
|
117
|
-
},
|
|
118
|
-
// 获取页面数据的方法
|
|
119
|
-
getFormData: {
|
|
120
|
-
type: Function,
|
|
121
|
-
default: function () {},
|
|
122
|
-
},
|
|
123
|
-
// 列表选中的记录集合
|
|
124
|
-
selections: {
|
|
125
|
-
type: Array,
|
|
126
|
-
default: null,
|
|
127
|
-
},
|
|
128
|
-
// 表单对象
|
|
129
|
-
myFormDataFun: {
|
|
130
|
-
type: Function,
|
|
131
|
-
default: function () {},
|
|
132
|
-
},
|
|
133
|
-
// 列表刷新方法
|
|
134
|
-
getSystemRef: {
|
|
135
|
-
type: Function,
|
|
136
|
-
default: function () {},
|
|
137
|
-
},
|
|
138
|
-
searchFormInfo: {
|
|
139
|
-
type: Object,
|
|
140
|
-
default: () => {
|
|
141
|
-
return { data: {} }
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
disabled: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
default: false,
|
|
147
|
-
},
|
|
148
|
-
// 没传的话,需要在本组件内判断是否显示
|
|
149
|
-
isVisible: {
|
|
150
|
-
type: String,
|
|
151
|
-
default: null,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
data() {
|
|
155
|
-
let permission = 'true'
|
|
156
|
-
if (
|
|
157
|
-
this.button.isPermission === undefined ||
|
|
158
|
-
this.button.isPermission === true
|
|
159
|
-
) {
|
|
160
|
-
// 表示按钮受权限保护
|
|
161
|
-
permission = this.permissionPrefix + '.' + this.button.code
|
|
162
|
-
if (this.button.functionCode) {
|
|
163
|
-
permission = this.button.functionCode
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
console.log('my-button-base1111------permission=', permission)
|
|
167
|
-
const isDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
168
|
-
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
169
|
-
console.log('my-button-base222------isDevMode=', isDevMode)
|
|
170
|
-
console.log('my-button-base333------isPreview=', isPreview)
|
|
171
|
-
if (
|
|
172
|
-
(isDevMode && isDevMode === true) ||
|
|
173
|
-
(isPreview && isPreview === true) ||
|
|
174
|
-
(this.button && this.button.code === 'back')
|
|
175
|
-
) {
|
|
176
|
-
// 开发模式 或 预览时 或 返回按钮,权限不受控制
|
|
177
|
-
permission = 'true'
|
|
178
|
-
}
|
|
179
|
-
console.log('my-button-base444------permission=', permission)
|
|
180
|
-
const displayConditions = this.button.buttonDisplayConditionsList
|
|
181
|
-
let isCustomVisible = false
|
|
182
|
-
const isView = this.isViewDetail(this.position)
|
|
183
|
-
let icon = this.button.icon
|
|
184
|
-
if (icon && icon.indexOf('fa-') === 0) {
|
|
185
|
-
// 表示以“fa-”开头,使用font-awesome中的图标
|
|
186
|
-
icon = 'fa fa-custom ' + icon
|
|
187
|
-
}
|
|
188
|
-
if (this.position === 'chart' && !icon && this.button.code === 'export') {
|
|
189
|
-
icon = 'fa fa-custom fa-cloud-download'
|
|
190
|
-
}
|
|
191
|
-
const formDataFun = this.myFormDataFun
|
|
192
|
-
let initFormData
|
|
193
|
-
if (formDataFun) {
|
|
194
|
-
initFormData = formDataFun.call(this)
|
|
195
|
-
}
|
|
196
|
-
let jumpInfo = sessionStorage.getItem(this.pageCode + '-jumpMode')
|
|
197
|
-
let backButtonName
|
|
198
|
-
if (jumpInfo) {
|
|
199
|
-
const jumpInfoObj = JSON.parse(jumpInfo)
|
|
200
|
-
const jumpMode = jumpInfoObj.jumpMode
|
|
201
|
-
if (jumpMode === 'openWindow' || jumpMode === 'newTab') {
|
|
202
|
-
// 新页签或新窗口显示“关闭”按钮
|
|
203
|
-
backButtonName = this.$t('superPage.closeButton')
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
permission, // 按钮的资源编码
|
|
208
|
-
isCustomVisible, // 是否显示按钮
|
|
209
|
-
displayConditions, // 按钮显示条件
|
|
210
|
-
isPreview, // 预览时导入按钮不操作
|
|
211
|
-
isView, // 是否是查看页面
|
|
212
|
-
additionalParamMap: null, // 跳转页面的附加参数
|
|
213
|
-
icon,
|
|
214
|
-
formData: {},
|
|
215
|
-
contextParameter: null,
|
|
216
|
-
watermarkSetting: null,
|
|
217
|
-
showPdfButton: false,
|
|
218
|
-
showExportForm: false,
|
|
219
|
-
initFormData, // 表单初始值
|
|
220
|
-
backButtonName,
|
|
221
|
-
customParams: {},
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
computed: {
|
|
225
|
-
...mapGetters(['preventReclick']),
|
|
226
|
-
},
|
|
227
|
-
created() {
|
|
228
|
-
if (this.button.customParams) {
|
|
229
|
-
this.customParams = this.formatCustomParams(this.button.customParams)
|
|
230
|
-
}
|
|
231
|
-
const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
|
|
232
|
-
if (additionalParamMap) {
|
|
233
|
-
this.additionalParamMap = additionalParamMap
|
|
234
|
-
}
|
|
235
|
-
const contextParameter = getStoreInfo(this.pageCode, '_contextParameter')
|
|
236
|
-
if (contextParameter) {
|
|
237
|
-
this.contextParameter = contextParameter
|
|
238
|
-
}
|
|
239
|
-
// 判断是否需要水印
|
|
240
|
-
if (this.button.code === 'exportPDF') {
|
|
241
|
-
this.judgeNeedWatermark()
|
|
242
|
-
// 判断pdf按钮需要的样式
|
|
243
|
-
this.judgePdfButtonStyle()
|
|
244
|
-
}
|
|
245
|
-
// 解析按钮是否显示
|
|
246
|
-
if (this.isVisible === undefined || this.isVisible === null) {
|
|
247
|
-
// 如果没有传按钮是否显示,则需要自己重新解析是否显示
|
|
248
|
-
if (!this.displayConditions || this.displayConditions.length === 0) {
|
|
249
|
-
// 如果没有配置按钮显示条件,则默认为显示
|
|
250
|
-
this.isCustomVisible = true
|
|
251
|
-
} else if (this.position === 'form' || this.position === 'workflowForm') {
|
|
252
|
-
this.isButtonVisible(
|
|
253
|
-
this.displayConditions,
|
|
254
|
-
this.tableName,
|
|
255
|
-
this.additionalParamMap
|
|
256
|
-
).then((result) => {
|
|
257
|
-
this.isCustomVisible = result
|
|
258
|
-
})
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
this.isCustomVisible = this.isVisible === 'true'
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
methods: {
|
|
265
|
-
...Util,
|
|
266
|
-
...superPageService,
|
|
267
|
-
judgePdfButtonStyle() {
|
|
268
|
-
if (this.button.loading === null || this.button.loading === undefined) {
|
|
269
|
-
this.button.loading = false
|
|
270
|
-
}
|
|
271
|
-
this.button.disabled = this.preventReclick
|
|
272
|
-
if (this.button.size === null || this.button.size === undefined) {
|
|
273
|
-
this.button.size = 'small'
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
// 判断是否需要水印
|
|
277
|
-
judgeNeedWatermark() {
|
|
278
|
-
if (this.button.pdfNeedAddWatermark) {
|
|
279
|
-
const system = getStoreInfo(this.pageCode, '_systemInfo')
|
|
280
|
-
let code = null
|
|
281
|
-
// 先获取按钮选择的水印
|
|
282
|
-
if (this.button.pdfTemplateWatermarkCode) {
|
|
283
|
-
code = this.button.pdfTemplateWatermarkCode
|
|
284
|
-
} else if (system && system.watermarkCode) {
|
|
285
|
-
// 当前系统的水印
|
|
286
|
-
code = system.watermarkCode
|
|
287
|
-
}
|
|
288
|
-
if (code) {
|
|
289
|
-
const contextParameter = getStoreInfo(
|
|
290
|
-
this.pageCode,
|
|
291
|
-
'_contextParameter'
|
|
292
|
-
)
|
|
293
|
-
this.getSystemWatermark(code).then((data) => {
|
|
294
|
-
if (data != null) {
|
|
295
|
-
if (data.watermarkSetting) {
|
|
296
|
-
// this.showPageWatermarkSetting(JSON.parse(data.watermarkSetting), contextParameter)
|
|
297
|
-
const pageWatermarkSetting = JSON.parse(data.watermarkSetting)
|
|
298
|
-
if (pageWatermarkSetting) {
|
|
299
|
-
const label = this.getWatermarkLabel(
|
|
300
|
-
pageWatermarkSetting,
|
|
301
|
-
contextParameter
|
|
302
|
-
)
|
|
303
|
-
pageWatermarkSetting.label = label
|
|
304
|
-
this.watermarkSetting = pageWatermarkSetting
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
this.showPdfButton = true
|
|
308
|
-
}
|
|
309
|
-
})
|
|
310
|
-
} else {
|
|
311
|
-
this.showPdfButton = true
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
this.showPdfButton = true
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
// 按钮组中按钮点击事件
|
|
318
|
-
clickMyButton(button) {
|
|
319
|
-
if (button.code === 'exportForm') {
|
|
320
|
-
this.showExportForm = true
|
|
321
|
-
} else {
|
|
322
|
-
$emit(this, 'click', button)
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
befoerOpenPdf() {
|
|
326
|
-
if (this.button.code === 'exportPDF') {
|
|
327
|
-
if (this.getFormData) {
|
|
328
|
-
const custFun = this.getFormData
|
|
329
|
-
custFun.call(this, false).then((data) => {
|
|
330
|
-
this.formData = data
|
|
331
|
-
})
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return true
|
|
335
|
-
},
|
|
336
|
-
closePreview() {
|
|
337
|
-
setTimeout(function () {
|
|
338
|
-
const thisNode = document.getElementById('1.23452384164.123412456415')
|
|
339
|
-
if (thisNode != null) {
|
|
340
|
-
if (document.getElementById('pdfDom')) {
|
|
341
|
-
var cell1 = document.getElementById('pdfDom')
|
|
342
|
-
cell1.removeChild(
|
|
343
|
-
document.getElementById('1.23452384164.123412456415')
|
|
344
|
-
)
|
|
345
|
-
} else {
|
|
346
|
-
console.log(thisNode.parentNode.childNodes)
|
|
347
|
-
// thisNode.parentNode.childNodes.splice(10, 1)
|
|
348
|
-
thisNode.parentNode.removeChild(thisNode)
|
|
349
|
-
// 1.23452384164.123412456415
|
|
350
|
-
// document.body.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}, 500)
|
|
354
|
-
// this.$nextTick(() => {
|
|
355
|
-
// debugger
|
|
356
|
-
// const thisNode = document.getElementById('1.23452384164.123412456415')
|
|
357
|
-
// if (thisNode != null) {
|
|
358
|
-
// if (document.getElementById('pdfDom')) {
|
|
359
|
-
// var cell1 = document.getElementById('pdfDom')
|
|
360
|
-
// cell1.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
361
|
-
// } else {
|
|
362
|
-
// document.body.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
363
|
-
// }
|
|
364
|
-
// }
|
|
365
|
-
// })
|
|
366
|
-
},
|
|
367
|
-
beforeExportFormReport(templateFileInfo) {
|
|
368
|
-
this.button['templateShowPath'] = templateFileInfo.templateShowPath
|
|
369
|
-
this.button['templateUUID'] = templateFileInfo.templateUUID
|
|
370
|
-
$emit(this, 'click', this.button)
|
|
371
|
-
},
|
|
372
|
-
previewExportFormReport(templateFileInfo) {
|
|
373
|
-
this.button['isPreviewFormReport'] = true
|
|
374
|
-
this.button['templateShowPath'] = templateFileInfo.templateShowPath
|
|
375
|
-
this.button['templateUUID'] = templateFileInfo.templateUUID
|
|
376
|
-
$emit(this, 'click', this.button)
|
|
377
|
-
},
|
|
378
|
-
closeExportFormDialog() {
|
|
379
|
-
this.showExportForm = false
|
|
380
|
-
},
|
|
381
|
-
fnProhibitToEdit(data) {
|
|
382
|
-
$emit(this, 'prohibi-edit', data)
|
|
383
|
-
},
|
|
384
|
-
getButtonLabel(button) {
|
|
385
|
-
let label = button.label
|
|
386
|
-
? button.label
|
|
387
|
-
: button.code === 'search'
|
|
388
|
-
? this.$t('superPageMessage.searchButtonLabel')
|
|
389
|
-
: ''
|
|
390
|
-
if (button.code === 'back' && this.backButtonName) {
|
|
391
|
-
label = this.backButtonName
|
|
392
|
-
}
|
|
393
|
-
return label
|
|
394
|
-
},
|
|
395
|
-
getButtonType(button) {
|
|
396
|
-
return this.position && this.position === 'chart'
|
|
397
|
-
? 'text'
|
|
398
|
-
: button.type
|
|
399
|
-
? button.type
|
|
400
|
-
: button.code === 'delete'
|
|
401
|
-
? 'danger'
|
|
402
|
-
: ''
|
|
403
|
-
},
|
|
404
|
-
formatCustomParams(customParams) {
|
|
405
|
-
if (customParams) {
|
|
406
|
-
const params = {}
|
|
407
|
-
customParams.forEach((param) => {
|
|
408
|
-
params[param.name] = param.value
|
|
409
|
-
})
|
|
410
|
-
return params
|
|
411
|
-
} else {
|
|
412
|
-
return {}
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
clickWorkflowButton(clickParam) {
|
|
416
|
-
const workflowButton = this.buttonGroups.find(
|
|
417
|
-
(button) => button.code === 'workflowButton'
|
|
418
|
-
)
|
|
419
|
-
if (workflowButton && !Array.isArray(workflowButton)) {
|
|
420
|
-
this.workflowButtonClick(
|
|
421
|
-
clickParam.event,
|
|
422
|
-
null,
|
|
423
|
-
null,
|
|
424
|
-
workflowButton,
|
|
425
|
-
clickParam.completeTaskParam
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
emits: ['click', 'prohibi-edit'],
|
|
431
|
-
}
|
|
432
|
-
</script>
|
|
433
|
-
|
|
434
|
-
<style>
|
|
435
|
-
.fa-custom {
|
|
436
|
-
padding-right: 5px;
|
|
437
|
-
}
|
|
438
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="isCustomVisible" :id="pageCode + '_' + button.code">
|
|
3
|
+
<span
|
|
4
|
+
v-if="!isView || button.code === 'back'"
|
|
5
|
+
v-permission="permission"
|
|
6
|
+
style="margin-right: 10px"
|
|
7
|
+
>
|
|
8
|
+
<span v-if="button.code !== 'exportPDF'">
|
|
9
|
+
<component
|
|
10
|
+
:is="button.customControl"
|
|
11
|
+
v-if="button.customControl"
|
|
12
|
+
:search-form-data="searchFormInfo.data"
|
|
13
|
+
:selections="selections"
|
|
14
|
+
:entity="initFormData"
|
|
15
|
+
:get-entity="myFormDataFun"
|
|
16
|
+
:refresh-list="getSystemRef"
|
|
17
|
+
:class="button.code"
|
|
18
|
+
:custom-params="customParams"
|
|
19
|
+
:button-groups="buttonGroups"
|
|
20
|
+
@workflow-button-click="clickWorkflowButton"
|
|
21
|
+
:additional-param-map="additionalParamMap"
|
|
22
|
+
@refresh="refreshEmit"
|
|
23
|
+
@prohibi-edit="fnProhibitToEdit"
|
|
24
|
+
@refresh-tab="refreshTab"
|
|
25
|
+
@refresh-from="refreshFrom"
|
|
26
|
+
/>
|
|
27
|
+
<el-button
|
|
28
|
+
v-else
|
|
29
|
+
:loading="button.loading === undefined ? false : button.loading"
|
|
30
|
+
:disabled="disabled ? disabled : preventReclick"
|
|
31
|
+
:size="button.size ? button.size : 'small'"
|
|
32
|
+
:type="getButtonType(button)"
|
|
33
|
+
:icon="icon"
|
|
34
|
+
:class="button.code"
|
|
35
|
+
:plain="
|
|
36
|
+
typeof button.isPlain === 'undefined' ? false : button.isPlain
|
|
37
|
+
"
|
|
38
|
+
:round="
|
|
39
|
+
typeof button.isRound === 'undefined' ? false : button.isRound
|
|
40
|
+
"
|
|
41
|
+
:circle="
|
|
42
|
+
typeof button.isCircle === 'undefined' ? false : button.isCircle
|
|
43
|
+
"
|
|
44
|
+
@click="clickMyButton(button)"
|
|
45
|
+
>{{ getButtonLabel(button) }}</el-button
|
|
46
|
+
>
|
|
47
|
+
</span>
|
|
48
|
+
<span v-else>
|
|
49
|
+
<export-pdf-button
|
|
50
|
+
v-if="showPdfButton"
|
|
51
|
+
:pdf-template-code="button.pdfTemplateCode"
|
|
52
|
+
:entity="formData"
|
|
53
|
+
:base-props="button"
|
|
54
|
+
:watermark-setting="watermarkSetting"
|
|
55
|
+
:befoer-open="befoerOpenPdf"
|
|
56
|
+
@closePreview="closePreview"
|
|
57
|
+
/>
|
|
58
|
+
</span>
|
|
59
|
+
</span>
|
|
60
|
+
<export-form-report-dialog
|
|
61
|
+
v-if="showExportForm"
|
|
62
|
+
:button="button"
|
|
63
|
+
:entity="initFormData"
|
|
64
|
+
@close="closeExportFormDialog"
|
|
65
|
+
@preview-export-form-report="previewExportFormReport"
|
|
66
|
+
@before-export-form-report="beforeExportFormReport"
|
|
67
|
+
/>
|
|
68
|
+
</span>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
|
|
73
|
+
import { mapGetters } from 'vuex'
|
|
74
|
+
import Util from './util/util'
|
|
75
|
+
import { getStoreInfo } from './util/common-util'
|
|
76
|
+
import superPageService from './util/super-page'
|
|
77
|
+
import ExportFormReportDialog from './export-form-report-dialog'
|
|
78
|
+
export default {
|
|
79
|
+
name: 'MyButtonBase',
|
|
80
|
+
components: {
|
|
81
|
+
ExportFormReportDialog,
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
button: {
|
|
85
|
+
type: Object,
|
|
86
|
+
default: null,
|
|
87
|
+
},
|
|
88
|
+
// 资源编码前缀,例如:系统编码.页面编码.列表组件编码 或 系统编码.页面编码.表单组件编码 或 系统编码.页面编码.按钮组组件编码
|
|
89
|
+
permissionPrefix: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: null,
|
|
92
|
+
},
|
|
93
|
+
// 按钮所在位置,list列表或form表单内
|
|
94
|
+
position: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: null,
|
|
97
|
+
},
|
|
98
|
+
// 数据表名称
|
|
99
|
+
tableName: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: null,
|
|
102
|
+
},
|
|
103
|
+
// 流程表单页面才需要传该设置
|
|
104
|
+
buttonGroups: {
|
|
105
|
+
type: Array,
|
|
106
|
+
default: null,
|
|
107
|
+
},
|
|
108
|
+
// 列表行编辑时编辑的记录下标,行编辑按钮使用
|
|
109
|
+
rowIndex: {
|
|
110
|
+
type: Number,
|
|
111
|
+
default: null,
|
|
112
|
+
},
|
|
113
|
+
// 页面编码
|
|
114
|
+
pageCode: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: null,
|
|
117
|
+
},
|
|
118
|
+
// 获取页面数据的方法
|
|
119
|
+
getFormData: {
|
|
120
|
+
type: Function,
|
|
121
|
+
default: function () {},
|
|
122
|
+
},
|
|
123
|
+
// 列表选中的记录集合
|
|
124
|
+
selections: {
|
|
125
|
+
type: Array,
|
|
126
|
+
default: null,
|
|
127
|
+
},
|
|
128
|
+
// 表单对象
|
|
129
|
+
myFormDataFun: {
|
|
130
|
+
type: Function,
|
|
131
|
+
default: function () {},
|
|
132
|
+
},
|
|
133
|
+
// 列表刷新方法
|
|
134
|
+
getSystemRef: {
|
|
135
|
+
type: Function,
|
|
136
|
+
default: function () {},
|
|
137
|
+
},
|
|
138
|
+
searchFormInfo: {
|
|
139
|
+
type: Object,
|
|
140
|
+
default: () => {
|
|
141
|
+
return { data: {} }
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
disabled: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false,
|
|
147
|
+
},
|
|
148
|
+
// 没传的话,需要在本组件内判断是否显示
|
|
149
|
+
isVisible: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: null,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
data() {
|
|
155
|
+
let permission = 'true'
|
|
156
|
+
if (
|
|
157
|
+
this.button.isPermission === undefined ||
|
|
158
|
+
this.button.isPermission === true
|
|
159
|
+
) {
|
|
160
|
+
// 表示按钮受权限保护
|
|
161
|
+
permission = this.permissionPrefix + '.' + this.button.code
|
|
162
|
+
if (this.button.functionCode) {
|
|
163
|
+
permission = this.button.functionCode
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
console.log('my-button-base1111------permission=', permission)
|
|
167
|
+
const isDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
|
|
168
|
+
const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
|
|
169
|
+
console.log('my-button-base222------isDevMode=', isDevMode)
|
|
170
|
+
console.log('my-button-base333------isPreview=', isPreview)
|
|
171
|
+
if (
|
|
172
|
+
(isDevMode && isDevMode === true) ||
|
|
173
|
+
(isPreview && isPreview === true) ||
|
|
174
|
+
(this.button && this.button.code === 'back')
|
|
175
|
+
) {
|
|
176
|
+
// 开发模式 或 预览时 或 返回按钮,权限不受控制
|
|
177
|
+
permission = 'true'
|
|
178
|
+
}
|
|
179
|
+
console.log('my-button-base444------permission=', permission)
|
|
180
|
+
const displayConditions = this.button.buttonDisplayConditionsList
|
|
181
|
+
let isCustomVisible = false
|
|
182
|
+
const isView = this.isViewDetail(this.position)
|
|
183
|
+
let icon = this.button.icon
|
|
184
|
+
if (icon && icon.indexOf('fa-') === 0) {
|
|
185
|
+
// 表示以“fa-”开头,使用font-awesome中的图标
|
|
186
|
+
icon = 'fa fa-custom ' + icon
|
|
187
|
+
}
|
|
188
|
+
if (this.position === 'chart' && !icon && this.button.code === 'export') {
|
|
189
|
+
icon = 'fa fa-custom fa-cloud-download'
|
|
190
|
+
}
|
|
191
|
+
const formDataFun = this.myFormDataFun
|
|
192
|
+
let initFormData
|
|
193
|
+
if (formDataFun) {
|
|
194
|
+
initFormData = formDataFun.call(this)
|
|
195
|
+
}
|
|
196
|
+
let jumpInfo = sessionStorage.getItem(this.pageCode + '-jumpMode')
|
|
197
|
+
let backButtonName
|
|
198
|
+
if (jumpInfo) {
|
|
199
|
+
const jumpInfoObj = JSON.parse(jumpInfo)
|
|
200
|
+
const jumpMode = jumpInfoObj.jumpMode
|
|
201
|
+
if (jumpMode === 'openWindow' || jumpMode === 'newTab') {
|
|
202
|
+
// 新页签或新窗口显示“关闭”按钮
|
|
203
|
+
backButtonName = this.$t('superPage.closeButton')
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
permission, // 按钮的资源编码
|
|
208
|
+
isCustomVisible, // 是否显示按钮
|
|
209
|
+
displayConditions, // 按钮显示条件
|
|
210
|
+
isPreview, // 预览时导入按钮不操作
|
|
211
|
+
isView, // 是否是查看页面
|
|
212
|
+
additionalParamMap: null, // 跳转页面的附加参数
|
|
213
|
+
icon,
|
|
214
|
+
formData: {},
|
|
215
|
+
contextParameter: null,
|
|
216
|
+
watermarkSetting: null,
|
|
217
|
+
showPdfButton: false,
|
|
218
|
+
showExportForm: false,
|
|
219
|
+
initFormData, // 表单初始值
|
|
220
|
+
backButtonName,
|
|
221
|
+
customParams: {},
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
computed: {
|
|
225
|
+
...mapGetters(['preventReclick']),
|
|
226
|
+
},
|
|
227
|
+
created() {
|
|
228
|
+
if (this.button.customParams) {
|
|
229
|
+
this.customParams = this.formatCustomParams(this.button.customParams)
|
|
230
|
+
}
|
|
231
|
+
const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
|
|
232
|
+
if (additionalParamMap) {
|
|
233
|
+
this.additionalParamMap = additionalParamMap
|
|
234
|
+
}
|
|
235
|
+
const contextParameter = getStoreInfo(this.pageCode, '_contextParameter')
|
|
236
|
+
if (contextParameter) {
|
|
237
|
+
this.contextParameter = contextParameter
|
|
238
|
+
}
|
|
239
|
+
// 判断是否需要水印
|
|
240
|
+
if (this.button.code === 'exportPDF') {
|
|
241
|
+
this.judgeNeedWatermark()
|
|
242
|
+
// 判断pdf按钮需要的样式
|
|
243
|
+
this.judgePdfButtonStyle()
|
|
244
|
+
}
|
|
245
|
+
// 解析按钮是否显示
|
|
246
|
+
if (this.isVisible === undefined || this.isVisible === null) {
|
|
247
|
+
// 如果没有传按钮是否显示,则需要自己重新解析是否显示
|
|
248
|
+
if (!this.displayConditions || this.displayConditions.length === 0) {
|
|
249
|
+
// 如果没有配置按钮显示条件,则默认为显示
|
|
250
|
+
this.isCustomVisible = true
|
|
251
|
+
} else if (this.position === 'form' || this.position === 'workflowForm') {
|
|
252
|
+
this.isButtonVisible(
|
|
253
|
+
this.displayConditions,
|
|
254
|
+
this.tableName,
|
|
255
|
+
this.additionalParamMap
|
|
256
|
+
).then((result) => {
|
|
257
|
+
this.isCustomVisible = result
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
this.isCustomVisible = this.isVisible === 'true'
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
methods: {
|
|
265
|
+
...Util,
|
|
266
|
+
...superPageService,
|
|
267
|
+
judgePdfButtonStyle() {
|
|
268
|
+
if (this.button.loading === null || this.button.loading === undefined) {
|
|
269
|
+
this.button.loading = false
|
|
270
|
+
}
|
|
271
|
+
this.button.disabled = this.preventReclick
|
|
272
|
+
if (this.button.size === null || this.button.size === undefined) {
|
|
273
|
+
this.button.size = 'small'
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
// 判断是否需要水印
|
|
277
|
+
judgeNeedWatermark() {
|
|
278
|
+
if (this.button.pdfNeedAddWatermark) {
|
|
279
|
+
const system = getStoreInfo(this.pageCode, '_systemInfo')
|
|
280
|
+
let code = null
|
|
281
|
+
// 先获取按钮选择的水印
|
|
282
|
+
if (this.button.pdfTemplateWatermarkCode) {
|
|
283
|
+
code = this.button.pdfTemplateWatermarkCode
|
|
284
|
+
} else if (system && system.watermarkCode) {
|
|
285
|
+
// 当前系统的水印
|
|
286
|
+
code = system.watermarkCode
|
|
287
|
+
}
|
|
288
|
+
if (code) {
|
|
289
|
+
const contextParameter = getStoreInfo(
|
|
290
|
+
this.pageCode,
|
|
291
|
+
'_contextParameter'
|
|
292
|
+
)
|
|
293
|
+
this.getSystemWatermark(code).then((data) => {
|
|
294
|
+
if (data != null) {
|
|
295
|
+
if (data.watermarkSetting) {
|
|
296
|
+
// this.showPageWatermarkSetting(JSON.parse(data.watermarkSetting), contextParameter)
|
|
297
|
+
const pageWatermarkSetting = JSON.parse(data.watermarkSetting)
|
|
298
|
+
if (pageWatermarkSetting) {
|
|
299
|
+
const label = this.getWatermarkLabel(
|
|
300
|
+
pageWatermarkSetting,
|
|
301
|
+
contextParameter
|
|
302
|
+
)
|
|
303
|
+
pageWatermarkSetting.label = label
|
|
304
|
+
this.watermarkSetting = pageWatermarkSetting
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
this.showPdfButton = true
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
} else {
|
|
311
|
+
this.showPdfButton = true
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
this.showPdfButton = true
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
// 按钮组中按钮点击事件
|
|
318
|
+
clickMyButton(button) {
|
|
319
|
+
if (button.code === 'exportForm') {
|
|
320
|
+
this.showExportForm = true
|
|
321
|
+
} else {
|
|
322
|
+
$emit(this, 'click', button)
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
befoerOpenPdf() {
|
|
326
|
+
if (this.button.code === 'exportPDF') {
|
|
327
|
+
if (this.getFormData) {
|
|
328
|
+
const custFun = this.getFormData
|
|
329
|
+
custFun.call(this, false).then((data) => {
|
|
330
|
+
this.formData = data
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return true
|
|
335
|
+
},
|
|
336
|
+
closePreview() {
|
|
337
|
+
setTimeout(function () {
|
|
338
|
+
const thisNode = document.getElementById('1.23452384164.123412456415')
|
|
339
|
+
if (thisNode != null) {
|
|
340
|
+
if (document.getElementById('pdfDom')) {
|
|
341
|
+
var cell1 = document.getElementById('pdfDom')
|
|
342
|
+
cell1.removeChild(
|
|
343
|
+
document.getElementById('1.23452384164.123412456415')
|
|
344
|
+
)
|
|
345
|
+
} else {
|
|
346
|
+
console.log(thisNode.parentNode.childNodes)
|
|
347
|
+
// thisNode.parentNode.childNodes.splice(10, 1)
|
|
348
|
+
thisNode.parentNode.removeChild(thisNode)
|
|
349
|
+
// 1.23452384164.123412456415
|
|
350
|
+
// document.body.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}, 500)
|
|
354
|
+
// this.$nextTick(() => {
|
|
355
|
+
// debugger
|
|
356
|
+
// const thisNode = document.getElementById('1.23452384164.123412456415')
|
|
357
|
+
// if (thisNode != null) {
|
|
358
|
+
// if (document.getElementById('pdfDom')) {
|
|
359
|
+
// var cell1 = document.getElementById('pdfDom')
|
|
360
|
+
// cell1.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
361
|
+
// } else {
|
|
362
|
+
// document.body.removeChild(document.getElementById('1.23452384164.123412456415'))
|
|
363
|
+
// }
|
|
364
|
+
// }
|
|
365
|
+
// })
|
|
366
|
+
},
|
|
367
|
+
beforeExportFormReport(templateFileInfo) {
|
|
368
|
+
this.button['templateShowPath'] = templateFileInfo.templateShowPath
|
|
369
|
+
this.button['templateUUID'] = templateFileInfo.templateUUID
|
|
370
|
+
$emit(this, 'click', this.button)
|
|
371
|
+
},
|
|
372
|
+
previewExportFormReport(templateFileInfo) {
|
|
373
|
+
this.button['isPreviewFormReport'] = true
|
|
374
|
+
this.button['templateShowPath'] = templateFileInfo.templateShowPath
|
|
375
|
+
this.button['templateUUID'] = templateFileInfo.templateUUID
|
|
376
|
+
$emit(this, 'click', this.button)
|
|
377
|
+
},
|
|
378
|
+
closeExportFormDialog() {
|
|
379
|
+
this.showExportForm = false
|
|
380
|
+
},
|
|
381
|
+
fnProhibitToEdit(data) {
|
|
382
|
+
$emit(this, 'prohibi-edit', data)
|
|
383
|
+
},
|
|
384
|
+
getButtonLabel(button) {
|
|
385
|
+
let label = button.label
|
|
386
|
+
? button.label
|
|
387
|
+
: button.code === 'search'
|
|
388
|
+
? this.$t('superPageMessage.searchButtonLabel')
|
|
389
|
+
: ''
|
|
390
|
+
if (button.code === 'back' && this.backButtonName) {
|
|
391
|
+
label = this.backButtonName
|
|
392
|
+
}
|
|
393
|
+
return label
|
|
394
|
+
},
|
|
395
|
+
getButtonType(button) {
|
|
396
|
+
return this.position && this.position === 'chart'
|
|
397
|
+
? 'text'
|
|
398
|
+
: button.type
|
|
399
|
+
? button.type
|
|
400
|
+
: button.code === 'delete'
|
|
401
|
+
? 'danger'
|
|
402
|
+
: ''
|
|
403
|
+
},
|
|
404
|
+
formatCustomParams(customParams) {
|
|
405
|
+
if (customParams) {
|
|
406
|
+
const params = {}
|
|
407
|
+
customParams.forEach((param) => {
|
|
408
|
+
params[param.name] = param.value
|
|
409
|
+
})
|
|
410
|
+
return params
|
|
411
|
+
} else {
|
|
412
|
+
return {}
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
clickWorkflowButton(clickParam) {
|
|
416
|
+
const workflowButton = this.buttonGroups.find(
|
|
417
|
+
(button) => button.code === 'workflowButton'
|
|
418
|
+
)
|
|
419
|
+
if (workflowButton && !Array.isArray(workflowButton)) {
|
|
420
|
+
this.workflowButtonClick(
|
|
421
|
+
clickParam.event,
|
|
422
|
+
null,
|
|
423
|
+
null,
|
|
424
|
+
workflowButton,
|
|
425
|
+
clickParam.completeTaskParam
|
|
426
|
+
)
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
emits: ['click', 'prohibi-edit'],
|
|
431
|
+
}
|
|
432
|
+
</script>
|
|
433
|
+
|
|
434
|
+
<style>
|
|
435
|
+
.fa-custom {
|
|
436
|
+
padding-right: 5px;
|
|
437
|
+
}
|
|
438
|
+
</style>
|