@jzg223/design-runtime 0.0.0-stage → 0.0.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/CHANGELOG.md +176 -0
- package/README.md +275 -2
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/api.js +149 -0
- package/dist/comb/design-comb.vue.js +7 -0
- package/dist/comb/design-comb2.vue.js +591 -0
- package/dist/compat.js +74 -0
- package/dist/components/ApiSwitch.vue.js +7 -0
- package/dist/components/ApiSwitch2.vue.js +98 -0
- package/dist/components/design-debug/dev-mode-toggle.vue.js +7 -0
- package/dist/components/design-debug/dev-mode-toggle2.vue.js +41 -0
- package/dist/components/design-debug/dev-mode.js +45 -0
- package/dist/components/design-debug/dev-state-button.vue.js +7 -0
- package/dist/components/design-debug/dev-state-button2.vue.js +447 -0
- package/dist/components/design-debug/expr-eval.js +81 -0
- package/dist/components/design-shared/host-api.js +47 -0
- package/dist/components/design-shared/popup-host.js +11 -0
- package/dist/components/design-table/design-table-inner.vue.js +7 -0
- package/dist/components/design-table/design-table-inner2.vue.js +39 -0
- package/dist/components/design-table/design-table.vue.js +7 -0
- package/dist/components/design-table/design-table2.vue.js +937 -0
- package/dist/components/design-table/row-actions/delete-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/delete-action2.vue.js +42 -0
- package/dist/components/design-table/row-actions/edit-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/edit-action2.vue.js +145 -0
- package/dist/components/design-table/row-actions/index.js +36 -0
- package/dist/components/design-table/row-actions/modal-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-comb-action2.vue.js +66 -0
- package/dist/components/design-table/row-actions/modal-custom-action.vue.js +7 -0
- package/dist/components/design-table/row-actions/modal-custom-action2.vue.js +105 -0
- package/dist/components/design-table/row-actions/modal-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-form-action2.vue.js +82 -0
- package/dist/components/design-table/row-actions/modal-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-table-action2.vue.js +67 -0
- package/dist/components/design-table/row-actions/modal-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-tree-action2.vue.js +70 -0
- package/dist/components/design-table/row-actions/navigate-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-comb-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-form-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-table-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-tree-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/other-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/other-action2.vue.js +44 -0
- package/dist/components/design-tools/add-tool.vue.js +4 -0
- package/dist/components/design-tools/add-tool2.vue.js +136 -0
- package/dist/components/design-tools/command-executor.js +135 -0
- package/dist/components/design-tools/export-tool.vue.js +4 -0
- package/dist/components/design-tools/export-tool2.vue.js +46 -0
- package/dist/components/design-tools/import-tool.vue.js +4 -0
- package/dist/components/design-tools/import-tool2.vue.js +101 -0
- package/dist/components/design-tools/index.js +36 -0
- package/dist/components/design-tools/modal-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-comb-tool2.vue.js +56 -0
- package/dist/components/design-tools/modal-form-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-form-tool2.vue.js +66 -0
- package/dist/components/design-tools/modal-hcm-tool.vue.js +7 -0
- package/dist/components/design-tools/modal-hcm-tool2.vue.js +85 -0
- package/dist/components/design-tools/modal-table-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-table-tool2.vue.js +54 -0
- package/dist/components/design-tools/modal-tree-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-tree-tool2.vue.js +57 -0
- package/dist/components/design-tools/navigate-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-comb-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-form-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-form-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-table-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-table-tool2.vue.js +33 -0
- package/dist/components/design-tools/other-tool.vue.js +4 -0
- package/dist/components/design-tools/other-tool2.vue.js +34 -0
- package/dist/components/flow-status-cell/flow-status-cell.vue.js +7 -0
- package/dist/components/flow-status-cell/flow-status-cell2.vue.js +124 -0
- package/dist/flow.js +22 -0
- package/dist/form/cell-condition.js +122 -0
- package/dist/form/derived-express.js +34 -0
- package/dist/form/design-form-inner.vue.js +7 -0
- package/dist/form/design-form-inner2.vue.js +449 -0
- package/dist/form/design-form.vue.js +7 -0
- package/dist/form/design-form2.vue.js +681 -0
- package/dist/form/fields/checkbox-field.vue.js +88 -0
- package/dist/form/fields/checkbox-field2.vue.js +4 -0
- package/dist/form/fields/custom-field.vue.js +36 -0
- package/dist/form/fields/custom-field2.vue.js +4 -0
- package/dist/form/fields/date-field.vue.js +64 -0
- package/dist/form/fields/date-field2.vue.js +4 -0
- package/dist/form/fields/embedded-list-field.vue.js +7 -0
- package/dist/form/fields/embedded-list-field2.vue.js +437 -0
- package/dist/form/fields/file-field.vue.js +88 -0
- package/dist/form/fields/file-field2.vue.js +4 -0
- package/dist/form/fields/image-field.vue.js +90 -0
- package/dist/form/fields/image-field2.vue.js +4 -0
- package/dist/form/fields/index.js +106 -0
- package/dist/form/fields/month-field.vue.js +51 -0
- package/dist/form/fields/month-field2.vue.js +4 -0
- package/dist/form/fields/org-select-field.vue.js +7 -0
- package/dist/form/fields/org-select-field2.vue.js +187 -0
- package/dist/form/fields/orgs-select-field.vue.js +182 -0
- package/dist/form/fields/orgs-select-field2.vue.js +4 -0
- package/dist/form/fields/radio-field.vue.js +91 -0
- package/dist/form/fields/radio-field2.vue.js +4 -0
- package/dist/form/fields/select-field.vue.js +7 -0
- package/dist/form/fields/select-field2.vue.js +317 -0
- package/dist/form/fields/splitline-field.vue.js +7 -0
- package/dist/form/fields/splitline-field2.vue.js +50 -0
- package/dist/form/fields/switch-field.vue.js +32 -0
- package/dist/form/fields/switch-field2.vue.js +4 -0
- package/dist/form/fields/text-field.vue.js +78 -0
- package/dist/form/fields/text-field2.vue.js +4 -0
- package/dist/form/fields/time-field.vue.js +50 -0
- package/dist/form/fields/time-field2.vue.js +4 -0
- package/dist/form/fields/tree-field.vue.js +157 -0
- package/dist/form/fields/tree-field2.vue.js +4 -0
- package/dist/form/number-precision.js +18 -0
- package/dist/form/transformer.js +162 -0
- package/dist/host.js +76 -0
- package/dist/http.js +19 -0
- package/dist/index.js +166 -0
- package/dist/mapping.js +44 -0
- package/dist/org/dept-api.js +30 -0
- package/dist/org/dept-tree-source.js +53 -0
- package/dist/org/dept-tree.js +122 -0
- package/dist/registry.js +77 -0
- package/dist/search/design-search.vue.js +7 -0
- package/dist/search/design-search2.vue.js +232 -0
- package/dist/search/transformer.js +115 -0
- package/dist/style.css +1220 -0
- package/dist/table/data.js +18 -0
- package/dist/table/load-gate.js +19 -0
- package/dist/table/query-body.js +59 -0
- package/dist/table/query-dedupe.js +54 -0
- package/dist/table/query-search.js +9 -0
- package/dist/table/row-action-mapping.js +34 -0
- package/dist/table/transformer.js +328 -0
- package/dist/tree/design-tree.vue.js +7 -0
- package/dist/tree/design-tree2.vue.js +783 -0
- package/dist/types/api.d.ts +83 -0
- package/dist/types/comb/design-comb.vue.d.ts +38 -0
- package/dist/types/compat.d.ts +46 -0
- package/dist/types/components/ApiSwitch.vue.d.ts +31 -0
- package/dist/types/components/design-debug/dev-mode-toggle.vue.d.ts +2 -0
- package/dist/types/components/design-debug/dev-mode.d.ts +8 -0
- package/dist/types/components/design-debug/dev-state-button.vue.d.ts +55 -0
- package/dist/types/components/design-debug/expr-eval.d.ts +55 -0
- package/dist/types/components/design-shared/host-api.d.ts +60 -0
- package/dist/types/components/design-shared/popup-host.d.ts +13 -0
- package/dist/types/components/design-table/design-table-inner.vue.d.ts +19 -0
- package/dist/types/components/design-table/design-table.vue.d.ts +70 -0
- package/dist/types/components/design-table/row-actions/delete-action.vue.d.ts +12 -0
- package/dist/types/components/design-table/row-actions/edit-action.vue.d.ts +14 -0
- package/dist/types/components/design-table/row-actions/index.d.ts +25 -0
- package/dist/types/components/design-table/row-actions/modal-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-custom-action.vue.d.ts +15 -0
- package/dist/types/components/design-table/row-actions/modal-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/other-action.vue.d.ts +14 -0
- package/dist/types/components/design-tools/add-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/command-executor.d.ts +80 -0
- package/dist/types/components/design-tools/export-tool.vue.d.ts +9 -0
- package/dist/types/components/design-tools/import-tool.vue.d.ts +14 -0
- package/dist/types/components/design-tools/index.d.ts +23 -0
- package/dist/types/components/design-tools/modal-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-form-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-hcm-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/modal-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-tree-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-form-tool.vue.d.ts +11 -0
- package/dist/types/components/design-tools/navigate-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/other-tool.vue.d.ts +16 -0
- package/dist/types/components/flow-status-cell/flow-status-cell.vue.d.ts +14 -0
- package/dist/types/components/index.d.ts +33 -0
- package/dist/types/flow.d.ts +50 -0
- package/dist/types/form/cell-condition.d.ts +35 -0
- package/dist/types/form/derived-express.d.ts +28 -0
- package/dist/types/form/design-form-inner.vue.d.ts +55 -0
- package/dist/types/form/design-form.vue.d.ts +96 -0
- package/dist/types/form/fields/checkbox-field.vue.d.ts +14 -0
- package/dist/types/form/fields/custom-field.vue.d.ts +22 -0
- package/dist/types/form/fields/date-field.vue.d.ts +12 -0
- package/dist/types/form/fields/embedded-list-field.vue.d.ts +26 -0
- package/dist/types/form/fields/file-field.vue.d.ts +12 -0
- package/dist/types/form/fields/image-field.vue.d.ts +12 -0
- package/dist/types/form/fields/index.d.ts +34 -0
- package/dist/types/form/fields/month-field.vue.d.ts +12 -0
- package/dist/types/form/fields/org-select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/orgs-select-field.vue.d.ts +12 -0
- package/dist/types/form/fields/radio-field.vue.d.ts +14 -0
- package/dist/types/form/fields/select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/splitline-field.vue.d.ts +7 -0
- package/dist/types/form/fields/switch-field.vue.d.ts +12 -0
- package/dist/types/form/fields/text-field.vue.d.ts +12 -0
- package/dist/types/form/fields/time-field.vue.d.ts +12 -0
- package/dist/types/form/fields/tree-field.vue.d.ts +12 -0
- package/dist/types/form/number-precision.d.ts +15 -0
- package/dist/types/form/transformer.d.ts +27 -0
- package/dist/types/host.d.ts +182 -0
- package/dist/types/http.d.ts +59 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/mapping.d.ts +39 -0
- package/dist/types/org/dept-api.d.ts +12 -0
- package/dist/types/org/dept-tree-source.d.ts +15 -0
- package/dist/types/org/dept-tree.d.ts +62 -0
- package/dist/types/registry.d.ts +79 -0
- package/dist/types/search/design-search.vue.d.ts +46 -0
- package/dist/types/search/transformer.d.ts +36 -0
- package/dist/types/table/data.d.ts +30 -0
- package/dist/types/table/index.d.ts +20 -0
- package/dist/types/table/load-gate.d.ts +24 -0
- package/dist/types/table/query-body.d.ts +46 -0
- package/dist/types/table/query-dedupe.d.ts +42 -0
- package/dist/types/table/query-search.d.ts +21 -0
- package/dist/types/table/row-action-mapping.d.ts +36 -0
- package/dist/types/table/transformer.d.ts +59 -0
- package/dist/types/tree/design-tree.vue.d.ts +33 -0
- package/dist/types/types.d.ts +525 -0
- package/dist/types/utils/default-value.d.ts +16 -0
- package/dist/types/utils/download.d.ts +9 -0
- package/dist/types/utils/popup-width.d.ts +21 -0
- package/dist/utils/default-value.js +38 -0
- package/dist/utils/download.js +19 -0
- package/dist/utils/popup-width.js +19 -0
- package/package.json +73 -4
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, createVNode, unref, createBlock, withCtx, Fragment, renderList, createTextVNode, resolveDynamicComponent } from "vue";
|
|
2
|
+
import { useRoute } from "vue-router";
|
|
3
|
+
import { Spin, Alert, Result, Space } from "antdv-next";
|
|
4
|
+
import { fetchFormConfig } from "../api.js";
|
|
5
|
+
import { designFlowSubmit } from "../flow.js";
|
|
6
|
+
import { getHostUi, getHostWorkflow, requireHttp } from "../host.js";
|
|
7
|
+
import { isOwnRoutePage, buildExtraParams } from "../mapping.js";
|
|
8
|
+
import { platformMessage } from "../components/design-shared/host-api.js";
|
|
9
|
+
import { resolveToolComponent } from "../components/design-tools/index.js";
|
|
10
|
+
import DesignFormInner from "./design-form-inner.vue.js";
|
|
11
|
+
import DesignDevStateButton from "../components/design-debug/dev-state-button.vue.js";
|
|
12
|
+
import { transformFormConfig } from "./transformer.js";
|
|
13
|
+
const _hoisted_1 = { class: "design-form" };
|
|
14
|
+
const _hoisted_2 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "form-title"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_3 = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "flex-center py-20"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_4 = {
|
|
23
|
+
key: 2,
|
|
24
|
+
class: "py-8"
|
|
25
|
+
};
|
|
26
|
+
const _hoisted_5 = { key: 4 };
|
|
27
|
+
const _hoisted_6 = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "design-form-toolbar"
|
|
30
|
+
};
|
|
31
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
|
+
...{ name: "DesignForm" },
|
|
33
|
+
__name: "design-form",
|
|
34
|
+
props: {
|
|
35
|
+
category: { default: "" },
|
|
36
|
+
name: { default: "" },
|
|
37
|
+
config: { default: null },
|
|
38
|
+
source: { default: void 0 },
|
|
39
|
+
sourceId: { default: void 0 },
|
|
40
|
+
parentParams: { default: () => ({}) },
|
|
41
|
+
taskTitle: { default: void 0 },
|
|
42
|
+
mode: { default: "standalone" },
|
|
43
|
+
devButtonTop: { default: 10 }
|
|
44
|
+
},
|
|
45
|
+
emits: ["data-change", "url-change", "config-loaded", "update:title", "saved", "deleted", "tool-command"],
|
|
46
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
47
|
+
const props = __props;
|
|
48
|
+
const emit = __emit;
|
|
49
|
+
const loading = ref(false);
|
|
50
|
+
const error = ref(null);
|
|
51
|
+
const config = ref(null);
|
|
52
|
+
const sourceData = ref(void 0);
|
|
53
|
+
const sourceLoading = ref(false);
|
|
54
|
+
const effectiveSource = computed(() => sourceData.value ?? props.source);
|
|
55
|
+
const pfield = computed(() => {
|
|
56
|
+
var _a;
|
|
57
|
+
return ((_a = config.value) == null ? void 0 : _a.pfield) || "id";
|
|
58
|
+
});
|
|
59
|
+
function normalizeSourceId(raw) {
|
|
60
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
61
|
+
const s = String(raw);
|
|
62
|
+
return s === "" || s === "undefined" || s === "null" ? void 0 : s;
|
|
63
|
+
}
|
|
64
|
+
function cleanParams(obj) {
|
|
65
|
+
const out = {};
|
|
66
|
+
if (!obj) return out;
|
|
67
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
68
|
+
if (val === void 0 || val === null || val === "") continue;
|
|
69
|
+
const sv = typeof val === "string" ? val : "";
|
|
70
|
+
if (sv === "undefined" || sv === "null") continue;
|
|
71
|
+
out[key] = val;
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function resolveSaveUrls(cfg) {
|
|
76
|
+
const tools = (cfg == null ? void 0 : cfg.toolBars) ?? [];
|
|
77
|
+
const saveTool = tools.find((t) => (t == null ? void 0 : t.type) === "save");
|
|
78
|
+
const deleteTool = tools.find((t) => (t == null ? void 0 : t.type) === "delete");
|
|
79
|
+
return {
|
|
80
|
+
insert: (saveTool == null ? void 0 : saveTool.insertUrl) || (cfg == null ? void 0 : cfg.insertUrl) || "",
|
|
81
|
+
update: (saveTool == null ? void 0 : saveTool.updateUrl) || (cfg == null ? void 0 : cfg.updateUrl) || "",
|
|
82
|
+
delete: (deleteTool == null ? void 0 : deleteTool.deleteUrl) || (cfg == null ? void 0 : cfg.deleteUrl) || ""
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const urls = ref({
|
|
86
|
+
delete: "",
|
|
87
|
+
insert: "",
|
|
88
|
+
show: "",
|
|
89
|
+
update: ""
|
|
90
|
+
});
|
|
91
|
+
function handleUrlChange(u) {
|
|
92
|
+
urls.value = u;
|
|
93
|
+
emit("url-change", u);
|
|
94
|
+
}
|
|
95
|
+
function titleOf(cfg) {
|
|
96
|
+
const anyCfg = cfg;
|
|
97
|
+
return String((anyCfg == null ? void 0 : anyCfg.runtimeTitle) || (anyCfg == null ? void 0 : anyCfg.title) || "").trim();
|
|
98
|
+
}
|
|
99
|
+
function emitRuntimeTitle(cfg) {
|
|
100
|
+
const runtimeTitle = String((cfg == null ? void 0 : cfg.runtimeTitle) ?? "").trim();
|
|
101
|
+
if (runtimeTitle) {
|
|
102
|
+
emit("update:title", runtimeTitle);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function loadConfig() {
|
|
106
|
+
if (props.config) {
|
|
107
|
+
config.value = props.config;
|
|
108
|
+
loading.value = false;
|
|
109
|
+
const saveUrls = resolveSaveUrls(props.config);
|
|
110
|
+
handleUrlChange({
|
|
111
|
+
delete: saveUrls.delete,
|
|
112
|
+
insert: saveUrls.insert,
|
|
113
|
+
show: props.config.showUrl || "",
|
|
114
|
+
update: saveUrls.update
|
|
115
|
+
});
|
|
116
|
+
emit("config-loaded", { title: titleOf(props.config), width: props.config.width });
|
|
117
|
+
emitRuntimeTitle(props.config);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!props.category || !props.name) return;
|
|
121
|
+
loading.value = true;
|
|
122
|
+
error.value = null;
|
|
123
|
+
try {
|
|
124
|
+
const resp = await fetchFormConfig(props.category, props.name);
|
|
125
|
+
config.value = resp;
|
|
126
|
+
const saveUrls = resolveSaveUrls(resp);
|
|
127
|
+
handleUrlChange({
|
|
128
|
+
delete: saveUrls.delete,
|
|
129
|
+
insert: saveUrls.insert,
|
|
130
|
+
show: resp.showUrl || "",
|
|
131
|
+
update: saveUrls.update
|
|
132
|
+
});
|
|
133
|
+
emit("config-loaded", { title: titleOf(resp), width: resp.width });
|
|
134
|
+
emitRuntimeTitle(resp);
|
|
135
|
+
} catch (err) {
|
|
136
|
+
const msg = (err == null ? void 0 : err.message) ?? "";
|
|
137
|
+
if (msg.includes("未发现")) {
|
|
138
|
+
config.value = null;
|
|
139
|
+
} else {
|
|
140
|
+
error.value = msg || "加载表单配置失败";
|
|
141
|
+
config.value = null;
|
|
142
|
+
}
|
|
143
|
+
} finally {
|
|
144
|
+
loading.value = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
watch(
|
|
148
|
+
() => [props.category, props.name, props.config],
|
|
149
|
+
() => loadConfig(),
|
|
150
|
+
{ immediate: true }
|
|
151
|
+
);
|
|
152
|
+
function normalizeSingleRow(resp) {
|
|
153
|
+
if (resp == null) {
|
|
154
|
+
return { row: {} };
|
|
155
|
+
}
|
|
156
|
+
if (Array.isArray(resp)) {
|
|
157
|
+
if (resp.length === 0) return { error: "按参数查询未找到数据" };
|
|
158
|
+
if (resp.length > 1) return { error: "按参数查询返回多条数据,无法确定唯一记录" };
|
|
159
|
+
return { row: resp[0] ?? {} };
|
|
160
|
+
}
|
|
161
|
+
if (typeof resp === "object") {
|
|
162
|
+
const wrapped = Array.isArray(resp.records) ? resp.records : Array.isArray(resp.datas) ? resp.datas : Array.isArray(resp.data) ? resp.data : null;
|
|
163
|
+
if (wrapped) {
|
|
164
|
+
if (wrapped.length === 0) return { error: "按参数查询未找到数据" };
|
|
165
|
+
if (wrapped.length > 1) return { error: "按参数查询返回多条数据,无法确定唯一记录" };
|
|
166
|
+
return { row: wrapped[0] ?? {} };
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return { row: resp };
|
|
170
|
+
}
|
|
171
|
+
async function fetchSourceData() {
|
|
172
|
+
const id = normalizeSourceId(props.sourceId);
|
|
173
|
+
const hasId = id !== void 0;
|
|
174
|
+
const cfg = config.value;
|
|
175
|
+
if (hasId) {
|
|
176
|
+
const url = cfg == null ? void 0 : cfg.showUrl;
|
|
177
|
+
if (!url) {
|
|
178
|
+
sourceData.value = void 0;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
sourceLoading.value = true;
|
|
182
|
+
try {
|
|
183
|
+
const resp = await requireHttp().post(url, { id });
|
|
184
|
+
sourceData.value = resp ?? {};
|
|
185
|
+
} catch (err) {
|
|
186
|
+
console.error("加载编辑数据失败:", (err == null ? void 0 : err.message) ?? err);
|
|
187
|
+
sourceData.value = void 0;
|
|
188
|
+
} finally {
|
|
189
|
+
sourceLoading.value = false;
|
|
190
|
+
}
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const byParamsUrl = cfg == null ? void 0 : cfg.showByParamsUrl;
|
|
194
|
+
const cleanExtra = byParamsUrl ? cleanParams(extraParams.value) : {};
|
|
195
|
+
const hasParams = byParamsUrl && Object.keys(cleanExtra).length > 0;
|
|
196
|
+
if (byParamsUrl && hasParams) {
|
|
197
|
+
sourceLoading.value = true;
|
|
198
|
+
try {
|
|
199
|
+
const resp = await requireHttp().post(
|
|
200
|
+
byParamsUrl,
|
|
201
|
+
{ params: cleanExtra }
|
|
202
|
+
);
|
|
203
|
+
const { row, error: singleError } = normalizeSingleRow(resp);
|
|
204
|
+
if (singleError) {
|
|
205
|
+
platformMessage().error(singleError);
|
|
206
|
+
throw new Error(singleError);
|
|
207
|
+
}
|
|
208
|
+
sourceData.value = row ?? {};
|
|
209
|
+
} catch (err) {
|
|
210
|
+
if ((err == null ? void 0 : err.message) && !String(err.message).includes("按参数查询")) {
|
|
211
|
+
console.error("加载按参数查询数据失败:", (err == null ? void 0 : err.message) ?? err);
|
|
212
|
+
}
|
|
213
|
+
sourceData.value = void 0;
|
|
214
|
+
} finally {
|
|
215
|
+
sourceLoading.value = false;
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
sourceData.value = void 0;
|
|
220
|
+
}
|
|
221
|
+
const fetchKey = computed(() => {
|
|
222
|
+
var _a, _b, _c;
|
|
223
|
+
const id = normalizeSourceId(props.sourceId);
|
|
224
|
+
if (id !== void 0) {
|
|
225
|
+
return `id:${id}:${((_a = config.value) == null ? void 0 : _a.showUrl) ?? ""}`;
|
|
226
|
+
}
|
|
227
|
+
const byParamsUrl = (_b = config.value) == null ? void 0 : _b.showByParamsUrl;
|
|
228
|
+
if (byParamsUrl) {
|
|
229
|
+
return `by:${byParamsUrl}:${JSON.stringify(cleanParams(extraParams.value))}`;
|
|
230
|
+
}
|
|
231
|
+
return `none:${((_c = config.value) == null ? void 0 : _c.showUrl) ?? ""}`;
|
|
232
|
+
});
|
|
233
|
+
watch(fetchKey, () => fetchSourceData(), { immediate: true });
|
|
234
|
+
const transformed = computed(() => {
|
|
235
|
+
if (!config.value) return null;
|
|
236
|
+
return transformFormConfig(config.value);
|
|
237
|
+
});
|
|
238
|
+
const gridConfig = computed(() => {
|
|
239
|
+
var _a;
|
|
240
|
+
return (_a = transformed.value) == null ? void 0 : _a.gridConfig;
|
|
241
|
+
});
|
|
242
|
+
const labelWidth = computed(() => {
|
|
243
|
+
var _a;
|
|
244
|
+
return ((_a = transformed.value) == null ? void 0 : _a.labelWidth) ?? 150;
|
|
245
|
+
});
|
|
246
|
+
const innerRef = ref();
|
|
247
|
+
const saving = ref(false);
|
|
248
|
+
function parseValidateRegex(raw) {
|
|
249
|
+
if (!raw) return null;
|
|
250
|
+
try {
|
|
251
|
+
const match = /^\/(.+)\/([gimsuy]*)$/.exec(raw.trim());
|
|
252
|
+
if (match) {
|
|
253
|
+
return new RegExp(match[1], match[2] || void 0);
|
|
254
|
+
}
|
|
255
|
+
return new RegExp(raw.trim());
|
|
256
|
+
} catch {
|
|
257
|
+
console.warn(`[DesignForm] 无效的正则表达式: ${raw}`);
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async function handleSave(values) {
|
|
262
|
+
var _a, _b, _c, _d;
|
|
263
|
+
const cells = ((_a = gridConfig.value) == null ? void 0 : _a.cells) ?? [];
|
|
264
|
+
const missing = [];
|
|
265
|
+
const invalid = [];
|
|
266
|
+
for (const cell of cells) {
|
|
267
|
+
const name = cell.name;
|
|
268
|
+
if (!name) continue;
|
|
269
|
+
if ((_c = (_b = innerRef.value) == null ? void 0 : _b.isCellHidden) == null ? void 0 : _c.call(_b, cell)) continue;
|
|
270
|
+
const val = values[name];
|
|
271
|
+
const label = cell.title || name;
|
|
272
|
+
if (cell.isneed === "1") {
|
|
273
|
+
if (val === void 0 || val === null || val === "") {
|
|
274
|
+
missing.push(label);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (cell.validate && val !== void 0 && val !== null && val !== "") {
|
|
279
|
+
const pattern = parseValidateRegex(cell.validate);
|
|
280
|
+
if (pattern && !pattern.test(String(val))) {
|
|
281
|
+
invalid.push({ label, validate: cell.validate });
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (missing.length > 0) {
|
|
286
|
+
const msg = `请填写:${missing.join("、")}`;
|
|
287
|
+
platformMessage().warning(msg);
|
|
288
|
+
throw new Error(msg);
|
|
289
|
+
}
|
|
290
|
+
if (invalid.length > 0) {
|
|
291
|
+
const names = invalid.map((i) => i.label).join("、");
|
|
292
|
+
const msg = `以下字段格式不正确:${names}`;
|
|
293
|
+
platformMessage().warning(msg);
|
|
294
|
+
throw new Error(msg);
|
|
295
|
+
}
|
|
296
|
+
const recordId = props.sourceId ?? ((_d = effectiveSource.value) == null ? void 0 : _d[pfield.value]);
|
|
297
|
+
const isUpdate = !!recordId;
|
|
298
|
+
const url = isUpdate ? urls.value.update : urls.value.insert;
|
|
299
|
+
if (!url) {
|
|
300
|
+
const msg = "保存失败:未配置 insertUrl 或 updateUrl";
|
|
301
|
+
console.error(msg);
|
|
302
|
+
throw new Error(msg);
|
|
303
|
+
}
|
|
304
|
+
saving.value = true;
|
|
305
|
+
try {
|
|
306
|
+
const params = {
|
|
307
|
+
info: values,
|
|
308
|
+
params: extraParams.value
|
|
309
|
+
};
|
|
310
|
+
if (isUpdate) {
|
|
311
|
+
params.id = recordId;
|
|
312
|
+
}
|
|
313
|
+
const result = await requireHttp().post(url, params);
|
|
314
|
+
emit("saved", result);
|
|
315
|
+
return result;
|
|
316
|
+
} catch (err) {
|
|
317
|
+
console.error("保存失败:", (err == null ? void 0 : err.message) ?? err);
|
|
318
|
+
throw err;
|
|
319
|
+
} finally {
|
|
320
|
+
saving.value = false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
async function submit() {
|
|
324
|
+
var _a, _b, _c;
|
|
325
|
+
const values = ((_c = (_b = (_a = innerRef.value) == null ? void 0 : _a.formApi) == null ? void 0 : _b.getValues) == null ? void 0 : _c.call(_b)) ?? {};
|
|
326
|
+
return handleSave(values);
|
|
327
|
+
}
|
|
328
|
+
function handleDataChange(data) {
|
|
329
|
+
emit("data-change", data);
|
|
330
|
+
}
|
|
331
|
+
async function handleDelete() {
|
|
332
|
+
var _a;
|
|
333
|
+
const url = urls.value.delete;
|
|
334
|
+
if (!url) {
|
|
335
|
+
console.error("删除失败:未配置 deleteUrl");
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
const deleteId = props.sourceId ?? ((_a = effectiveSource.value) == null ? void 0 : _a[pfield.value]);
|
|
340
|
+
await requireHttp().post(url, { id: deleteId });
|
|
341
|
+
emit("deleted");
|
|
342
|
+
} catch (err) {
|
|
343
|
+
console.error("删除失败:", (err == null ? void 0 : err.message) ?? err);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const formConfigWidth = computed(() => {
|
|
347
|
+
var _a;
|
|
348
|
+
return (_a = config.value) == null ? void 0 : _a.width;
|
|
349
|
+
});
|
|
350
|
+
const formConfigTitle = computed(() => {
|
|
351
|
+
var _a;
|
|
352
|
+
return (_a = config.value) == null ? void 0 : _a.title;
|
|
353
|
+
});
|
|
354
|
+
const route = useRoute();
|
|
355
|
+
const extraParams = computed(() => {
|
|
356
|
+
const routeParams = isOwnRoutePage(route.path, props.category, props.name) ? { ...route.params, ...route.query } : {};
|
|
357
|
+
return buildExtraParams(routeParams, props.parentParams);
|
|
358
|
+
});
|
|
359
|
+
const parsedTools = computed(() => {
|
|
360
|
+
var _a;
|
|
361
|
+
return ((_a = config.value) == null ? void 0 : _a.toolBars) ?? [];
|
|
362
|
+
});
|
|
363
|
+
const toolLabelMap = {
|
|
364
|
+
add: "新增",
|
|
365
|
+
save: "保存",
|
|
366
|
+
submit: "提交",
|
|
367
|
+
reset: "重置",
|
|
368
|
+
delete: "删除",
|
|
369
|
+
"navigate-form": "跳转表单",
|
|
370
|
+
"navigate-table": "跳转列表",
|
|
371
|
+
"navigate-combo": "跳转组合视图",
|
|
372
|
+
"modal-form": "弹窗表单",
|
|
373
|
+
"modal-table": "弹窗列表",
|
|
374
|
+
"modal-combo": "弹窗组合视图",
|
|
375
|
+
"modal-tree": "弹窗树形视图",
|
|
376
|
+
other: "其他"
|
|
377
|
+
};
|
|
378
|
+
function getToolLabel(tool) {
|
|
379
|
+
return tool.title || tool.label || toolLabelMap[tool.type ?? ""] || tool.type || "";
|
|
380
|
+
}
|
|
381
|
+
const toolScope = computed(() => ({
|
|
382
|
+
params: extraParams.value,
|
|
383
|
+
data: effectiveSource.value ?? {}
|
|
384
|
+
}));
|
|
385
|
+
const toolRefs = ref({});
|
|
386
|
+
function setToolRef(idx) {
|
|
387
|
+
return (el) => {
|
|
388
|
+
toolRefs.value[idx] = el;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
function handleToolClick(tool, idx) {
|
|
392
|
+
var _a, _b, _c;
|
|
393
|
+
if (tool.type === "save") {
|
|
394
|
+
void triggerFormSave();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (tool.type === "submit") {
|
|
398
|
+
void handleFlowSubmit(tool);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (tool.type === "reset") {
|
|
402
|
+
(_b = (_a = innerRef.value) == null ? void 0 : _a.formApi) == null ? void 0 : _b.resetForm();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (tool.type === "delete") {
|
|
406
|
+
void handleDelete();
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (tool.type === "other") {
|
|
410
|
+
emit("tool-command", tool);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const inst = toolRefs.value[idx];
|
|
414
|
+
(_c = inst == null ? void 0 : inst.trigger) == null ? void 0 : _c.call(inst);
|
|
415
|
+
}
|
|
416
|
+
async function triggerFormSave() {
|
|
417
|
+
var _a, _b, _c;
|
|
418
|
+
try {
|
|
419
|
+
const values = ((_c = (_b = (_a = innerRef.value) == null ? void 0 : _a.formApi) == null ? void 0 : _b.getValues) == null ? void 0 : _c.call(_b)) ?? {};
|
|
420
|
+
await handleSave(values);
|
|
421
|
+
} catch (err) {
|
|
422
|
+
console.error("[design-form] 工具条保存失败:", (err == null ? void 0 : err.message) ?? err);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const flowSubmitting = ref(false);
|
|
426
|
+
const useVbenModalInjected = getHostUi().useVbenModal;
|
|
427
|
+
const applyModalComp = getHostWorkflow().applyModal;
|
|
428
|
+
const hasFlowApply = Boolean(useVbenModalInjected && applyModalComp);
|
|
429
|
+
const [ApplyModal, applyModalApi] = hasFlowApply ? useVbenModalInjected({ connectedComponent: applyModalComp }) : [null, null];
|
|
430
|
+
function resolveFlowBusinessType() {
|
|
431
|
+
const cfg = config.value ?? {};
|
|
432
|
+
return (cfg.relationTableName || cfg.tableName || cfg.dcode || props.name || "").trim();
|
|
433
|
+
}
|
|
434
|
+
async function handleFlowSubmit(tool) {
|
|
435
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
436
|
+
if (!hasFlowApply) {
|
|
437
|
+
platformMessage().warning(
|
|
438
|
+
"未注入流程提交能力(host.ui.useVbenModal + host.workflow.applyModal):本次只保存,不发起流程"
|
|
439
|
+
);
|
|
440
|
+
const valuesNoFlow = ((_c = (_b = (_a = innerRef.value) == null ? void 0 : _a.formApi) == null ? void 0 : _b.getValues) == null ? void 0 : _c.call(_b)) ?? {};
|
|
441
|
+
try {
|
|
442
|
+
await handleSave(valuesNoFlow);
|
|
443
|
+
} catch {
|
|
444
|
+
}
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const flowCode = (_d = tool == null ? void 0 : tool.flowCode) == null ? void 0 : _d.trim();
|
|
448
|
+
if (!flowCode) {
|
|
449
|
+
platformMessage().warning(
|
|
450
|
+
"该表单「提交」未配置流程编码 flowCode,请先在构建端配置"
|
|
451
|
+
);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
const recordId = props.sourceId ?? ((_e = effectiveSource.value) == null ? void 0 : _e[pfield.value]);
|
|
455
|
+
if (recordId === void 0 || recordId === null || recordId === "") {
|
|
456
|
+
platformMessage().warning("请先保存记录后再提交流程");
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const businessType = resolveFlowBusinessType();
|
|
460
|
+
if (!businessType) {
|
|
461
|
+
platformMessage().warning("无法确定业务表 code,暂不能发起流程");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const values = ((_h = (_g = (_f = innerRef.value) == null ? void 0 : _f.formApi) == null ? void 0 : _g.getValues) == null ? void 0 : _h.call(_g)) ?? {};
|
|
465
|
+
try {
|
|
466
|
+
await handleSave(values);
|
|
467
|
+
} catch {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
flowSubmitting.value = true;
|
|
471
|
+
try {
|
|
472
|
+
const variables = {
|
|
473
|
+
__designMeta: {
|
|
474
|
+
businessType,
|
|
475
|
+
businessId: String(recordId),
|
|
476
|
+
// 审批详情(/design 通用组件)定位渲染用
|
|
477
|
+
moduleName: props.category || "",
|
|
478
|
+
formCode: props.name || "",
|
|
479
|
+
title: props.taskTitle || ""
|
|
480
|
+
},
|
|
481
|
+
entity: values
|
|
482
|
+
};
|
|
483
|
+
const start = await designFlowSubmit({
|
|
484
|
+
businessType,
|
|
485
|
+
businessId: String(recordId),
|
|
486
|
+
flowCode,
|
|
487
|
+
variables
|
|
488
|
+
});
|
|
489
|
+
applyModalApi.setData({
|
|
490
|
+
taskId: String((start == null ? void 0 : start.taskId) ?? ""),
|
|
491
|
+
taskVariables: variables,
|
|
492
|
+
variables: {}
|
|
493
|
+
});
|
|
494
|
+
applyModalApi.open();
|
|
495
|
+
} catch (err) {
|
|
496
|
+
console.error("发起流程失败:", (err == null ? void 0 : err.message) ?? err);
|
|
497
|
+
} finally {
|
|
498
|
+
flowSubmitting.value = false;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function handleFlowApplyClosed() {
|
|
502
|
+
}
|
|
503
|
+
const derivedDebug = ref({});
|
|
504
|
+
function onDerivedChange(snapshot) {
|
|
505
|
+
derivedDebug.value = snapshot;
|
|
506
|
+
}
|
|
507
|
+
const conditionDebug = ref({ scope: {}, items: [] });
|
|
508
|
+
function onConditionChange(snapshot) {
|
|
509
|
+
conditionDebug.value = snapshot;
|
|
510
|
+
}
|
|
511
|
+
const conditionExprScopeExtra = computed(() => ({
|
|
512
|
+
label: "条件作用域(派生值)",
|
|
513
|
+
scope: conditionDebug.value.scope,
|
|
514
|
+
hint: "渲染条件 / 显示条件表达式的真实作用域:只有派生字段值(裸名 + derivedValues 对象,不含普通表单字段),且只在派生值变化时重算。"
|
|
515
|
+
}));
|
|
516
|
+
const devState = computed(() => {
|
|
517
|
+
var _a;
|
|
518
|
+
return {
|
|
519
|
+
props: {
|
|
520
|
+
category: props.category,
|
|
521
|
+
name: props.name,
|
|
522
|
+
config: props.config ? { id: props.config.id, name: props.config.name, title: props.config.title } : null,
|
|
523
|
+
source: props.source,
|
|
524
|
+
sourceId: props.sourceId,
|
|
525
|
+
taskTitle: props.taskTitle,
|
|
526
|
+
mode: props.mode,
|
|
527
|
+
parentParams: props.parentParams
|
|
528
|
+
},
|
|
529
|
+
route: {
|
|
530
|
+
params: route.params,
|
|
531
|
+
query: route.query
|
|
532
|
+
},
|
|
533
|
+
extraParams: extraParams.value,
|
|
534
|
+
config: config.value ? {
|
|
535
|
+
name: config.value.name,
|
|
536
|
+
title: config.value.title,
|
|
537
|
+
pfield: config.value.pfield,
|
|
538
|
+
labelwidth: config.value.labelwidth,
|
|
539
|
+
width: config.value.width,
|
|
540
|
+
insertUrl: config.value.insertUrl,
|
|
541
|
+
updateUrl: config.value.updateUrl,
|
|
542
|
+
deleteUrl: config.value.deleteUrl,
|
|
543
|
+
showUrl: config.value.showUrl,
|
|
544
|
+
showByParamsUrl: config.value.showByParamsUrl,
|
|
545
|
+
toolBars: config.value.toolBars,
|
|
546
|
+
/** 完整表单配置(cells 网格、totalRow/Col、colWidths/rowHeights 等) */
|
|
547
|
+
formContent: config.value.config
|
|
548
|
+
} : null,
|
|
549
|
+
urls: urls.value,
|
|
550
|
+
sourceData: {
|
|
551
|
+
sourceLoading: sourceLoading.value,
|
|
552
|
+
effectiveSource: effectiveSource.value
|
|
553
|
+
},
|
|
554
|
+
derivedFieldList: ((_a = config.value) == null ? void 0 : _a.derivedFieldList) ?? null,
|
|
555
|
+
derivedValues: derivedDebug.value,
|
|
556
|
+
/** 单元格条件(vif/vshow):作用域 + 每个配了条件的格的求值结果 */
|
|
557
|
+
conditionScope: conditionDebug.value.scope,
|
|
558
|
+
cellConditions: conditionDebug.value.items,
|
|
559
|
+
pfield: pfield.value,
|
|
560
|
+
loading: loading.value,
|
|
561
|
+
error: error.value
|
|
562
|
+
};
|
|
563
|
+
});
|
|
564
|
+
__expose({
|
|
565
|
+
getFormApi: () => {
|
|
566
|
+
var _a;
|
|
567
|
+
return (_a = innerRef.value) == null ? void 0 : _a.formApi;
|
|
568
|
+
},
|
|
569
|
+
/** 程序化提交入口:取当前表单值并走统一保存逻辑(供父组件/宿主调用) */
|
|
570
|
+
submit,
|
|
571
|
+
/** 保存进行中状态(供宿主读取,如同步到 drawer confirmLoading) */
|
|
572
|
+
saving,
|
|
573
|
+
/** 表单配置的宽度(供抽屉组件读取) */
|
|
574
|
+
formConfigWidth,
|
|
575
|
+
/** 表单配置的标题(供抽屉组件读取) */
|
|
576
|
+
formConfigTitle,
|
|
577
|
+
/** 开发面板状态(本库不渲染调试台,留给宿主调试台按需读取) */
|
|
578
|
+
devState,
|
|
579
|
+
toolScope
|
|
580
|
+
});
|
|
581
|
+
watch(
|
|
582
|
+
() => parsedTools.value.map((tool) => tool.type),
|
|
583
|
+
(types) => types.forEach((type) => resolveToolComponent(type)),
|
|
584
|
+
{ immediate: true }
|
|
585
|
+
);
|
|
586
|
+
return (_ctx, _cache) => {
|
|
587
|
+
const _component_a_button = resolveComponent("a-button");
|
|
588
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
589
|
+
__props.taskTitle ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.taskTitle), 1)) : createCommentVNode("", true),
|
|
590
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
591
|
+
createVNode(unref(Spin), {
|
|
592
|
+
spinning: true,
|
|
593
|
+
tip: "加载表单配置中..."
|
|
594
|
+
})
|
|
595
|
+
])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
596
|
+
createVNode(unref(Alert), {
|
|
597
|
+
message: error.value,
|
|
598
|
+
type: "error",
|
|
599
|
+
"show-icon": "",
|
|
600
|
+
closable: "",
|
|
601
|
+
onClose: _cache[0] || (_cache[0] = ($event) => error.value = null)
|
|
602
|
+
}, null, 8, ["message"])
|
|
603
|
+
])) : !config.value ? (openBlock(), createBlock(unref(Result), {
|
|
604
|
+
key: 3,
|
|
605
|
+
status: "404",
|
|
606
|
+
title: "未发现表单配置",
|
|
607
|
+
"sub-title": "该表单尚未在构建端完成配置,或配置名称有误"
|
|
608
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
609
|
+
createVNode(DesignFormInner, {
|
|
610
|
+
ref_key: "innerRef",
|
|
611
|
+
ref: innerRef,
|
|
612
|
+
"grid-config": gridConfig.value,
|
|
613
|
+
"label-width": labelWidth.value,
|
|
614
|
+
source: effectiveSource.value,
|
|
615
|
+
pfield: pfield.value,
|
|
616
|
+
"extra-params": extraParams.value,
|
|
617
|
+
category: __props.category,
|
|
618
|
+
onDataChange: handleDataChange,
|
|
619
|
+
onDerivedChange,
|
|
620
|
+
onConditionChange
|
|
621
|
+
}, null, 8, ["grid-config", "label-width", "source", "pfield", "extra-params", "category"]),
|
|
622
|
+
parsedTools.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
623
|
+
createVNode(unref(Space), null, {
|
|
624
|
+
default: withCtx(() => [
|
|
625
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedTools.value, (tool, idx) => {
|
|
626
|
+
return openBlock(), createBlock(_component_a_button, {
|
|
627
|
+
key: idx,
|
|
628
|
+
type: ["add", "save", "submit"].includes(tool.type ?? "") ? "primary" : "default",
|
|
629
|
+
danger: tool.type === "delete",
|
|
630
|
+
loading: tool.type === "submit" && flowSubmitting.value,
|
|
631
|
+
onClick: ($event) => handleToolClick(tool, idx)
|
|
632
|
+
}, {
|
|
633
|
+
default: withCtx(() => [
|
|
634
|
+
createTextVNode(toDisplayString(getToolLabel(tool)), 1)
|
|
635
|
+
]),
|
|
636
|
+
_: 2
|
|
637
|
+
}, 1032, ["type", "danger", "loading", "onClick"]);
|
|
638
|
+
}), 128))
|
|
639
|
+
]),
|
|
640
|
+
_: 1
|
|
641
|
+
}),
|
|
642
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedTools.value, (tool, idx) => {
|
|
643
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(resolveToolComponent)(tool.type)), {
|
|
644
|
+
key: "drawer-" + idx,
|
|
645
|
+
ref_for: true,
|
|
646
|
+
ref: setToolRef(idx),
|
|
647
|
+
tool,
|
|
648
|
+
category: __props.category,
|
|
649
|
+
pfield: pfield.value,
|
|
650
|
+
"extra-params": extraParams.value,
|
|
651
|
+
"mapping-scope": toolScope.value
|
|
652
|
+
}, null, 8, ["tool", "category", "pfield", "extra-params", "mapping-scope"]);
|
|
653
|
+
}), 128))
|
|
654
|
+
])) : createCommentVNode("", true)
|
|
655
|
+
])),
|
|
656
|
+
unref(ApplyModal) ? (openBlock(), createBlock(resolveDynamicComponent(unref(ApplyModal)), {
|
|
657
|
+
key: 5,
|
|
658
|
+
onComplete: handleFlowApplyClosed,
|
|
659
|
+
onCancel: handleFlowApplyClosed
|
|
660
|
+
}, null, 32)) : createCommentVNode("", true),
|
|
661
|
+
createVNode(DesignDevStateButton, {
|
|
662
|
+
"designer-category": __props.category,
|
|
663
|
+
"designer-name": __props.name,
|
|
664
|
+
"expr-scope": toolScope.value,
|
|
665
|
+
"expr-scope-extra": conditionExprScopeExtra.value,
|
|
666
|
+
"expr-scope-labels": {
|
|
667
|
+
params: "组件自身参数(extraParams)",
|
|
668
|
+
data: "当前记录 / 上游数据"
|
|
669
|
+
},
|
|
670
|
+
state: devState.value,
|
|
671
|
+
top: __props.devButtonTop,
|
|
672
|
+
"designer-type": "form",
|
|
673
|
+
title: "DesignForm"
|
|
674
|
+
}, null, 8, ["designer-category", "designer-name", "expr-scope", "expr-scope-extra", "state", "top"])
|
|
675
|
+
]);
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
export {
|
|
680
|
+
_sfc_main as default
|
|
681
|
+
};
|