super-pages 0.0.7-up → 0.0.9-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.
Files changed (54) hide show
  1. package/lib/super-pages.js +1 -1
  2. package/lib/super-pages.umd.cjs +1 -1
  3. package/package.json +12 -2
  4. package/index.html +0 -13
  5. package/packages/index.js +0 -30
  6. package/packages/super-page/index.js +0 -9
  7. package/packages/super-page/src/button-group.vue +0 -294
  8. package/packages/super-page/src/chart-page.vue +0 -215
  9. package/packages/super-page/src/chart-query-page.vue +0 -163
  10. package/packages/super-page/src/common-form-page.vue +0 -594
  11. package/packages/super-page/src/export-form-report-dialog.vue +0 -145
  12. package/packages/super-page/src/form-head.vue +0 -74
  13. package/packages/super-page/src/form-page.vue +0 -107
  14. package/packages/super-page/src/group-tag.vue +0 -21
  15. package/packages/super-page/src/list-page.vue +0 -1453
  16. package/packages/super-page/src/list-toolbar-dynamic-source.vue +0 -89
  17. package/packages/super-page/src/list-toolbar-page.vue +0 -377
  18. package/packages/super-page/src/my-button-base.vue +0 -438
  19. package/packages/super-page/src/my-button.vue +0 -196
  20. package/packages/super-page/src/page-custom-component.vue +0 -56
  21. package/packages/super-page/src/remove-signer-dialog.vue +0 -103
  22. package/packages/super-page/src/sub-tab-page.vue +0 -79
  23. package/packages/super-page/src/super-page-component.vue +0 -86
  24. package/packages/super-page/src/super-page.vue +0 -162
  25. package/packages/super-page/src/tab-page.vue +0 -154
  26. package/packages/super-page/src/task-informition-dialog.vue +0 -82
  27. package/packages/super-page/src/util/ListButtonEvent.js +0 -896
  28. package/packages/super-page/src/util/api.js +0 -37
  29. package/packages/super-page/src/util/callEvents.js +0 -62
  30. package/packages/super-page/src/util/chartButtonEvent.js +0 -60
  31. package/packages/super-page/src/util/common-util.js +0 -102
  32. package/packages/super-page/src/util/commonButtonEvent.js +0 -70
  33. package/packages/super-page/src/util/eventBus.js +0 -8
  34. package/packages/super-page/src/util/formButtonEvent.js +0 -509
  35. package/packages/super-page/src/util/store.js +0 -3
  36. package/packages/super-page/src/util/super-page.js +0 -29
  37. package/packages/super-page/src/util/util.js +0 -1491
  38. package/packages/super-page/src/util/workflowButtonEvent.js +0 -1729
  39. package/packages/super-page/src/widget-col-page.vue +0 -339
  40. package/packages/super-page/src/widget-page.vue +0 -703
  41. package/packages/super-page/src/widget-sub-tab-pane-page.vue +0 -115
  42. package/packages/super-page/src/widget-tab-pane-page.vue +0 -135
  43. package/packages/super-page/src/workflow-button-group.vue +0 -561
  44. package/packages/super-page/src/workflow-form-page.vue +0 -1310
  45. package/packages/super-page-dialog/index.js +0 -9
  46. package/packages/super-page-dialog/src/super-page-dialog.vue +0 -200
  47. package/packages/utils/gogocodeTransfer.js +0 -59
  48. package/public/vite.svg +0 -1
  49. package/src/i18n/i18n.js +0 -16
  50. package/src/i18n/langs/cn.js +0 -65
  51. package/src/i18n/langs/en.js +0 -68
  52. package/src/styles/index.scss +0 -4
  53. package/src/utils/common-util.js +0 -9
  54. package/vite.config.js +0 -36
