super-pages 0.7.60 → 0.7.61

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.
@@ -106,6 +106,7 @@ import formHead from './form-head'
106
106
  import callEvents from './util/callEvents'
107
107
  import apis from './util/api'
108
108
  import { getStoreInfo, setStoreInfo } from './util/common-util'
109
+ import { isPromise } from 'imatrix-ui/src/utils/common-util'
109
110
  import eventBus from './util/eventBus'
110
111
  export default {
111
112
  name: 'WorkflowFormPage',
@@ -401,151 +402,162 @@ export default {
401
402
  this.hasLoaded = true
402
403
  return
403
404
  }
404
- // 获得当前环节的“逻辑设置”,包括:“意见是否必填”和“可执行条件”、“自动设值”、“转换规则”
405
- this.logicSetting = this.getCurrentNodeLogicSetting(
406
- workflowButton,
407
- model,
408
- event
409
- )
410
- // console.log('clickWorkflowButtonOn-this.logicSetting =', this.logicSetting)
411
- let jsContent = false
412
- if (eventSetting && typeof eventSetting.jsContent !== 'undefined') {
413
- jsContent = eventSetting.jsContent
414
- }
415
- this.myJsContent = jsContent
416
- if (eventSetting) {
417
- this.isNeedValueMapping = eventSetting.isNeedValueMapping
405
+ if (isPromise(beforeClickResult)) {
406
+ beforeClickResult.then((result) => {
407
+ if (result) {
408
+ this.clickWorkflowButtonOnSuccess(event, operation, eventSetting, workflowButton, model)
409
+ }
410
+ })
411
+ } else {
412
+ this.clickWorkflowButtonOnSuccess(event, operation, eventSetting, workflowButton, model)
418
413
  }
414
+ }
415
+ })
416
+ },
417
+ clickWorkflowButtonOnSuccess (event, operation, eventSetting, workflowButton, model) {
418
+ // 获得当前环节的“逻辑设置”,包括:“意见是否必填”和“可执行条件”、“自动设值”、“转换规则”
419
+ this.logicSetting = this.getCurrentNodeLogicSetting(
420
+ workflowButton,
421
+ model,
422
+ event
423
+ )
424
+ // console.log('clickWorkflowButtonOn-this.logicSetting =', this.logicSetting)
425
+ let jsContent = false
426
+ if (eventSetting && typeof eventSetting.jsContent !== 'undefined') {
427
+ jsContent = eventSetting.jsContent
428
+ }
429
+ this.myJsContent = jsContent
430
+ if (eventSetting) {
431
+ this.isNeedValueMapping = eventSetting.isNeedValueMapping
432
+ }
419
433
 
420
- let successOperation = false
421
- if (
422
- eventSetting &&
434
+ let successOperation = false
435
+ if (
436
+ eventSetting &&
423
437
  typeof eventSetting.successOperation !== 'undefined'
424
- ) {
425
- successOperation = eventSetting.successOperation
426
- }
427
- this.successOperation = successOperation
428
- let logSetting = false
429
- if (eventSetting && typeof eventSetting.logSetting !== 'undefined') {
430
- logSetting = eventSetting.logSetting
431
- }
432
- this.logSetting = logSetting
433
- let dataConversionRule = ''
434
- if (
435
- this.logicSetting &&
438
+ ) {
439
+ successOperation = eventSetting.successOperation
440
+ }
441
+ this.successOperation = successOperation
442
+ let logSetting = false
443
+ if (eventSetting && typeof eventSetting.logSetting !== 'undefined') {
444
+ logSetting = eventSetting.logSetting
445
+ }
446
+ this.logSetting = logSetting
447
+ let dataConversionRule = ''
448
+ if (
449
+ this.logicSetting &&
436
450
  this.logicSetting.current &&
437
451
  typeof this.logicSetting.current.dataConversionRule !== 'undefined'
438
- ) {
439
- dataConversionRule = this.logicSetting.current.dataConversionRule
440
- }
441
- let autoSetValueData = ''
442
- if (
443
- this.logicSetting &&
452
+ ) {
453
+ dataConversionRule = this.logicSetting.current.dataConversionRule
454
+ }
455
+ let autoSetValueData = ''
456
+ if (
457
+ this.logicSetting &&
444
458
  this.logicSetting.current &&
445
459
  typeof this.logicSetting.current.autoSetValueData !== 'undefined'
446
- ) {
447
- autoSetValueData = this.logicSetting.current.autoSetValueData
448
- }
449
- let taskMap = null
450
- if (
451
- eventSetting &&
460
+ ) {
461
+ autoSetValueData = this.logicSetting.current.autoSetValueData
462
+ }
463
+ let taskMap = null
464
+ if (
465
+ eventSetting &&
452
466
  eventSetting.taskMap &&
453
467
  typeof eventSetting.taskMap !== 'undefined'
454
- ) {
455
- taskMap = eventSetting.taskMap
456
- }
457
- const needDeleteFileUuid = this.getNeedDeleteFileUuidS()
458
- if (event === 'returnTaskTo') {
459
- // 退回按钮
460
- this.dataConversionRule = dataConversionRule
461
- this.getTaskInformitions(
462
- this.system,
463
- this.entityName,
464
- this.beanName
465
- )
466
- } else if (event === 'returnToPreviousTask') {
467
- // 驳回
468
- this.returnToPreviousTask(
469
- this.system,
470
- this.tableName,
471
- model,
472
- this.formViewCode,
473
- this.formViewVersion,
474
- this.entityName,
475
- jsContent,
476
- successOperation,
477
- this.isNeedValueMapping,
478
- taskMap,
479
- this.beanName
480
- )
481
- } else if (event === 'endInstance') {
482
- // 强制结束
483
- this.endInstance(
484
- this.system,
485
- this.tableName,
486
- model,
487
- this.formViewCode,
488
- this.formViewVersion,
489
- this.entityName,
490
- jsContent,
491
- successOperation,
492
- this.isNeedValueMapping,
493
- taskMap,
494
- this.beanName
495
- )
496
- } else {
497
- if (
498
- !this.logicSetting ||
468
+ ) {
469
+ taskMap = eventSetting.taskMap
470
+ }
471
+ const needDeleteFileUuid = this.getNeedDeleteFileUuidS()
472
+ if (event === 'returnTaskTo') {
473
+ // 退回按钮
474
+ this.dataConversionRule = dataConversionRule
475
+ this.getTaskInformitions(
476
+ this.system,
477
+ this.entityName,
478
+ this.beanName
479
+ )
480
+ } else if (event === 'returnToPreviousTask') {
481
+ // 驳回
482
+ this.returnToPreviousTask(
483
+ this.system,
484
+ this.tableName,
485
+ model,
486
+ this.formViewCode,
487
+ this.formViewVersion,
488
+ this.entityName,
489
+ jsContent,
490
+ successOperation,
491
+ this.isNeedValueMapping,
492
+ taskMap,
493
+ this.beanName
494
+ )
495
+ } else if (event === 'endInstance') {
496
+ // 强制结束
497
+ this.endInstance(
498
+ this.system,
499
+ this.tableName,
500
+ model,
501
+ this.formViewCode,
502
+ this.formViewVersion,
503
+ this.entityName,
504
+ jsContent,
505
+ successOperation,
506
+ this.isNeedValueMapping,
507
+ taskMap,
508
+ this.beanName
509
+ )
510
+ } else {
511
+ if (
512
+ !this.logicSetting ||
499
513
  this.validateOpinion(
500
514
  this.logicSetting.current,
501
515
  operation,
502
516
  model
503
517
  ) === true
504
- ) {
505
- // 表示意见已填,或不需要必填意见
506
- this.canExecuteWorkflow(model, event).then(result => {
507
- if (result.canExecute === true) {
508
- // 表示可执行
509
- const entities = result.entities
510
- if (entities && entities.length > 0) {
511
- model = entities[0]
512
- }
513
- let endLogicSetting = null
514
- if (this.logicSetting) {
515
- endLogicSetting = this.logicSetting.end
516
- }
517
- this.formModel = model
518
- this.clickWorflowButton(
519
- event,
520
- this.system,
521
- this.tableName,
522
- model,
523
- this.definitionId,
524
- this.emailTemplateCode,
525
- operation,
526
- this.formViewCode,
527
- this.formViewVersion,
528
- this.entityName,
529
- jsContent,
530
- this.formNoRuleCode,
531
- successOperation,
532
- dataConversionRule,
533
- endLogicSetting,
534
- autoSetValueData,
535
- this.logSetting,
536
- null,
537
- null,
538
- workflowButton ? workflowButton.isNeedValueMapping : false,
539
- taskMap,
540
- needDeleteFileUuid,
541
- this.beanName
542
- )
543
- }
544
- })
518
+ ) {
519
+ // 表示意见已填,或不需要必填意见
520
+ this.canExecuteWorkflow(model, event).then(result => {
521
+ if (result.canExecute === true) {
522
+ // 表示可执行
523
+ const entities = result.entities
524
+ if (entities && entities.length > 0) {
525
+ model = entities[0]
526
+ }
527
+ let endLogicSetting = null
528
+ if (this.logicSetting) {
529
+ endLogicSetting = this.logicSetting.end
530
+ }
531
+ this.formModel = model
532
+ this.clickWorflowButton(
533
+ event,
534
+ this.system,
535
+ this.tableName,
536
+ model,
537
+ this.definitionId,
538
+ this.emailTemplateCode,
539
+ operation,
540
+ this.formViewCode,
541
+ this.formViewVersion,
542
+ this.entityName,
543
+ jsContent,
544
+ this.formNoRuleCode,
545
+ successOperation,
546
+ dataConversionRule,
547
+ endLogicSetting,
548
+ autoSetValueData,
549
+ this.logSetting,
550
+ null,
551
+ null,
552
+ workflowButton ? workflowButton.isNeedValueMapping : false,
553
+ taskMap,
554
+ needDeleteFileUuid,
555
+ this.beanName
556
+ )
545
557
  }
546
- }
558
+ })
547
559
  }
548
- })
560
+ }
549
561
  },
