cloud-web-corejs 1.0.54-dev.185 → 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.185",
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 () {
@@ -1157,19 +1209,18 @@ modules = {
1157
1209
  this.field.options.valueKey || "value"
1158
1210
  );
1159
1211
  this.field.options.optionItems = optionItems
1160
- /*let tableParam = this.tableParam;
1161
- if(tableParam){
1162
- this.setGloatOptionItems(optionItems)
1163
- tableParam.column.params.rowOptionFlag = rowOptionFlag
1164
- }*/
1165
1212
  },
1166
- getGloatOptionItems: function (e, rowOptionFlag) {
1213
+ getOptionKey() {
1214
+ let key = "optionItems-" + this.field.options.name
1215
+ return key;
1216
+ },
1217
+ getOptionItemsFlag: function () {
1167
1218
  let key = this.getOptionKey()
1168
1219
  return this.getGlobalParam(key);
1169
1220
  },
1170
- setGloatOptionItems: function (optionItems) {
1221
+ setOptionItemsFlag: function (flag) {
1171
1222
  let key = this.getOptionKey()
1172
- return this.setGlobalParam(key, optionItems);
1223
+ return this.setGlobalParam(key, flag);
1173
1224
  },
1174
1225
  reloadOptions: function (e) {
1175
1226
  let optionItems = baseRefUtil.translateOptionItems(
@@ -1179,13 +1230,6 @@ modules = {
1179
1230
  this.field.options.valueKey || "value"
1180
1231
  );
1181
1232
  this.field.options.optionItems = optionItems;
1182
- let tableParam = this.tableParam;
1183
- if (tableParam) {
1184
- // let key = this.getOptionKey();
1185
- // tableParam.column.params[key] = optionItems;
1186
- this.setGloatOptionItems(optionItems)
1187
- // tableParam.column.params.optionItems = optionItems;
1188
- }
1189
1233
  },
1190
1234
  getOptions: function () {
1191
1235
  return this.getOptionItems();
@@ -1197,15 +1241,7 @@ modules = {
1197
1241
  this.enableOptionOfList(this.getOptionItems(), e);
1198
1242
  },
1199
1243
  getOptionItems: function () {
1200
- // return this.field.options.optionItems;
1201
- let tableParam = this.tableParam;
1202
1244
  let optionItems = this.field.options.optionItems;
1203
- /*if(tableParam){
1204
- let rows = this.getGloatOptionItems()
1205
- if(!tableParam.column.params.rowOptionFlag && rows!==undefined){
1206
- optionItems = rows || []
1207
- }
1208
- }*/
1209
1245
  return optionItems;
1210
1246
  },
1211
1247
  setUploadHeader: function (e, t) {
@@ -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) {