@@ -1,1491 +0,0 @@
1
- import { $on, $off, $once, $emit } from '../../../utils/gogocodeTransfer'
2
- import * as Vue from 'vue'
3
- import { getI18n } from '../../../../src/utils/common-util'
4
- import eventBus from './eventBus'
5
- import axios from 'axios'
6
- import Cookies from 'js-cookie'
7
- import { getStoreInfo, setStoreInfo } from './common-util'
8
- import { jumpToPage } from 'imatrix-ui/src/utils/jump-page-utils'
9
- import { analysisCondition } from 'imatrix-ui/src/utils/util'
10
- import { showWatermark } from 'imatrix-ui/src/utils/watermark'
11
- import {
12
- getSystemBackendUrl,
13
- isPromise,
14
- } from 'imatrix-ui/src/utils/common-util'
15
- import { getToken } from 'imatrix-ui/src/utils/auth'
16
- const Util = {
17
- // 表示是全路径
18
- isFullPath(path) {
19
- return path.indexOf('http:') === 0 || path.indexOf('https:') === 0
20
- },
21
- getRealRestApiPath(orgRestApiPath, system) {
22
- let path = orgRestApiPath
23
- if (orgRestApiPath) {
24
- if (system && !this.isFullPath(orgRestApiPath)) {
25
- const baseUrl = this.getBaseUrl(system)
26
- if (system.standard === false) {
27
- // 自定义系统
28
- // 扩展系统的后台地址格式为:/dsc/systemCode/xxx/x,例如:/dsc/demo/orders/list,配置的路径为/orders/list即可
29
- path = baseUrl + '/' + system.code + orgRestApiPath
30
- } else {
31
- // 标准系统
32
- path = baseUrl + orgRestApiPath
33
- }
34
- }
35
- }
36
- return path
37
- },
38
- // 在表单中获得实例id
39
- getWorkflowId(pageCode) {
40
- const formData = getStoreInfo(pageCode, '_formData')
41
- if (formData) {
42
- let workflowId = formData.workflow_id
43
- if (!workflowId) {
44
- workflowId = formData.WORKFLOW_ID
45
- }
46
- if (!workflowId && formData.workflowInfo) {
47
- workflowId = formData.workflowInfo.workflowId
48
- }
49
- return workflowId
50
- }
51
- },
52
- // 获得表单页面返回按钮的信息
53
- getBackButton() {
54
- return {
55
- code: 'back',
56
- label: getI18n().t('superPage.backButton'),
57
- }
58
- },
59
- /**
60
- * 排序数组
61
- * @param arr 排序数组
62
- * @param feildName 排序字段
63
- * @param orderType 排序方式:asc、desc
64
- */
65
- sortArr(arr, feildName, orderType) {
66
- if (!arr) {
67
- return []
68
- }
69
- arr = arr.sort(this.compare(feildName, orderType))
70
- return arr
71
- },
72
- compare(feildName, orderType) {
73
- if (orderType === 'desc') {
74
- // 降序
75
- return function (object1, object2) {
76
- const value1 = object1[feildName]
77
- const value2 = object2[feildName]
78
- if (value2 > value1) {
79
- return 1
80
- } else if (value2 < value1) {
81
- return -1
82
- } else {
83
- return 0
84
- }
85
- }
86
- } else {
87
- // 升序
88
- return function (object1, object2) {
89
- const value1 = object1[feildName]
90
- const value2 = object2[feildName]
91
- if (value2 < value1) {
92
- return 1
93
- } else if (value2 > value1) {
94
- return -1
95
- } else {
96
- return 0
97
- }
98
- }
99
- }
100
- },
101
- // 点击按钮时,操作多条记录,解析是否可执行的配置
102
- canExecuteWithMore(
103
- executableDataSetting,
104
- entities,
105
- isSql,
106
- tableName,
107
- additionalParamMap
108
- ) {
109
- return new Promise((resolve, reject) => {
110
- if (
111
- executableDataSetting === undefined ||
112
- executableDataSetting === '' ||
113
- entities === undefined ||
114
- entities.length === 0
115
- ) {
116
- // 表示没有设置“可执行条件” 且 没有“自动填写字段”设置 或 没有选择记录
117
- resolve({
118
- canExecute: true,
119
- })
120
- } else {
121
- const contextParameter = getStoreInfo(
122
- this.pageCode,
123
- '_contextParameter'
124
- )
125
- let isCanExecute = true
126
- let failMessage
127
- let failEntity
128
- for (let i = 0; i < entities.length; i++) {
129
- const entity = entities[i]
130
- for (let n = 0; n < executableDataSetting.length; n++) {
131
- const conditionSetting = executableDataSetting[n]
132
- // 当失败时的提示信息
133
- const message = conditionSetting.toolTips
134
- const conditionList = conditionSetting.conditionList
135
- const canExecute = analysisCondition(
136
- conditionList,
137
- entity,
138
- additionalParamMap,
139
- contextParameter,
140
- isSql,
141
- tableName,
142
- null
143
- )
144
- if (!canExecute) {
145
- // 表示不可执行,把解析结果返回回去
146
- // result.put("canExecute",false);
147
- // result.put("message",message);
148
- // result.put("failEntity",entity);
149
- isCanExecute = false
150
- failMessage = message
151
- failEntity = entity
152
- break
153
- }
154
- }
155
- }
156
- if (!isCanExecute) {
157
- if (failMessage) {
158
- this.$message({
159
- showClose: true,
160
- type: 'warning',
161
- message: failMessage,
162
- })
163
- }
164
- resolve({
165
- canExecute: false,
166
- message: failMessage,
167
- failEntity: failEntity,
168
- })
169
- } else {
170
- resolve({
171
- canExecute: true,
172
- })
173
- }
174
-
175
- // const pageSettingEntity = {
176
- // entities,
177
- // sql: isSql,
178
- // tableName
179
- // }
180
- // if (executableDataSetting) {
181
- // pageSettingEntity.setting = JSON.stringify(executableDataSetting)
182
- // }
183
- // if (additionalParamMap) {
184
- // pageSettingEntity.additionalParamMap = additionalParamMap
185
- // }
186
- // const path = Vue.prototype.baseAPI + '/component/super-pages/can-executes'
187
- // this.$http.post(path, pageSettingEntity).then((result) => {
188
- // if(result){
189
- // const canExecute = result.canExecute
190
- // if (canExecute === false) {
191
- // // 表示不可执行
192
- // let message = result.message
193
- // if (message === '') {
194
- // message = this.$t('superPageMessage.canExecuteDefaultMessage')
195
- // }
196
- // this.$message({
197
- // showClose: true,
198
- // type: 'warning',
199
- // message: message
200
- // })
201
- // // console.log('失败的记录信息:', result.failEntity)
202
- // resolve(result)
203
- // } else {
204
- // resolve(result)
205
- // }
206
- // } else {
207
- // resolve({
208
- // canExecute: true
209
- // })
210
- // }
211
- // }).catch((error) => {
212
- // reject(error)
213
- // })
214
- }
215
- })
216
- },
217
- // 点击按钮时,单条记录时,解析是否可执行的配置
218
- canExecute(
219
- executableDataSetting,
220
- entity,
221
- isSql,
222
- tableName,
223
- additionalParamMap
224
- ) {
225
- const entities = []
226
- entities.push(entity)
227
- return this.canExecuteWithMore(
228
- executableDataSetting,
229
- entities,
230
- isSql,
231
- tableName,
232
- additionalParamMap
233
- )
234
- },
235
- // 解析按钮是否显示
236
- isButtonVisible(displayConditions, tableName, additionalParamMap) {
237
- return new Promise((resolve, reject) => {
238
- const isSqlQuery = getStoreInfo(this.pageCode, '_pageIsDsc')
239
- if (displayConditions && displayConditions.length > 0) {
240
- // 表单页面才需要解析按钮显示条件
241
- // const isCreateForm = store.get('_isCreateformData')
242
- const entity = getStoreInfo(this.pageCode, '_formData')
243
- const contextParameter = getStoreInfo(
244
- this.pageCode,
245
- '_contextParameter'
246
- )
247
- const result = analysisCondition(
248
- displayConditions,
249
- entity,
250
- additionalParamMap,
251
- contextParameter,
252
- isSqlQuery,
253
- tableName,
254
- null
255
- )
256
- resolve(result)
257
- } else {
258
- resolve(true)
259
- }
260
- })
261
- },
262
- // 解析工作流按钮组“显示条件”配置
263
- getWorkflowButtonVisible(
264
- workflowButtonEventSetting,
265
- tableName,
266
- additionalParamMap
267
- ) {
268
- return new Promise((resolve, reject) => {
269
- const isSqlQuery = getStoreInfo(this.pageCode, '_pageIsDsc')
270
- if (workflowButtonEventSetting && workflowButtonEventSetting.length > 0) {
271
- // 表单页面才需要解析按钮显示条件
272
- // 是否是新建表单
273
- // const isCreateForm = store.get('_isCreateformData')
274
- const entity = getStoreInfo(this.pageCode, '_formData')
275
- const contextParameter = getStoreInfo(
276
- this.pageCode,
277
- '_contextParameter'
278
- )
279
- const result = {}
280
- for (let i = 0; i < workflowButtonEventSetting.length; i++) {
281
- const eventSetting = workflowButtonEventSetting[i]
282
- const event = eventSetting.event
283
- if (event) {
284
- const isVisibleObj = eventSetting.isVisible
285
- // 默认是显示该按钮
286
- let isVisible = true
287
- if (
288
- isVisibleObj !== undefined &&
289
- isVisibleObj !== null &&
290
- isVisibleObj + '' === 'false'
291
- ) {
292
- isVisible = false
293
- }
294
- if (isVisible === true) {
295
- // 显示时,再判断是否符合显示条件,符合显示条件才显示,否则就隐藏
296
- const displayConditionObj =
297
- eventSetting.buttonDisplayConditionsList
298
- if (
299
- displayConditionObj === undefined ||
300
- displayConditionObj === null
301
- ) {
302
- continue
303
- }
304
- const displayConditionList = displayConditionObj
305
- isVisible = analysisCondition(
306
- displayConditionList,
307
- entity,
308
- additionalParamMap,
309
- contextParameter,
310
- isSqlQuery,
311
- tableName,
312
- null
313
- )
314
- }
315
- result[event] = isVisible
316
- }
317
- }
318
- if (Object.keys(result).length > 0) {
319
- // 再经过流程本身判断
320
- resolve(result)
321
- } else {
322
- resolve(true)
323
- }
324
- } else {
325
- resolve(true)
326
- }
327
- })
328
- },
329
- // 表单页面“成功后” 操作
330
- afterSuccessOperateInForm(
331
- successOperation,
332
- formData,
333
- isNeedValueMapping,
334
- isWorkflowForm
335
- ) {
336
- console.log(
337
- 'afterSuccessOperateInForm---successOperation=-',
338
- successOperation,
339
- formData,
340
- isNeedValueMapping
341
- )
342
- if (
343
- !successOperation ||
344
- successOperation === '' ||
345
- successOperation === null
346
- ) {
347
- // 如果没有配置“成功后”操作,则默认是刷新
348
- successOperation = 'refresh'
349
- }
350
- if (successOperation === 'noOperation') {
351
- // 无操作时,更新表单内容
352
- // 必须加这个代码,否则会导致表单不能连续保存
353
- if (formData && this.$refs.superForm) {
354
- this.$refs.superForm.refresh(formData)
355
- setStoreInfo(this.pageCode, '_formData', formData)
356
- }
357
- } else if (successOperation === 'refresh') {
358
- // 重新加载表单,解决子表权限问题
359
- // initWorkflowFormData和getDscFormData中有重新加载表单内容,不需要调用updateFormData方法了
360
- // this.updateFormData(formData)
361
- if (formData && (formData.id || formData.ID)) {
362
- this.dataId = formData.ID == null ? formData.id : formData.ID
363
- if (this.$route.query._t_) {
364
- sessionStorage.setItem(this.$route.query._t_ + '_id', this.dataId)
365
- }
366
- if (isWorkflowForm) {
367
- this.initWorkflowFormData()
368
- } else {
369
- this.getDscFormData()
370
- }
371
- }
372
- } else if (
373
- successOperation === 'closeWindow' ||
374
- successOperation === 'closeWindowAndRefresh'
375
- ) {
376
- // 关闭弹框Dialog
377
- console.log(
378
- 'afterSuccessOperateInForm--successOperation=--',
379
- successOperation
380
- )
381
- if (
382
- isNeedValueMapping !== undefined &&
383
- isNeedValueMapping === true &&
384
- formData &&
385
- formData !== undefined
386
- ) {
387
- // 如果需要回填值,将事件抛出,让父页面捕获,直到弹框页面捕获
388
- let jumpInfo = sessionStorage.getItem(this.pageCode + '-jumpMode')
389
- // console.log('---update-value-afterSuccessOperateInForm---jumpInfo=', jumpInfo)
390
- let rowIndex
391
- if (jumpInfo) {
392
- const jumpInfoObj = JSON.parse(jumpInfo)
393
- // 该弹框页面的父页面是列表组件的某记录时,用于回填列表记录值使用
394
- rowIndex = jumpInfoObj.rowIndex
395
- }
396
- $emit(this, 'update-value', formData, this.tableName, rowIndex)
397
- }
398
- this.closePage(this.pageCode, successOperation, formData)
399
- // // 关闭window窗口
400
- // if (window.parent) {
401
- // window.parent.close()
402
- // } else {
403
- // window.close()
404
- // }
405
- }
406
- },
407
- updateFormData(formData) {
408
- this.isShow = false
409
- const that = this
410
- setTimeout(() => {
411
- that.formData = formData
412
- that.isShow = true
413
- if (that.$refs.superForm) {
414
- that.$refs.superForm.refresh(that.formData)
415
- }
416
- }, 10)
417
- },
418
- isArrayFn(value) {
419
- // 首先判断浏览器是否支持Array.isArray这个方法
420
- if (typeof Array.isArray === 'function') {
421
- return Array.isArray(value)
422
- } else {
423
- return Object.prototype.toString.call(value) === '[object Array]'
424
- // return obj.__proto__ === Array.prototype;
425
- }
426
- },
427
- // 获得普通表单保存时的request请求,表单页面和行编辑保存时使用了
428
- getSaveFormRequest(
429
- system,
430
- restfulApiPath,
431
- formViewCode,
432
- formViewVersion,
433
- tableName,
434
- formData,
435
- entityName,
436
- myJsContent,
437
- formNoRuleCode,
438
- dataConversionRule,
439
- autoSetValueData,
440
- url,
441
- logSettingText,
442
- dynamicColumnInfo,
443
- mainDefaultValueColumns,
444
- taskMap,
445
- needDeleteFileUuidS,
446
- additionalParamMap,
447
- beanName,
448
- isWorkflow,
449
- functionCode,
450
- isUnControlVersion
451
- ) {
452
- // 自定义系统时,封装CommonEntity
453
- const param = {
454
- entity: formData,
455
- formViewCode: formViewCode,
456
- formViewVersion: formViewVersion,
457
- tableName: tableName,
458
- formNoRuleCode,
459
- isWorkflowEntity: isWorkflow,
460
- functionCode: functionCode,
461
- }
462
- if (this.judgeHeavyList) {
463
- // 判重组合字段配置
464
- param.judgeHeavyList = JSON.stringify(this.judgeHeavyList)
465
- }
466
- if (dataConversionRule) {
467
- if (this.isArrayFn(dataConversionRule)) {
468
- param.dataConversionRule = dataConversionRule.join(',')
469
- } else if (typeof dataConversionRule === 'string') {
470
- param.dataConversionRule = dataConversionRule
471
- }
472
- }
473
- if (autoSetValueData) {
474
- param.autoSetValueData = JSON.stringify(autoSetValueData)
475
- }
476
- // 添加日志
477
- if (logSettingText) {
478
- param.logSettingText = logSettingText
479
- }
480
- if (!param.systemCode) {
481
- param.systemCode = system.code
482
- }
483
- if (entityName) {
484
- // 表示需要重写后台保存的实现
485
- param.entityName = entityName
486
- }
487
- if (beanName) {
488
- // 表示需要重写后台保存的实现
489
- param.beanName = beanName
490
- }
491
- if (taskMap) {
492
- param.taskMap = taskMap
493
- }
494
- if (needDeleteFileUuidS) {
495
- param.needDeleteFileUuidS = needDeleteFileUuidS
496
- }
497
- if (this.dataTypeMap) {
498
- param.dataTypeMap = this.dataTypeMap
499
- }
500
- if (dynamicColumnInfo) {
501
- param.dynamicColumnInfo = dynamicColumnInfo
502
- }
503
- if (mainDefaultValueColumns) {
504
- param.mainDefaultValueColumns = mainDefaultValueColumns
505
- }
506
- if (additionalParamMap) {
507
- param.additionalParamMap = additionalParamMap
508
- }
509
- if (isUnControlVersion !== undefined) {
510
- param.unControlVersion = isUnControlVersion
511
- }
512
- return this.getSaveFormRequestByParam(
513
- system,
514
- restfulApiPath,
515
- param,
516
- myJsContent,
517
- url,
518
- formData
519
- )
520
- },
521
- // 获得普通表单保存时的request请求,表单页面和行编辑保存时使用了
522
- getSaveFormRequestByParam(
523
- system,
524
- restfulApiPath,
525
- param,
526
- myJsContent,
527
- url,
528
- formData
529
- ) {
530
- let path = restfulApiPath
531
- if (system.standard === false && !path) {
532
- // 表示是自定义系统
533
- const baseUrl = this.getBaseUrl(system)
534
- path = baseUrl + url
535
- }
536
- path = this.getRealRestApiPath(path, system)
537
- let request
538
- if (myJsContent) {
539
- // 将js文本转换为函数,并运行
540
- // eslint-disable-next-line no-eval
541
- const buttonFun = eval('(' + myJsContent + ')')
542
- // 运行方法
543
- request = buttonFun(this, param)
544
- } else {
545
- if (formData && (formData.id || formData.ID)) {
546
- // 表示是修改操作
547
- request = this.$http.put(path, param)
548
- } else {
549
- // 表示是新建操作
550
- request = this.$http.post(path, param)
551
- }
552
- }
553
- return request
554
- },
555
- // 导出报告按钮实现
556
- exportFormReport(
557
- templateUUID,
558
- fileName,
559
- myJsContent,
560
- entityName,
561
- system,
562
- logSettingText,
563
- taskMap,
564
- additionalParamMap,
565
- isWorkflowForm,
566
- beanName,
567
- button,
568
- tableName
569
- ) {
570
- if (this.$refs.superForm) {
571
- // 通过getViewModels获得处理了下拉框、复选框的值之后的表单数据,用于导出报告使用
572
- this.$refs.superForm.getViewModels().then(async (viewModels) => {
573
- const param = {
574
- entity: viewModels,
575
- fileName: templateUUID, // uuid
576
- showName: fileName, // 下载的文件名称
577
- entityName, // 实体名,首字母小写
578
- beanName,
579
- isWorkflowForm, // 是否是流程表单
580
- functionCode: button.functionCode,
581
- tableName,
582
- }
583
- if (logSettingText) {
584
- param.logSettingText = logSettingText
585
- }
586
- if (!param.systemCode) {
587
- param.systemCode = system.code
588
- }
589
- if (taskMap) {
590
- param.taskMap = taskMap
591
- }
592
- if (additionalParamMap) {
593
- param.additionalParamMap = additionalParamMap
594
- }
595
- let beforeClickResult = this.callBeforeClickButton(
596
- this.formEvents,
597
- this.formViewCode + '__exportForm',
598
- {
599
- params: this.additionalParamMap,
600
- additionalParamMap: this.additionalParamMap,
601
- exportParam: param,
602
- }
603
- )
604
- if (isPromise(beforeClickResult)) {
605
- await beforeClickResult.then((result) => {
606
- console.log('点击前事件返回结果--Promise--resolve---', result)
607
- beforeClickResult = result
608
- })
609
- }
610
- if (!beforeClickResult) {
611
- // 返回值为false,不继续执行按钮操作
612
- return
613
- }
614
- if (isPromise(beforeClickResult)) {
615
- beforeClickResult.then((result) => {
616
- if (result) {
617
- this.exportFormReportSuccess(
618
- templateUUID,
619
- fileName,
620
- myJsContent,
621
- entityName,
622
- system,
623
- logSettingText,
624
- taskMap,
625
- additionalParamMap,
626
- isWorkflowForm,
627
- beanName,
628
- button,
629
- tableName,
630
- param
631
- )
632
- }
633
- })
634
- } else {
635
- this.exportFormReportSuccess(
636
- templateUUID,
637
- fileName,
638
- myJsContent,
639
- entityName,
640
- system,
641
- logSettingText,
642
- taskMap,
643
- additionalParamMap,
644
- isWorkflowForm,
645
- beanName,
646
- button,
647
- tableName,
648
- param
649
- )
650
- }
651
- })
652
- }
653
- },
654
- exportFormReportSuccess(
655
- templateUUID,
656
- fileName,
657
- myJsContent,
658
- entityName,
659
- system,
660
- logSettingText,
661
- taskMap,
662
- additionalParamMap,
663
- isWorkflowForm,
664
- beanName,
665
- button,
666
- tableName,
667
- param
668
- ) {
669
- let request
670
- if (myJsContent) {
671
- // 将js文本转换为函数,并运行
672
- // eslint-disable-next-line no-eval
673
- const buttonFun = eval('(' + myJsContent + ')')
674
- // 运行方法
675
- request = buttonFun(this, param)
676
- } else {
677
- const baseUrl = this.getBaseUrl(system)
678
- const path = baseUrl + '/dsc/commons/export-reports'
679
- axios.defaults.headers.common.Authorization = getToken()
680
- request = axios.post(
681
- path,
682
- param,
683
- {
684
- responseType: 'blob',
685
- },
686
- {
687
- headers: {
688
- 'content-type': 'application/x-www-form-urlencoded',
689
- },
690
- }
691
- )
692
- }
693
- request.then((response) => {
694
- const blob = new Blob([response.data])
695
- let fileNameTwo = '报告.xlsx'
696
- if (fileName) {
697
- fileNameTwo = fileName
698
- }
699
- const elink = document.createElement('a')
700
- elink.download = fileNameTwo
701
- elink.style.display = 'none'
702
- elink.target = '_blank'
703
- elink.href = URL.createObjectURL(blob)
704
- document.body.appendChild(elink)
705
- elink.click()
706
- URL.revokeObjectURL(elink.href) // 释放URL对象
707
- document.body.removeChild(elink)
708
- // 调用afterClick回调事件
709
- this.callAfterClickButton(
710
- this.formEvents,
711
- this.formViewCode + '__exportForm',
712
- {
713
- params: this.additionalParamMap,
714
- additionalParamMap: this.additionalParamMap,
715
- entity: this.formData,
716
- }
717
- )
718
- })
719
- },
720
- // 首字母大写
721
- upperFirstCase(str) {
722
- return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase()) // 执行代码
723
- },
724
- getBaseUrl(system) {
725
- // Vue.prototype.baseURL 应该是自定义扩展系统的后台访问路径
726
- let baseUrl = window.$vueApp.config.globalProperties.baseURL
727
- if (system) {
728
- baseUrl = getSystemBackendUrl(system.backendUrl)
729
- }
730
- return baseUrl
731
- },
732
- getFormatDate(date, formatStr) {
733
- if (formatStr === 'yyyy-MM-dd') {
734
- var year = date.getFullYear()
735
- var month =
736
- date.getMonth() + 1 < 10
737
- ? '0' + (date.getMonth() + 1)
738
- : date.getMonth() + 1
739
- var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
740
- return year + '-' + month + '-' + day
741
- }
742
- },
743
- // 普通按钮点击事件
744
- commonButtonClick(button) {
745
- $emit(this, 'click', button)
746
- },
747
- // 流程页面中按钮点击事件
748
- workflowButtonClick(event, param, eventSetting, button, completeTaskParam) {
749
- $emit(
750
- this,
751
- 'workflowClick',
752
- event,
753
- param,
754
- eventSetting,
755
- button,
756
- completeTaskParam
757
- )
758
- },
759
- // 是否是查看详情页面
760
- isViewDetail(position) {
761
- let isView = false
762
- let openPageButton = getStoreInfo(this.pageCode, 'openPageButton')
763
- if (!openPageButton) {
764
- // 新页签 跳转方式时,从dsc-fe传过来的参数
765
- openPageButton = getStoreInfo(this.pageCode, '_sourceButtonCode')
766
- }
767
- if (
768
- openPageButton &&
769
- openPageButton === 'viewDetail' &&
770
- (!position || position !== 'list')
771
- ) {
772
- // 非列表页面查看详情页面中控制所有按钮禁止编辑
773
- isView = true
774
- }
775
- return isView
776
- },
777
- // 封装表单事件
778
- packageFormEvents(formViewCode) {
779
- const allFormEvents = {}
780
- let formEvents = []
781
- const pageEvents = getStoreInfo(this.pageCode, '_pageEvents')
782
- if (pageEvents) {
783
- formEvents = pageEvents.formEvents
784
- if (formViewCode && formEvents) {
785
- Object.keys(formEvents).forEach((key) => {
786
- const formViewCodeKey = key.substring(0, key.indexOf('__'))
787
- if (formViewCode === formViewCodeKey) {
788
- // 表示是当前表单的事件,封装到事件对象中
789
- const event = key.substring(key.indexOf('__') + '__'.length)
790
- allFormEvents[event] = formEvents[key]
791
- }
792
- })
793
- }
794
- const customEvents = pageEvents.customEvents
795
- if (customEvents) {
796
- allFormEvents.customEvents = customEvents
797
- }
798
- }
799
- return allFormEvents
800
- },
801
- /**
802
- * 根据动态数据源获得下拉选的选项集合
803
- * @param {*} dynamicSourceCode 动态数据源编码
804
- * @param {*} searchText 查询的文本
805
- * @param {*} entity 实体信息
806
- * @returns
807
- */
808
- findOptionsByDynamicDataSource(
809
- dynamicSourceCode,
810
- searchText,
811
- entity,
812
- additionalParamMap
813
- ) {
814
- return new Promise((resolve, reject) => {
815
- if (searchText === undefined || searchText === null) {
816
- searchText = ''
817
- }
818
- const params = {
819
- searchText,
820
- }
821
- if (additionalParamMap) {
822
- params.additionalParamMap = additionalParamMap
823
- }
824
- if (entity && entity !== null) {
825
- params.entity = entity
826
- }
827
- this.findDynamicDataSourceByCode(dynamicSourceCode, params)
828
- .then((dynamicDataSourceDto) => {
829
- resolve(dynamicDataSourceDto)
830
- })
831
- .catch((error) => {
832
- reject(error)
833
- })
834
- })
835
- },
836
- findDynamicDataSourceByCode(dynamicSourceCode, params) {
837
- return new Promise((resolve, reject) => {
838
- this.$http
839
- .post(
840
- window.$vueApp.config.globalProperties.baseURL +
841
- '/common/dynamic-data-source/' +
842
- dynamicSourceCode,
843
- params
844
- )
845
- .then((result) => {
846
- if (result.backendUrl) {
847
- // result.backendUrl表示需要使用动态数据源所属的系统路径重新获得一次数据
848
- this.$http
849
- .post(
850
- result.backendUrl +
851
- '/common/dynamic-data-source/' +
852
- dynamicSourceCode,
853
- params,
854
- { headers: { targetSystemCode: result.systemCode } }
855
- )
856
- .then((finallyResult) => {
857
- resolve(finallyResult)
858
- })
859
- .catch((error) => {
860
- reject(error)
861
- })
862
- } else {
863
- resolve(result)
864
- }
865
- })
866
- })
867
- },
868
- // 获得远程数据
869
- getOptionGroupOptions(optionGroupCode) {
870
- return new Promise((resolve, reject) => {
871
- this.$http
872
- .get(
873
- window.$vueApp.config.globalProperties.baseAPI +
874
- '/api/options/with-option-groups?optionGroupCode=' +
875
- optionGroupCode
876
- )
877
- .then((options) => {
878
- let resultOptions = []
879
- if (options) {
880
- options.forEach((item) => {
881
- // 值
882
- const value = item.value
883
- // 显示的标签
884
- const label = item.name
885
- const selected = item.selected
886
- resultOptions.push({
887
- label,
888
- value,
889
- selected,
890
- })
891
- })
892
- }
893
- resolve(resultOptions)
894
- })
895
- })
896
- },
897
- // 将标准值解析为确切的值
898
- analysisStandardValues(map) {
899
- return new Promise((resolve, reject) => {
900
- this.$http
901
- .post(
902
- window.$vueApp.config.globalProperties.baseAPI +
903
- '/component/super-pages/analysisValues',
904
- map
905
- )
906
- .then((options) => {
907
- resolve(options)
908
- })
909
- })
910
- },
911
- jumpToPage(
912
- jumpPageSetting,
913
- system,
914
- dataId,
915
- entity,
916
- additionalParamMap,
917
- ids,
918
- buttonCode,
919
- pageCode
920
- ) {
921
- let canClick = true
922
- let pageCustomEvents = this.customEvents
923
- console.log(
924
- 'super-pages---jumpToPage---this.customEvents',
925
- pageCustomEvents
926
- )
927
- if (jumpPageSetting.beforeClick) {
928
- const funName = jumpPageSetting.beforeClick
929
- console.log(
930
- 'super-pages---jumpToPage---jumpPageSetting.beforeClick',
931
- funName
932
- )
933
- let beforeClickEvent
934
- if (
935
- pageCustomEvents &&
936
- funName &&
937
- funName !== null &&
938
- pageCustomEvents[funName]
939
- ) {
940
- beforeClickEvent = pageCustomEvents[funName]
941
- }
942
- if (beforeClickEvent) {
943
- const param = {
944
- entity: entity,
945
- additionalParamMap: additionalParamMap,
946
- ids: ids,
947
- dataId: dataId,
948
- }
949
- canClick = beforeClickEvent.call(this, param)
950
- }
951
- }
952
- if (isPromise(canClick)) {
953
- canClick = canClick.then((result) => {
954
- if (result === undefined || result === true) {
955
- this.doJumpPage(
956
- jumpPageSetting,
957
- system,
958
- dataId,
959
- entity,
960
- additionalParamMap,
961
- ids,
962
- buttonCode,
963
- pageCode
964
- )
965
- }
966
- })
967
- } else {
968
- if (canClick === undefined || canClick === true) {
969
- this.doJumpPage(
970
- jumpPageSetting,
971
- system,
972
- dataId,
973
- entity,
974
- additionalParamMap,
975
- ids,
976
- buttonCode,
977
- pageCode
978
- )
979
- }
980
- }
981
- },
982
- doJumpPage(
983
- jumpPageSetting,
984
- system,
985
- dataId,
986
- entity,
987
- additionalParamMap,
988
- ids,
989
- buttonCode,
990
- pageCode
991
- ) {
992
- jumpToPage(
993
- jumpPageSetting,
994
- system,
995
- dataId,
996
- entity,
997
- additionalParamMap,
998
- ids,
999
- buttonCode
1000
- ).then((openPageParams) => {
1001
- if (openPageParams) {
1002
- const jumpMode = openPageParams.jumpMode
1003
- const popPageSetting = openPageParams
1004
- if (jumpMode === 'popup') {
1005
- // 给页面发送弹框事件
1006
- popPageSetting.isRefreshWhenClosePopup =
1007
- jumpPageSetting.isRefreshWhenClosePopup
1008
- this.jumpPageSetting = popPageSetting
1009
- this.isShowPageDialog = true
1010
- } else if (jumpMode === 'refresh') {
1011
- this.$router.push({
1012
- path: '/dsc/page',
1013
- query: popPageSetting,
1014
- })
1015
- }
1016
- }
1017
- })
1018
- },
1019
- // 返回按钮 或 自定义按钮配置的是“关闭弹框Dialog”时会走该方法
1020
- closePage(pageCode, successOperation, formData) {
1021
- // console.log('----closePage---pageCode=', pageCode)
1022
- let jumpInfo = sessionStorage.getItem(pageCode + '-jumpMode')
1023
- sessionStorage.removeItem(pageCode + '-jumpMode')
1024
- // console.log('----closePage---jumpInfo=', jumpInfo)
1025
- if (!jumpInfo) {
1026
- return
1027
- }
1028
- const jumpInfoObj = JSON.parse(jumpInfo)
1029
- const jumpMode = jumpInfoObj.jumpMode
1030
- if (jumpMode === 'popup') {
1031
- // 弹框Dialog
1032
- // 弹框所属的页面
1033
- let sourcePageCode = sessionStorage.getItem(
1034
- pageCode + '_source_page_code'
1035
- )
1036
- sessionStorage.removeItem(pageCode + '_source_page_code')
1037
- let myFormData = formData
1038
- if (!formData && this.pageType && this.pageType === 'form') {
1039
- // 表示是表单页面,需要获得表单实体信息
1040
- myFormData = this.getFormData()
1041
- }
1042
- // console.log('----closePage---sourcePageCode=', sourcePageCode)
1043
- if (sourcePageCode) {
1044
- // 关闭表单编辑器中的弹框 或 关闭列表组件行编辑时的弹框
1045
- console.log(
1046
- '-----close-component-page-dialog=',
1047
- jumpInfoObj,
1048
- myFormData,
1049
- this.pageCode
1050
- )
1051
- $emit(
1052
- eventBus,
1053
- sourcePageCode + '-close-component-page-dialog',
1054
- jumpInfoObj,
1055
- myFormData,
1056
- this.pageCode
1057
- )
1058
- } else {
1059
- // 页面组件中关闭弹框
1060
- console.log(
1061
- '-----close-dialog=',
1062
- pageCode,
1063
- successOperation,
1064
- myFormData,
1065
- this.pageCode,
1066
- this.pageType
1067
- )
1068
- $emit(
1069
- eventBus,
1070
- pageCode + '-close-dialog',
1071
- pageCode,
1072
- successOperation,
1073
- myFormData,
1074
- this.pageCode
1075
- )
1076
- }
1077
- } else if (jumpMode === 'openWindow' || jumpMode === 'newTab') {
1078
- // 新页签
1079
- if (window.parent) {
1080
- window.parent.close()
1081
- } else {
1082
- window.close()
1083
- }
1084
- } else {
1085
- this.$router.go(-1)
1086
- }
1087
- },
1088
- // 页面组件中点击弹框的右上角的关闭'x'按钮关闭弹框
1089
- closeInPage(popParams) {
1090
- // popParams格式为{ entity, pageCode }
1091
- let popEntity
1092
- if (popParams && popParams.entity) {
1093
- popEntity = popParams.entity
1094
- }
1095
- let popPageCode
1096
- if (popParams && popParams.pageCode) {
1097
- popPageCode = popParams.pageCode
1098
- }
1099
- this.closeInPageEvent(popEntity, popPageCode, null, this)
1100
- },
1101
- // 页面组件中点击按钮等组件关闭弹框调用
1102
- closeInPageEvent(popEntity, popPageCode, successOperation, that) {
1103
- if (that.jumpPageSetting) {
1104
- const pageEvents = getStoreInfo(that.pageCode, '_pageEvents')
1105
- if (pageEvents) {
1106
- // 调用关闭弹框事件
1107
- let formData
1108
- if (that.pageType && that.pageType === 'form') {
1109
- // 表示是表单页面,需要获得表单实体信息
1110
- formData = that.getFormData()
1111
- }
1112
- that.callFormItemEvent(
1113
- pageEvents,
1114
- that.jumpPageSetting.closeEvent,
1115
- formData,
1116
- {
1117
- popEntity: popEntity,
1118
- popPageCode: popPageCode,
1119
- pageCode: that.pageCode,
1120
- }
1121
- )
1122
- }
1123
- let isRefresh = false
1124
- if (that.pageType && that.pageType === 'list') {
1125
- isRefresh = true
1126
- }
1127
- that.eventBusOnCloseDialog(
1128
- popPageCode,
1129
- that,
1130
- that.jumpPageSetting.buttonCode,
1131
- successOperation,
1132
- that.jumpPageSetting,
1133
- isRefresh
1134
- )
1135
- } else {
1136
- that.isShowPageDialog = false
1137
- that.jumpPageSetting = null
1138
- }
1139
- },
1140
- // 响应关闭弹框事件
1141
- eventBusOnCloseDialog(
1142
- pageCode,
1143
- that,
1144
- buttonCode,
1145
- successOperation,
1146
- jumpPageSetting,
1147
- isRefresh
1148
- ) {
1149
- that.isShowPageDialog = false
1150
- that.jumpPageSetting = null
1151
- if (isRefresh !== undefined && isRefresh !== null && isRefresh === true) {
1152
- const gridRef = that.$refs.grid
1153
- if (gridRef) {
1154
- gridRef.refresh()
1155
- }
1156
- } else if (
1157
- (buttonCode && (buttonCode === 'create' || buttonCode === 'update')) ||
1158
- (successOperation && successOperation === 'closeWindowAndRefresh')
1159
- ) {
1160
- // 控制当是新建、修改按钮的弹框关闭时,刷新列表页面数据
1161
- const gridRef = that.$refs.grid
1162
- if (gridRef) {
1163
- gridRef.refresh()
1164
- }
1165
- } else if (
1166
- jumpPageSetting.isRefreshWhenClosePopup !== undefined &&
1167
- jumpPageSetting.isRefreshWhenClosePopup === true
1168
- ) {
1169
- // 表示关闭弹框时刷新列表数据
1170
- const gridRef = that.$refs.grid
1171
- if (gridRef) {
1172
- gridRef.refresh()
1173
- }
1174
- }
1175
- },
1176
- getWatermarkLabel(pageWatermarkSetting, contextParameter) {
1177
- let label = ''
1178
- if (pageWatermarkSetting.label && pageWatermarkSetting.label !== '') {
1179
- const regex = /\$\{(.+?)\]}/g
1180
- const matched = pageWatermarkSetting.label.match(regex)
1181
- for (const item of matched) {
1182
- let result = item
1183
- if (item.indexOf('${writeTitle[') >= 0) {
1184
- const index = item.indexOf('${writeTitle[')
1185
- result = result.substring(index + 13)
1186
- result = result.substring(0, result.indexOf(']'))
1187
- label += result
1188
- } else if (item.indexOf('${standard[') >= 0) {
1189
- if (contextParameter) {
1190
- result = result.substring(
1191
- result.indexOf('[') + 1,
1192
- result.indexOf(']')
1193
- )
1194
- if (result && result !== '') {
1195
- if (result.indexOf('context.currentTime') !== -1) {
1196
- result = contextParameter.currentTime
1197
- } else if (
1198
- result.indexOf('context.currentTransactorName') !== -1
1199
- ) {
1200
- result = contextParameter.currentTransactorName
1201
- } else if (result.indexOf('context.currentTransactorId') !== -1) {
1202
- result = contextParameter.currentTransactorId
1203
- } else if (result.indexOf('context.currentTransactor') !== -1) {
1204
- result = contextParameter.currentTransactor
1205
- } else if (
1206
- result.indexOf('context.currentTransactorMainDepartmentId') !==
1207
- -1
1208
- ) {
1209
- result = contextParameter.currentTransactorMainDepartmentId
1210
- } else if (
1211
- result.indexOf('context.currentTransactorMainDepartment') !== -1
1212
- ) {
1213
- result = contextParameter.currentTransactorMainDepartment
1214
- } else if (
1215
- result.indexOf('context.currentTransactorRoleId') !== -1
1216
- ) {
1217
- result = contextParameter.currentTransactorRoleId
1218
- } else if (
1219
- result.indexOf('context.currentTransactorRole') !== -1
1220
- ) {
1221
- result = contextParameter.currentTransactorRole
1222
- } else if (
1223
- result.indexOf('context.currentTransactorWorkGroupId') !== -1
1224
- ) {
1225
- result = contextParameter.currentTransactorWorkGroupId
1226
- } else if (
1227
- result.indexOf('context.currentTransactorWorkGroup') !== -1
1228
- ) {
1229
- result = contextParameter.currentTransactorWorkGroup
1230
- }
1231
- }
1232
- label += result
1233
- }
1234
- }
1235
- }
1236
- }
1237
- return label
1238
- },
1239
- setWatermark(code, contextParameter) {
1240
- this.getSystemWatermark(code).then((data) => {
1241
- if (data != null) {
1242
- if (data.watermarkSetting) {
1243
- this.showPageWatermarkSetting(
1244
- JSON.parse(data.watermarkSetting),
1245
- contextParameter
1246
- )
1247
- }
1248
- }
1249
- })
1250
- },
1251
- // 展示水印
1252
- showPageWatermarkSetting(pageWatermarkSetting, contextParameter) {
1253
- // 先解析label
1254
- if (pageWatermarkSetting) {
1255
- const label = this.getWatermarkLabel(
1256
- pageWatermarkSetting,
1257
- contextParameter
1258
- )
1259
- showWatermark(label, pageWatermarkSetting)
1260
- }
1261
- },
1262
- closeFormPageDialog(jumpInfo, that, popEntity, popPageCode) {
1263
- // console.log('closeFormPageDialog==00--jumpInfo=', jumpInfo)
1264
- if (!jumpInfo) {
1265
- that.$refs.superForm.closePageDialog({
1266
- entity: popEntity,
1267
- pageCode: popPageCode,
1268
- })
1269
- } else {
1270
- // 点击列表组件super-grid还是表单组件super-form中某元素弹出的页面,值为:list或form
1271
- const jumpPosition = jumpInfo.position
1272
- if (!jumpPosition || jumpPosition === 'form') {
1273
- // 表示要关闭点击表单页面中某组件弹出的页面
1274
- // console.log('closeFormPageDialog==11')
1275
- if (that.$refs.superForm) {
1276
- that.$refs.superForm.closePageDialog({
1277
- entity: popEntity,
1278
- pageCode: popPageCode,
1279
- })
1280
- }
1281
- } else {
1282
- // jumpPosition应该为list
1283
- // 表示要关闭点击表单页面子表列表组件的某组件弹出的页面
1284
- // console.log('closeFormPageDialog==22')
1285
- if (that.$refs.superForm) {
1286
- that.$refs.superForm.closeSubTablePageDialog(
1287
- jumpInfo.listCode,
1288
- popEntity,
1289
- popPageCode
1290
- )
1291
- }
1292
- }
1293
- }
1294
- },
1295
- refreshEmit(formData) {
1296
- $emit(this, 'refresh', formData)
1297
- },
1298
- refreshFrom(formData) {
1299
- $emit(this, 'refreshFrom', formData)
1300
- },
1301
- previewFormReport(
1302
- templateUUID,
1303
- fileName,
1304
- myJsContent,
1305
- entityName,
1306
- system,
1307
- logSettingText,
1308
- taskMap,
1309
- additionalParamMap,
1310
- isWorkflowForm,
1311
- beanName,
1312
- functionCode,
1313
- tableName
1314
- ) {
1315
- if (this.$refs.superForm) {
1316
- // 通过getViewModels获得处理了下拉框、复选框的值之后的表单数据,用于导出报告使用
1317
- this.$refs.superForm.getViewModels().then(async (viewModels) => {
1318
- const param = {
1319
- entity: viewModels,
1320
- fileName: templateUUID, // uuid
1321
- showName: fileName, // 下载的文件名称
1322
- entityName, // 实体名,首字母小写
1323
- beanName,
1324
- isWorkflowForm, // 是否是流程表单
1325
- functionCode: functionCode,
1326
- tableName: tableName,
1327
- }
1328
- if (logSettingText) {
1329
- param.logSettingText = logSettingText
1330
- }
1331
- if (!param.systemCode) {
1332
- param.systemCode = system.code
1333
- }
1334
- if (taskMap) {
1335
- param.taskMap = taskMap
1336
- }
1337
- if (additionalParamMap) {
1338
- param.additionalParamMap = additionalParamMap
1339
- }
1340
- let beforeClickResult = this.callBeforeClickButton(
1341
- this.formEvents,
1342
- this.formViewCode + '__exportForm',
1343
- {
1344
- params: this.additionalParamMap,
1345
- additionalParamMap: this.additionalParamMap,
1346
- exportParam: param,
1347
- }
1348
- )
1349
- if (isPromise(beforeClickResult)) {
1350
- await beforeClickResult.then((result) => {
1351
- console.log('点击前事件返回结果--Promise--resolve---', result)
1352
- beforeClickResult = result
1353
- })
1354
- }
1355
- if (!beforeClickResult) {
1356
- // 返回值为false,不继续执行按钮操作
1357
- return
1358
- }
1359
- if (isPromise(beforeClickResult)) {
1360
- beforeClickResult.then((result) => {
1361
- if (result) {
1362
- this.previewFormReportSuccess(
1363
- templateUUID,
1364
- fileName,
1365
- myJsContent,
1366
- entityName,
1367
- system,
1368
- logSettingText,
1369
- taskMap,
1370
- additionalParamMap,
1371
- isWorkflowForm,
1372
- beanName,
1373
- functionCode,
1374
- tableName,
1375
- param
1376
- )
1377
- }
1378
- })
1379
- } else {
1380
- this.previewFormReportSuccess(
1381
- templateUUID,
1382
- fileName,
1383
- myJsContent,
1384
- entityName,
1385
- system,
1386
- logSettingText,
1387
- taskMap,
1388
- additionalParamMap,
1389
- isWorkflowForm,
1390
- beanName,
1391
- functionCode,
1392
- tableName,
1393
- param
1394
- )
1395
- }
1396
- })
1397
- }
1398
- },
1399
- previewFormReportSuccess(
1400
- templateUUID,
1401
- fileName,
1402
- myJsContent,
1403
- entityName,
1404
- system,
1405
- logSettingText,
1406
- taskMap,
1407
- additionalParamMap,
1408
- isWorkflowForm,
1409
- beanName,
1410
- functionCode,
1411
- tableName,
1412
- param
1413
- ) {
1414
- let request
1415
- if (myJsContent) {
1416
- // 将js文本转换为函数,并运行
1417
- // eslint-disable-next-line no-eval
1418
- const buttonFun = eval('(' + myJsContent + ')')
1419
- // 运行方法
1420
- request = buttonFun(this, param)
1421
- } else {
1422
- const baseUrl = this.getBaseUrl(system)
1423
- const path = baseUrl + '/dsc/commons/create-preview-file'
1424
- axios.defaults.headers.common.Authorization = Cookies.get('JWT')
1425
- request = axios.post(
1426
- path,
1427
- param,
1428
- {},
1429
- {
1430
- headers: {
1431
- 'content-type': 'application/x-www-form-urlencoded',
1432
- },
1433
- }
1434
- )
1435
- }
1436
- request.then((response) => {
1437
- const previewUrl =
1438
- window.$vueApp.config.globalProperties.baseURL +
1439
- '/component/export-report/preview'
1440
- window.open(
1441
- previewUrl +
1442
- '?showName=' +
1443
- encodeURI(response.data) +
1444
- '&serverPath=' +
1445
- encodeURI(response.data)
1446
- )
1447
- // const blob = new Blob([response.data])
1448
- // let fileNameTwo = '报告.xlsx'
1449
- // if (fileName) {
1450
- // fileNameTwo = fileName
1451
- // }
1452
- // const elink = document.createElement('a')
1453
- // elink.download = fileNameTwo
1454
- // elink.style.display = 'none'
1455
- // elink.target = '_blank'
1456
- // elink.href = URL.createObjectURL(blob)
1457
- // document.body.appendChild(elink)
1458
- // elink.click()
1459
- // URL.revokeObjectURL(elink.href) // 释放URL对象
1460
- // document.body.removeChild(elink)
1461
- // // 调用afterClick回调事件
1462
- // this.callAfterClickButton(this.formEvents, this.formViewCode + '__exportForm', {
1463
- // params: this.additionalParamMap,
1464
- // entity: this.formData
1465
- // })
1466
- })
1467
- },
1468
- // 重新刷新按钮
1469
- reviewButton(entity) {
1470
- if (this.$refs.superForm) {
1471
- // 获得表单实体最新信息
1472
- const formData = this.$refs.superForm.getFormData()
1473
- setStoreInfo(this.pageCode, '_formData', formData)
1474
- } else if (entity) {
1475
- setStoreInfo(this.pageCode, '_formData', entity)
1476
- }
1477
- this.isShowBuuton = false
1478
- const that = this
1479
- setTimeout(function () {
1480
- that.isShowBuuton = true
1481
- }, 100)
1482
- },
1483
- // 刷新页签内容:列表数据或表单数据
1484
- refreshTab(tabCode, entity) {
1485
- if (tabCode === undefined || tabCode === null) {
1486
- tabCode = getStoreInfo(this.pageCode, '_activeTab')
1487
- }
1488
- $emit(eventBus, this.pageCode + '-refresh-tab', tabCode, entity)
1489
- },
1490
- }
1491
- export default Util