550
562
  // 响应点击流程表单页面中的扩展按钮
551
563
  clickWorkflowExtensionButtonOn (button) {
@@ -583,129 +595,140 @@ export default {
583
595
  // 返回值为false,不继续执行按钮操作
584
596
  return
585
597
  }
586
- // 是否可执行
587
- that
588
- .canExecute(
589
- button.executableData,
590
- model,
591
- that.isSqlQuery,
592
- that.tableName,
593
- this.additionalParamMap
594
- )
595
- .then(result => {
596
- if (result.canExecute === true) {
597
- // 可执行条件解析结果为true
598
- const entities = result.entities
599
- if (entities && entities.length > 0) {
600
- model = entities[0]
601
- }
602
- let jsContent = false
603
- if (
604
- typeof button.jsContent !== 'undefined' &&
598
+ if (isPromise(beforeClickResult)) {
599
+ beforeClickResult.then((result) => {
600
+ if (result) {
601
+ that.clickWorkflowExtensionButtonOnSuccess(button, model, that)
602
+ }
603
+ })
604
+ } else {
605
+ that.clickWorkflowExtensionButtonOnSuccess(button, model, that)
606
+ }
607
+ }
608
+ })
609
+ }
610
+ },
611
+ clickWorkflowExtensionButtonOnSuccess (button, model, that) {
612
+ // 是否可执行
613
+ that
614
+ .canExecute(
615
+ button.executableData,
616
+ model,
617
+ that.isSqlQuery,
618
+ that.tableName,
619
+ this.additionalParamMap
620
+ )
621
+ .then(result => {
622
+ if (result.canExecute === true) {
623
+ // 可执行条件解析结果为true
624
+ const entities = result.entities
625
+ if (entities && entities.length > 0) {
626
+ model = entities[0]
627
+ }
628
+ let jsContent = false
629
+ if (
630
+ typeof button.jsContent !== 'undefined' &&
605
631
  button.jsContent !== ''
606
- ) {
607
- if (button && typeof button.jsContent !== 'undefined') {
608
- jsContent = button.jsContent
609
- }
610
- }
611
- let successOperation = false
612
- if (
613
- button &&
632
+ ) {
633
+ if (button && typeof button.jsContent !== 'undefined') {
634
+ jsContent = button.jsContent
635
+ }
636
+ }
637
+ let successOperation = false
638
+ if (
639
+ button &&
614
640
  typeof button.successOperation !== 'undefined'
615
- ) {
616
- successOperation = button.successOperation
617
- }
618
- that.successOperation = successOperation
619
- let dataConversionRule = ''
620
- if (
621
- button &&
641
+ ) {
642
+ successOperation = button.successOperation
643
+ }
644
+ that.successOperation = successOperation
645
+ let dataConversionRule = ''
646
+ if (
647
+ button &&
622
648
  typeof button.dataConversionRule !== 'undefined'
623
- ) {
624
- dataConversionRule = button.dataConversionRule
625
- }
626
- let autoSetValueData = ''
627
- if (
628
- button &&
649
+ ) {
650
+ dataConversionRule = button.dataConversionRule
651
+ }
652
+ let autoSetValueData = ''
653
+ if (
654
+ button &&
629
655
  typeof button.autoSetValueData !== 'undefined'
630
- ) {
631
- autoSetValueData = button.autoSetValueData
632
- }
633
- let taskMap = null
634
- if (button && typeof button.taskMap !== 'undefined') {
635
- taskMap = button.taskMap
636
- }
637
- const needDeleteFileUuid = this.getNeedDeleteFileUuidS()
638
- if (this.isCommonButton(button.code)) {
639
- // 表示点了非流程的“提交”、“同意”、“不同意”
640
- that.clickWorflowButton(
641
- '#_default_#' + button.code,
642
- that.system,
643
- that.tableName,
644
- model,
645
- that.definitionId,
646
- that.emailTemplateCode,
647
- null,
648
- that.formViewCode,
649
- that.formViewVersion,
650
- that.entityName,
651
- jsContent,
652
- that.formNoRuleCode,
653
- successOperation,
654
- dataConversionRule,
655
- that.logicSetting && that.logicSetting.end
656
- ? that.logicSetting.end
657
- : null,
658
- autoSetValueData,
659
- button.logSetting,
660
- this.ids,
661
- this.isBatchProcessing,
662
- button ? button.isNeedValueMapping : false,
663
- taskMap,
664
- needDeleteFileUuid,
665
- this.beanName,
666
- button
667
- )
668
- } else if (button.code === 'exportForm') {
669
- // 表示点了“导出报告”
670
- this.exportFormReport(
671
- button.templateUUID,
672
- button.templateShowPath,
673
- jsContent,
674
- that.entityName,
675
- that.system,
676
- button.logSetting,
677
- taskMap,
678
- that.additionalParamMap,
679
- true,
680
- this.beanName,
681
- button,
682
- this.tableName
683
- )
684
- } else {
685
- that.clickWorkflowExtensionButton(
686
- that.system,
687
- that.tableName,
688
- model,
689
- that.definitionId,
690
- that.emailTemplateCode,
691
- that.formViewCode,
692
- that.formViewVersion,
693
- jsContent,
694
- this.formNoRuleCode,
695
- successOperation,
696
- dataConversionRule,
697
- autoSetValueData,
698
- button,
699
- needDeleteFileUuid,
700
- this.entityName,
701
- this.beanName
702
- )
703
- }
704
- }
705
- })
656
+ ) {
657
+ autoSetValueData = button.autoSetValueData
658
+ }
659
+ let taskMap = null
660
+ if (button && typeof button.taskMap !== 'undefined') {
661
+ taskMap = button.taskMap
662
+ }
663
+ const needDeleteFileUuid = this.getNeedDeleteFileUuidS()
664
+ if (this.isCommonButton(button.code)) {
665
+ // 表示点了非流程的“提交”、“同意”、“不同意”
666
+ that.clickWorflowButton(
667
+ '#_default_#' + button.code,
668
+ that.system,
669
+ that.tableName,
670
+ model,
671
+ that.definitionId,
672
+ that.emailTemplateCode,
673
+ null,
674
+ that.formViewCode,
675
+ that.formViewVersion,
676
+ that.entityName,
677
+ jsContent,
678
+ that.formNoRuleCode,
679
+ successOperation,
680
+ dataConversionRule,
681
+ that.logicSetting && that.logicSetting.end
682
+ ? that.logicSetting.end
683
+ : null,
684
+ autoSetValueData,
685
+ button.logSetting,
686
+ this.ids,
687
+ this.isBatchProcessing,
688
+ button ? button.isNeedValueMapping : false,
689
+ taskMap,
690
+ needDeleteFileUuid,
691
+ this.beanName,
692
+ button
693
+ )
694
+ } else if (button.code === 'exportForm') {
695
+ // 表示点了“导出报告”
696
+ this.exportFormReport(
697
+ button.templateUUID,
698
+ button.templateShowPath,
699
+ jsContent,
700
+ that.entityName,
701
+ that.system,
702
+ button.logSetting,
703
+ taskMap,
704
+ that.additionalParamMap,
705
+ true,
706
+ this.beanName,
707
+ button,
708
+ this.tableName
709
+ )
710
+ } else {
711
+ that.clickWorkflowExtensionButton(
712
+ that.system,
713
+ that.tableName,
714
+ model,
715
+ that.definitionId,
716
+ that.emailTemplateCode,
717
+ that.formViewCode,
718
+ that.formViewVersion,
719
+ jsContent,
720
+ this.formNoRuleCode,
721
+ successOperation,
722
+ dataConversionRule,
723
+ autoSetValueData,
724
+ button,
725
+ needDeleteFileUuid,
726
+ this.entityName,
727
+ this.beanName
728
+ )
729
+ }
706
730
  }
