cloud-web-corejs 1.0.54-dev.184 → 1.0.54-dev.186

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.184",
4
+ "version": "1.0.54-dev.186",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -87,7 +87,7 @@
87
87
  需要在父组件created中初始化!! */
88
88
  this.handleCreatedEnterEvent();
89
89
  this.initFieldModel()
90
- this.initOptionItems()
90
+ this.initOptionItemsHandle()
91
91
  this.registerToRefList()
92
92
  this.initEventHandler()
93
93
  this.buildFieldRules()
@@ -467,11 +467,10 @@ modules = {
467
467
  : delete this.refList[e];
468
468
  }
469
469
  },
470
- getOptionKey(){
471
- let key = "optionItems-"+ this.field.options.name
472
- return key;
470
+ initOptionItemsHandle() {
471
+ this.initGloatOptionItems(true);
473
472
  },
474
- async initOptionItems(gloatFlag) {
473
+ initGloatOptionItems(initFlag) {
475
474
  var t = this;
476
475
  if (this.designState) {
477
476
  return;
@@ -489,13 +488,13 @@ modules = {
489
488
  let scriptCode = this.field.options.formScriptCode || "getList";
490
489
  let tableParam = this.tableParam;
491
490
  if (formScriptEnabled) {
492
- /*if(tableParam){
493
- let optionItems = this.getGloatOptionItems()
494
- if(optionItems!==undefined){
491
+ if (initFlag && tableParam) {
492
+ let optionItems = this.getOptionItemsFlag()
493
+ if (optionItems !== undefined) {
495
494
  return
496
495
  }
497
- this.setGloatOptionItems(null)
498
- }*/
496
+ this.setOptionItemsFlag(null)
497
+ }
499
498
  let accessParam = this.handleCustomEvent(
500
499
  this.field.options.formScriptParam
501
500
  );
@@ -511,7 +510,7 @@ modules = {
511
510
  },
512
511
  callback: (res) => {
513
512
  let rows = res.objx || [];
514
- this.loadOptions(rows);
513
+ this.loadGloatOptions(rows, initFlag);
515
514
  this.handleCustomEvent(
516
515
  this.field.options.formScriptSuccess,
517
516
  ["res"],
@@ -522,17 +521,17 @@ modules = {
522
521
  } else if (this.field.options.commonAttributeEnabled) {
523
522
  let commonAttributeCode = this.field.options.commonAttributeCode;
524
523
  if (!commonAttributeCode) return;
525
- /*if(tableParam){
526
- let optionItems = this.getGloatOptionItems();
527
- if(optionItems!==undefined){
524
+ if (initFlag && tableParam) {
525
+ let optionItems = this.getOptionItemsFlag();
526
+ if (optionItems !== undefined) {
528
527
  return
529
528
  }
530
- this.setGloatOptionItems(null)
531
- }*/
529
+ this.setOptionItemsFlag(null)
530
+ }
532
531
  this.$getBaseDicts({
533
532
  code: commonAttributeCode,
534
533
  success: ({dicts, dictMap}) => {
535
- this.loadOptions(dicts);
534
+ this.loadGloatOptions(dicts, initFlag);
536
535
  this.handleCustomEvent(
537
536
  this.field.options.formScriptSuccess,
538
537
  ["res"],
@@ -540,63 +539,116 @@ modules = {
540
539
  );
541
540
  },
542
541
  });
543
- }else{
544
- if(tableParam){
545
- // tableParam.column.params.optionItems
546
- // let key = this.getOptionKey();
547
- // let optionItems = tableParam.column.params[key];
548
- let optionItems = this.getGloatOptionItems();
549
- if(optionItems!==undefined){
550
- return
551
- }
552
- // tableParam.column.params[key] = this.$baseLodash.cloneDeep(this.field.options.optionItems);
553
- this.setGloatOptionItems(this.$baseLodash.cloneDeep(this.field.options.optionItems));
554
- }
555
542
  }
556
543
 
557
544
  return;
558
- /*if (t.field.options.isLoadDataByAccess && t.field.options.scriptUuid) {
559
- this.scriptHttp(
560
- {
561
- options: t.field.options,
562
- params: {},
563
- callback: (res) => {
564
- let rows = res && res.objx ? res.objx : [];
565
- t.loadOptions(rows);
566
- }
567
- });
568
- } else if (!t.field.options.dsEnabled) {
569
- /!* 异步更新option-data之后globalOptionData不能获取到最新值,改用provide的getOptionData()方法 *!/
570
- const newOptionItems = this.getOptionData();
571
- if (!!newOptionItems && newOptionItems.hasOwnProperty(this.fieldKeyName)) {
572
- if (!!keepSelected) {
573
- this.reloadOptions(newOptionItems[this.fieldKeyName]);
574
- } else {
575
- this.loadOptions(newOptionItems[this.fieldKeyName]);
576
- }
545
+ }
546
+ },
547
+ loadGloatOptions: function (e, initFlag) {
548
+ let optionItems = baseRefUtil.translateOptionItems(
549
+ e,
550
+ this.field.type,
551
+ this.field.options.labelKey || "label",
552
+ this.field.options.valueKey || "value"
553
+ );
554
+ this.field.options.optionItems = optionItems
555
+ let tableParam = this.tableParam;
556
+ if (tableParam) {
557
+ if (initFlag) {
558
+ this.setOptionItemsFlag(true)
559
+ }
560
+ this.loadTableOtions(e)
561
+ }
562
+ },
563
+ loadTableOtions(optionItems) {
564
+ let tableParam = this.tableParam;
565
+ if (tableParam) {
566
+ let widgetName = this.field.options.name;
567
+ let tableWidgetName = tableParam.column.params.tableWidgetName
568
+ let tableTarget = this.getWidgetRef(tableWidgetName);
569
+ tableTarget.loopHandleWidgetByName(widgetName, (row, widget, target) => {
570
+ widget.options.optionItems = optionItems
571
+ })
572
+ if (tableParam.column.params.widget) {
573
+ if (tableParam.column.params.widget.options.name == widgetName) {
574
+ tableParam.column.params.widget.options.optionItems = optionItems
577
575
  }
578
- } else {
579
- var n, a, l, s, r, d;
580
576
 
581
- await this.initAccess();
582
-
583
- let requestAccess = this.requestAccess;
584
- if (!requestAccess) {
585
- return;
577
+ }
578
+ if (tableParam.column.params.editWidget) {
579
+ if (tableParam.column.params.editWidget.options.name == widgetName) {
580
+ tableParam.column.params.editWidget.options.optionItems = optionItems
586
581
  }
587
- return l = t.getGlobalDsv() || {},
588
- s = new Object({}),
589
- baseRefUtil.overwriteObj(s, l),
590
- s["widgetName"] = t.field.options.name,
591
- s.widgetKeyName = this.fieldKeyName,
592
- s["requestAccess"] = requestAccess,
593
- a = requestAccess.dsModel,
594
- // r = i.sent,
595
- baseRefUtil.runDataSourceRequest(a, s, t.getFormRef(), !1, t
596
- .$message).then(res => {
597
- t.loadOptions(res || []);
598
- });
599
- }*/
582
+ }
583
+ if (tableParam.column.params.widgetList?.length) {
584
+ this.loopHandleWidget(tableParam.column.params.widgetList, (item1) => {
585
+ if (item1.options.name == widgetName) {
586
+ item1.options.optionItems = optionItems
587
+ }
588
+ });
589
+ }
590
+
591
+ delete tableParam.column.params[widgetName]
592
+ }
593
+ },
594
+ async initOptionItems(gloatFlag) {
595
+ var t = this;
596
+ if (this.designState) {
597
+ return;
598
+ }
599
+
600
+ if (
601
+ this.field.type === "radio" ||
602
+ this.field.type === "checkbox" ||
603
+ this.field.type === "select" ||
604
+ this.field.type === "cascader"
605
+ ) {
606
+ let reportTemplate = this.getFormRef().reportTemplate;
607
+ let formCode = reportTemplate.formCode;
608
+ let formScriptEnabled = this.field.options.formScriptEnabled || false;
609
+ let scriptCode = this.field.options.formScriptCode || "getList";
610
+ let tableParam = this.tableParam;
611
+ if (formScriptEnabled) {
612
+ let accessParam = this.handleCustomEvent(
613
+ this.field.options.formScriptParam
614
+ );
615
+ return this.formHttp({
616
+ scriptCode: scriptCode,
617
+ data: {
618
+ formCode: formCode,
619
+ formVersion: reportTemplate.formVersion,
620
+ taBm: this.fieldKeyName,
621
+ data: {
622
+ ...accessParam,
623
+ },
624
+ },
625
+ callback: (res) => {
626
+ let rows = res.objx || [];
627
+ this.loadOptions(rows);
628
+ this.handleCustomEvent(
629
+ this.field.options.formScriptSuccess,
630
+ ["res"],
631
+ [res]
632
+ );
633
+ },
634
+ });
635
+ } else if (this.field.options.commonAttributeEnabled) {
636
+ let commonAttributeCode = this.field.options.commonAttributeCode;
637
+ if (!commonAttributeCode) return;
638
+ this.$getBaseDicts({
639
+ code: commonAttributeCode,
640
+ success: ({dicts, dictMap}) => {
641
+ this.loadOptions(dicts);
642
+ this.handleCustomEvent(
643
+ this.field.options.formScriptSuccess,
644
+ ["res"],
645
+ [dicts]
646
+ );
647
+ },
648
+ });
649
+ }
650
+
651
+ return;
600
652
  }
601
653
  },
602
654
  refreshDefaultValue: function () {
@@ -772,7 +824,7 @@ modules = {
772
824
  },
773
825
  handleCustomClickEvent: function (flag) {
774
826
  let tableParam = this.tableParam;
775
- let clickBindEvent = !flag ? this.field.options.clickBindEvent: this.field.options.widgetTextLinkConfig?.options?.clickBindEvent;
827
+ let clickBindEvent = !flag ? this.field.options.clickBindEvent : this.field.options.widgetTextLinkConfig?.options?.clickBindEvent;
776
828
  if (clickBindEvent == "1") {
777
829
  //打开选择弹框
778
830
  this.openSearchDialog(tableParam, flag);
@@ -782,7 +834,7 @@ modules = {
782
834
  }
783
835
  },
784
836
  handleAddTableDataEvent(flag) {
785
- let optionModel = !flag? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
837
+ let optionModel = !flag ? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
786
838
 
787
839
  let addTableDataConfig = optionModel.addTableDataConfig || {};
788
840
  if (!addTableDataConfig.tableRef) return;
@@ -807,9 +859,9 @@ modules = {
807
859
  o.call(this, e, t, i, n);
808
860
  }
809
861
  },
810
- handleButtonWidgetClick: function (event,flag) {
862
+ handleButtonWidgetClick: function (event, flag) {
811
863
  if (!this.designState) {
812
- let onClick = !flag? this.field.options.onClick : this.field.options.widgetTextLinkConfig?.options?.onClick
864
+ let onClick = !flag ? this.field.options.onClick : this.field.options.widgetTextLinkConfig?.options?.onClick
813
865
  if (onClick) {
814
866
  let tableParam = this.tableParam;
815
867
  let eventParamNames = ["event"];
@@ -824,7 +876,7 @@ modules = {
824
876
  eventParamValues
825
877
  );
826
878
  } else {
827
- if(!flag)this.dispatch("VFormRender", "buttonClick", [this]);
879
+ if (!flag) this.dispatch("VFormRender", "buttonClick", [this]);
828
880
  }
829
881
  this.handleCustomClickEvent(flag);
830
882
  }
@@ -833,8 +885,8 @@ modules = {
833
885
  let searchDialogConfig = this.field.options.searchDialogConfig || {};
834
886
  let tableData = searchDialogConfig.tableData || [];
835
887
  },
836
- openSearchDialog(tableParam,flag) {
837
- let optionModel = !flag? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
888
+ openSearchDialog(tableParam, flag) {
889
+ let optionModel = !flag ? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
838
890
  let searchDialogConfig = optionModel.searchDialogConfig || {};
839
891
  let formCode = searchDialogConfig.formCode;
840
892
  let tableData = searchDialogConfig.tableData || [];
@@ -861,7 +913,7 @@ modules = {
861
913
  rows,
862
914
  multiple: searchDialogConfig.multipleChoices || false,
863
915
  confirm: (rows) => {
864
- this.handleConfirmSearchDialog(rows, false ,flag);
916
+ this.handleConfirmSearchDialog(rows, false, flag);
865
917
  /*if(rows.length){
866
918
  let row = rows[0];
867
919
  if(this.field.type == "vabsearch"){
@@ -909,9 +961,9 @@ modules = {
909
961
  let multipleChoices = this.field.options.multipleChoices;
910
962
  return multipleChoices;
911
963
  },
912
- handleConfirmSearchDialog(rows, isClear,flag) {
964
+ handleConfirmSearchDialog(rows, isClear, flag) {
913
965
  if (!isClear && !rows.length) return;
914
- let optionModel = !flag? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
966
+ let optionModel = !flag ? this.field.options : (this.field.options.widgetTextLinkConfig?.options || {});
915
967
 
916
968
  let tableParam = this.tableParam;
917
969
  let searchDialogConfig = optionModel.searchDialogConfig || {};
@@ -928,7 +980,7 @@ modules = {
928
980
 
929
981
  if (tableParam) {
930
982
  let rowData = tableParam.row;
931
- if (multipleChoices) {
983
+ if (this.getMultipleChoices()) {
932
984
  if (isClear) {
933
985
  rowData[fieldKeyName] = [];
934
986
  } else {
@@ -963,26 +1015,44 @@ modules = {
963
1015
  });
964
1016
  }
965
1017
  } else {
966
- this.fieldModel = !isClear
967
- ? row[searchDialogConfig.valueSourceField]
968
- : null;
969
- if (searchDialogConfig.labelSourceField) {
970
- this.setShowValue(
971
- !isClear ? row[searchDialogConfig.labelSourceField] : null
972
- );
973
- }
974
- tableData.forEach((item) => {
975
- // formModel[item.targetField] = row[item.sourceField]
976
- let value = !isClear ? row[item.sourceField] ?? null : null;
977
- if (item.targetField) {
978
- this.getWidgetRef(item.targetField).setValue(value);
979
- } else if (item.targetFormField) {
980
- formModel[item.targetFormField] = value;
1018
+ if (this.getMultipleChoices()) {
1019
+ let rowData = [];
1020
+ if (isClear) {
1021
+ rowData = [];
1022
+ } else {
1023
+ rowData = rows.map((item) => {
1024
+ let newData = {};
1025
+ newData[valueField] =
1026
+ item[searchDialogConfig.valueSourceField] ?? null;
1027
+ newData[vabSearchName] =
1028
+ item[searchDialogConfig.labelSourceField] ?? null;
1029
+ tableData.forEach((item1) => {
1030
+ let targetFormField = item1.targetFormField || item1.targetField
1031
+ newData[targetFormField] = item[item1.sourceField];
1032
+ });
1033
+ return newData;
1034
+ });
981
1035
  }
982
-
983
- // formModel[item.targetField] = value;
984
- });
985
- // this.$forceUpdate();
1036
+ this.setValue(rowData);
1037
+ } else {
1038
+ this.fieldModel = !isClear
1039
+ ? row[searchDialogConfig.valueSourceField]
1040
+ : null;
1041
+ if (searchDialogConfig.labelSourceField) {
1042
+ this.setShowValue(
1043
+ !isClear ? row[searchDialogConfig.labelSourceField] : null
1044
+ );
1045
+ }
1046
+ tableData.forEach((item) => {
1047
+ // formModel[item.targetField] = row[item.sourceField]
1048
+ let value = !isClear ? row[item.sourceField] ?? null : null;
1049
+ if (item.targetField) {
1050
+ this.getWidgetRef(item.targetField).setValue(value);
1051
+ } else if (item.targetFormField) {
1052
+ formModel[item.targetFormField] = value;
1053
+ }
1054
+ });
1055
+ }
986
1056
  }
987
1057
  } else {
988
1058
  if (searchDialogConfig.tableEnabled) {
@@ -1131,7 +1201,7 @@ modules = {
1131
1201
  );
1132
1202
  this.field.options.optionItems = optionItems
1133
1203
  },
1134
- loadOptions: function (e,rowOptionFlag) {
1204
+ loadOptions: function (e, rowOptionFlag) {
1135
1205
  let optionItems = baseRefUtil.translateOptionItems(
1136
1206
  e,
1137
1207
  this.field.type,
@@ -1139,19 +1209,18 @@ modules = {
1139
1209
  this.field.options.valueKey || "value"
1140
1210
  );
1141
1211
  this.field.options.optionItems = optionItems
1142
- /*let tableParam = this.tableParam;
1143
- if(tableParam){
1144
- this.setGloatOptionItems(optionItems)
1145
- tableParam.column.params.rowOptionFlag = rowOptionFlag
1146
- }*/
1147
- },
1148
- getGloatOptionItems: function (e, rowOptionFlag) {
1149
- let key = this.getOptionKey()
1212
+ },
1213
+ getOptionKey() {
1214
+ let key = "optionItems-" + this.field.options.name
1215
+ return key;
1216
+ },
1217
+ getOptionItemsFlag: function () {
1218
+ let key = this.getOptionKey()
1150
1219
  return this.getGlobalParam(key);
1151
1220
  },
1152
- setGloatOptionItems: function (optionItems) {
1153
- let key = this.getOptionKey()
1154
- return this.setGlobalParam(key,optionItems);
1221
+ setOptionItemsFlag: function (flag) {
1222
+ let key = this.getOptionKey()
1223
+ return this.setGlobalParam(key, flag);
1155
1224
  },
1156
1225
  reloadOptions: function (e) {
1157
1226
  let optionItems = baseRefUtil.translateOptionItems(
@@ -1161,13 +1230,6 @@ modules = {
1161
1230
  this.field.options.valueKey || "value"
1162
1231
  );
1163
1232
  this.field.options.optionItems = optionItems;
1164
- let tableParam = this.tableParam;
1165
- if(tableParam){
1166
- // let key = this.getOptionKey();
1167
- // tableParam.column.params[key] = optionItems;
1168
- this.setGloatOptionItems(optionItems)
1169
- // tableParam.column.params.optionItems = optionItems;
1170
- }
1171
1233
  },
1172
1234
  getOptions: function () {
1173
1235
  return this.getOptionItems();
@@ -1179,15 +1241,7 @@ modules = {
1179
1241
  this.enableOptionOfList(this.getOptionItems(), e);
1180
1242
  },
1181
1243
  getOptionItems: function () {
1182
- // return this.field.options.optionItems;
1183
- let tableParam = this.tableParam;
1184
1244
  let optionItems = this.field.options.optionItems;
1185
- /*if(tableParam){
1186
- let rows = this.getGloatOptionItems()
1187
- if(!tableParam.column.params.rowOptionFlag && rows!==undefined){
1188
- optionItems = rows || []
1189
- }
1190
- }*/
1191
1245
  return optionItems;
1192
1246
  },
1193
1247
  setUploadHeader: function (e, t) {
@@ -1314,19 +1368,19 @@ modules = {
1314
1368
  let name = this.parentWidget?.options?.name ?? null;
1315
1369
  return name ? this.getWidgetRef(name) : null;
1316
1370
  },
1317
- setWidgetTextFlag(val){
1371
+ setWidgetTextFlag(val) {
1318
1372
  this.widgetTextFlag = val;
1319
1373
  },
1320
- showWidget(){
1374
+ showWidget() {
1321
1375
  this.widgetTextFlag = 0;
1322
1376
  },
1323
- showText(){
1377
+ showText() {
1324
1378
  this.widgetTextFlag = 1;
1325
1379
  },
1326
- showEncryptText(){
1380
+ showEncryptText() {
1327
1381
  this.widgetTextFlag = 2;
1328
1382
  },
1329
- showAText(){
1383
+ showAText() {
1330
1384
  this.widgetTextFlag = 3;
1331
1385
  },
1332
1386
  },
@@ -87,7 +87,7 @@
87
87
  需要在父组件created中初始化!! */
88
88
  this.handleCreatedEnterEvent();
89
89
  this.initFieldModel()
90
- this.initOptionItems()
90
+ this.initOptionItemsHandle()
91
91
  this.registerToRefList()
92
92
  this.initEventHandler()
93
93
  this.buildFieldRules()
@@ -108,7 +108,7 @@ export default {
108
108
  this.buildFieldRules()
109
109
 
110
110
  this.handleOnCreated()
111
- this.initOptionItems()
111
+ this.initOptionItemsHandle()
112
112
  },
113
113
 
114
114
  mounted() {
@@ -12,8 +12,8 @@
12
12
  </div>
13
13
  <baseUpload accept="file" :file.sync="fieldModel" :hidePasteArea.sync="isH5"
14
14
  :uploadDialogCustomClass="isH5?'dialog-upload-h5':null" :pickPrivateProfile="false"
15
- :multi.sync="multi"
16
- :limit.sync="limit"
15
+ :multi="field.options.limit!==1"
16
+ :limit="field.options.limit"
17
17
  resultType="Array"
18
18
  :edit="!field.options.disabled"
19
19
  @callback="submitFile"
@@ -83,12 +83,6 @@ export default {
83
83
  formDataId() {
84
84
  let formRef = this.getFormRef();
85
85
  return formRef.dataId;
86
- },
87
- limit() {
88
- return this.field.options.limit ? this.field.options.limit : null;
89
- },
90
- multi() {
91
- return this.limit !== 1;
92
86
  }
93
87
  },
94
88
  beforeCreate() {
@@ -213,8 +213,10 @@ modules = {
213
213
  let rows = this.getValue();
214
214
  rows.forEach((row, index) => {
215
215
  let target = this.getWidgetRefByTableRow(index, name)
216
- let widget = target.field || target.widget;
217
- callback(row, widget, target)
216
+ if (target) {
217
+ let widget = target.field || target.widget;
218
+ callback(row, widget, target)
219
+ }
218
220
  })
219
221
  },
220
222
  getRowWidgetOption(rowParam, fieldWidget) {