@fecp/designer 5.3.10 → 5.3.11
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 +201 -182
- package/es/packages/designer/package.json.mjs +1 -1
- package/es/packages/designer/src/components/FieldSetMapping.vue2.mjs +3 -1
- package/es/packages/designer/src/layout/header/index.vue.mjs +4 -0
- package/es/packages/designer/src/packages/dataSource/dataSource.vue.mjs +65 -45
- package/es/packages/designer/src/packages/dialogGlobal/index.vue.mjs +2 -0
- package/es/packages/designer/src/packages/event/index.vue2.mjs +3 -1
- package/es/packages/designer/src/packages/eventFlow/dialog/action/Upload.vue2.mjs +179 -0
- package/es/packages/designer/src/packages/eventFlow/dialog/action/config.mjs +18 -3
- package/es/packages/designer/src/packages/table/headerBtn.vue.mjs +2 -0
- package/es/packages/designer/src/packages/table/index.vue.mjs +2 -1
- package/es/packages/designer/src/packages/table/property/optBtn.vue.mjs +0 -9
- package/es/packages/designer/src/packages/table/queryModule/index.vue.mjs +3 -1
- package/es/packages/designer/src/packages/table/tableSetting.vue.mjs +2 -1
- package/es/packages/mobile/src/components/base/card/Card.vue.mjs +2 -2
- package/es/packages/vue/src/utils/datasource.mjs +4 -0
- package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +105 -5
- package/lib/designer.css +201 -182
- package/lib/packages/designer/package.json.js +1 -1
- package/lib/packages/designer/src/components/FieldSetMapping.vue2.js +3 -1
- package/lib/packages/designer/src/layout/header/index.vue.js +4 -0
- package/lib/packages/designer/src/packages/dataSource/dataSource.vue.js +64 -44
- package/lib/packages/designer/src/packages/dialogGlobal/index.vue.js +2 -0
- package/lib/packages/designer/src/packages/event/index.vue2.js +3 -1
- package/lib/packages/designer/src/packages/eventFlow/dialog/action/Upload.vue2.js +179 -0
- package/lib/packages/designer/src/packages/eventFlow/dialog/action/config.js +18 -3
- package/lib/packages/designer/src/packages/table/headerBtn.vue.js +2 -0
- package/lib/packages/designer/src/packages/table/index.vue.js +2 -1
- package/lib/packages/designer/src/packages/table/property/optBtn.vue.js +0 -9
- package/lib/packages/designer/src/packages/table/queryModule/index.vue.js +3 -1
- package/lib/packages/designer/src/packages/table/tableSetting.vue.js +2 -1
- package/lib/packages/mobile/src/components/base/card/Card.vue.js +2 -2
- package/lib/packages/vue/src/utils/datasource.js +4 -0
- package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +104 -4
- package/package.json +1 -1
|
@@ -380,7 +380,7 @@ async function handleCustomAction(node, data, fields, context) {
|
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
382
|
async function handleFormSetValue(node, data, fields, context) {
|
|
383
|
-
var _a, _b, _c;
|
|
383
|
+
var _a, _b, _c, _d;
|
|
384
384
|
const basic = node.basic || {};
|
|
385
385
|
if (!(basic == null ? void 0 : basic.dataSourceId)) {
|
|
386
386
|
console.error("form-setValue: 缺少 dataSourceId 配置");
|
|
@@ -410,8 +410,8 @@ async function handleFormSetValue(node, data, fields, context) {
|
|
|
410
410
|
formData = common.removeEmptyValues(formData);
|
|
411
411
|
delete formData.pageNo;
|
|
412
412
|
delete formData.pageSize;
|
|
413
|
-
const formComponent = (_a = context.components) == null ? void 0 : _a.form;
|
|
414
|
-
const setFormDataMethod = (
|
|
413
|
+
const formComponent = ((_a = context.components) == null ? void 0 : _a.form) || ((_b = context.components) == null ? void 0 : _b.table);
|
|
414
|
+
const setFormDataMethod = (_d = (_c = formComponent == null ? void 0 : formComponent.$) == null ? void 0 : _c.exposed) == null ? void 0 : _d.setFormData;
|
|
415
415
|
if (typeof setFormDataMethod === "function") {
|
|
416
416
|
setFormDataMethod(formData);
|
|
417
417
|
return {
|
|
@@ -569,6 +569,104 @@ async function handleDialog(node, data, fields, context) {
|
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
+
async function handleUpload(node, data, fields, context) {
|
|
573
|
+
const basic = node.basic || {};
|
|
574
|
+
console.log("[EventFlow] 执行文件上传动作:", basic);
|
|
575
|
+
const dataSourceId = basic.dataSourceId || "";
|
|
576
|
+
const acceptType = basic.acceptType || [];
|
|
577
|
+
const maxSize = basic.maxSize || 0;
|
|
578
|
+
const multipleUpload = basic.multipleUpload || false;
|
|
579
|
+
if (!dataSourceId) {
|
|
580
|
+
return {
|
|
581
|
+
success: false,
|
|
582
|
+
message: "文件上传动作缺少必要的数据源配置(dataSourceId)",
|
|
583
|
+
shouldShowError: true
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
const acceptArr = [];
|
|
587
|
+
if (acceptType.includes("image")) {
|
|
588
|
+
acceptArr.push("image/*");
|
|
589
|
+
}
|
|
590
|
+
if (acceptType.includes("video")) {
|
|
591
|
+
acceptArr.push("video/*");
|
|
592
|
+
}
|
|
593
|
+
if (acceptType.includes("audio")) {
|
|
594
|
+
acceptArr.push("audio/*");
|
|
595
|
+
}
|
|
596
|
+
if (acceptType.includes("text")) {
|
|
597
|
+
acceptArr.push("text/plain");
|
|
598
|
+
}
|
|
599
|
+
if (acceptType.includes("doc")) {
|
|
600
|
+
acceptArr.push(".doc");
|
|
601
|
+
acceptArr.push(".docx");
|
|
602
|
+
}
|
|
603
|
+
if (acceptType.includes("xls")) {
|
|
604
|
+
acceptArr.push(".xls");
|
|
605
|
+
acceptArr.push(".xlsx");
|
|
606
|
+
}
|
|
607
|
+
if (acceptType.includes("ppt")) {
|
|
608
|
+
acceptArr.push(".ppt");
|
|
609
|
+
acceptArr.push(".pptx");
|
|
610
|
+
}
|
|
611
|
+
if (acceptType.includes("pdf")) {
|
|
612
|
+
acceptArr.push("application/pdf");
|
|
613
|
+
}
|
|
614
|
+
if (acceptType.includes("zip")) {
|
|
615
|
+
acceptArr.push("application/zip");
|
|
616
|
+
acceptArr.push("application/x-rar-compressed");
|
|
617
|
+
}
|
|
618
|
+
let accept = "";
|
|
619
|
+
if (acceptArr.length < 13) {
|
|
620
|
+
accept = acceptArr.join(",");
|
|
621
|
+
}
|
|
622
|
+
const files = await new Promise((resolve, reject) => {
|
|
623
|
+
const input = document.createElement("input");
|
|
624
|
+
input.type = "file";
|
|
625
|
+
input.multiple = multipleUpload;
|
|
626
|
+
input.accept = accept;
|
|
627
|
+
input.click();
|
|
628
|
+
input.onchange = () => {
|
|
629
|
+
let files2 = Array.from(input.files || []);
|
|
630
|
+
if (files2.length === 0) return resolve([]);
|
|
631
|
+
if (maxSize > 0) {
|
|
632
|
+
const maxByte = maxSize * 1024 * 1024;
|
|
633
|
+
const invalidFiles = files2.some((f) => f.size > maxByte);
|
|
634
|
+
if (invalidFiles) {
|
|
635
|
+
reject(new Error(`文件不能超过 ${maxSize}MB`));
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
resolve(files2);
|
|
640
|
+
};
|
|
641
|
+
});
|
|
642
|
+
if (!files || files.length === 0) {
|
|
643
|
+
return { success: false, message: "未选择文件" };
|
|
644
|
+
}
|
|
645
|
+
try {
|
|
646
|
+
const params = multipleUpload ? { files } : { file: files[0] };
|
|
647
|
+
const result = await handleApiCall(node, data, fields, context, params);
|
|
648
|
+
if (!result.success) {
|
|
649
|
+
return result;
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
success: true,
|
|
653
|
+
message: `文件上传成功'}`,
|
|
654
|
+
data: {
|
|
655
|
+
dataSourceId,
|
|
656
|
+
acceptType,
|
|
657
|
+
maxSize,
|
|
658
|
+
multipleUpload,
|
|
659
|
+
acceptType
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
} catch (error) {
|
|
663
|
+
return {
|
|
664
|
+
success: false,
|
|
665
|
+
message: "上传失败",
|
|
666
|
+
shouldShowError: true
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
}
|
|
572
670
|
const defaultActionHandlers = {
|
|
573
671
|
"page-jump": handlePageJump,
|
|
574
672
|
"page-go-back": handlePageGoBack,
|
|
@@ -581,7 +679,8 @@ const defaultActionHandlers = {
|
|
|
581
679
|
"form-setValue": handleFormSetValue,
|
|
582
680
|
"form-submit": handleFormSubmit,
|
|
583
681
|
"custom": handleCustomAction,
|
|
584
|
-
"ui-dialog": handleDialog
|
|
682
|
+
"ui-dialog": handleDialog,
|
|
683
|
+
"ui-upload": handleUpload
|
|
585
684
|
};
|
|
586
685
|
exports.default = defaultActionHandlers;
|
|
587
686
|
exports.defaultActionHandlers = defaultActionHandlers;
|
|
@@ -595,3 +694,4 @@ exports.handlePageJump = handlePageJump;
|
|
|
595
694
|
exports.handleTableChildRefresh = handleTableChildRefresh;
|
|
596
695
|
exports.handleTableRefresh = handleTableRefresh;
|
|
597
696
|
exports.handleTableRowDelete = handleTableRowDelete;
|
|
697
|
+
exports.handleUpload = handleUpload;
|