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