@ebuilding/biz-comm 2.5.12 → 2.6.1
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/components/formula/src/form-item/index.d.ts +1 -0
- package/fesm2022/components.formula.mjs +6 -2
- package/fesm2022/components.formula.mjs.map +1 -1
- package/fesm2022/other.formula.mjs +6 -2
- package/fesm2022/other.formula.mjs.map +1 -1
- package/fesm2022/other.rule.mjs +67 -19
- package/fesm2022/other.rule.mjs.map +1 -1
- package/fesm2022/type.lookup.mjs +22 -7
- package/fesm2022/type.lookup.mjs.map +1 -1
- package/fesm2022/type.mjs +20 -5
- package/fesm2022/type.mjs.map +1 -1
- package/other/formula/src/form-item/index.d.ts +1 -0
- package/other/rule/src/main/index.component.d.ts +6 -1
- package/package.json +39 -39
- package/type/lookup/src/default/index.d.ts +5 -1
package/fesm2022/other.rule.mjs
CHANGED
|
@@ -494,21 +494,11 @@ class SettingRoleComponent {
|
|
|
494
494
|
if (rule && rule.success && rule.result) {
|
|
495
495
|
if (rule.result.listItem) {
|
|
496
496
|
rule.result.listItem.forEach((item) => {
|
|
497
|
-
this.
|
|
497
|
+
this.hydrateRuleItem(item);
|
|
498
|
+
this.fieldChange(item, true);
|
|
498
499
|
if (item.changeFieldType == 'ITEM') {
|
|
499
|
-
if (item.changeValue) {
|
|
500
|
-
|
|
501
|
-
if (this.configSrv.sourceFieldData) {
|
|
502
|
-
this.configSrv.sourceFieldData.forEach((i) => {
|
|
503
|
-
if (i.itemKey == item.changeFieldKey) {
|
|
504
|
-
type = i.fieldType;
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
if (type == 'REF' || item.changeType == 'CHANGE') {
|
|
509
|
-
item.changeValue = item.changeValue;
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
500
|
+
if (item.changeValue && ['HIDE_SELECT', 'SHOW_SELECT'].includes(item.changeType)) {
|
|
501
|
+
if (!Array.isArray(item.changeValue)) {
|
|
512
502
|
item.changeValue = item.changeValue.split(',');
|
|
513
503
|
}
|
|
514
504
|
}
|
|
@@ -536,6 +526,49 @@ class SettingRoleComponent {
|
|
|
536
526
|
btnAdd() {
|
|
537
527
|
this.pageData = [...this.pageData, {}];
|
|
538
528
|
}
|
|
529
|
+
hydrateRuleItem(item) {
|
|
530
|
+
if (!item) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
item.changeTypeData = this.arrayData(item.changeTypeData);
|
|
534
|
+
item.options = this.arrayData(item.options);
|
|
535
|
+
if (item.triggerValueInfo == null && item.triggerValue != null) {
|
|
536
|
+
item.triggerValueInfo = this.optionInfo(this.configSrv.itemOptions, item.triggerValue);
|
|
537
|
+
}
|
|
538
|
+
if (item.changeValueInfo == null && item.changeValue != null) {
|
|
539
|
+
item.changeValueInfo = this.optionInfo(item.options, item.changeValue);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
arrayData(value) {
|
|
543
|
+
if (Array.isArray(value)) {
|
|
544
|
+
return value;
|
|
545
|
+
}
|
|
546
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
547
|
+
try {
|
|
548
|
+
const parsed = JSON.parse(value);
|
|
549
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
550
|
+
}
|
|
551
|
+
catch (e) {
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return [];
|
|
556
|
+
}
|
|
557
|
+
optionInfo(options, value) {
|
|
558
|
+
if (value == null || !Array.isArray(options)) {
|
|
559
|
+
return null;
|
|
560
|
+
}
|
|
561
|
+
const found = options.find((option) => this.optionValue(option) == value);
|
|
562
|
+
if (found) {
|
|
563
|
+
return found;
|
|
564
|
+
}
|
|
565
|
+
return {
|
|
566
|
+
id: value,
|
|
567
|
+
value,
|
|
568
|
+
label: value,
|
|
569
|
+
name: value,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
539
572
|
btnDelete(e, i) {
|
|
540
573
|
this.pageData = this.pageData.filter((item, index, object) => {
|
|
541
574
|
return i != index;
|
|
@@ -611,7 +644,7 @@ class SettingRoleComponent {
|
|
|
611
644
|
this.loading = false;
|
|
612
645
|
});
|
|
613
646
|
}
|
|
614
|
-
fieldChange(e) {
|
|
647
|
+
fieldChange(e, keepExisting = false) {
|
|
615
648
|
let field = null;
|
|
616
649
|
let arr = [
|
|
617
650
|
{ value: 'CHANGE', label: '变更值' },
|
|
@@ -620,7 +653,7 @@ class SettingRoleComponent {
|
|
|
620
653
|
{ value: 'REQUIRED', label: '变更必填' },
|
|
621
654
|
];
|
|
622
655
|
this.configSrv.sourceFieldData.forEach((item) => {
|
|
623
|
-
if (item
|
|
656
|
+
if (this.fieldKey(item) == e.changeFieldKey) {
|
|
624
657
|
field = item;
|
|
625
658
|
}
|
|
626
659
|
});
|
|
@@ -649,12 +682,27 @@ class SettingRoleComponent {
|
|
|
649
682
|
default:
|
|
650
683
|
break;
|
|
651
684
|
}
|
|
652
|
-
e['changeFieldType']
|
|
685
|
+
if (!keepExisting || !e['changeFieldType']) {
|
|
686
|
+
e['changeFieldType'] = field.fieldType;
|
|
687
|
+
}
|
|
653
688
|
}
|
|
654
689
|
arr.push({ value: 'FORMULA', label: '已有表达式' });
|
|
655
690
|
arr.push({ value: 'SCRIPT', label: 'Python代码片段' });
|
|
656
|
-
e['changeTypeData']
|
|
657
|
-
|
|
691
|
+
if (!keepExisting || !e['changeTypeData']) {
|
|
692
|
+
e['changeTypeData'] = arr;
|
|
693
|
+
}
|
|
694
|
+
if (!keepExisting || !e['options']) {
|
|
695
|
+
e['options'] = field?.options;
|
|
696
|
+
}
|
|
697
|
+
if (e.changeValueInfo == null && e.changeValue != null) {
|
|
698
|
+
e.changeValueInfo = this.optionInfo(e.options, e.changeValue);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
fieldKey(item) {
|
|
702
|
+
return item?.itemKey ?? item?.fieldKey ?? item?.key ?? item?.id;
|
|
703
|
+
}
|
|
704
|
+
optionValue(option) {
|
|
705
|
+
return option?.value ?? option?.id ?? option?.code;
|
|
658
706
|
}
|
|
659
707
|
initText(arr) {
|
|
660
708
|
arr.push({ value: 'LENGTH', label: '变更长度限制' });
|