@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,783 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, onBeforeUnmount, nextTick, resolveComponent, openBlock, createElementBlock, createVNode, unref, createBlock, withCtx, Fragment, renderList, createTextVNode, toDisplayString, resolveDynamicComponent, createCommentVNode, createElementVNode, normalizeStyle, withModifiers } from "vue";
|
|
2
|
+
import { useRoute, useRouter } from "vue-router";
|
|
3
|
+
import { Spin, Alert, Result, Space, Button, Tree, Empty } from "antdv-next";
|
|
4
|
+
import { fetchTreeViewConfig, fetchDataSetMeta, fetchDataSetTreeAsync, fetchDataSetTreeSync, fetchTreeNodeCount } from "../api.js";
|
|
5
|
+
import DesignTable from "../components/design-table/design-table.vue.js";
|
|
6
|
+
import { resolveToolComponent } from "../components/design-tools/index.js";
|
|
7
|
+
import DesignDevStateButton from "../components/design-debug/dev-state-button.vue.js";
|
|
8
|
+
import DesignComb from "../comb/design-comb.vue.js";
|
|
9
|
+
import DesignForm from "../form/design-form.vue.js";
|
|
10
|
+
import { isOwnRoutePage, buildExtraParams, evaluateMappedExpress, buildMappedParams } from "../mapping.js";
|
|
11
|
+
const _hoisted_1 = { class: "design-tree" };
|
|
12
|
+
const _hoisted_2 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "flex-center py-20"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_3 = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "py-8"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_4 = {
|
|
21
|
+
key: 3,
|
|
22
|
+
class: "design-tree-main"
|
|
23
|
+
};
|
|
24
|
+
const _hoisted_5 = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "design-tree-toolbar"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_6 = { class: "design-tree-layout" };
|
|
29
|
+
const _hoisted_7 = { class: "design-tree-body" };
|
|
30
|
+
const _hoisted_8 = ["title"];
|
|
31
|
+
const _hoisted_9 = { class: "tree-node-title__text" };
|
|
32
|
+
const _hoisted_10 = {
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "tree-node-title__count"
|
|
35
|
+
};
|
|
36
|
+
const _hoisted_11 = { class: "design-tree-relation" };
|
|
37
|
+
const _hoisted_12 = {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "flex-center flex-1"
|
|
40
|
+
};
|
|
41
|
+
const _hoisted_13 = {
|
|
42
|
+
key: 1,
|
|
43
|
+
class: "flex-center flex-1"
|
|
44
|
+
};
|
|
45
|
+
const TREE_WIDTH_MIN = 160;
|
|
46
|
+
const TREE_WIDTH_MAX = 900;
|
|
47
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
48
|
+
...{ name: "DesignTree" },
|
|
49
|
+
__name: "design-tree",
|
|
50
|
+
props: {
|
|
51
|
+
category: { default: "" },
|
|
52
|
+
name: { default: "" },
|
|
53
|
+
config: { default: null },
|
|
54
|
+
parentParams: { default: void 0 },
|
|
55
|
+
devButtonTop: { default: 10 }
|
|
56
|
+
},
|
|
57
|
+
emits: ["update:title", "update:remarks", "update:has-config", "config-loaded", "tool-command"],
|
|
58
|
+
setup(__props, { emit: __emit }) {
|
|
59
|
+
const props = __props;
|
|
60
|
+
const emit = __emit;
|
|
61
|
+
const route = useRoute();
|
|
62
|
+
const router = useRouter();
|
|
63
|
+
const loading = ref(false);
|
|
64
|
+
const error = ref(null);
|
|
65
|
+
const config = ref(null);
|
|
66
|
+
async function loadConfig() {
|
|
67
|
+
if (props.config) {
|
|
68
|
+
config.value = props.config;
|
|
69
|
+
loading.value = false;
|
|
70
|
+
emit("update:has-config", true);
|
|
71
|
+
void loadTreeByConfig();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!props.category || !props.name) return;
|
|
75
|
+
loading.value = true;
|
|
76
|
+
error.value = null;
|
|
77
|
+
try {
|
|
78
|
+
config.value = await fetchTreeViewConfig(props.category, props.name);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
const msg = (err == null ? void 0 : err.message) ?? "";
|
|
81
|
+
if (msg.includes("未发现")) {
|
|
82
|
+
config.value = null;
|
|
83
|
+
} else {
|
|
84
|
+
error.value = msg || "加载树形视图配置失败";
|
|
85
|
+
config.value = null;
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
loading.value = false;
|
|
89
|
+
}
|
|
90
|
+
emit("update:has-config", Boolean(config.value));
|
|
91
|
+
void loadTreeByConfig();
|
|
92
|
+
}
|
|
93
|
+
watch(
|
|
94
|
+
() => [props.category, props.name, props.config],
|
|
95
|
+
() => loadConfig(),
|
|
96
|
+
{ immediate: true }
|
|
97
|
+
);
|
|
98
|
+
const title = computed(() => {
|
|
99
|
+
var _a;
|
|
100
|
+
return String(((_a = config.value) == null ? void 0 : _a.runtimeTitle) ?? "").trim();
|
|
101
|
+
});
|
|
102
|
+
watch(title, (val) => {
|
|
103
|
+
if (val) {
|
|
104
|
+
emit("update:title", val);
|
|
105
|
+
}
|
|
106
|
+
}, { immediate: true });
|
|
107
|
+
watch(
|
|
108
|
+
() => config.value,
|
|
109
|
+
(cfg) => emit("config-loaded", cfg ?? null),
|
|
110
|
+
{ immediate: true }
|
|
111
|
+
);
|
|
112
|
+
watch(
|
|
113
|
+
() => {
|
|
114
|
+
var _a;
|
|
115
|
+
return (_a = config.value) == null ? void 0 : _a.remarks;
|
|
116
|
+
},
|
|
117
|
+
(val) => emit("update:remarks", val ?? ""),
|
|
118
|
+
{ immediate: true }
|
|
119
|
+
);
|
|
120
|
+
const configTreeWidth = computed(() => {
|
|
121
|
+
var _a;
|
|
122
|
+
const w = Number((_a = config.value) == null ? void 0 : _a.treeWidth);
|
|
123
|
+
return Number.isFinite(w) && w > 0 ? w : 260;
|
|
124
|
+
});
|
|
125
|
+
const widthStorageKey = computed(
|
|
126
|
+
() => `design-tree-width:${[props.category, props.name].filter(Boolean).join("/")}`
|
|
127
|
+
);
|
|
128
|
+
const treeWidth = ref(260);
|
|
129
|
+
function clampWidth(w) {
|
|
130
|
+
return Math.min(TREE_WIDTH_MAX, Math.max(TREE_WIDTH_MIN, Math.round(w)));
|
|
131
|
+
}
|
|
132
|
+
function initTreeWidth() {
|
|
133
|
+
let w = configTreeWidth.value;
|
|
134
|
+
try {
|
|
135
|
+
const saved = Number(localStorage.getItem(widthStorageKey.value));
|
|
136
|
+
if (Number.isFinite(saved) && saved > 0) w = saved;
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
treeWidth.value = clampWidth(w);
|
|
140
|
+
}
|
|
141
|
+
watch([configTreeWidth, widthStorageKey], () => initTreeWidth(), { immediate: true });
|
|
142
|
+
const dragState = ref(null);
|
|
143
|
+
function onResizeStart(e) {
|
|
144
|
+
dragState.value = { startX: e.clientX, startW: treeWidth.value };
|
|
145
|
+
document.addEventListener("mousemove", onResizeMove);
|
|
146
|
+
document.addEventListener("mouseup", onResizeEnd);
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
}
|
|
149
|
+
function onResizeMove(e) {
|
|
150
|
+
if (!dragState.value) return;
|
|
151
|
+
treeWidth.value = clampWidth(
|
|
152
|
+
dragState.value.startW + (e.clientX - dragState.value.startX)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
function onResizeEnd() {
|
|
156
|
+
if (dragState.value) {
|
|
157
|
+
try {
|
|
158
|
+
localStorage.setItem(widthStorageKey.value, String(treeWidth.value));
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
dragState.value = null;
|
|
163
|
+
document.removeEventListener("mousemove", onResizeMove);
|
|
164
|
+
document.removeEventListener("mouseup", onResizeEnd);
|
|
165
|
+
}
|
|
166
|
+
onBeforeUnmount(() => {
|
|
167
|
+
document.removeEventListener("mousemove", onResizeMove);
|
|
168
|
+
document.removeEventListener("mouseup", onResizeEnd);
|
|
169
|
+
});
|
|
170
|
+
const treeData = ref([]);
|
|
171
|
+
const flatRows = ref([]);
|
|
172
|
+
const selectedKeys = ref([]);
|
|
173
|
+
const expandedKeys = ref([]);
|
|
174
|
+
const treeLoading = ref(false);
|
|
175
|
+
const treeError = ref(null);
|
|
176
|
+
const treeMeta = ref(null);
|
|
177
|
+
const asyncLoadedKeys = ref(/* @__PURE__ */ new Set());
|
|
178
|
+
let treeLoadSeq = 0;
|
|
179
|
+
function normalizeRows(resp) {
|
|
180
|
+
if (Array.isArray(resp)) return resp;
|
|
181
|
+
if (resp && Array.isArray(resp.datas)) return resp.datas;
|
|
182
|
+
if (resp && Array.isArray(resp.data)) return resp.data;
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
function collectRows(nodes, out, seen) {
|
|
186
|
+
for (const node of nodes || []) {
|
|
187
|
+
if (!node) continue;
|
|
188
|
+
const sk = (node == null ? void 0 : node.key) === void 0 || (node == null ? void 0 : node.key) === null ? "" : String(node.key);
|
|
189
|
+
if (sk && !seen.has(sk)) {
|
|
190
|
+
seen.add(sk);
|
|
191
|
+
const { children, ...row } = node;
|
|
192
|
+
out.push(row);
|
|
193
|
+
}
|
|
194
|
+
if (Array.isArray(node.children) && node.children.length > 0) {
|
|
195
|
+
collectRows(node.children, out, seen);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function applyTree(nodes, expandRoots) {
|
|
200
|
+
treeData.value = nodes || [];
|
|
201
|
+
const flat = [];
|
|
202
|
+
collectRows(nodes || [], flat, /* @__PURE__ */ new Set());
|
|
203
|
+
flatRows.value = flat;
|
|
204
|
+
treeLoading.value = false;
|
|
205
|
+
treeError.value = null;
|
|
206
|
+
const rootKeys = (nodes || []).map((n) => n == null ? void 0 : n.key).filter((k) => k !== void 0 && k !== null);
|
|
207
|
+
expandedKeys.value = rootKeys;
|
|
208
|
+
const first = (nodes || [])[0];
|
|
209
|
+
selectedKeys.value = (first == null ? void 0 : first.key) === void 0 ? [] : [first.key];
|
|
210
|
+
void loadNodeCounts(flat);
|
|
211
|
+
}
|
|
212
|
+
function buildTreeParams() {
|
|
213
|
+
return { ...extraParams.value };
|
|
214
|
+
}
|
|
215
|
+
async function loadTreeByConfig() {
|
|
216
|
+
var _a;
|
|
217
|
+
const seq = ++treeLoadSeq;
|
|
218
|
+
treeLoading.value = true;
|
|
219
|
+
treeError.value = null;
|
|
220
|
+
treeData.value = [];
|
|
221
|
+
flatRows.value = [];
|
|
222
|
+
expandedKeys.value = [];
|
|
223
|
+
asyncLoadedKeys.value = /* @__PURE__ */ new Set();
|
|
224
|
+
nodeCountMap.value = {};
|
|
225
|
+
const code = (_a = config.value) == null ? void 0 : _a.dataSetName;
|
|
226
|
+
if (!code) {
|
|
227
|
+
treeLoading.value = false;
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
const meta = await fetchDataSetMeta(code);
|
|
232
|
+
if (seq !== treeLoadSeq) return;
|
|
233
|
+
treeMeta.value = meta;
|
|
234
|
+
if ((meta == null ? void 0 : meta.setType) && meta.setType !== "tree") {
|
|
235
|
+
treeError.value = `绑定的数据集「${meta.setName || code}」不是树形类型,请在构建端把数据集类型设为树形`;
|
|
236
|
+
treeLoading.value = false;
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const asyncMode = (meta == null ? void 0 : meta.requestMode) === "async";
|
|
240
|
+
if (asyncMode) {
|
|
241
|
+
const roots = normalizeRows(
|
|
242
|
+
await fetchDataSetTreeAsync(code, null, buildTreeParams())
|
|
243
|
+
);
|
|
244
|
+
if (seq !== treeLoadSeq) return;
|
|
245
|
+
const withKids = await Promise.all(
|
|
246
|
+
(roots || []).map(async (root) => {
|
|
247
|
+
if (!root || !root.hasChild) return root;
|
|
248
|
+
try {
|
|
249
|
+
const kids = normalizeRows(
|
|
250
|
+
await fetchDataSetTreeAsync(code, root.key, buildTreeParams())
|
|
251
|
+
);
|
|
252
|
+
return { ...root, children: kids };
|
|
253
|
+
} catch {
|
|
254
|
+
return root;
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
);
|
|
258
|
+
if (seq !== treeLoadSeq) return;
|
|
259
|
+
applyTree(withKids, true);
|
|
260
|
+
} else {
|
|
261
|
+
const roots = normalizeRows(
|
|
262
|
+
await fetchDataSetTreeSync(code, buildTreeParams())
|
|
263
|
+
);
|
|
264
|
+
if (seq !== treeLoadSeq) return;
|
|
265
|
+
applyTree(roots, true);
|
|
266
|
+
}
|
|
267
|
+
} catch (err) {
|
|
268
|
+
if (seq !== treeLoadSeq) return;
|
|
269
|
+
treeError.value = (err == null ? void 0 : err.message) ?? "加载树数据失败";
|
|
270
|
+
treeLoading.value = false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function patchTreeNodeChildren(nodes, key, children) {
|
|
274
|
+
return (nodes || []).map((node) => {
|
|
275
|
+
if ((node == null ? void 0 : node.key) === void 0 || (node == null ? void 0 : node.key) === null) return node;
|
|
276
|
+
if (String(node.key) === key) {
|
|
277
|
+
return { ...node, children };
|
|
278
|
+
}
|
|
279
|
+
if (Array.isArray(node.children) && node.children.length > 0) {
|
|
280
|
+
return { ...node, children: patchTreeNodeChildren(node.children, key, children) };
|
|
281
|
+
}
|
|
282
|
+
return node;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
async function onTreeLoadData(node) {
|
|
286
|
+
var _a;
|
|
287
|
+
const key = node == null ? void 0 : node.key;
|
|
288
|
+
if (key === void 0 || key === null) return;
|
|
289
|
+
const code = (_a = config.value) == null ? void 0 : _a.dataSetName;
|
|
290
|
+
if (!code) return;
|
|
291
|
+
const sk = String(key);
|
|
292
|
+
const loaded = asyncLoadedKeys.value;
|
|
293
|
+
if (loaded.has(sk)) return;
|
|
294
|
+
loaded.add(sk);
|
|
295
|
+
try {
|
|
296
|
+
const kids = normalizeRows(
|
|
297
|
+
await fetchDataSetTreeAsync(code, key, buildTreeParams())
|
|
298
|
+
);
|
|
299
|
+
treeData.value = patchTreeNodeChildren(treeData.value, sk, kids);
|
|
300
|
+
const flat = [];
|
|
301
|
+
collectRows(kids, flat, /* @__PURE__ */ new Set());
|
|
302
|
+
flatRows.value = flatRows.value.concat(flat);
|
|
303
|
+
void loadNodeCounts(kids);
|
|
304
|
+
} catch (err) {
|
|
305
|
+
loaded.delete(sk);
|
|
306
|
+
throw err;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function handleTreeSelect(keys) {
|
|
310
|
+
selectedKeys.value = keys;
|
|
311
|
+
}
|
|
312
|
+
const nodeCountConfig = computed(() => {
|
|
313
|
+
var _a;
|
|
314
|
+
const cfg = (_a = config.value) == null ? void 0 : _a.nodeCount;
|
|
315
|
+
if (!cfg || typeof cfg !== "object" || cfg.enabled !== true) return null;
|
|
316
|
+
if (!cfg.keyColumn || !cfg.valueColumn) return null;
|
|
317
|
+
return cfg;
|
|
318
|
+
});
|
|
319
|
+
const nodeCountMap = ref({});
|
|
320
|
+
function nodeMatchValue(node) {
|
|
321
|
+
var _a;
|
|
322
|
+
const field = String(((_a = nodeCountConfig.value) == null ? void 0 : _a.matchField) ?? "").trim();
|
|
323
|
+
if (!field) return node == null ? void 0 : node.key;
|
|
324
|
+
return resolveScopePath(node ?? {}, field);
|
|
325
|
+
}
|
|
326
|
+
function countTextOf(node) {
|
|
327
|
+
const cfg = nodeCountConfig.value;
|
|
328
|
+
if (!cfg) return "";
|
|
329
|
+
const value = nodeMatchValue(node);
|
|
330
|
+
const key = value === void 0 || value === null ? "" : String(value);
|
|
331
|
+
const raw = key !== "" && Object.prototype.hasOwnProperty.call(nodeCountMap.value, key) ? nodeCountMap.value[key] : cfg.defaultValue;
|
|
332
|
+
if (raw === void 0 || raw === null || raw === "") return "";
|
|
333
|
+
const text = String(raw).trim();
|
|
334
|
+
if (text === "") return "";
|
|
335
|
+
if (cfg.hideZero && Number(text) === 0) return "";
|
|
336
|
+
return text + String(cfg.suffix ?? "");
|
|
337
|
+
}
|
|
338
|
+
async function loadNodeCounts(nodes) {
|
|
339
|
+
const cfg = nodeCountConfig.value;
|
|
340
|
+
if (!cfg || !props.category || !props.name) return;
|
|
341
|
+
const keys = [];
|
|
342
|
+
const seen = /* @__PURE__ */ new Set();
|
|
343
|
+
for (const node of nodes || []) {
|
|
344
|
+
const value = nodeMatchValue(node);
|
|
345
|
+
if (value === void 0 || value === null || String(value) === "") continue;
|
|
346
|
+
const sk = String(value);
|
|
347
|
+
if (seen.has(sk)) continue;
|
|
348
|
+
seen.add(sk);
|
|
349
|
+
keys.push(value);
|
|
350
|
+
}
|
|
351
|
+
if (keys.length === 0) return;
|
|
352
|
+
const treeSeq = treeLoadSeq;
|
|
353
|
+
try {
|
|
354
|
+
const data = await fetchTreeNodeCount(
|
|
355
|
+
props.category,
|
|
356
|
+
props.name,
|
|
357
|
+
keys,
|
|
358
|
+
buildTreeParams()
|
|
359
|
+
);
|
|
360
|
+
if (treeSeq !== treeLoadSeq) return;
|
|
361
|
+
const next = { ...nodeCountMap.value };
|
|
362
|
+
for (const [key, value] of Object.entries(data || {})) {
|
|
363
|
+
if (value === void 0 || value === null || String(value).trim() === "") continue;
|
|
364
|
+
next[key] = value;
|
|
365
|
+
}
|
|
366
|
+
nodeCountMap.value = next;
|
|
367
|
+
} catch {
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const relationType = computed(() => {
|
|
371
|
+
var _a;
|
|
372
|
+
return ((_a = config.value) == null ? void 0 : _a.relationType) ?? "";
|
|
373
|
+
});
|
|
374
|
+
const relationTargetName = computed(
|
|
375
|
+
() => {
|
|
376
|
+
var _a;
|
|
377
|
+
return ((_a = config.value) == null ? void 0 : _a.relationTargetName) ?? "";
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
const extraParams = computed(() => {
|
|
381
|
+
const routeParams2 = isOwnRoutePage(route.path, props.category, props.name) ? { ...route.params, ...route.query } : {};
|
|
382
|
+
return buildExtraParams(routeParams2, props.parentParams);
|
|
383
|
+
});
|
|
384
|
+
const routeParams = computed(() => ({
|
|
385
|
+
...route.params,
|
|
386
|
+
...extraParams.value
|
|
387
|
+
}));
|
|
388
|
+
const selectedId = computed(
|
|
389
|
+
() => selectedKeys.value.length === 1 ? selectedKeys.value[0] : void 0
|
|
390
|
+
);
|
|
391
|
+
const hasSelection = computed(() => selectedKeys.value.length === 1);
|
|
392
|
+
const mappings = computed(() => {
|
|
393
|
+
var _a;
|
|
394
|
+
const raw = (_a = config.value) == null ? void 0 : _a.mappings;
|
|
395
|
+
if (Array.isArray(raw)) return raw;
|
|
396
|
+
if (typeof raw === "string") {
|
|
397
|
+
try {
|
|
398
|
+
const parsed = JSON.parse(raw);
|
|
399
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
400
|
+
} catch {
|
|
401
|
+
return [];
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return [];
|
|
405
|
+
});
|
|
406
|
+
const selectedNode = computed(() => {
|
|
407
|
+
if (selectedId.value === void 0) return void 0;
|
|
408
|
+
return flatRows.value.find(
|
|
409
|
+
(r) => r != null && r.key !== void 0 && String(r.key) === String(selectedId.value)
|
|
410
|
+
);
|
|
411
|
+
});
|
|
412
|
+
const relationParams = computed(() => {
|
|
413
|
+
const base = { ...extraParams.value };
|
|
414
|
+
if (selectedId.value === void 0) return base;
|
|
415
|
+
const list = mappings.value;
|
|
416
|
+
if (list.length > 0 && selectedNode.value) {
|
|
417
|
+
const result = {};
|
|
418
|
+
for (const m of list) {
|
|
419
|
+
if (m == null ? void 0 : m.paramName) {
|
|
420
|
+
result[m.paramName] = evaluateMappedExpress(m.express, {
|
|
421
|
+
node: selectedNode.value,
|
|
422
|
+
router: routeParams.value
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return { ...base, ...result };
|
|
427
|
+
}
|
|
428
|
+
return base;
|
|
429
|
+
});
|
|
430
|
+
function resolveScopePath(scope, path) {
|
|
431
|
+
const segs = path.split(".").map((s) => s.trim()).filter(Boolean);
|
|
432
|
+
let cur = scope;
|
|
433
|
+
for (const seg of segs) {
|
|
434
|
+
if (cur === void 0 || cur === null) return void 0;
|
|
435
|
+
cur = cur[seg];
|
|
436
|
+
}
|
|
437
|
+
return cur;
|
|
438
|
+
}
|
|
439
|
+
function evaluateTreeExpress(expr, scope) {
|
|
440
|
+
const raw = (expr ?? "").trim();
|
|
441
|
+
if (!raw) return void 0;
|
|
442
|
+
if (raw.includes("${")) {
|
|
443
|
+
try {
|
|
444
|
+
return raw.replace(/\$\{([^}]+)\}/g, (_m, pathRaw) => {
|
|
445
|
+
const p = pathRaw.trim();
|
|
446
|
+
let val;
|
|
447
|
+
if (p.startsWith("node.") || p.startsWith("params.") || p.startsWith("router.")) {
|
|
448
|
+
val = resolveScopePath(scope, p);
|
|
449
|
+
} else {
|
|
450
|
+
val = resolveScopePath(scope, p) ?? resolveScopePath(scope, `node.${p}`) ?? resolveScopePath(scope, `params.${p}`) ?? resolveScopePath(scope, `router.${p}`);
|
|
451
|
+
}
|
|
452
|
+
return val === void 0 || val === null ? "" : String(val);
|
|
453
|
+
});
|
|
454
|
+
} catch {
|
|
455
|
+
return void 0;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return evaluateMappedExpress(raw, scope);
|
|
459
|
+
}
|
|
460
|
+
const relationTargetId = computed(() => {
|
|
461
|
+
var _a;
|
|
462
|
+
const expr = (_a = config.value) == null ? void 0 : _a.expressId;
|
|
463
|
+
if (!expr || !expr.trim()) return void 0;
|
|
464
|
+
const scope = {
|
|
465
|
+
node: selectedNode.value ?? {},
|
|
466
|
+
params: extraParams.value,
|
|
467
|
+
router: routeParams.value
|
|
468
|
+
};
|
|
469
|
+
const val = evaluateTreeExpress(expr, scope);
|
|
470
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
471
|
+
const s = String(val);
|
|
472
|
+
return s === "undefined" || s === "null" ? void 0 : s;
|
|
473
|
+
});
|
|
474
|
+
const hasRelation = computed(
|
|
475
|
+
() => Boolean(relationType.value && relationTargetName.value)
|
|
476
|
+
);
|
|
477
|
+
const parsedTools = computed(() => {
|
|
478
|
+
var _a;
|
|
479
|
+
return ((_a = config.value) == null ? void 0 : _a.toolBars) ?? [];
|
|
480
|
+
});
|
|
481
|
+
const toolLabelMap = {
|
|
482
|
+
add: "新增",
|
|
483
|
+
"navigate-form": "跳转表单",
|
|
484
|
+
"navigate-table": "跳转列表",
|
|
485
|
+
"navigate-combo": "跳转组合视图",
|
|
486
|
+
other: "其他"
|
|
487
|
+
};
|
|
488
|
+
function getToolLabel(tool) {
|
|
489
|
+
return tool.title || tool.label || toolLabelMap[tool.type ?? ""] || tool.type || "";
|
|
490
|
+
}
|
|
491
|
+
const navigateRouteMap = {
|
|
492
|
+
"navigate-form": "/design/form",
|
|
493
|
+
"navigate-table": "/design/table",
|
|
494
|
+
"navigate-combo": "/design/comb"
|
|
495
|
+
};
|
|
496
|
+
const toolScope = computed(() => ({
|
|
497
|
+
params: extraParams.value,
|
|
498
|
+
node: selectedNode.value ?? {},
|
|
499
|
+
router: routeParams.value
|
|
500
|
+
}));
|
|
501
|
+
const exprScope = computed(() => ({
|
|
502
|
+
params: extraParams.value,
|
|
503
|
+
node: selectedNode.value ?? {}
|
|
504
|
+
}));
|
|
505
|
+
function handleToolClick(tool, idx) {
|
|
506
|
+
var _a;
|
|
507
|
+
if (tool.type === "add") {
|
|
508
|
+
const inst = toolRefs.value[idx];
|
|
509
|
+
(_a = inst == null ? void 0 : inst.trigger) == null ? void 0 : _a.call(inst);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
const prefix = navigateRouteMap[tool.type ?? ""];
|
|
513
|
+
if (prefix) {
|
|
514
|
+
const targetCategory = tool.targetFormCategory || tool.targetTableCategory || tool.targetComboCategory || props.category;
|
|
515
|
+
const targetName = tool.targetFormName || tool.targetTableName || tool.targetComboName;
|
|
516
|
+
if (targetCategory && targetName) {
|
|
517
|
+
const query = buildMappedParams(tool, toolScope.value);
|
|
518
|
+
router.push({ path: `${prefix}/${targetCategory}/${targetName}`, query });
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (tool.type === "other") {
|
|
523
|
+
emit("tool-command", tool);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const toolRefs = ref({});
|
|
527
|
+
function setToolRef(idx) {
|
|
528
|
+
return (el) => {
|
|
529
|
+
toolRefs.value[idx] = el;
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
function handleToolSaved() {
|
|
533
|
+
var _a, _b;
|
|
534
|
+
(_b = (_a = tableRef.value) == null ? void 0 : _a.reload) == null ? void 0 : _b.call(_a);
|
|
535
|
+
}
|
|
536
|
+
const tableRef = ref();
|
|
537
|
+
watch(selectedId, async () => {
|
|
538
|
+
var _a, _b;
|
|
539
|
+
await nextTick();
|
|
540
|
+
(_b = (_a = tableRef.value) == null ? void 0 : _a.reload) == null ? void 0 : _b.call(_a);
|
|
541
|
+
});
|
|
542
|
+
const devState = computed(() => {
|
|
543
|
+
var _a, _b;
|
|
544
|
+
return {
|
|
545
|
+
props: {
|
|
546
|
+
category: props.category,
|
|
547
|
+
name: props.name,
|
|
548
|
+
config: props.config ? { id: props.config.id, name: props.config.name, title: props.config.title } : null,
|
|
549
|
+
parentParams: props.parentParams
|
|
550
|
+
},
|
|
551
|
+
route: {
|
|
552
|
+
params: route.params,
|
|
553
|
+
query: route.query
|
|
554
|
+
},
|
|
555
|
+
extraParams: extraParams.value,
|
|
556
|
+
routeParams: routeParams.value,
|
|
557
|
+
config: config.value ? {
|
|
558
|
+
name: config.value.name,
|
|
559
|
+
title: config.value.title,
|
|
560
|
+
dataSetName: config.value.dataSetName,
|
|
561
|
+
relationType: config.value.relationType,
|
|
562
|
+
relationTargetName: config.value.relationTargetName,
|
|
563
|
+
expressId: config.value.expressId,
|
|
564
|
+
mappings: config.value.mappings,
|
|
565
|
+
toolBars: config.value.toolBars
|
|
566
|
+
} : null,
|
|
567
|
+
tree: {
|
|
568
|
+
setType: ((_a = treeMeta.value) == null ? void 0 : _a.setType) ?? "",
|
|
569
|
+
requestMode: ((_b = treeMeta.value) == null ? void 0 : _b.requestMode) ?? "",
|
|
570
|
+
flatRowCount: flatRows.value.length,
|
|
571
|
+
treeRootCount: treeData.value.length
|
|
572
|
+
},
|
|
573
|
+
/** 节点数量(2026-10-23):配置 + 已取到的数量样本,排查「徽标不显示」看这里 */
|
|
574
|
+
nodeCount: nodeCountConfig.value ? {
|
|
575
|
+
enabled: true,
|
|
576
|
+
mode: nodeCountConfig.value.mode ?? "dataset",
|
|
577
|
+
keyColumn: nodeCountConfig.value.keyColumn,
|
|
578
|
+
valueColumn: nodeCountConfig.value.valueColumn,
|
|
579
|
+
matchField: nodeCountConfig.value.matchField || "(node.key)",
|
|
580
|
+
defaultValue: nodeCountConfig.value.defaultValue ?? "",
|
|
581
|
+
suffix: nodeCountConfig.value.suffix ?? "",
|
|
582
|
+
hideZero: nodeCountConfig.value.hideZero === true,
|
|
583
|
+
hitCount: Object.keys(nodeCountMap.value).length,
|
|
584
|
+
sample: Object.entries(nodeCountMap.value).slice(0, 5)
|
|
585
|
+
} : null,
|
|
586
|
+
selected: {
|
|
587
|
+
selectedId: selectedId.value,
|
|
588
|
+
selectedKeys: selectedKeys.value,
|
|
589
|
+
selectedNode: selectedNode.value,
|
|
590
|
+
relationTargetId: relationTargetId.value
|
|
591
|
+
},
|
|
592
|
+
relationParams: relationParams.value,
|
|
593
|
+
loading: loading.value,
|
|
594
|
+
error: error.value
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
watch(
|
|
598
|
+
() => parsedTools.value.map((tool) => tool.type),
|
|
599
|
+
(types) => types.forEach((type) => resolveToolComponent(type)),
|
|
600
|
+
{ immediate: true }
|
|
601
|
+
);
|
|
602
|
+
return (_ctx, _cache) => {
|
|
603
|
+
const _component_DesignTree = resolveComponent("DesignTree", true);
|
|
604
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
605
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
606
|
+
createVNode(unref(Spin), {
|
|
607
|
+
spinning: true,
|
|
608
|
+
tip: "加载树形视图配置中..."
|
|
609
|
+
})
|
|
610
|
+
])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
611
|
+
createVNode(unref(Alert), {
|
|
612
|
+
message: error.value,
|
|
613
|
+
type: "error",
|
|
614
|
+
"show-icon": "",
|
|
615
|
+
closable: "",
|
|
616
|
+
onClose: _cache[0] || (_cache[0] = ($event) => error.value = null)
|
|
617
|
+
}, null, 8, ["message"])
|
|
618
|
+
])) : !config.value ? (openBlock(), createBlock(unref(Result), {
|
|
619
|
+
key: 2,
|
|
620
|
+
status: "404",
|
|
621
|
+
title: "未发现树形视图配置",
|
|
622
|
+
"sub-title": "该视图尚未在构建端完成配置,或配置名称有误"
|
|
623
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
624
|
+
parsedTools.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
625
|
+
createVNode(unref(Space), null, {
|
|
626
|
+
default: withCtx(() => [
|
|
627
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedTools.value, (tool, idx) => {
|
|
628
|
+
return openBlock(), createBlock(unref(Button), {
|
|
629
|
+
key: idx,
|
|
630
|
+
type: tool.type === "add" ? "primary" : "default",
|
|
631
|
+
onClick: ($event) => handleToolClick(tool, idx)
|
|
632
|
+
}, {
|
|
633
|
+
default: withCtx(() => [
|
|
634
|
+
createTextVNode(toDisplayString(getToolLabel(tool)), 1)
|
|
635
|
+
]),
|
|
636
|
+
_: 2
|
|
637
|
+
}, 1032, ["type", "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
|
+
"extra-params": extraParams.value,
|
|
650
|
+
"mapping-scope": toolScope.value,
|
|
651
|
+
onSaved: handleToolSaved
|
|
652
|
+
}, null, 40, ["tool", "category", "extra-params", "mapping-scope"]);
|
|
653
|
+
}), 128))
|
|
654
|
+
])) : createCommentVNode("", true),
|
|
655
|
+
createElementVNode("div", _hoisted_6, [
|
|
656
|
+
createElementVNode("div", {
|
|
657
|
+
class: "design-tree-panel",
|
|
658
|
+
style: normalizeStyle({ width: treeWidth.value + "px" })
|
|
659
|
+
}, [
|
|
660
|
+
createElementVNode("div", _hoisted_7, [
|
|
661
|
+
treeError.value ? (openBlock(), createBlock(unref(Alert), {
|
|
662
|
+
key: 0,
|
|
663
|
+
type: "warning",
|
|
664
|
+
"show-icon": "",
|
|
665
|
+
message: treeError.value,
|
|
666
|
+
class: "mb-2"
|
|
667
|
+
}, null, 8, ["message"])) : createCommentVNode("", true),
|
|
668
|
+
treeLoading.value ? (openBlock(), createBlock(unref(Spin), {
|
|
669
|
+
key: 1,
|
|
670
|
+
spinning: true,
|
|
671
|
+
tip: "加载树数据中...",
|
|
672
|
+
class: "block py-8"
|
|
673
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
674
|
+
treeData.value.length > 0 ? (openBlock(), createBlock(unref(Tree), {
|
|
675
|
+
key: 0,
|
|
676
|
+
"selected-keys": selectedKeys.value,
|
|
677
|
+
"onUpdate:selectedKeys": _cache[1] || (_cache[1] = ($event) => selectedKeys.value = $event),
|
|
678
|
+
"expanded-keys": expandedKeys.value,
|
|
679
|
+
"onUpdate:expandedKeys": _cache[2] || (_cache[2] = ($event) => expandedKeys.value = $event),
|
|
680
|
+
"field-names": { title: "title", key: "key", children: "children" },
|
|
681
|
+
"show-line": { showLeafIcon: false },
|
|
682
|
+
"tree-data": treeData.value,
|
|
683
|
+
"load-data": onTreeLoadData,
|
|
684
|
+
virtual: false,
|
|
685
|
+
class: "design-tree__tree",
|
|
686
|
+
styles: {
|
|
687
|
+
item: {
|
|
688
|
+
"--ant-tree-node-selected-bg": "var(--ant-color-primary-bg-hover)"
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
onSelect: handleTreeSelect
|
|
692
|
+
}, {
|
|
693
|
+
titleRender: withCtx((node) => [
|
|
694
|
+
nodeCountConfig.value ? (openBlock(), createElementBlock("span", {
|
|
695
|
+
key: 0,
|
|
696
|
+
class: "tree-node-title",
|
|
697
|
+
title: String((node == null ? void 0 : node.title) ?? "")
|
|
698
|
+
}, [
|
|
699
|
+
createElementVNode("span", _hoisted_9, toDisplayString(node == null ? void 0 : node.title), 1),
|
|
700
|
+
countTextOf(node) ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(countTextOf(node)), 1)) : createCommentVNode("", true)
|
|
701
|
+
], 8, _hoisted_8)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
702
|
+
createTextVNode(toDisplayString(node == null ? void 0 : node.title), 1)
|
|
703
|
+
], 64))
|
|
704
|
+
]),
|
|
705
|
+
_: 1
|
|
706
|
+
}, 8, ["selected-keys", "expanded-keys", "tree-data"])) : !treeError.value ? (openBlock(), createBlock(unref(Empty), {
|
|
707
|
+
key: 1,
|
|
708
|
+
image: unref(Empty).PRESENTED_IMAGE_SIMPLE,
|
|
709
|
+
description: "暂无数据",
|
|
710
|
+
class: "pt-8"
|
|
711
|
+
}, null, 8, ["image"])) : createCommentVNode("", true)
|
|
712
|
+
], 64))
|
|
713
|
+
])
|
|
714
|
+
], 4),
|
|
715
|
+
createElementVNode("div", {
|
|
716
|
+
class: "design-tree-resizer",
|
|
717
|
+
title: "拖拽调整树宽",
|
|
718
|
+
onMousedown: withModifiers(onResizeStart, ["prevent"])
|
|
719
|
+
}, null, 32),
|
|
720
|
+
createElementVNode("div", _hoisted_11, [
|
|
721
|
+
!hasRelation.value ? (openBlock(), createElementBlock("div", _hoisted_12, [
|
|
722
|
+
createVNode(unref(Empty), { description: "未配置关联目标" })
|
|
723
|
+
])) : !hasSelection.value ? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
724
|
+
createVNode(unref(Empty), { description: "请选择左侧节点" })
|
|
725
|
+
])) : relationType.value === "form" ? (openBlock(), createBlock(DesignForm, {
|
|
726
|
+
key: 2,
|
|
727
|
+
category: __props.category,
|
|
728
|
+
name: relationTargetName.value,
|
|
729
|
+
"source-id": relationTargetId.value,
|
|
730
|
+
"parent-params": relationParams.value,
|
|
731
|
+
"dev-button-top": 48
|
|
732
|
+
}, null, 8, ["category", "name", "source-id", "parent-params"])) : relationType.value === "table" ? (openBlock(), createBlock(DesignTable, {
|
|
733
|
+
key: 3,
|
|
734
|
+
ref_key: "tableRef",
|
|
735
|
+
ref: tableRef,
|
|
736
|
+
category: __props.category,
|
|
737
|
+
name: relationTargetName.value,
|
|
738
|
+
"parent-params": relationParams.value,
|
|
739
|
+
"no-page": true,
|
|
740
|
+
"table-height": "100%",
|
|
741
|
+
"dev-button-top": 48
|
|
742
|
+
}, null, 8, ["category", "name", "parent-params"])) : relationType.value === "comboView" ? (openBlock(), createBlock(DesignComb, {
|
|
743
|
+
key: 4,
|
|
744
|
+
category: __props.category,
|
|
745
|
+
name: relationTargetName.value,
|
|
746
|
+
"source-id": relationTargetId.value,
|
|
747
|
+
"parent-params": relationParams.value,
|
|
748
|
+
"dev-button-top": 48
|
|
749
|
+
}, null, 8, ["category", "name", "source-id", "parent-params"])) : relationType.value === "tree" ? (openBlock(), createBlock(_component_DesignTree, {
|
|
750
|
+
key: 5,
|
|
751
|
+
category: __props.category,
|
|
752
|
+
name: relationTargetName.value,
|
|
753
|
+
"parent-params": relationParams.value,
|
|
754
|
+
"dev-button-top": 48
|
|
755
|
+
}, null, 8, ["category", "name", "parent-params"])) : (openBlock(), createBlock(unref(Alert), {
|
|
756
|
+
key: 6,
|
|
757
|
+
type: "warning",
|
|
758
|
+
"show-icon": "",
|
|
759
|
+
message: `不支持的关联类型: ${relationType.value}`
|
|
760
|
+
}, null, 8, ["message"]))
|
|
761
|
+
])
|
|
762
|
+
])
|
|
763
|
+
])),
|
|
764
|
+
createVNode(DesignDevStateButton, {
|
|
765
|
+
"designer-category": __props.category,
|
|
766
|
+
"designer-name": __props.name,
|
|
767
|
+
"expr-scope": exprScope.value,
|
|
768
|
+
"expr-scope-labels": {
|
|
769
|
+
params: "组件自身参数(extraParams,已含路由参数)",
|
|
770
|
+
node: "当前选中节点"
|
|
771
|
+
},
|
|
772
|
+
state: devState.value,
|
|
773
|
+
top: __props.devButtonTop,
|
|
774
|
+
"designer-type": "tree",
|
|
775
|
+
title: "DesignTree"
|
|
776
|
+
}, null, 8, ["designer-category", "designer-name", "expr-scope", "state", "top"])
|
|
777
|
+
]);
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
export {
|
|
782
|
+
_sfc_main as default
|
|
783
|
+
};
|