707
731
  })
708
- }
709
732
  },
710
733
  // 获取需要删除的附件
711
734
  getNeedDeleteFileUuidS () {
@@ -134,26 +134,30 @@ export default {
134
134
  position: this.jumpPageSetting._position,
135
135
  listCode: this.jumpPageSetting._listCode,
136
136
  rowIndex: this.jumpPageSetting._rowIndex }))
137
- if (this.jumpPageSetting.paramStoreId) {
138
- const paramStoreId = this.jumpPageSetting.paramStoreId
139
- if (paramStoreId) {
140
- const additionalParamMapJson = sessionStorage.getItem(paramStoreId)
141
- sessionStorage.removeItem(paramStoreId)
142
- if (pageSettingStoreInfo && additionalParamMapJson) {
143
- // 缓存页面动态参数
144
- pageSettingStoreInfo.additionalParamMap = JSON.parse(additionalParamMapJson)
145
- store.set(this.pageCode, pageSettingStoreInfo)
146
- }
137
+ const paramStoreId = this.jumpPageSetting.paramStoreId
138
+ if (paramStoreId) {
139
+ const additionalParamMapJson = sessionStorage.getItem(paramStoreId)
140
+ sessionStorage.removeItem(paramStoreId)
141
+ if (pageSettingStoreInfo && additionalParamMapJson) {
142
+ // 缓存页面动态参数
143
+ pageSettingStoreInfo.additionalParamMap = JSON.parse(additionalParamMapJson)
144
+ store.set(this.pageCode, pageSettingStoreInfo)
147
145
  }
148
146
  }
149
147
  // 原有代码
150
148
  // store.set(this.pageCode, getPageParam(this.devMode, this.jumpMode, this.buttonCode))
151
149
  pageSettingStoreInfo._pageDevMode = this.devMode
152
150
  pageSettingStoreInfo._sourceButtonCode = this.buttonCode
153
- if (this.jumpPageSetting.ids) {
151
+ const idsArr = this.jumpPageSetting.ids
152
+ if (idsArr) {
154
153
  if (pageSettingStoreInfo) {
154
+ let idsStr = idsArr
155
+ if (Array.isArray(idsArr) && idsArr.length > 0) {
156
+ idsStr = idsArr.join(',')
157
+ }
155
158
  pageSettingStoreInfo._pathQuery = {
156
- ids: this.jumpPageSetting.ids
159
+ ids: idsArr,
160
+ _idsStr: idsStr
157
161
  }
158
162
  }
159
163
  }
@@ -58,7 +58,8 @@ const cn = {
58
58
  pleaseSaveRow: '请先保存记录',
59
59
  thePreconditionOfTheButtonTo: '该按钮前置条件为[{message}]',
60
60
  onlyOneRecordCanBeselected: '只能选择一条记录',
61
- selectAtLeastOneRecord: '至少选择一条记录'
61
+ selectAtLeastOneRecord: '至少选择一条记录',
62
+ asyncImport: '正在异步导入,请等待消息通知!'
62
63
  }
63
64
  }
64
65
  export default cn
@@ -59,7 +59,8 @@ const en = {
59
59
  pleaseSaveRow: 'Please save row',
60
60
  thePreconditionOfTheButtonTo: 'The Precondition Of The Button To [{message}]',
61
61
  onlyOneRecordCanBeselected: 'Only One Record Can Be Selected',
62
- selectAtLeastOneRecord: 'Select At Least One Record'
62
+ selectAtLeastOneRecord: 'Select At Least One Record',
63
+ asyncImport: 'Asynchronous import, please wait for message notification!'
63
64
  }
64
65
  }
65
66
  export default en