@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,937 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, nextTick, onUnmounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, unref, createBlock, Fragment, resolveDynamicComponent, withCtx, createSlots, createElementVNode, renderList, createTextVNode, toDisplayString, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { useRoute } from "vue-router";
|
|
3
|
+
import { UnorderedListOutlined, MoreOutlined, ExportOutlined, InboxOutlined, DownloadOutlined, PlusOutlined } from "@antdv-next/icons";
|
|
4
|
+
import { Spin, Alert, Result, Space } from "antdv-next";
|
|
5
|
+
import { fetchTableConfig, fetchSearchConfig } from "../../api.js";
|
|
6
|
+
import { designFlowRemove, designFlowStatus } from "../../flow.js";
|
|
7
|
+
import { getHostUi, requireVxeGrid, requireHttp } from "../../host.js";
|
|
8
|
+
import { isOwnRoutePage, buildExtraParams } from "../../mapping.js";
|
|
9
|
+
import { resolveDesignComponent } from "../../registry.js";
|
|
10
|
+
import { buildSearchFormOptions } from "../../search/transformer.js";
|
|
11
|
+
import { evaluateLoadGate } from "../../table/load-gate.js";
|
|
12
|
+
import { buildQuerySearch } from "../../table/query-search.js";
|
|
13
|
+
import { createQueryDedupe } from "../../table/query-dedupe.js";
|
|
14
|
+
import { transformTableConfig } from "../../table/transformer.js";
|
|
15
|
+
import { platformMessage, buildHostApi } from "../design-shared/host-api.js";
|
|
16
|
+
import { resolveToolComponent } from "../design-tools/index.js";
|
|
17
|
+
import DesignDevStateButton from "../design-debug/dev-state-button.vue.js";
|
|
18
|
+
import FlowStatusCell from "../flow-status-cell/flow-status-cell.vue.js";
|
|
19
|
+
import { resolveRowActionComponent } from "./row-actions/index.js";
|
|
20
|
+
const _hoisted_1 = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "flex-center py-20"
|
|
23
|
+
};
|
|
24
|
+
const _hoisted_2 = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "py-8"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_3 = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "design-table__title"
|
|
31
|
+
};
|
|
32
|
+
const _hoisted_4 = { class: "design-table__toolbar" };
|
|
33
|
+
const _hoisted_5 = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "vxe-icon-fullscreen"
|
|
36
|
+
};
|
|
37
|
+
const _hoisted_6 = {
|
|
38
|
+
key: 1,
|
|
39
|
+
class: "vxe-icon-minimize"
|
|
40
|
+
};
|
|
41
|
+
const _hoisted_7 = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "design-table__title"
|
|
44
|
+
};
|
|
45
|
+
const _hoisted_8 = { class: "design-table__toolbar" };
|
|
46
|
+
const _hoisted_9 = {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: "vxe-icon-fullscreen"
|
|
49
|
+
};
|
|
50
|
+
const _hoisted_10 = {
|
|
51
|
+
key: 1,
|
|
52
|
+
class: "vxe-icon-minimize"
|
|
53
|
+
};
|
|
54
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
55
|
+
...{ name: "DesignTable" },
|
|
56
|
+
__name: "design-table",
|
|
57
|
+
props: {
|
|
58
|
+
category: { default: "" },
|
|
59
|
+
name: { default: "" },
|
|
60
|
+
config: { default: null },
|
|
61
|
+
parentParams: { default: void 0 },
|
|
62
|
+
search: { default: void 0 },
|
|
63
|
+
noPage: { type: Boolean, default: false },
|
|
64
|
+
tableHeight: { default: void 0 },
|
|
65
|
+
devButtonTop: { default: 10 }
|
|
66
|
+
},
|
|
67
|
+
emits: ["tool-command", "row-command", "deleted", "loaded", "update:title"],
|
|
68
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
69
|
+
const pageShell = computed(() => getHostUi().Page ?? "div");
|
|
70
|
+
const props = __props;
|
|
71
|
+
const route = useRoute();
|
|
72
|
+
const extraParams = computed(() => {
|
|
73
|
+
const routeParams = isOwnRoutePage(route.path, props.category, props.name) ? { ...route.params, ...route.query } : {};
|
|
74
|
+
return buildExtraParams(routeParams, props.parentParams);
|
|
75
|
+
});
|
|
76
|
+
const emit = __emit;
|
|
77
|
+
const loading = ref(false);
|
|
78
|
+
const error = ref(null);
|
|
79
|
+
const config = ref(null);
|
|
80
|
+
const summaries = ref({});
|
|
81
|
+
const searchFormOptions = ref(void 0);
|
|
82
|
+
const lastQuerySearch = ref(null);
|
|
83
|
+
const lastFormValues = ref(null);
|
|
84
|
+
function emitTitle() {
|
|
85
|
+
const cfg = config.value;
|
|
86
|
+
const runtimeTitle = String((cfg == null ? void 0 : cfg.runtimeTitle) || "").trim();
|
|
87
|
+
if (runtimeTitle) {
|
|
88
|
+
emit("update:title", runtimeTitle);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function loadConfig() {
|
|
92
|
+
if (props.config) {
|
|
93
|
+
config.value = props.config;
|
|
94
|
+
loading.value = false;
|
|
95
|
+
await loadSearchForm();
|
|
96
|
+
emit("loaded", props.config);
|
|
97
|
+
emitTitle();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!props.category || !props.name) return;
|
|
101
|
+
loading.value = true;
|
|
102
|
+
error.value = null;
|
|
103
|
+
try {
|
|
104
|
+
const resp = await fetchTableConfig(
|
|
105
|
+
props.category,
|
|
106
|
+
props.name,
|
|
107
|
+
extraParams.value ?? {}
|
|
108
|
+
);
|
|
109
|
+
config.value = resp;
|
|
110
|
+
await loadSearchForm();
|
|
111
|
+
emit("loaded", resp ?? null);
|
|
112
|
+
emitTitle();
|
|
113
|
+
} catch (err) {
|
|
114
|
+
const msg = (err == null ? void 0 : err.message) ?? "";
|
|
115
|
+
if (msg.includes("未发现")) {
|
|
116
|
+
config.value = null;
|
|
117
|
+
} else {
|
|
118
|
+
error.value = msg || "加载表格配置失败";
|
|
119
|
+
config.value = null;
|
|
120
|
+
}
|
|
121
|
+
emit("loaded", null);
|
|
122
|
+
} finally {
|
|
123
|
+
loading.value = false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function loadSearchForm() {
|
|
127
|
+
var _a;
|
|
128
|
+
const searchName = (_a = config.value) == null ? void 0 : _a.searchForm;
|
|
129
|
+
if (!searchName || !props.category) {
|
|
130
|
+
searchFormOptions.value = void 0;
|
|
131
|
+
searchMeta.value = {};
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const resp = await fetchSearchConfig(props.category, searchName);
|
|
136
|
+
searchFormOptions.value = buildSearchFormOptions(resp);
|
|
137
|
+
searchMeta.value = {
|
|
138
|
+
firstLoadSubmit: (resp == null ? void 0 : resp.firstLoadSubmit) ?? null
|
|
139
|
+
};
|
|
140
|
+
} catch {
|
|
141
|
+
searchFormOptions.value = void 0;
|
|
142
|
+
searchMeta.value = {};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
watch(
|
|
146
|
+
() => [props.category, props.name, props.config],
|
|
147
|
+
() => loadConfig(),
|
|
148
|
+
{ immediate: true }
|
|
149
|
+
);
|
|
150
|
+
const extraParamsRef = ref({});
|
|
151
|
+
watch(
|
|
152
|
+
() => extraParams.value,
|
|
153
|
+
(val) => {
|
|
154
|
+
extraParamsRef.value = val ?? {};
|
|
155
|
+
},
|
|
156
|
+
{ immediate: true }
|
|
157
|
+
);
|
|
158
|
+
const queryDedupe = createQueryDedupe();
|
|
159
|
+
function buildQueryKey(page, search, envParams) {
|
|
160
|
+
try {
|
|
161
|
+
return JSON.stringify({
|
|
162
|
+
page: page && typeof page === "object" ? { currentPage: page.currentPage, pageSize: page.pageSize } : page,
|
|
163
|
+
search,
|
|
164
|
+
env: envParams ?? {}
|
|
165
|
+
});
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const transformHost = {
|
|
171
|
+
resolveCustom: (comname) => resolveDesignComponent(comname),
|
|
172
|
+
getParams: () => extraParamsRef.value ?? {},
|
|
173
|
+
getApi: () => buildHostApi({ reload: () => onReloadTable() }),
|
|
174
|
+
/**
|
|
175
|
+
* 数据接口带回的运行时标题(2026-10-22):列表的标题表达式由后端按 params/search 求值,
|
|
176
|
+
* 随 pager 响应返回,这里转成 `update:title` 给外壳刷标签页/浏览器标题。
|
|
177
|
+
*/
|
|
178
|
+
onRuntimeTitle: (title) => emit("update:title", title),
|
|
179
|
+
/** 合计行:footerMethod 渲染时读取(值来自数据接口的 summaries) */
|
|
180
|
+
getSummaries: () => summaries.value,
|
|
181
|
+
onSummaries: (next) => {
|
|
182
|
+
summaries.value = next ?? {};
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const extraConfig = computed(() => {
|
|
186
|
+
var _a;
|
|
187
|
+
const raw = (_a = config.value) == null ? void 0 : _a.extraConfig;
|
|
188
|
+
if (!raw) return {};
|
|
189
|
+
if (typeof raw === "object") return raw;
|
|
190
|
+
try {
|
|
191
|
+
const parsed = JSON.parse(String(raw));
|
|
192
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
193
|
+
} catch {
|
|
194
|
+
console.warn("[design-table] 附加配置(extraConfig) 不是合法 JSON,已忽略");
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const gateWhen = computed(() => {
|
|
199
|
+
const when = (extraConfig.value.query ?? {}).when;
|
|
200
|
+
return typeof when === "string" ? when.trim() : "";
|
|
201
|
+
});
|
|
202
|
+
const firstQuerySkipped = ref(false);
|
|
203
|
+
const searchMeta = ref({});
|
|
204
|
+
const skipFirstQuery = computed(() => {
|
|
205
|
+
var _a;
|
|
206
|
+
const value = (_a = searchMeta.value) == null ? void 0 : _a.firstLoadSubmit;
|
|
207
|
+
return value === 0 || value === "0";
|
|
208
|
+
});
|
|
209
|
+
const gridOptions = computed(() => {
|
|
210
|
+
var _a, _b, _c;
|
|
211
|
+
if (!config.value) return {};
|
|
212
|
+
const result = transformTableConfig(
|
|
213
|
+
config.value,
|
|
214
|
+
props.tableHeight,
|
|
215
|
+
transformHost
|
|
216
|
+
).gridOptions;
|
|
217
|
+
const originalQuery = (_b = (_a = result.proxyConfig) == null ? void 0 : _a.ajax) == null ? void 0 : _b.query;
|
|
218
|
+
if (originalQuery) {
|
|
219
|
+
result.proxyConfig = {
|
|
220
|
+
...result.proxyConfig,
|
|
221
|
+
ajax: {
|
|
222
|
+
...(_c = result.proxyConfig) == null ? void 0 : _c.ajax,
|
|
223
|
+
query: async (page, formValues = {}) => {
|
|
224
|
+
const search = buildQuerySearch(props.search, formValues);
|
|
225
|
+
lastQuerySearch.value = { ...search };
|
|
226
|
+
lastFormValues.value = { ...formValues };
|
|
227
|
+
const envParams = extraParamsRef.value || {};
|
|
228
|
+
const emptyPage = { records: [], total: 0 };
|
|
229
|
+
if (skipFirstQuery.value && !firstQuerySkipped.value) {
|
|
230
|
+
firstQuerySkipped.value = true;
|
|
231
|
+
return emptyPage;
|
|
232
|
+
}
|
|
233
|
+
if (gateWhen.value) {
|
|
234
|
+
const gate = evaluateLoadGate(gateWhen.value, {
|
|
235
|
+
params: envParams,
|
|
236
|
+
search
|
|
237
|
+
});
|
|
238
|
+
if (!gate.ok) {
|
|
239
|
+
console.debug(
|
|
240
|
+
"[design-table] 加载条件未满足,跳过请求:",
|
|
241
|
+
gateWhen.value,
|
|
242
|
+
gate.error ? `(${gate.error})` : ""
|
|
243
|
+
);
|
|
244
|
+
return emptyPage;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const exec = async () => {
|
|
248
|
+
var _a2;
|
|
249
|
+
const data = await originalQuery(page, { ...search }, envParams);
|
|
250
|
+
const pf = ((_a2 = config.value) == null ? void 0 : _a2.pfield) || "id";
|
|
251
|
+
const records = Array.isArray(data == null ? void 0 : data.records) ? data.records : Array.isArray(data == null ? void 0 : data.datas) ? data.datas : Array.isArray(data) ? data : [];
|
|
252
|
+
await syncFlowStatuses(records, pf);
|
|
253
|
+
return data;
|
|
254
|
+
};
|
|
255
|
+
const key = buildQueryKey(page, search, envParams);
|
|
256
|
+
return key === null ? exec() : queryDedupe.run(key, exec);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
result.toolbarConfig = {
|
|
262
|
+
...result.toolbarConfig,
|
|
263
|
+
custom: true,
|
|
264
|
+
zoom: false,
|
|
265
|
+
refresh: false
|
|
266
|
+
};
|
|
267
|
+
result.minHeight = 0;
|
|
268
|
+
const cols = result.columns ?? [];
|
|
269
|
+
if (flowAware.value && !cols.some((c) => c.field === "__flowStatus")) {
|
|
270
|
+
const flowCol = {
|
|
271
|
+
field: "__flowStatus",
|
|
272
|
+
title: "流程状态",
|
|
273
|
+
width: 150,
|
|
274
|
+
resizable: false,
|
|
275
|
+
slots: { default: "flowStatus" }
|
|
276
|
+
};
|
|
277
|
+
const actionIdx = cols.findIndex(
|
|
278
|
+
(c) => {
|
|
279
|
+
var _a2;
|
|
280
|
+
return ((_a2 = c.slots) == null ? void 0 : _a2.default) === "action" || c.type === "action";
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
if (actionIdx >= 0) {
|
|
284
|
+
cols.splice(actionIdx, 0, flowCol);
|
|
285
|
+
} else {
|
|
286
|
+
cols.push(flowCol);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return result;
|
|
290
|
+
});
|
|
291
|
+
const gridKey = ref(0);
|
|
292
|
+
watch(
|
|
293
|
+
() => config.value,
|
|
294
|
+
(val, oldVal) => {
|
|
295
|
+
if (val !== oldVal) {
|
|
296
|
+
queryDedupe.markRebuild();
|
|
297
|
+
gridKey.value += 1;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
const tableTitle = computed(() => {
|
|
302
|
+
var _a;
|
|
303
|
+
return ((_a = config.value) == null ? void 0 : _a.title) ?? "";
|
|
304
|
+
});
|
|
305
|
+
const pfield = computed(() => {
|
|
306
|
+
var _a;
|
|
307
|
+
return ((_a = config.value) == null ? void 0 : _a.pfield) || "id";
|
|
308
|
+
});
|
|
309
|
+
const flowMap = ref({});
|
|
310
|
+
const flowAware = ref(false);
|
|
311
|
+
function resolveFlowBusinessType() {
|
|
312
|
+
const c = config.value ?? {};
|
|
313
|
+
return (c.relationTableName || c.tableName || c.name || props.name || "").trim();
|
|
314
|
+
}
|
|
315
|
+
const parsedTools = computed(() => {
|
|
316
|
+
var _a;
|
|
317
|
+
return ((_a = config.value) == null ? void 0 : _a.toolBars) ?? [];
|
|
318
|
+
});
|
|
319
|
+
const toolLabelMap = {
|
|
320
|
+
add: "新增",
|
|
321
|
+
export: "导出",
|
|
322
|
+
import: "导入",
|
|
323
|
+
"modal-combo": "弹窗组合视图",
|
|
324
|
+
"modal-form": "弹窗表单",
|
|
325
|
+
"modal-table": "弹窗列表",
|
|
326
|
+
"modal-tree": "弹窗树形视图",
|
|
327
|
+
"navigate-combo": "跳转组合视图",
|
|
328
|
+
"navigate-form": "跳转表单",
|
|
329
|
+
"navigate-table": "跳转表格",
|
|
330
|
+
other: "其他"
|
|
331
|
+
};
|
|
332
|
+
function getToolLabel(tool) {
|
|
333
|
+
return tool.title || tool.label || toolLabelMap[tool.type ?? ""] || tool.type || "";
|
|
334
|
+
}
|
|
335
|
+
const toolIconMap = {
|
|
336
|
+
add: PlusOutlined,
|
|
337
|
+
export: DownloadOutlined,
|
|
338
|
+
import: InboxOutlined,
|
|
339
|
+
"navigate-form": ExportOutlined,
|
|
340
|
+
"navigate-table": ExportOutlined,
|
|
341
|
+
"navigate-combo": ExportOutlined,
|
|
342
|
+
other: MoreOutlined
|
|
343
|
+
};
|
|
344
|
+
function toolIcon(tool) {
|
|
345
|
+
return toolIconMap[tool.type ?? ""] || PlusOutlined;
|
|
346
|
+
}
|
|
347
|
+
const parsedActions = computed(() => {
|
|
348
|
+
var _a;
|
|
349
|
+
return ((_a = config.value) == null ? void 0 : _a.rowActions) ?? [];
|
|
350
|
+
});
|
|
351
|
+
const hasAutoActions = computed(() => {
|
|
352
|
+
var _a;
|
|
353
|
+
const columns = (_a = gridOptions.value) == null ? void 0 : _a.columns;
|
|
354
|
+
return Array.isArray(columns) ? columns.some((c) => {
|
|
355
|
+
var _a2;
|
|
356
|
+
return ((_a2 = c.slots) == null ? void 0 : _a2.default) === "action";
|
|
357
|
+
}) : false;
|
|
358
|
+
});
|
|
359
|
+
function handleRowSaved() {
|
|
360
|
+
var _a;
|
|
361
|
+
(_a = gridApi == null ? void 0 : gridApi.query) == null ? void 0 : _a.call(gridApi);
|
|
362
|
+
}
|
|
363
|
+
function handleRowDeleted(row) {
|
|
364
|
+
handleDelete(row);
|
|
365
|
+
}
|
|
366
|
+
function handleRowCommand(action, row) {
|
|
367
|
+
emit("row-command", action, row);
|
|
368
|
+
}
|
|
369
|
+
const toolRefs = ref({});
|
|
370
|
+
function setToolRef(idx) {
|
|
371
|
+
return (el) => {
|
|
372
|
+
toolRefs.value[idx] = el;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
function handleToolSaved() {
|
|
376
|
+
var _a;
|
|
377
|
+
(_a = gridApi == null ? void 0 : gridApi.query) == null ? void 0 : _a.call(gridApi);
|
|
378
|
+
}
|
|
379
|
+
function handleToolImported() {
|
|
380
|
+
var _a;
|
|
381
|
+
(_a = gridApi == null ? void 0 : gridApi.query) == null ? void 0 : _a.call(gridApi);
|
|
382
|
+
}
|
|
383
|
+
function handleToolCommand(tool) {
|
|
384
|
+
emit("tool-command", tool);
|
|
385
|
+
}
|
|
386
|
+
function handleToolClick(_tool, idx) {
|
|
387
|
+
var _a;
|
|
388
|
+
const inst = toolRefs.value[idx];
|
|
389
|
+
(_a = inst == null ? void 0 : inst.trigger) == null ? void 0 : _a.call(inst);
|
|
390
|
+
}
|
|
391
|
+
const tableFull = ref(false);
|
|
392
|
+
const gridHeightPx = ref(null);
|
|
393
|
+
const rootRef = ref(null);
|
|
394
|
+
let gridHeightTimer;
|
|
395
|
+
let gridHeightPoll;
|
|
396
|
+
let gridHeightObserver = null;
|
|
397
|
+
let gridHeightStable = 0;
|
|
398
|
+
let baseOverflow = 0;
|
|
399
|
+
function measureGridHeight() {
|
|
400
|
+
const host = rootRef.value;
|
|
401
|
+
if (!host) return;
|
|
402
|
+
const gridEl = host.querySelector(".vxe-grid");
|
|
403
|
+
if (!gridEl) return;
|
|
404
|
+
const wrap = host.querySelector(".vxe-grid--table-wrapper");
|
|
405
|
+
const inner = host.querySelector(".vxe-table--body-inner-wrapper");
|
|
406
|
+
const h = Math.round(gridEl.getBoundingClientRect().height);
|
|
407
|
+
if (h <= 0) return;
|
|
408
|
+
if (gridHeightPx.value == null && wrap && inner) {
|
|
409
|
+
baseOverflow = Math.max(
|
|
410
|
+
0,
|
|
411
|
+
Math.round(inner.getBoundingClientRect().bottom - wrap.getBoundingClientRect().bottom)
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
const target = Math.max(40, h - baseOverflow);
|
|
415
|
+
if (gridHeightPx.value == null || Math.abs(target - gridHeightPx.value) >= 2) {
|
|
416
|
+
gridHeightPx.value = target;
|
|
417
|
+
gridHeightStable = 0;
|
|
418
|
+
} else {
|
|
419
|
+
gridHeightStable += 1;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function stopGridHeightPoll() {
|
|
423
|
+
window.clearInterval(gridHeightPoll);
|
|
424
|
+
gridHeightPoll = void 0;
|
|
425
|
+
}
|
|
426
|
+
function startGridHeightPoll() {
|
|
427
|
+
stopGridHeightPoll();
|
|
428
|
+
gridHeightStable = 0;
|
|
429
|
+
gridHeightPoll = window.setInterval(() => {
|
|
430
|
+
if (gridHeightPx.value != null && gridHeightStable >= 3) {
|
|
431
|
+
stopGridHeightPoll();
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
measureGridHeight();
|
|
435
|
+
}, 250);
|
|
436
|
+
}
|
|
437
|
+
function scheduleGridHeight() {
|
|
438
|
+
window.clearTimeout(gridHeightTimer);
|
|
439
|
+
gridHeightTimer = window.setTimeout(() => {
|
|
440
|
+
measureGridHeight();
|
|
441
|
+
}, 60);
|
|
442
|
+
}
|
|
443
|
+
onMounted(() => {
|
|
444
|
+
startGridHeightPoll();
|
|
445
|
+
gridHeightObserver = new ResizeObserver(scheduleGridHeight);
|
|
446
|
+
if (rootRef.value) {
|
|
447
|
+
gridHeightObserver.observe(rootRef.value);
|
|
448
|
+
}
|
|
449
|
+
window.addEventListener("resize", scheduleGridHeight);
|
|
450
|
+
});
|
|
451
|
+
watch(
|
|
452
|
+
() => [config.value, tableFull.value],
|
|
453
|
+
() => {
|
|
454
|
+
startGridHeightPoll();
|
|
455
|
+
nextTick(() => {
|
|
456
|
+
measureGridHeight();
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
const gridHeightProp = computed(
|
|
461
|
+
() => gridHeightPx.value ?? void 0
|
|
462
|
+
);
|
|
463
|
+
onUnmounted(() => {
|
|
464
|
+
stopGridHeightPoll();
|
|
465
|
+
window.clearTimeout(gridHeightTimer);
|
|
466
|
+
window.removeEventListener("resize", scheduleGridHeight);
|
|
467
|
+
gridHeightObserver == null ? void 0 : gridHeightObserver.disconnect();
|
|
468
|
+
gridHeightObserver = null;
|
|
469
|
+
});
|
|
470
|
+
function onReloadTable() {
|
|
471
|
+
var _a;
|
|
472
|
+
if ((_a = gridApi == null ? void 0 : gridApi.grid) == null ? void 0 : _a.commitProxy) {
|
|
473
|
+
queryDedupe.reset();
|
|
474
|
+
void gridApi.query();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function onToggleFullscreen() {
|
|
478
|
+
tableFull.value = !tableFull.value;
|
|
479
|
+
}
|
|
480
|
+
function onToggleColumnSetting() {
|
|
481
|
+
var _a, _b;
|
|
482
|
+
(_b = (_a = gridApi == null ? void 0 : gridApi.grid) == null ? void 0 : _a.toggleCustom) == null ? void 0 : _b.call(_a);
|
|
483
|
+
}
|
|
484
|
+
const deleting = ref(false);
|
|
485
|
+
async function handleDelete(row) {
|
|
486
|
+
var _a, _b, _c, _d;
|
|
487
|
+
const url = (_a = config.value) == null ? void 0 : _a.deleteUrl;
|
|
488
|
+
if (!url) {
|
|
489
|
+
console.error("删除失败:未配置 deleteUrl");
|
|
490
|
+
platformMessage().error("删除失败:列表未配置「删除地址」(列表维护 → 删除地址)");
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const pf = ((_b = config.value) == null ? void 0 : _b.pfield) || "id";
|
|
494
|
+
const flowBt = resolveFlowBusinessType();
|
|
495
|
+
if (flowBt) {
|
|
496
|
+
try {
|
|
497
|
+
await designFlowRemove({
|
|
498
|
+
businessType: flowBt,
|
|
499
|
+
businessIds: [row[pf]]
|
|
500
|
+
});
|
|
501
|
+
} catch (err) {
|
|
502
|
+
platformMessage().error((err == null ? void 0 : err.message) ?? "删除失败:流程关联清理未通过");
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
deleting.value = true;
|
|
507
|
+
try {
|
|
508
|
+
const pfield2 = ((_c = config.value) == null ? void 0 : _c.pfield) || "id";
|
|
509
|
+
await requireHttp().post(url, { id: row[pfield2] });
|
|
510
|
+
emit("deleted");
|
|
511
|
+
(_d = gridApi == null ? void 0 : gridApi.query) == null ? void 0 : _d.call(gridApi);
|
|
512
|
+
} catch (err) {
|
|
513
|
+
console.error("删除失败:", (err == null ? void 0 : err.message) ?? err);
|
|
514
|
+
} finally {
|
|
515
|
+
deleting.value = false;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async function syncFlowStatuses(records, pf) {
|
|
519
|
+
const bt = resolveFlowBusinessType();
|
|
520
|
+
if (!bt || !Array.isArray(records) || records.length === 0) return;
|
|
521
|
+
const ids = [];
|
|
522
|
+
for (const r of records) {
|
|
523
|
+
const v = r == null ? void 0 : r[pf];
|
|
524
|
+
if (v !== void 0 && v !== null && v !== "") ids.push(v);
|
|
525
|
+
}
|
|
526
|
+
if (ids.length === 0) return;
|
|
527
|
+
try {
|
|
528
|
+
const list = await designFlowStatus({ businessType: bt, businessIds: ids });
|
|
529
|
+
const map = {};
|
|
530
|
+
for (const vo of list ?? []) {
|
|
531
|
+
if ((vo == null ? void 0 : vo.businessId) != null) map[String(vo.businessId)] = vo;
|
|
532
|
+
}
|
|
533
|
+
flowMap.value = map;
|
|
534
|
+
if (!flowAware.value && Object.keys(map).length > 0) {
|
|
535
|
+
flowAware.value = true;
|
|
536
|
+
}
|
|
537
|
+
} catch (err) {
|
|
538
|
+
console.error("[design-table] 流程状态查询失败:", (err == null ? void 0 : err.message) ?? err);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
watch(flowAware, (val) => {
|
|
542
|
+
if (val) {
|
|
543
|
+
queryDedupe.markRebuild();
|
|
544
|
+
gridKey.value += 1;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
const [Grid, gridApi] = requireVxeGrid()({
|
|
548
|
+
gridOptions: gridOptions.value
|
|
549
|
+
});
|
|
550
|
+
function currentFormValues() {
|
|
551
|
+
var _a, _b, _c, _d;
|
|
552
|
+
try {
|
|
553
|
+
const formValues = (_b = (_a = gridApi == null ? void 0 : gridApi.formApi) == null ? void 0 : _a.form) == null ? void 0 : _b.values;
|
|
554
|
+
if (formValues && typeof formValues === "object") {
|
|
555
|
+
return { ...formValues };
|
|
556
|
+
}
|
|
557
|
+
const submitted = (_d = (_c = gridApi == null ? void 0 : gridApi.formApi) == null ? void 0 : _c.getLatestSubmissionValues) == null ? void 0 : _d.call(_c);
|
|
558
|
+
if (submitted && typeof submitted === "object") {
|
|
559
|
+
return { ...submitted };
|
|
560
|
+
}
|
|
561
|
+
} catch {
|
|
562
|
+
}
|
|
563
|
+
return lastFormValues.value ?? {};
|
|
564
|
+
}
|
|
565
|
+
const devState = computed(() => {
|
|
566
|
+
var _a;
|
|
567
|
+
const formValuesNow = currentFormValues();
|
|
568
|
+
const wouldSend = buildQuerySearch(props.search, formValuesNow);
|
|
569
|
+
return {
|
|
570
|
+
props: {
|
|
571
|
+
category: props.category,
|
|
572
|
+
name: props.name,
|
|
573
|
+
config: props.config ? { id: props.config.id, name: props.config.name, title: props.config.title } : null,
|
|
574
|
+
parentParams: props.parentParams,
|
|
575
|
+
noPage: props.noPage,
|
|
576
|
+
tableHeight: props.tableHeight
|
|
577
|
+
},
|
|
578
|
+
route: {
|
|
579
|
+
params: route.params,
|
|
580
|
+
query: route.query
|
|
581
|
+
},
|
|
582
|
+
extraParams: extraParams.value,
|
|
583
|
+
// 真正下发的查询条件(页面 search < 表格查询表单值):
|
|
584
|
+
// 取数后是实际下发的那份,取数前按当前表单值现算
|
|
585
|
+
search: lastQuerySearch.value ?? wouldSend,
|
|
586
|
+
// 拆开看:谁贡献了哪个条件(排查"我传了 search 为什么像没生效"时对一下)
|
|
587
|
+
searchParts: {
|
|
588
|
+
fromPage: props.search ?? null,
|
|
589
|
+
fromForm: formValuesNow,
|
|
590
|
+
lastSent: lastQuerySearch.value
|
|
591
|
+
},
|
|
592
|
+
config: config.value ? {
|
|
593
|
+
name: config.value.name,
|
|
594
|
+
title: config.value.title,
|
|
595
|
+
pfield: config.value.pfield,
|
|
596
|
+
url: config.value.url,
|
|
597
|
+
pager: config.value.pager,
|
|
598
|
+
pagesize: config.value.pagesize,
|
|
599
|
+
searchForm: config.value.searchForm,
|
|
600
|
+
deleteUrl: config.value.deleteUrl,
|
|
601
|
+
showUrl: config.value.showUrl,
|
|
602
|
+
rowActions: config.value.rowActions,
|
|
603
|
+
toolBars: config.value.toolBars
|
|
604
|
+
} : null,
|
|
605
|
+
searchForm: {
|
|
606
|
+
name: ((_a = config.value) == null ? void 0 : _a.searchForm) ?? null,
|
|
607
|
+
optionsReady: !!searchFormOptions.value
|
|
608
|
+
},
|
|
609
|
+
grid: {
|
|
610
|
+
gridKey: gridKey.value,
|
|
611
|
+
tableTitle: tableTitle.value,
|
|
612
|
+
hasAutoActions: hasAutoActions.value,
|
|
613
|
+
// 重复取数抑制计数:fetched=真实请求数,merged/reused=被去重的次数
|
|
614
|
+
queryDedupe: queryDedupe.getStats()
|
|
615
|
+
},
|
|
616
|
+
loading: loading.value,
|
|
617
|
+
error: error.value
|
|
618
|
+
};
|
|
619
|
+
});
|
|
620
|
+
const exprScope = computed(() => ({
|
|
621
|
+
params: extraParams.value
|
|
622
|
+
}));
|
|
623
|
+
__expose({
|
|
624
|
+
gridApi,
|
|
625
|
+
handleDelete,
|
|
626
|
+
reload: () => {
|
|
627
|
+
var _a;
|
|
628
|
+
if ((_a = gridApi == null ? void 0 : gridApi.grid) == null ? void 0 : _a.commitProxy) {
|
|
629
|
+
queryDedupe.reset();
|
|
630
|
+
void gridApi.query();
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
/** 开发面板用的状态快照(本库不渲染面板,留给宿主调试台按需读取) */
|
|
634
|
+
devState,
|
|
635
|
+
exprScope
|
|
636
|
+
});
|
|
637
|
+
watch(
|
|
638
|
+
[
|
|
639
|
+
() => parsedTools.value.map((tool) => tool.type),
|
|
640
|
+
() => parsedActions.value.map((action) => action.type)
|
|
641
|
+
],
|
|
642
|
+
([toolTypes, actionTypes]) => {
|
|
643
|
+
toolTypes.forEach((type) => resolveToolComponent(type));
|
|
644
|
+
actionTypes.forEach((type) => resolveRowActionComponent(type));
|
|
645
|
+
},
|
|
646
|
+
{ immediate: true }
|
|
647
|
+
);
|
|
648
|
+
return (_ctx, _cache) => {
|
|
649
|
+
const _component_a_button = resolveComponent("a-button");
|
|
650
|
+
const _component_List = resolveComponent("List");
|
|
651
|
+
return openBlock(), createElementBlock("div", {
|
|
652
|
+
ref_key: "rootRef",
|
|
653
|
+
ref: rootRef,
|
|
654
|
+
class: normalizeClass(["design-table", { "is-fullscreen": tableFull.value, "has-search-form": !!searchFormOptions.value }])
|
|
655
|
+
}, [
|
|
656
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
657
|
+
createVNode(unref(Spin), {
|
|
658
|
+
spinning: true,
|
|
659
|
+
tip: "加载表格配置中..."
|
|
660
|
+
})
|
|
661
|
+
])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
662
|
+
createVNode(unref(Alert), {
|
|
663
|
+
message: error.value,
|
|
664
|
+
type: "error",
|
|
665
|
+
"show-icon": "",
|
|
666
|
+
closable: "",
|
|
667
|
+
onClose: _cache[0] || (_cache[0] = ($event) => error.value = null)
|
|
668
|
+
}, null, 8, ["message"])
|
|
669
|
+
])) : !config.value ? (openBlock(), createBlock(unref(Result), {
|
|
670
|
+
key: 2,
|
|
671
|
+
status: "404",
|
|
672
|
+
title: "未发现列表配置",
|
|
673
|
+
"sub-title": "该列表尚未在构建端完成配置,或配置名称有误"
|
|
674
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
675
|
+
!__props.noPage ? (openBlock(), createBlock(resolveDynamicComponent(pageShell.value), {
|
|
676
|
+
key: 0,
|
|
677
|
+
"auto-content-height": true
|
|
678
|
+
}, {
|
|
679
|
+
default: withCtx(() => [
|
|
680
|
+
(openBlock(), createBlock(unref(Grid), {
|
|
681
|
+
key: gridKey.value,
|
|
682
|
+
height: gridHeightProp.value,
|
|
683
|
+
"table-title": tableTitle.value,
|
|
684
|
+
"grid-options": gridOptions.value,
|
|
685
|
+
"form-options": searchFormOptions.value,
|
|
686
|
+
separator: false,
|
|
687
|
+
class: "flex-1 min-h-0"
|
|
688
|
+
}, createSlots({
|
|
689
|
+
"table-title": withCtx(() => [
|
|
690
|
+
tableTitle.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
691
|
+
createVNode(unref(UnorderedListOutlined)),
|
|
692
|
+
createElementVNode("span", null, toDisplayString(tableTitle.value), 1)
|
|
693
|
+
])) : createCommentVNode("", true)
|
|
694
|
+
]),
|
|
695
|
+
"toolbar-tools": withCtx(() => [
|
|
696
|
+
createElementVNode("div", _hoisted_4, [
|
|
697
|
+
parsedTools.value.length > 0 ? (openBlock(), createBlock(unref(Space), { key: 0 }, {
|
|
698
|
+
default: withCtx(() => [
|
|
699
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedTools.value, (tool, idx) => {
|
|
700
|
+
return openBlock(), createBlock(_component_a_button, {
|
|
701
|
+
key: "tool" + idx,
|
|
702
|
+
shape: "round",
|
|
703
|
+
onClick: ($event) => handleToolClick(tool, idx)
|
|
704
|
+
}, {
|
|
705
|
+
default: withCtx(() => [
|
|
706
|
+
(openBlock(), createBlock(resolveDynamicComponent(toolIcon(tool)))),
|
|
707
|
+
createTextVNode(" " + toDisplayString(getToolLabel(tool)), 1)
|
|
708
|
+
]),
|
|
709
|
+
_: 2
|
|
710
|
+
}, 1032, ["onClick"]);
|
|
711
|
+
}), 128))
|
|
712
|
+
]),
|
|
713
|
+
_: 1
|
|
714
|
+
})) : createCommentVNode("", true),
|
|
715
|
+
createVNode(unref(Space), { class: "design-table__sys-btns" }, {
|
|
716
|
+
default: withCtx(() => [
|
|
717
|
+
createVNode(_component_a_button, {
|
|
718
|
+
shape: "round",
|
|
719
|
+
onClick: onToggleColumnSetting
|
|
720
|
+
}, {
|
|
721
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
722
|
+
createElementVNode("i", { class: "vxe-icon-setting" }, null, -1),
|
|
723
|
+
createTextVNode(" 列设置", -1)
|
|
724
|
+
])]),
|
|
725
|
+
_: 1
|
|
726
|
+
}),
|
|
727
|
+
createVNode(_component_a_button, {
|
|
728
|
+
shape: "round",
|
|
729
|
+
onClick: onReloadTable
|
|
730
|
+
}, {
|
|
731
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
732
|
+
createElementVNode("i", { class: "vxe-icon-repeat" }, null, -1),
|
|
733
|
+
createTextVNode(" 刷新", -1)
|
|
734
|
+
])]),
|
|
735
|
+
_: 1
|
|
736
|
+
}),
|
|
737
|
+
createVNode(_component_a_button, {
|
|
738
|
+
shape: "round",
|
|
739
|
+
onClick: onToggleFullscreen
|
|
740
|
+
}, {
|
|
741
|
+
default: withCtx(() => [
|
|
742
|
+
!tableFull.value ? (openBlock(), createElementBlock("i", _hoisted_5)) : (openBlock(), createElementBlock("i", _hoisted_6)),
|
|
743
|
+
createTextVNode(" " + toDisplayString(tableFull.value ? "还原" : "全屏"), 1)
|
|
744
|
+
]),
|
|
745
|
+
_: 1
|
|
746
|
+
})
|
|
747
|
+
]),
|
|
748
|
+
_: 1
|
|
749
|
+
})
|
|
750
|
+
])
|
|
751
|
+
]),
|
|
752
|
+
flowStatus: withCtx(({ row }) => [
|
|
753
|
+
createVNode(FlowStatusCell, {
|
|
754
|
+
row,
|
|
755
|
+
pfield: pfield.value,
|
|
756
|
+
"flow-map": flowMap.value,
|
|
757
|
+
onChanged: onReloadTable
|
|
758
|
+
}, null, 8, ["row", "pfield", "flow-map"])
|
|
759
|
+
]),
|
|
760
|
+
_: 2
|
|
761
|
+
}, [
|
|
762
|
+
hasAutoActions.value ? {
|
|
763
|
+
name: "action",
|
|
764
|
+
fn: withCtx(({ row }) => [
|
|
765
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedActions.value, (action) => {
|
|
766
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(resolveRowActionComponent)(action.type)), {
|
|
767
|
+
key: action.type,
|
|
768
|
+
action,
|
|
769
|
+
row,
|
|
770
|
+
category: __props.category,
|
|
771
|
+
pfield: pfield.value,
|
|
772
|
+
params: extraParams.value,
|
|
773
|
+
"grid-api": unref(gridApi),
|
|
774
|
+
onDeleted: handleRowDeleted,
|
|
775
|
+
onSaved: handleRowSaved,
|
|
776
|
+
onCommand: handleRowCommand
|
|
777
|
+
}, null, 40, ["action", "row", "category", "pfield", "params", "grid-api"]);
|
|
778
|
+
}), 128))
|
|
779
|
+
]),
|
|
780
|
+
key: "0"
|
|
781
|
+
} : void 0,
|
|
782
|
+
renderList(_ctx.$slots, (_, name) => {
|
|
783
|
+
return {
|
|
784
|
+
name,
|
|
785
|
+
fn: withCtx((data) => [
|
|
786
|
+
!(hasAutoActions.value && name === "action") ? renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data)), void 0, true, 0) : createCommentVNode("", true)
|
|
787
|
+
])
|
|
788
|
+
};
|
|
789
|
+
})
|
|
790
|
+
]), 1032, ["height", "table-title", "grid-options", "form-options"]))
|
|
791
|
+
]),
|
|
792
|
+
_: 3
|
|
793
|
+
})) : (openBlock(), createBlock(unref(Grid), {
|
|
794
|
+
key: gridKey.value,
|
|
795
|
+
height: gridHeightProp.value,
|
|
796
|
+
"table-title": tableTitle.value,
|
|
797
|
+
"grid-options": gridOptions.value,
|
|
798
|
+
"form-options": searchFormOptions.value,
|
|
799
|
+
separator: false,
|
|
800
|
+
class: "flex-1 min-h-0"
|
|
801
|
+
}, createSlots({
|
|
802
|
+
"table-title": withCtx(() => [
|
|
803
|
+
tableTitle.value ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
804
|
+
createVNode(_component_List),
|
|
805
|
+
createElementVNode("span", null, toDisplayString(tableTitle.value), 1)
|
|
806
|
+
])) : createCommentVNode("", true)
|
|
807
|
+
]),
|
|
808
|
+
"toolbar-tools": withCtx(() => [
|
|
809
|
+
createElementVNode("div", _hoisted_8, [
|
|
810
|
+
parsedTools.value.length > 0 ? (openBlock(), createBlock(unref(Space), { key: 0 }, {
|
|
811
|
+
default: withCtx(() => [
|
|
812
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedTools.value, (tool, idx) => {
|
|
813
|
+
return openBlock(), createBlock(_component_a_button, {
|
|
814
|
+
key: "tool" + idx,
|
|
815
|
+
shape: "round",
|
|
816
|
+
onClick: ($event) => handleToolClick(tool, idx)
|
|
817
|
+
}, {
|
|
818
|
+
default: withCtx(() => [
|
|
819
|
+
(openBlock(), createBlock(resolveDynamicComponent(toolIcon(tool)))),
|
|
820
|
+
createTextVNode(" " + toDisplayString(getToolLabel(tool)), 1)
|
|
821
|
+
]),
|
|
822
|
+
_: 2
|
|
823
|
+
}, 1032, ["onClick"]);
|
|
824
|
+
}), 128))
|
|
825
|
+
]),
|
|
826
|
+
_: 1
|
|
827
|
+
})) : createCommentVNode("", true),
|
|
828
|
+
createVNode(unref(Space), { class: "design-table__sys-btns" }, {
|
|
829
|
+
default: withCtx(() => [
|
|
830
|
+
createVNode(_component_a_button, {
|
|
831
|
+
shape: "round",
|
|
832
|
+
onClick: onToggleColumnSetting
|
|
833
|
+
}, {
|
|
834
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
835
|
+
createElementVNode("i", { class: "vxe-icon-setting" }, null, -1),
|
|
836
|
+
createTextVNode(" 列设置", -1)
|
|
837
|
+
])]),
|
|
838
|
+
_: 1
|
|
839
|
+
}),
|
|
840
|
+
createVNode(_component_a_button, {
|
|
841
|
+
shape: "round",
|
|
842
|
+
onClick: onReloadTable
|
|
843
|
+
}, {
|
|
844
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
845
|
+
createElementVNode("i", { class: "vxe-icon-repeat" }, null, -1),
|
|
846
|
+
createTextVNode(" 刷新", -1)
|
|
847
|
+
])]),
|
|
848
|
+
_: 1
|
|
849
|
+
}),
|
|
850
|
+
createVNode(_component_a_button, {
|
|
851
|
+
shape: "round",
|
|
852
|
+
onClick: onToggleFullscreen
|
|
853
|
+
}, {
|
|
854
|
+
default: withCtx(() => [
|
|
855
|
+
!tableFull.value ? (openBlock(), createElementBlock("i", _hoisted_9)) : (openBlock(), createElementBlock("i", _hoisted_10)),
|
|
856
|
+
createTextVNode(" " + toDisplayString(tableFull.value ? "还原" : "全屏"), 1)
|
|
857
|
+
]),
|
|
858
|
+
_: 1
|
|
859
|
+
})
|
|
860
|
+
]),
|
|
861
|
+
_: 1
|
|
862
|
+
})
|
|
863
|
+
])
|
|
864
|
+
]),
|
|
865
|
+
flowStatus: withCtx(({ row }) => [
|
|
866
|
+
createVNode(FlowStatusCell, {
|
|
867
|
+
row,
|
|
868
|
+
pfield: pfield.value,
|
|
869
|
+
"flow-map": flowMap.value,
|
|
870
|
+
onChanged: onReloadTable
|
|
871
|
+
}, null, 8, ["row", "pfield", "flow-map"])
|
|
872
|
+
]),
|
|
873
|
+
_: 2
|
|
874
|
+
}, [
|
|
875
|
+
hasAutoActions.value ? {
|
|
876
|
+
name: "action",
|
|
877
|
+
fn: withCtx(({ row }) => [
|
|
878
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedActions.value, (action) => {
|
|
879
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(resolveRowActionComponent)(action.type)), {
|
|
880
|
+
key: action.type,
|
|
881
|
+
action,
|
|
882
|
+
row,
|
|
883
|
+
category: __props.category,
|
|
884
|
+
pfield: pfield.value,
|
|
885
|
+
params: extraParams.value,
|
|
886
|
+
"grid-api": unref(gridApi),
|
|
887
|
+
onDeleted: handleRowDeleted,
|
|
888
|
+
onSaved: handleRowSaved,
|
|
889
|
+
onCommand: handleRowCommand
|
|
890
|
+
}, null, 40, ["action", "row", "category", "pfield", "params", "grid-api"]);
|
|
891
|
+
}), 128))
|
|
892
|
+
]),
|
|
893
|
+
key: "0"
|
|
894
|
+
} : void 0,
|
|
895
|
+
renderList(_ctx.$slots, (_, name) => {
|
|
896
|
+
return {
|
|
897
|
+
name,
|
|
898
|
+
fn: withCtx((data) => [
|
|
899
|
+
!(hasAutoActions.value && name === "action") ? renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(data)), void 0, true, 0) : createCommentVNode("", true)
|
|
900
|
+
])
|
|
901
|
+
};
|
|
902
|
+
})
|
|
903
|
+
]), 1032, ["height", "table-title", "grid-options", "form-options"]))
|
|
904
|
+
], 64)),
|
|
905
|
+
config.value && !loading.value ? (openBlock(true), createElementBlock(Fragment, { key: 4 }, renderList(parsedTools.value, (tool, idx) => {
|
|
906
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(resolveToolComponent)(tool.type)), {
|
|
907
|
+
key: idx,
|
|
908
|
+
ref_for: true,
|
|
909
|
+
ref: setToolRef(idx),
|
|
910
|
+
tool,
|
|
911
|
+
category: __props.category,
|
|
912
|
+
pfield: pfield.value,
|
|
913
|
+
"grid-api": unref(gridApi),
|
|
914
|
+
"extra-params": extraParams.value,
|
|
915
|
+
"mapping-scope": { params: extraParams.value },
|
|
916
|
+
onSaved: handleToolSaved,
|
|
917
|
+
onImported: handleToolImported,
|
|
918
|
+
onCommand: handleToolCommand
|
|
919
|
+
}, null, 40, ["tool", "category", "pfield", "grid-api", "extra-params", "mapping-scope"]);
|
|
920
|
+
}), 128)) : createCommentVNode("", true),
|
|
921
|
+
createVNode(DesignDevStateButton, {
|
|
922
|
+
"designer-category": __props.category,
|
|
923
|
+
"designer-name": __props.name,
|
|
924
|
+
"expr-scope": exprScope.value,
|
|
925
|
+
"expr-scope-labels": { params: "组件自身参数(extraParams)" },
|
|
926
|
+
state: devState.value,
|
|
927
|
+
top: __props.devButtonTop,
|
|
928
|
+
"designer-type": "table",
|
|
929
|
+
title: "DesignTable"
|
|
930
|
+
}, null, 8, ["designer-category", "designer-name", "expr-scope", "state", "top"])
|
|
931
|
+
], 2);
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
export {
|
|
936
|
+
_sfc_main as default
|
|
937
|
+
};
|