cloud-web-corejs 1.0.54-dev.206 → 1.0.54-dev.208

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.
@@ -20,7 +20,8 @@ import {
20
20
  overwriteObj,
21
21
  runDataSourceRequest,
22
22
  getContainerWidgetByName,
23
- cloneFormConfigWithoutEventHandler
23
+ cloneFormConfigWithoutEventHandler,
24
+ loopHandleWidget
24
25
  } from '../../../components/xform/utils/util';
25
26
  import {
26
27
  containers,
@@ -183,7 +184,9 @@ modules = {
183
184
  userRoleDTO2s: [],
184
185
  defaultUserSaleOrgDTO: null,
185
186
  bdService: null,
186
- globalParam: {}
187
+ globalParam: {},
188
+ widgetEditOnWf: null,
189
+ wfModifyEnabled: false
187
190
  };
188
191
  },
189
192
  computed: {
@@ -235,12 +238,13 @@ modules = {
235
238
  await this.initUserRoleData();
236
239
  await this.initBdService();
237
240
  this.buildFormModel(!this.formJsonObj ? null : this.formJsonObj.widgetList);
238
- this.hanldeCommonWidget();//处理组件显隐规则
241
+ // this.hanldeCommonWidget();//处理组件显隐规则
239
242
  if (formConfig.isLoadEntity) {
240
243
  await this.loadDefaultEntityData(() => {
241
244
  this.handleCustomEvent(formConfig.formScriptSuccess);
242
245
  });
243
246
  } else {
247
+ this.hanldeCommonWidget2();//处理组件显隐,可编辑
244
248
  this.handleShowContent();
245
249
  }
246
250
  this.handleOnCreated(),
@@ -429,8 +433,253 @@ modules = {
429
433
 
430
434
  return Object.keys(originalWidget.options).indexOf(configName) > -1;
431
435
  },
436
+ hanldeCommonWidget2() {
437
+ let wfParam = this.wfParam || {};
438
+ let wfInfo = wfParam?.wfInfo
439
+ let taskDefinitionKey = wfInfo?.taskDefinitionKey;
440
+ let toModify = wfInfo?.toModify || false;
441
+
442
+ let hasModifyItem = false;
443
+ let saveButton;
444
+ let saveButtonOptions;
445
+ let bdService = this.bdService;
446
+
447
+ let widgetEditOnWf = this.hanldeWfWidgetNew0();//是否有流程时,当前用户特定流程节点是否可全局可编辑
448
+ this.widgetEditOnWf = widgetEditOnWf;
449
+
450
+ loopHandleWidget(this.formJson.widgetList, (widget) => {
451
+
452
+ let isModify = false;
453
+ //处理组件显隐规则
454
+ let hidden = this.handleWidgetShowRule(widget);
455
+
456
+ if (wfParam.hasWf) {
457
+ //设置组件的有流程可编辑,有流程隐藏
458
+ this.hanldeWfWidgetNew1(widget)
459
+ if (toModify) {
460
+ //设置组件的特定流程节点的可编辑,仅显示,隐藏
461
+ if (taskDefinitionKey) {
462
+ this.hanldeWfWidgetNew2(widget, (modifyFlag, saveButtonWidget) => {
463
+ if (!saveButton && saveButtonWidget) {
464
+ saveButton = saveButtonWidget
465
+ }
466
+ /*if (modifyFlag) {
467
+ hasModifyItem = true;
468
+ }*/
469
+ })
470
+ }
471
+ if (widget.formItemFlag && !widget.options.hidden && !widget.options.disbaled) {
472
+ hasModifyItem = true;
473
+ }
474
+ }
475
+ }
476
+ });
477
+ if (hasModifyItem && saveButton) {
478
+ saveButton.options.disabled = false;
479
+ saveButton.options.hidden = false;
480
+ }
481
+
482
+ this.wfModifyEnabled = hasModifyItem;
483
+ },
484
+ hanldeWfWidgetNew0() {
485
+
486
+ let wfParam = this.wfParam || {};
487
+ let wfInfo = wfParam?.wfInfo
488
+ let toModify = wfInfo?.toModify;
489
+ let result = false;
490
+
491
+ let formConfig = this.formConfig;
492
+ if (toModify && formConfig.wfConfigDataEnabled) {
493
+
494
+ let modelKey = wfInfo.modelKey;
495
+ let companyCode = this.$store.getters.companyCode;
496
+ let taskStep = (wfInfo.taskStep ?? "") + "";
497
+ let taskDefinitionKey = wfInfo.taskDefinitionKey;
498
+ let bdService = this.bdService;
499
+
500
+ let wfConfigData = formConfig.wfConfigData || []
501
+ let flag = false;
502
+ wfConfigData.forEach(item => {
503
+ let type = item.type;
504
+ let taskStepList = item.taskSteps ? item.taskSteps.split(',') : []
505
+ if (taskStepList.includes(taskStep)) {
506
+ let companyCodeStr = item.companyCodes;
507
+ let companyCodes = companyCodeStr ? companyCodeStr.split(",").filter(item => !!item) : [];
508
+ let flag1 = !item.serveName || item.serveName == bdService;
509
+ let flag2 = !item.modelKey || item.modelKey == modelKey;
510
+ let flag3 = !companyCodes.length || companyCodes.includes(companyCode)
511
+ if (flag1 && flag2 && flag3) {
512
+ //可编辑
513
+ result = true;
514
+ }
515
+ }
516
+ })
517
+ return result;
518
+ }
519
+ },
520
+ hanldeWfWidgetNew1(widget) {
521
+ let wfParam = this.wfParam || {};
522
+ if (!wfParam.hasWf) return;
523
+ let isWfFlag = this.hasConfig(widget, 'wfFlag');
524
+ let widgetType = widget?.type;
525
+ let enabledByWf = widget?.options?.enabledByWf;
526
+ let hiddenByWf = widget?.options?.hiddenByWf;
527
+ let widgetName = widget?.options?.name;
528
+ if (!hiddenByWf && this.widgetEditOnWf) {
529
+ enabledByWf = true;
530
+ }
531
+ let hidden = null;
532
+ let disabled = null;
533
+ if (isWfFlag) {
534
+ if (this.hasConfig(widget, 'disabled')) {
535
+
536
+ if (!enabledByWf) {
537
+ disabled = true;
538
+ let onClick = widget.options.onClick;
539
+ if (onClick && onClick.startsWith("this.getFormRef().$baseReload()")) {
540
+ disabled = false;
541
+ }
542
+ } else {
543
+ disabled = false;
544
+ }
545
+ if (widgetType == 'reset_button' && enabledByWf === undefined) {
546
+ disabled = false;
547
+ }
548
+ if (disabled !== null) {
549
+ widget.options.disabled = disabled;
550
+ }
551
+ }
552
+
553
+
554
+ if (hiddenByWf) {
555
+ hidden = true
556
+ }
557
+ if (widget && widgetType == 'save_button' && hiddenByWf === undefined) {
558
+ hidden = true
559
+ }
560
+ if (hidden !== null) {
561
+ widget.options.hidden = hidden;
562
+ }
563
+ }
564
+
565
+ if (widget?.type == "data-table") {
566
+ let loopDo = (t, e) => {
567
+ if (t.children && t.children.length) {
568
+ t.children.forEach(item => {
569
+ loopDo(item)
570
+ })
571
+ } else {
572
+ if (t.widget) {
573
+ this.hanldeWfWidgetNew1(t.widget)
574
+ }
575
+ if (t.widgetList && t.widgetList.length) {
576
+ loopHandleWidget(t.widgetList, (item1) => {
577
+ this.hanldeWfWidgetNew1(item1)
578
+ });
579
+ }
580
+ }
581
+ }
582
+ widget.options.tableColumns.forEach(item => {
583
+ loopDo(item)
584
+ })
585
+
586
+ }
587
+ },
588
+ hanldeWfWidgetNew2(widget, callback) {
589
+ let hasModifyItem = false;
590
+ let saveButton;
591
+ let flag = this.hanldeWfWidgetItemNew(widget)
592
+ if (flag) {
593
+ hasModifyItem = true
594
+ }
595
+ if (widget?.options?.saveButton) {
596
+ saveButton = widget;
597
+ }
598
+ callback(hasModifyItem, saveButton)
599
+ },
600
+ hanldeWfWidgetItemNew(widget) {
601
+ let hasModifyItem = false;
602
+ // let widget = target.field || target.widget;
603
+ let wfEdit = widget?.options.wfEdit;
604
+
605
+ let bdService = this.bdService;
606
+ let wfParam = this.wfParam;
607
+ let wfInfo = wfParam.wfInfo
608
+ let modelKey = wfInfo.modelKey;
609
+ let companyCode = this.$store.getters.companyCode;
610
+ let taskStep = (wfInfo.taskStep ?? "") + "";
611
+
612
+ let handleWfConfigData = (widget, columnOptions) => {
613
+ let options = widget?.options || columnOptions;
614
+ if (!options || !options.wfEdit) return
615
+ let wfConfigData = options.wfConfigData || [];
616
+ let flag = false;
617
+ wfConfigData.forEach(item => {
618
+ let type = item.type;
619
+ let taskStepList = item.taskSteps ? item.taskSteps.split(',') : []
620
+ if (type && taskStepList.includes(taskStep)) {
621
+ let companyCodeStr = item.companyCodes;
622
+ let companyCodes = companyCodeStr ? companyCodeStr.split(",").filter(item => !!item) : [];
623
+ let flag1 = !item.serveName || item.serveName == bdService;
624
+ let flag2 = !item.modelKey || item.modelKey == modelKey;
625
+ let flag3 = !companyCodes.length || companyCodes.includes(companyCode)
626
+ if (flag1 && flag2 && flag3) {
627
+ if (type === 1) {
628
+ //可编辑
629
+ hasModifyItem = true;
630
+ if (options.disabled !== undefined) options.disabled = false;
631
+ // target.setDisabled && target.setDisabled(false);
632
+ // target.setHidden(false);
633
+ options.hidden = false;
634
+ flag = true;
635
+ } else if (type === 2) {
636
+ //仅显示
637
+ // target.setDisabled && target.setDisabled(true);
638
+ if (options.disabled !== undefined) options.disabled = true;
639
+ // target.setHidden(false);
640
+ options.hidden = false;
641
+ flag = true;
642
+ } else if (type === 3) {
643
+ // target.setHidden(true);
644
+ options.hidden = true;
645
+ flag = true;
646
+ }
647
+ }
648
+ }
649
+ })
650
+ /*if (flag && e && widget.type == 'baseAttachment') {
651
+ e.initOption();
652
+ }*/
653
+ }
654
+ handleWfConfigData(widget)
655
+ if (widget.type == "data-table") {
656
+ let loopDo = (t) => {
657
+ if (t.children && t.children.length) {
658
+ t.children.forEach(item => {
659
+ loopDo(item)
660
+ })
661
+ } else {
662
+ if (t.widget) {
663
+ handleWfConfigData(t.widget)
664
+ }
665
+ if (t.widgetList && t.widgetList.length) {
666
+ loopHandleWidget(t.widgetList, (item1) => {
667
+ handleWfConfigData(item1)
668
+ });
669
+ }
670
+ }
671
+ }
672
+
673
+ widget.options.tableColumns.forEach(item => {
674
+ loopDo(item)
675
+ })
676
+ }
677
+
678
+ return hasModifyItem;
679
+ },
680
+
432
681
  hanldeCommonWidget() {
433
- this.loopHandleWidget(this.formJson.widgetList, (widget) => {
682
+ loopHandleWidget(this.formJson.widgetList, (widget) => {
434
683
  //处理组件显隐规则
435
684
  this.handleWidgetShowRule(widget)
436
685
  });
@@ -489,6 +738,7 @@ modules = {
489
738
  }
490
739
  }
491
740
  }
741
+ return optionModel.hidden;
492
742
  }
493
743
 
494
744
  },
@@ -566,7 +816,7 @@ modules = {
566
816
  }
567
817
  widget.options.tableColumns.forEach(item => {
568
818
  loopDo(item)
569
- this.loopHandleWidget(item.widgetList, (item1) => {
819
+ loopHandleWidget(item.widgetList, (item1) => {
570
820
  toDo2(item1)
571
821
  });
572
822
  })
@@ -577,7 +827,7 @@ modules = {
577
827
  }*/
578
828
  }
579
829
 
580
- this.loopHandleWidget(this.formJson.widgetList, (widget) => {
830
+ loopHandleWidget(this.formJson.widgetList, (widget) => {
581
831
  //有流程,处理禁用状态
582
832
  let formItemFlag = widget?.formItemFlag
583
833
  if (formItemFlag) {
@@ -604,7 +854,7 @@ modules = {
604
854
  let saveButtonOptions;
605
855
  let bdService = this.bdService;
606
856
 
607
- this.loopHandleWidget(this.formJson.widgetList, (widget) => {
857
+ loopHandleWidget(this.formJson.widgetList, (widget) => {
608
858
  let flag = this.hanldeWfWidgetItem(widget)
609
859
  if (!hasModifyItem && flag) {
610
860
  hasModifyItem = true
@@ -692,21 +942,16 @@ modules = {
692
942
 
693
943
  widget.options.tableColumns.forEach(item => {
694
944
  loopDo(item)
695
- this.loopHandleWidget(item.widgetList, (item1) => {
945
+ loopHandleWidget(item.widgetList, (item1) => {
696
946
  handleWfConfigData(item1)
697
947
  });
698
948
  })
699
- /*this.loopHandleWidget(widget.widgetList, (item1) => {
700
- handleWfConfigData(item1.options)
701
- });
702
- this.loopHandleWidget(widget.buttons, (item1) => {
703
- handleWfConfigData(item1.options)
704
- });*/
705
949
  }
706
950
 
707
951
  return hasModifyItem;
708
952
  },
709
953
  loadDefaultEntityData(callback) {
954
+ let that = this;
710
955
  let formConfig = this.formConfig;
711
956
  // let isLoadEntity = formConfig.isLoadEntity;
712
957
  let entity = formConfig.entity;
@@ -745,10 +990,11 @@ modules = {
745
990
  this.hasWf = hasWf;
746
991
  this.wfParam = wfParam;
747
992
 
748
- if (hasWf) {
993
+ /*if (hasWf) {
749
994
  this.hanldeWfWidget();
750
995
  this.hanldeWfWidget2();
751
- }
996
+ }*/
997
+ this.hanldeCommonWidget2();//处理组件显隐,可编辑
752
998
 
753
999
  this.showFormContent = true;
754
1000
  this.$nextTick(() => {
@@ -784,6 +1030,37 @@ modules = {
784
1030
  })
785
1031
  }
786
1032
  }
1033
+
1034
+ if (formConfig.wfAgreenBindSave) {
1035
+ option.onClickAgree = (done) => {
1036
+ if (that.wfModifyEnabled) {
1037
+ let formRef = this.getFormRef ? this.getFormRef() : this;
1038
+ formRef.validate(valid => {
1039
+ if (valid) {
1040
+ done();
1041
+ }
1042
+ });
1043
+ } else {
1044
+ done();
1045
+ }
1046
+ }
1047
+ option.onBeforeAgree = (done) => {
1048
+ if (that.wfModifyEnabled) {
1049
+ this.saveDefaultHandle({
1050
+ config: {
1051
+ successMsg: false,
1052
+ isConfirm: false,
1053
+ success: res => {
1054
+ done()
1055
+ },
1056
+ }
1057
+ })
1058
+ } else {
1059
+ done();
1060
+ }
1061
+ }
1062
+ }
1063
+
787
1064
  let resOption = option
788
1065
  if (wfConfig1) {
789
1066
  resOption = extendDeeply(resOption, wfConfig1)
@@ -817,6 +1094,7 @@ modules = {
817
1094
  formData = res.objx || {};
818
1095
  // this.currentFormData = res.objx || {};
819
1096
  if (!wfConfig) {
1097
+ this.hanldeCommonWidget2();//处理组件显隐,可编辑
820
1098
  this.setFormData(formData);
821
1099
  this.showFormContent = true;
822
1100
  this.$nextTick(() => {
@@ -827,6 +1105,7 @@ modules = {
827
1105
  }
828
1106
  });
829
1107
  } else {
1108
+ this.hanldeCommonWidget2();//处理组件显隐,可编辑
830
1109
  this.handleShowContent();
831
1110
  }
832
1111
  },
@@ -1142,19 +1421,19 @@ modules = {
1142
1421
  if (!!subFormName) {
1143
1422
  let subFormRef = this.getWidgetRef(subFormName)
1144
1423
  if (!!subFormRef) {
1145
- if(subFormRef.widget.type == "data-table"){
1424
+ if (subFormRef.widget.type == "data-table") {
1146
1425
  let rows = subFormRef.getValue();
1147
- if(rows){
1426
+ if (rows) {
1148
1427
  rows.forEach(row => {
1149
- result.push( widgetName + '_' + row._X_ROW_KEY)
1428
+ result.push(widgetName + '_' + row._X_ROW_KEY)
1150
1429
  })
1151
1430
  }
1152
1431
 
1153
- }else{
1432
+ } else {
1154
1433
  let rowIds = subFormRef.getRowIdData()
1155
1434
  if (!!rowIds && (rowIds.length > 0)) {
1156
1435
  rowIds.forEach(rid => {
1157
- result.push( widgetName + '@row' + rid)
1436
+ result.push(widgetName + '@row' + rid)
1158
1437
  })
1159
1438
  }
1160
1439
  }
@@ -2128,126 +2407,6 @@ modules = {
2128
2407
  this.formDrawerOption.confirm && this.formDrawerOption.confirm()
2129
2408
  },
2130
2409
 
2131
- loopHandleWidget: function (e, callback) {
2132
- let t = this;
2133
- e
2134
- && e.length > 0
2135
- && e.forEach(function (e) {
2136
- t.loopHandleWidgetItem(e, callback);
2137
- });
2138
- },
2139
- loopHandleWidgetItem: function (e, callback) {
2140
- let t = this;
2141
- let dataId = this.dataId;
2142
- let currentFormData = this.currentFormData;
2143
- let fieldKeyName = this.getFieldKeyName(e)
2144
- let defaultValue = e.options.defaultValue === undefined || e.options.defaultValue === "" ? null : e.options.defaultValue;
2145
- if ('container' === e.category) {
2146
- callback(e)
2147
- if ('vf-dialog' === e.type || 'vf-drawer' === e.type) ;
2148
- else if ('data-table' === e.type) {
2149
- if (!!e.widgetList) {
2150
- e.widgetList.forEach((childItem) => {
2151
- this.loopHandleWidgetItem(childItem, callback);
2152
- });
2153
- }
2154
- if (!!e.buttons) {
2155
- e.buttons.forEach((childItem) => {
2156
- this.loopHandleWidgetItem(childItem, callback);
2157
- });
2158
- }
2159
- } else if ('list-h5' === e.type) {
2160
- if (!!e.widgetList && (e.widgetList.length > 0)) {
2161
- e.widgetList.forEach((childItem) => {
2162
- this.loopHandleWidgetItem(childItem, callback);
2163
- });
2164
- }
2165
- } else if ('grid' === e.type) {
2166
- e.cols
2167
- && e.cols.length > 0
2168
- && e.cols.forEach(function (e) {
2169
- t.loopHandleWidgetItem(e, callback);
2170
- });
2171
- } else if ('table' === e.type) {
2172
- e.rows
2173
- && e.rows.length > 0
2174
- && e.rows.forEach(function (e) {
2175
- e.cols
2176
- && e.cols.length > 0
2177
- && e.cols.forEach(function (e) {
2178
- t.loopHandleWidgetItem(e, callback);
2179
- });
2180
- });
2181
- } else if ('h5-table' === e.type) {
2182
- e.rows
2183
- && e.rows.length > 0
2184
- && e.rows.forEach(function (e) {
2185
- e.cols
2186
- && e.cols.length > 0
2187
- && e.cols.forEach(function (e) {
2188
- t.loopHandleWidgetItem(e, callback);
2189
- });
2190
- });
2191
- } else if ('tab' === e.type) {
2192
- e.tabs
2193
- && e.tabs.length > 0
2194
- && e.tabs.forEach(function (e) {
2195
- e.widgetList
2196
- && e.widgetList.length > 0
2197
- && e.widgetList.forEach(function (e) {
2198
- t.loopHandleWidgetItem(e, callback);
2199
- });
2200
- });
2201
- } else if ('detail' === e.type) {
2202
- if (e.panes) {
2203
- e.panes.forEach(function (e) {
2204
- if (e.widgetList) {
2205
- e.widgetList.forEach(function (e) {
2206
- t.loopHandleWidgetItem(e, callback);
2207
- });
2208
- }
2209
- if (e.buttonWidgetList) {
2210
- e.buttonWidgetList.forEach(function (e) {
2211
- t.loopHandleWidgetItem(e, callback);
2212
- });
2213
- }
2214
- });
2215
- }
2216
- if (e.widgetList) {
2217
- e.widgetList.forEach(function (e) {
2218
- t.loopHandleWidgetItem(e, callback);
2219
- });
2220
- }
2221
- } else if ('detail-pane' === e.type) {
2222
- if (e.widgetList) {
2223
- e.widgetList.forEach(function (e) {
2224
- t.loopHandleWidgetItem(e, callback);
2225
- });
2226
- }
2227
- if (e.buttonWidgetList) {
2228
- e.buttonWidgetList.forEach(function (e) {
2229
- t.loopHandleWidgetItem(e, callback);
2230
- });
2231
- }
2232
- } else {
2233
- 'grid-col' === e.type || e.type,
2234
- e.widgetList
2235
- && e.widgetList.length > 0
2236
- && e.widgetList.forEach(function (e) {
2237
- t.loopHandleWidgetItem(e, callback);
2238
- });
2239
- }
2240
-
2241
- } else {
2242
- callback && callback(e)
2243
- /*if (dataId || currentFormData.hasOwnProperty(fieldKeyName)) {
2244
- let c = currentFormData[fieldKeyName] ?? null;
2245
- this.$set(this.formDataModel, fieldKeyName, baseRefUtil.deepClone(c));
2246
- } else {
2247
- this.$set(this.formDataModel, fieldKeyName, defaultValue);
2248
- }*/
2249
- }
2250
- },
2251
2410
 
2252
2411
  }
2253
2412
  };
@@ -807,6 +807,9 @@ export function getDefaultFormConfig() {
807
807
  saveScriptCode: "saveUpdate",
808
808
  wfConfig: null,
809
809
  wfStartBindSave: false,
810
+ wfAgreenBindSave:false,
811
+ wfConfigDataEnabled:false,
812
+ wfConfigData:[]
810
813
  };
811
814
  }
812
815