@fecp/designer 5.3.4 → 5.3.5
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/es/designer.css +208 -179
- package/es/packages/designer/package.json.mjs +1 -1
- package/es/packages/designer/src/components/FilterConfigDisplay.vue.mjs +5 -3
- package/es/packages/designer/src/packages/advancedFilter/ValueInput.vue2.mjs +2 -2
- package/es/packages/designer/src/packages/dataLinkage/index.vue.mjs +85 -75
- package/es/packages/designer/src/packages/dialogGlobal/index.vue.mjs +2 -0
- package/es/packages/designer/src/packages/eventFlow/dialog/action/TableChildRefresh.vue2.mjs +94 -0
- package/es/packages/designer/src/packages/eventFlow/dialog/action/TableRowDelete.vue2.mjs +54 -0
- package/es/packages/designer/src/packages/eventFlow/dialog/action/config.mjs +12 -1
- package/es/packages/designer/src/packages/formulaEditor/index.vue2.mjs +10 -1
- package/es/packages/designer/src/packages/table/headerBtn.vue.mjs +2 -0
- package/es/packages/designer/src/packages/table/queryModule/DynamicModeConfig.vue.mjs +12 -5
- package/es/packages/designer/src/packages/table/queryModule/index.vue.mjs +11 -16
- package/es/packages/vue/src/components/bus/approvalHistory/ApprovalHistory.vue.mjs +5 -4
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +234 -139
- package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +20 -3
- package/es/packages/vue/src/components/forms/subForm/SubForm.vue.mjs +4 -4
- package/es/packages/vue/src/components/forms/subTable/SubTable.vue.mjs +11 -5
- package/es/packages/vue/src/components/table/CustomButtons.vue.mjs +11 -3
- package/es/packages/vue/src/components/table/DynamicQuery.vue.mjs +16 -8
- package/es/packages/vue/src/components/table/Table.vue.mjs +7 -5
- package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +86 -5
- package/es/packages/vue/src/utils/parseFilterConfig.mjs +44 -0
- package/lib/designer.css +208 -179
- package/lib/packages/designer/package.json.js +1 -1
- package/lib/packages/designer/src/components/FilterConfigDisplay.vue.js +5 -3
- package/lib/packages/designer/src/packages/advancedFilter/ValueInput.vue2.js +2 -2
- package/lib/packages/designer/src/packages/dataLinkage/index.vue.js +93 -83
- package/lib/packages/designer/src/packages/dialogGlobal/index.vue.js +2 -0
- package/lib/packages/designer/src/packages/eventFlow/dialog/action/TableChildRefresh.vue2.js +94 -0
- package/lib/packages/designer/src/packages/eventFlow/dialog/action/TableRowDelete.vue2.js +54 -0
- package/lib/packages/designer/src/packages/eventFlow/dialog/action/config.js +12 -1
- package/lib/packages/designer/src/packages/formulaEditor/index.vue2.js +10 -1
- package/lib/packages/designer/src/packages/table/headerBtn.vue.js +2 -0
- package/lib/packages/designer/src/packages/table/queryModule/DynamicModeConfig.vue.js +12 -5
- package/lib/packages/designer/src/packages/table/queryModule/index.vue.js +11 -16
- package/lib/packages/vue/src/components/bus/approvalHistory/ApprovalHistory.vue.js +5 -4
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +232 -137
- package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +19 -2
- package/lib/packages/vue/src/components/forms/subForm/SubForm.vue.js +4 -4
- package/lib/packages/vue/src/components/forms/subTable/SubTable.vue.js +11 -5
- package/lib/packages/vue/src/components/table/CustomButtons.vue.js +11 -3
- package/lib/packages/vue/src/components/table/DynamicQuery.vue.js +16 -8
- package/lib/packages/vue/src/components/table/Table.vue.js +7 -5
- package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +92 -11
- package/lib/packages/vue/src/utils/parseFilterConfig.js +44 -0
- package/package.json +1 -1
|
@@ -38,8 +38,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
38
38
|
const traceNo = vue.ref("");
|
|
39
39
|
const formData = vue.inject("formData");
|
|
40
40
|
vue.inject("rowHeight");
|
|
41
|
-
|
|
41
|
+
vue.inject("gridLayout");
|
|
42
42
|
vue.inject("gridLayoutFieldsData");
|
|
43
|
+
const setFormItemHeight = vue.inject("setFormItemHeight");
|
|
43
44
|
const fieldsData = props.localConfig.fieldsData.map((item) => {
|
|
44
45
|
return item.component;
|
|
45
46
|
});
|
|
@@ -65,11 +66,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
65
66
|
const foundItem = props.localConfig.fieldsData.find(
|
|
66
67
|
(item) => item.id == props.config.id
|
|
67
68
|
);
|
|
68
|
-
const titleHeight = config.titleMode != "none" ? 60 : 0;
|
|
69
|
+
const titleHeight = props.config.titleMode != "none" ? 60 : 0;
|
|
69
70
|
if (foundItem) {
|
|
70
71
|
foundItem.fixedH = true;
|
|
71
72
|
foundItem.h = dom.offsetHeight + titleHeight;
|
|
72
|
-
|
|
73
|
+
setFormItemHeight(props.config.id, dom.offsetHeight + titleHeight);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
return (_ctx, _cache) => {
|
|
@@ -126,5 +127,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
|
-
const _ApprovalHistory = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
130
|
+
const _ApprovalHistory = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-ca0519c9"]]);
|
|
130
131
|
exports.default = _ApprovalHistory;
|
|
@@ -149,6 +149,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
149
149
|
});
|
|
150
150
|
hiddenFields.value = option.hiddenFields || [];
|
|
151
151
|
await loadFieldDataSources();
|
|
152
|
+
await loadProductData();
|
|
153
|
+
applyProductConfigToForm();
|
|
154
|
+
mergeOptionsToFields();
|
|
152
155
|
loadFormData();
|
|
153
156
|
loadEventFlow();
|
|
154
157
|
if (pageEvents && localConfig.value.pageEventConfig) {
|
|
@@ -160,9 +163,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
160
163
|
await pageEvents.executeEvent("onCreated");
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
|
-
await loadProductData();
|
|
164
|
-
applyProductConfigToForm();
|
|
165
|
-
mergeOptionsToFields();
|
|
166
166
|
} catch (error) {
|
|
167
167
|
console.error("加载配置失败:", error);
|
|
168
168
|
index$5.ElMessage.error("加载配置失败");
|
|
@@ -176,7 +176,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
176
176
|
if (fieldsData.value) {
|
|
177
177
|
fieldsData.value.forEach((component) => {
|
|
178
178
|
if (component.fieldName) {
|
|
179
|
-
|
|
179
|
+
let defaultValue = component.defaultValue || null;
|
|
180
|
+
if (component.fieldType == "number") {
|
|
181
|
+
defaultValue = Number(defaultValue || 0);
|
|
182
|
+
}
|
|
183
|
+
defaultData[component.fieldName] = defaultValue;
|
|
180
184
|
}
|
|
181
185
|
if (component.fieldName) {
|
|
182
186
|
const fieldRules = validation.generateFieldRules(component);
|
|
@@ -359,16 +363,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
359
363
|
prodRules.value[formField.fieldName] = [];
|
|
360
364
|
}
|
|
361
365
|
const customValidator = (rule, value, callback) => {
|
|
362
|
-
console.log(
|
|
363
|
-
"🚀 ~ customValidator 被调用 ~ 字段:",
|
|
364
|
-
formField == null ? void 0 : formField.fieldName,
|
|
365
|
-
"值:",
|
|
366
|
-
value,
|
|
367
|
-
"minValue:",
|
|
368
|
-
minValue,
|
|
369
|
-
"maxValue:",
|
|
370
|
-
maxValue
|
|
371
|
-
);
|
|
372
366
|
if (value === null || value === void 0 || value === "") {
|
|
373
367
|
callback();
|
|
374
368
|
return;
|
|
@@ -474,7 +468,36 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
474
468
|
}
|
|
475
469
|
});
|
|
476
470
|
}
|
|
477
|
-
const
|
|
471
|
+
const gridLayoutFieldsData = vue.ref([]);
|
|
472
|
+
const oriGridLayoutData = vue.ref([]);
|
|
473
|
+
const formItemRefs = vue.ref(/* @__PURE__ */ new Map());
|
|
474
|
+
const setFormItemRef = (el, component) => {
|
|
475
|
+
if (!el) {
|
|
476
|
+
if (component && component.id) {
|
|
477
|
+
formItemRefs.value.delete(component.id);
|
|
478
|
+
}
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (component && component.id) {
|
|
482
|
+
formItemRefs.value.set(String(component.id), el);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
const getFormItemRef = (fieldId) => {
|
|
486
|
+
const formItem = formItemRefs.value.get(fieldId);
|
|
487
|
+
if (!formItem) {
|
|
488
|
+
console.log(`未找到 fieldId: ${fieldId} 的 FormItem 组件`);
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
console.log(`找到 FormItem 组件:`, formItem);
|
|
492
|
+
if (typeof formItem.getInnerComponentRef === "function") {
|
|
493
|
+
const innerRef = formItem.getInnerComponentRef();
|
|
494
|
+
console.log(`内部组件 ref:`, innerRef);
|
|
495
|
+
return innerRef;
|
|
496
|
+
} else {
|
|
497
|
+
console.log(`FormItem 组件没有 getInnerComponentRef 方法`);
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
478
501
|
function initGridLayoutDataConfig() {
|
|
479
502
|
let gridLayoutData = common.cloneDeep(localConfig.value.fieldsData || []);
|
|
480
503
|
gridLayoutData = gridLayoutData.map((item) => {
|
|
@@ -492,125 +515,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
492
515
|
}
|
|
493
516
|
return item;
|
|
494
517
|
});
|
|
495
|
-
|
|
518
|
+
oriGridLayoutData.value = gridLayoutData;
|
|
496
519
|
}
|
|
497
|
-
const gridLayoutFieldsData = vue.computed(() => {
|
|
498
|
-
initGridLayoutDataConfig();
|
|
499
|
-
let gridLayoutData = common.cloneDeep(gridLayoutDataConfig.value || []);
|
|
500
|
-
const linkedConfig = localConfig.value.linkedConfig || {};
|
|
501
|
-
const dataLink = (linkedConfig == null ? void 0 : linkedConfig.dataLink) || [];
|
|
502
|
-
const fields = [...fieldsData.value, ...hiddenFields.value];
|
|
503
|
-
dataLink.forEach((item) => {
|
|
504
|
-
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
505
|
-
const fieldAssignments = item.fieldAssignments || [];
|
|
506
|
-
fieldAssignments.forEach((assignment) => {
|
|
507
|
-
var _a, _b;
|
|
508
|
-
const fieldId = assignment.fieldId;
|
|
509
|
-
const formulaText = (_b = (_a = assignment.formula) == null ? void 0 : _a.value) == null ? void 0 : _b.text;
|
|
510
|
-
const field = fields.find((f) => f.id == fieldId);
|
|
511
|
-
if (field && formulaText) {
|
|
512
|
-
const calcResult = calculate.calculate({
|
|
513
|
-
text: formulaText,
|
|
514
|
-
marks: [],
|
|
515
|
-
value: formData.value
|
|
516
|
-
});
|
|
517
|
-
formData.value[field.fieldName] = calcResult;
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
const visibility = (linkedConfig == null ? void 0 : linkedConfig.visibility) || [];
|
|
523
|
-
visibility.forEach((item) => {
|
|
524
|
-
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
525
|
-
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
526
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
527
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
528
|
-
if (layoutFieldItem) {
|
|
529
|
-
layoutFieldItem.hidden = false;
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
} else {
|
|
533
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
534
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
535
|
-
if (layoutFieldItem) {
|
|
536
|
-
layoutFieldItem.hidden = true;
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
gridLayoutData = gridLayoutData.filter((item) => !item.hidden);
|
|
542
|
-
const requiredArr = (linkedConfig == null ? void 0 : linkedConfig.required) || [];
|
|
543
|
-
requiredArr.forEach((item) => {
|
|
544
|
-
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
545
|
-
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
546
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
547
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
548
|
-
if (layoutFieldItem) {
|
|
549
|
-
layoutFieldItem.component.required = true;
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
} else {
|
|
553
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
554
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
555
|
-
if (layoutFieldItem) {
|
|
556
|
-
layoutFieldItem.component.required = false;
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
const rules = {};
|
|
562
|
-
gridLayoutData.forEach(({ component }) => {
|
|
563
|
-
if (component.fieldName) {
|
|
564
|
-
const fieldRules = validation.generateFieldRules(component);
|
|
565
|
-
if (fieldRules.length > 0) {
|
|
566
|
-
rules[component.fieldName] = fieldRules;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
for (let fieldName in prodRules.value) {
|
|
571
|
-
rules[fieldName] = prodRules.value[fieldName];
|
|
572
|
-
}
|
|
573
|
-
formRules.value = rules;
|
|
574
|
-
const readonlyArr = (linkedConfig == null ? void 0 : linkedConfig.readonly) || [];
|
|
575
|
-
readonlyArr.forEach((item) => {
|
|
576
|
-
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
577
|
-
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
578
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
579
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
580
|
-
if (layoutFieldItem) {
|
|
581
|
-
layoutFieldItem.component.readOnly = true;
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
} else {
|
|
585
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
586
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
587
|
-
if (layoutFieldItem) {
|
|
588
|
-
layoutFieldItem.component.readOnly = false;
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
const disabledArr = (linkedConfig == null ? void 0 : linkedConfig.disabled) || [];
|
|
594
|
-
disabledArr.forEach((item) => {
|
|
595
|
-
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
596
|
-
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
597
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
598
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
599
|
-
if (layoutFieldItem) {
|
|
600
|
-
layoutFieldItem.component.disabled = true;
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
} else {
|
|
604
|
-
dataLinkFieldList.forEach((fieldId) => {
|
|
605
|
-
const layoutFieldItem = gridLayoutData.find((g) => g.id == fieldId);
|
|
606
|
-
if (layoutFieldItem) {
|
|
607
|
-
layoutFieldItem.component.disabled = false;
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
return gridLayoutData;
|
|
613
|
-
});
|
|
614
520
|
const getFieldError = (fieldName) => {
|
|
615
521
|
var _a;
|
|
616
522
|
if (!formRef.value) return "";
|
|
@@ -748,13 +654,199 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
748
654
|
vue.onMounted(() => {
|
|
749
655
|
loadConfig();
|
|
750
656
|
});
|
|
657
|
+
vue.onBeforeUnmount(() => {
|
|
658
|
+
formItemRefs.value.clear();
|
|
659
|
+
});
|
|
660
|
+
const prevFormData = vue.ref({});
|
|
661
|
+
const findChangedFields = (newData, oldData) => {
|
|
662
|
+
const changedFields = [];
|
|
663
|
+
const allKeys = /* @__PURE__ */ new Set([
|
|
664
|
+
...Object.keys(newData || {}),
|
|
665
|
+
...Object.keys(oldData || {})
|
|
666
|
+
]);
|
|
667
|
+
for (const key of allKeys) {
|
|
668
|
+
const newVal = newData[key];
|
|
669
|
+
const oldVal = oldData[key];
|
|
670
|
+
if (newVal !== oldVal) {
|
|
671
|
+
changedFields.push(key);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return changedFields;
|
|
675
|
+
};
|
|
676
|
+
const filterRelevantLinkageConfigs = (changedFieldNames, linkedConfig, fields) => {
|
|
677
|
+
const result = {
|
|
678
|
+
dataLink: [],
|
|
679
|
+
visibility: [],
|
|
680
|
+
required: [],
|
|
681
|
+
readonly: [],
|
|
682
|
+
disabled: []
|
|
683
|
+
};
|
|
684
|
+
if (!linkedConfig || changedFieldNames.length === 0) {
|
|
685
|
+
return result;
|
|
686
|
+
}
|
|
687
|
+
const changedFieldIds = changedFieldNames.map((fieldName) => {
|
|
688
|
+
const field = fields.find((f) => f.fieldName == fieldName);
|
|
689
|
+
return field ? field.id : null;
|
|
690
|
+
}).filter((id) => id !== null);
|
|
691
|
+
if (linkedConfig.dataLink) {
|
|
692
|
+
result.dataLink = linkedConfig.dataLink.filter((item) => {
|
|
693
|
+
return changedFieldIds.some(
|
|
694
|
+
(fieldId) => parseFilterConfig.checkFieldInFilterConfig(item.filterConfig, fieldId) || parseFilterConfig.checkFieldInResultConfig(item.fieldAssignments, fieldId, fields)
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
if (linkedConfig.visibility) {
|
|
699
|
+
result.visibility = linkedConfig.visibility;
|
|
700
|
+
}
|
|
701
|
+
if (linkedConfig.required) {
|
|
702
|
+
result.required = linkedConfig.required;
|
|
703
|
+
}
|
|
704
|
+
if (linkedConfig.readonly) {
|
|
705
|
+
result.readonly = linkedConfig.readonly;
|
|
706
|
+
}
|
|
707
|
+
if (linkedConfig.disabled) {
|
|
708
|
+
result.disabled = linkedConfig.disabled;
|
|
709
|
+
}
|
|
710
|
+
return result;
|
|
711
|
+
};
|
|
712
|
+
const applyLinkageEffectsForChangedFields = (changedFieldNames) => {
|
|
713
|
+
console.log(
|
|
714
|
+
"🚀 ~ applyLinkageEffectsForChangedFields ~ 变化的字段:",
|
|
715
|
+
changedFieldNames
|
|
716
|
+
);
|
|
717
|
+
const linkedConfig = localConfig.value.linkedConfig || {};
|
|
718
|
+
const fields = [...fieldsData.value, ...hiddenFields.value];
|
|
719
|
+
const relevantConfigs = filterRelevantLinkageConfigs(
|
|
720
|
+
changedFieldNames,
|
|
721
|
+
linkedConfig,
|
|
722
|
+
fields
|
|
723
|
+
);
|
|
724
|
+
relevantConfigs.dataLink.forEach((item) => {
|
|
725
|
+
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
726
|
+
const fieldAssignments = item.fieldAssignments || [];
|
|
727
|
+
fieldAssignments.forEach((assignment) => {
|
|
728
|
+
var _a, _b;
|
|
729
|
+
const fieldId = assignment.fieldId;
|
|
730
|
+
const formulaText = (_b = (_a = assignment.formula) == null ? void 0 : _a.value) == null ? void 0 : _b.text;
|
|
731
|
+
const field = fields.find((f) => f.id == fieldId);
|
|
732
|
+
if (field && formulaText) {
|
|
733
|
+
const calcResult = calculate.calculate({
|
|
734
|
+
text: formulaText,
|
|
735
|
+
marks: [],
|
|
736
|
+
value: formData.value
|
|
737
|
+
});
|
|
738
|
+
formData.value[field.fieldName] = calcResult;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
const updatedLayoutData = common.cloneDeep(oriGridLayoutData.value || []);
|
|
744
|
+
relevantConfigs.visibility.forEach((item) => {
|
|
745
|
+
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
746
|
+
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
747
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
748
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
749
|
+
if (layoutFieldItem) {
|
|
750
|
+
layoutFieldItem.hidden = false;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
} else {
|
|
754
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
755
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
756
|
+
if (layoutFieldItem) {
|
|
757
|
+
layoutFieldItem.hidden = true;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
relevantConfigs.required.forEach((item) => {
|
|
763
|
+
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
764
|
+
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
765
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
766
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
767
|
+
if (layoutFieldItem) {
|
|
768
|
+
layoutFieldItem.component.required = true;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
} else {
|
|
772
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
773
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
774
|
+
if (layoutFieldItem) {
|
|
775
|
+
layoutFieldItem.component.required = false;
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
const rules = {};
|
|
781
|
+
updatedLayoutData.forEach(({ component }) => {
|
|
782
|
+
if (component.fieldName) {
|
|
783
|
+
const fieldRules = validation.generateFieldRules(component);
|
|
784
|
+
if (fieldRules.length > 0) {
|
|
785
|
+
rules[component.fieldName] = fieldRules;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
for (let fieldName in prodRules.value) {
|
|
790
|
+
rules[fieldName] = prodRules.value[fieldName];
|
|
791
|
+
}
|
|
792
|
+
formRules.value = rules;
|
|
793
|
+
relevantConfigs.readonly.forEach((item) => {
|
|
794
|
+
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
795
|
+
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
796
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
797
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
798
|
+
if (layoutFieldItem) {
|
|
799
|
+
layoutFieldItem.component.readOnly = true;
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
} else {
|
|
803
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
804
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
805
|
+
if (layoutFieldItem) {
|
|
806
|
+
layoutFieldItem.component.readOnly = false;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
relevantConfigs.disabled.forEach((item) => {
|
|
812
|
+
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
813
|
+
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
814
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
815
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
816
|
+
if (layoutFieldItem) {
|
|
817
|
+
layoutFieldItem.component.disabled = true;
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
} else {
|
|
821
|
+
dataLinkFieldList.forEach((fieldId) => {
|
|
822
|
+
const layoutFieldItem = updatedLayoutData.find((g) => g.id == fieldId);
|
|
823
|
+
if (layoutFieldItem) {
|
|
824
|
+
layoutFieldItem.component.disabled = false;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
gridLayoutFieldsData.value = updatedLayoutData.filter((item) => !item.hidden);
|
|
830
|
+
};
|
|
751
831
|
vue.watch(
|
|
752
832
|
formData,
|
|
753
|
-
(newVal) => {
|
|
833
|
+
(newVal, oldVal) => {
|
|
834
|
+
initGridLayoutDataConfig();
|
|
835
|
+
const changedFields = findChangedFields(newVal, prevFormData.value);
|
|
836
|
+
if (changedFields.length > 0) {
|
|
837
|
+
applyLinkageEffectsForChangedFields(changedFields);
|
|
838
|
+
}
|
|
839
|
+
prevFormData.value = { ...newVal };
|
|
754
840
|
emit("update:modelValue", newVal);
|
|
755
841
|
},
|
|
756
842
|
{ deep: true }
|
|
757
843
|
);
|
|
844
|
+
function setFormItemHeight(id, h) {
|
|
845
|
+
const item = gridLayoutFieldsData.value.find((item2) => item2.id == id);
|
|
846
|
+
if (item) {
|
|
847
|
+
item.h = h;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
758
850
|
vue.provide("formData", formData);
|
|
759
851
|
vue.provide("localConfig", localConfig);
|
|
760
852
|
vue.provide("fieldsData", fieldsData);
|
|
@@ -762,12 +854,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
762
854
|
vue.provide("rowHeight", rowHeight);
|
|
763
855
|
vue.provide("gridLayout", gridLayout);
|
|
764
856
|
vue.provide("gridLayoutFieldsData", gridLayoutFieldsData);
|
|
857
|
+
vue.provide("setFormItemHeight", setFormItemHeight);
|
|
765
858
|
vue.provide("formCtx", ctx);
|
|
766
859
|
__expose({
|
|
767
860
|
validate,
|
|
768
861
|
resetFields,
|
|
769
862
|
getFormData,
|
|
770
863
|
setFormData,
|
|
864
|
+
getFormItemRef,
|
|
771
865
|
formRef,
|
|
772
866
|
localConfig
|
|
773
867
|
});
|
|
@@ -803,8 +897,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
803
897
|
key: 0,
|
|
804
898
|
ref_key: "gridLayout",
|
|
805
899
|
ref: gridLayout,
|
|
806
|
-
layout:
|
|
807
|
-
"onUpdate:layout": _cache[0] || (_cache[0] = ($event) =>
|
|
900
|
+
layout: gridLayoutFieldsData.value,
|
|
901
|
+
"onUpdate:layout": _cache[0] || (_cache[0] = ($event) => gridLayoutFieldsData.value = $event),
|
|
808
902
|
"row-height": rowHeight.value,
|
|
809
903
|
margin: [0, 0],
|
|
810
904
|
"use-css-transforms": false,
|
|
@@ -814,6 +908,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
814
908
|
}, {
|
|
815
909
|
item: vue.withCtx(({ item: { component } }) => [
|
|
816
910
|
vue.createVNode(FormItem.default, {
|
|
911
|
+
ref: (el) => setFormItemRef(el, component),
|
|
817
912
|
modelValue: formData.value[component.fieldName],
|
|
818
913
|
"onUpdate:modelValue": ($event) => formData.value[component.fieldName] = $event,
|
|
819
914
|
config: component,
|
|
@@ -852,5 +947,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
852
947
|
};
|
|
853
948
|
}
|
|
854
949
|
});
|
|
855
|
-
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
950
|
+
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-5e8468de"]]);
|
|
856
951
|
exports.default = _Form;
|
|
@@ -56,7 +56,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
emits: ["update:modelValue", "change"],
|
|
59
|
-
setup(__props, { emit: __emit }) {
|
|
59
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
60
60
|
const props = __props;
|
|
61
61
|
const emit = __emit;
|
|
62
62
|
function handleChange(config, val) {
|
|
@@ -90,6 +90,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}, 300);
|
|
93
|
+
const innerComponentRef = vue.ref(null);
|
|
93
94
|
const compValue = vue.computed({
|
|
94
95
|
get: () => props.modelValue,
|
|
95
96
|
set: (val) => {
|
|
@@ -99,6 +100,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
});
|
|
103
|
+
const getInnerComponentRef = () => {
|
|
104
|
+
debugger;
|
|
105
|
+
return innerComponentRef.value;
|
|
106
|
+
};
|
|
107
|
+
__expose({
|
|
108
|
+
config: props.config,
|
|
109
|
+
getInnerComponentRef
|
|
110
|
+
});
|
|
102
111
|
return (_ctx, _cache) => {
|
|
103
112
|
const _component_el_tooltip = index$8.ElTooltip;
|
|
104
113
|
const _component_el_form_item = index$7.ElFormItem;
|
|
@@ -110,15 +119,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
110
119
|
config: __props.config
|
|
111
120
|
}, null, 8, ["config"])) : __props.config.fieldType == "subForm" ? (vue.openBlock(), vue.createBlock(vue.unref(index$4.SubForm), {
|
|
112
121
|
key: 2,
|
|
122
|
+
ref_key: "innerComponentRef",
|
|
123
|
+
ref: innerComponentRef,
|
|
113
124
|
config: __props.config,
|
|
114
125
|
localConfig: __props.localConfig,
|
|
115
126
|
formMode: __props.formMode
|
|
116
127
|
}, null, 8, ["config", "localConfig", "formMode"])) : __props.config.fieldType == "subTable" ? (vue.openBlock(), vue.createBlock(vue.unref(index$5.SubTable), {
|
|
117
128
|
key: 3,
|
|
129
|
+
ref_key: "innerComponentRef",
|
|
130
|
+
ref: innerComponentRef,
|
|
118
131
|
config: __props.config,
|
|
119
132
|
localConfig: __props.localConfig
|
|
120
133
|
}, null, 8, ["config", "localConfig"])) : __props.config.fieldType == "approvalHistory" ? (vue.openBlock(), vue.createBlock(vue.unref(index$6.ApprovalHistory), {
|
|
121
134
|
key: 4,
|
|
135
|
+
ref_key: "innerComponentRef",
|
|
136
|
+
ref: innerComponentRef,
|
|
122
137
|
config: __props.config,
|
|
123
138
|
localConfig: __props.localConfig
|
|
124
139
|
}, null, 8, ["config", "localConfig"])) : __props.config.fieldType == "blank" || __props.config.fieldType == "divider" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -134,6 +149,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
134
149
|
default: vue.withCtx(() => [
|
|
135
150
|
__props.config.labelMode != "label" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(componentType.value), vue.mergeProps({
|
|
136
151
|
key: 0,
|
|
152
|
+
ref_key: "innerComponentRef",
|
|
153
|
+
ref: innerComponentRef,
|
|
137
154
|
modelValue: compValue.value,
|
|
138
155
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => compValue.value = $event)
|
|
139
156
|
}, componentProps.value, {
|
|
@@ -172,5 +189,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
172
189
|
};
|
|
173
190
|
}
|
|
174
191
|
});
|
|
175
|
-
const _FormItem = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
192
|
+
const _FormItem = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-1fbcd248"]]);
|
|
176
193
|
exports.default = _FormItem;
|
|
@@ -50,8 +50,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
50
50
|
const props = __props;
|
|
51
51
|
const formData = vue.inject("formData");
|
|
52
52
|
vue.inject("rowHeight");
|
|
53
|
-
|
|
54
|
-
vue.inject("
|
|
53
|
+
vue.inject("gridLayout");
|
|
54
|
+
const setFormItemHeight = vue.inject("setFormItemHeight");
|
|
55
55
|
function subFormLoaded(subOption) {
|
|
56
56
|
const fieldsData = subOption.fieldsData;
|
|
57
57
|
console.log("🚀 ~ loaded ~ subOption:", subOption);
|
|
@@ -62,10 +62,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
62
62
|
(item) => item.id == props.config.id
|
|
63
63
|
);
|
|
64
64
|
const y = 1;
|
|
65
|
-
const titleHeight = config.titleMode != "none" ? 1 : 0;
|
|
65
|
+
const titleHeight = props.config.titleMode != "none" ? 1 : 0;
|
|
66
66
|
if (foundItem) {
|
|
67
67
|
foundItem.h = maxY + y + titleHeight;
|
|
68
|
-
|
|
68
|
+
setFormItemHeight(props.config.id, maxY + y + titleHeight);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return (_ctx, _cache) => {
|
|
@@ -46,12 +46,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
46
46
|
// default: false,
|
|
47
47
|
// },
|
|
48
48
|
},
|
|
49
|
-
setup(__props) {
|
|
49
|
+
setup(__props, { expose: __expose }) {
|
|
50
50
|
const props = __props;
|
|
51
51
|
const formData = vue.inject("formData");
|
|
52
52
|
vue.inject("rowHeight");
|
|
53
|
-
|
|
54
|
-
vue.inject("
|
|
53
|
+
vue.inject("gridLayout");
|
|
54
|
+
const setFormItemHeight = vue.inject("setFormItemHeight");
|
|
55
55
|
const subTableData = vue.computed(() => {
|
|
56
56
|
if (props.config.dataSourceFrom == "main") {
|
|
57
57
|
return formData.value[props.config.fieldName];
|
|
@@ -85,11 +85,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
85
85
|
const foundItem = props.localConfig.fieldsData.find(
|
|
86
86
|
(item) => item.id == props.config.id
|
|
87
87
|
);
|
|
88
|
-
const titleHeight = config.titleMode != "none" ? 60 : 0;
|
|
88
|
+
const titleHeight = props.config.titleMode != "none" ? 60 : 0;
|
|
89
89
|
if (foundItem) {
|
|
90
90
|
foundItem.fixedH = true;
|
|
91
91
|
foundItem.h = props.config.subTableHeight + titleHeight;
|
|
92
|
-
|
|
92
|
+
setFormItemHeight(
|
|
93
|
+
props.config.id,
|
|
94
|
+
props.config.subTableHeight + titleHeight
|
|
95
|
+
);
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
const tableRef = vue.ref();
|
|
@@ -101,6 +104,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
101
104
|
type: "custom"
|
|
102
105
|
});
|
|
103
106
|
};
|
|
107
|
+
__expose({
|
|
108
|
+
subTableRef: tableRef
|
|
109
|
+
});
|
|
104
110
|
return (_ctx, _cache) => {
|
|
105
111
|
const _component_el_button = index$1.ElButton;
|
|
106
112
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
@@ -29,6 +29,14 @@ const _sfc_main = {
|
|
|
29
29
|
localConfig: {
|
|
30
30
|
type: Object,
|
|
31
31
|
default: {}
|
|
32
|
+
},
|
|
33
|
+
readOnly: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
isSubTable: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
emits: ["click"],
|
|
@@ -90,10 +98,10 @@ const _sfc_main = {
|
|
|
90
98
|
})
|
|
91
99
|
])) : vue.createCommentVNode("", true),
|
|
92
100
|
__props.localConfig.showTitle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(__props.localConfig.templateName), 1)) : vue.createCommentVNode("", true),
|
|
93
|
-
hasButtons.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.VxeToolbar), {
|
|
101
|
+
!__props.readOnly && !__props.isSubTable && hasButtons.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.VxeToolbar), {
|
|
94
102
|
key: 2,
|
|
95
103
|
ref: "toolbarRef",
|
|
96
|
-
style: { "flex": "1" }
|
|
104
|
+
style: { "flex": "1", "margin-bottom": "8px" }
|
|
97
105
|
}, {
|
|
98
106
|
buttons: vue.withCtx(() => [
|
|
99
107
|
leftButtons.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(leftButtons.value, (btn) => {
|
|
@@ -131,5 +139,5 @@ const _sfc_main = {
|
|
|
131
139
|
};
|
|
132
140
|
}
|
|
133
141
|
};
|
|
134
|
-
const CustomButtons = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
142
|
+
const CustomButtons = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-4a702348"]]);
|
|
135
143
|
exports.default = CustomButtons;
|