@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,232 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, reactive, watch, openBlock, createElementBlock, createVNode, unref, createBlock, Fragment, renderList, createElementVNode, normalizeStyle, toDisplayString, resolveDynamicComponent, withCtx, createTextVNode, createCommentVNode } from "vue";
|
|
2
|
+
import { Spin, Alert, Result, Button } from "antdv-next";
|
|
3
|
+
import { fetchSearchConfig } from "../api.js";
|
|
4
|
+
import { resolveComponent } from "../form/fields/index.js";
|
|
5
|
+
import DesignDevStateButton from "../components/design-debug/dev-state-button.vue.js";
|
|
6
|
+
const _hoisted_1 = { class: "design-search" };
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex-center py-4"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 3,
|
|
13
|
+
class: "design-search-form"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = { class: "design-search-field" };
|
|
16
|
+
const _hoisted_5 = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "design-search-actions"
|
|
19
|
+
};
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
...{ name: "DesignSearch" },
|
|
22
|
+
__name: "design-search",
|
|
23
|
+
props: {
|
|
24
|
+
category: { default: "" },
|
|
25
|
+
name: { default: "" },
|
|
26
|
+
config: { default: null },
|
|
27
|
+
labelWidth: { default: "auto" },
|
|
28
|
+
filterEmpty: { type: Boolean, default: true },
|
|
29
|
+
showActions: { type: Boolean, default: true },
|
|
30
|
+
devButtonTop: { default: 10 }
|
|
31
|
+
},
|
|
32
|
+
emits: ["query", "reset", "change"],
|
|
33
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emit = __emit;
|
|
36
|
+
const loading = ref(false);
|
|
37
|
+
const error = ref(null);
|
|
38
|
+
const rawConfig = ref([]);
|
|
39
|
+
const cells = computed(() => {
|
|
40
|
+
const list = [];
|
|
41
|
+
for (const row of rawConfig.value) {
|
|
42
|
+
if (Array.isArray(row)) list.push(...row);
|
|
43
|
+
}
|
|
44
|
+
return list;
|
|
45
|
+
});
|
|
46
|
+
const formData = reactive({});
|
|
47
|
+
function initFormData() {
|
|
48
|
+
for (const cell of cells.value) {
|
|
49
|
+
if (cell.name && !(cell.name in formData)) {
|
|
50
|
+
formData[cell.name] = void 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function normalizeConfig(resp) {
|
|
55
|
+
const arr = Array.isArray(resp) ? resp : resp == null ? void 0 : resp.cells;
|
|
56
|
+
if (!Array.isArray(arr)) return [];
|
|
57
|
+
if (arr.length > 0 && !Array.isArray(arr[0])) {
|
|
58
|
+
return [arr];
|
|
59
|
+
}
|
|
60
|
+
return arr;
|
|
61
|
+
}
|
|
62
|
+
async function loadConfig() {
|
|
63
|
+
if (props.config) {
|
|
64
|
+
rawConfig.value = normalizeConfig(props.config);
|
|
65
|
+
loading.value = false;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!props.category || !props.name) return;
|
|
69
|
+
loading.value = true;
|
|
70
|
+
error.value = null;
|
|
71
|
+
try {
|
|
72
|
+
const resp = await fetchSearchConfig(props.category, props.name);
|
|
73
|
+
rawConfig.value = normalizeConfig(resp);
|
|
74
|
+
} catch (err) {
|
|
75
|
+
const msg = (err == null ? void 0 : err.message) ?? "";
|
|
76
|
+
if (msg.includes("未发现")) {
|
|
77
|
+
rawConfig.value = [];
|
|
78
|
+
} else {
|
|
79
|
+
error.value = msg || "加载查询配置失败";
|
|
80
|
+
rawConfig.value = [];
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
loading.value = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
watch(
|
|
87
|
+
() => [props.category, props.name, props.config],
|
|
88
|
+
() => loadConfig(),
|
|
89
|
+
{ immediate: true }
|
|
90
|
+
);
|
|
91
|
+
watch(cells, () => initFormData(), { immediate: true });
|
|
92
|
+
function getValues() {
|
|
93
|
+
return { ...formData };
|
|
94
|
+
}
|
|
95
|
+
function getQueryValues() {
|
|
96
|
+
if (!props.filterEmpty) return { ...formData };
|
|
97
|
+
const result = {};
|
|
98
|
+
for (const [key, val] of Object.entries(formData)) {
|
|
99
|
+
if (val !== void 0 && val !== null && val !== "") {
|
|
100
|
+
result[key] = val;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
function setValues(values) {
|
|
106
|
+
for (const key of Object.keys(values)) {
|
|
107
|
+
formData[key] = values[key];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function handleQuery() {
|
|
111
|
+
emit("query", getQueryValues());
|
|
112
|
+
}
|
|
113
|
+
function handleReset() {
|
|
114
|
+
for (const cell of cells.value) {
|
|
115
|
+
if (cell.name) formData[cell.name] = void 0;
|
|
116
|
+
}
|
|
117
|
+
emit("reset");
|
|
118
|
+
}
|
|
119
|
+
watch(
|
|
120
|
+
() => ({ ...formData }),
|
|
121
|
+
(values) => emit("change", { ...values }),
|
|
122
|
+
{ deep: true }
|
|
123
|
+
);
|
|
124
|
+
__expose({
|
|
125
|
+
getQueryValues,
|
|
126
|
+
getValues,
|
|
127
|
+
handleQuery,
|
|
128
|
+
handleReset,
|
|
129
|
+
setValues
|
|
130
|
+
});
|
|
131
|
+
const labelStyle = computed(() => {
|
|
132
|
+
if (props.labelWidth === "auto") return {};
|
|
133
|
+
const w = typeof props.labelWidth === "number" ? `${props.labelWidth}px` : props.labelWidth;
|
|
134
|
+
return { width: w };
|
|
135
|
+
});
|
|
136
|
+
const devState = computed(() => {
|
|
137
|
+
var _a, _b, _c;
|
|
138
|
+
return {
|
|
139
|
+
props: {
|
|
140
|
+
category: props.category,
|
|
141
|
+
name: props.name,
|
|
142
|
+
config: props.config ? Array.isArray(props.config) ? { rows: props.config.length } : { id: (_a = props.config) == null ? void 0 : _a.id, name: (_b = props.config) == null ? void 0 : _b.name, title: (_c = props.config) == null ? void 0 : _c.title } : null,
|
|
143
|
+
labelWidth: props.labelWidth,
|
|
144
|
+
filterEmpty: props.filterEmpty,
|
|
145
|
+
showActions: props.showActions
|
|
146
|
+
},
|
|
147
|
+
config: {
|
|
148
|
+
rows: rawConfig.value.length,
|
|
149
|
+
cells: cells.value.length,
|
|
150
|
+
fields: cells.value.map((c) => c.name || c.title)
|
|
151
|
+
},
|
|
152
|
+
loading: loading.value,
|
|
153
|
+
error: error.value
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
const exprScope = computed(() => ({ data: formData }));
|
|
157
|
+
return (_ctx, _cache) => {
|
|
158
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
159
|
+
loading.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
160
|
+
createVNode(unref(Spin), {
|
|
161
|
+
spinning: true,
|
|
162
|
+
tip: "加载查询配置中..."
|
|
163
|
+
})
|
|
164
|
+
])) : error.value ? (openBlock(), createBlock(unref(Alert), {
|
|
165
|
+
key: 1,
|
|
166
|
+
message: error.value,
|
|
167
|
+
type: "error",
|
|
168
|
+
"show-icon": "",
|
|
169
|
+
closable: "",
|
|
170
|
+
onClose: _cache[0] || (_cache[0] = ($event) => error.value = null)
|
|
171
|
+
}, null, 8, ["message"])) : cells.value.length === 0 ? (openBlock(), createBlock(unref(Result), {
|
|
172
|
+
key: 2,
|
|
173
|
+
status: "404",
|
|
174
|
+
title: "未发现查询配置",
|
|
175
|
+
"sub-title": "该查询表单尚未在构建端完成配置,或配置名称有误"
|
|
176
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
177
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(cells.value, (cell, idx) => {
|
|
178
|
+
return openBlock(), createElementBlock("div", {
|
|
179
|
+
key: cell.name || idx,
|
|
180
|
+
class: "design-search-item"
|
|
181
|
+
}, [
|
|
182
|
+
createElementVNode("span", {
|
|
183
|
+
class: "design-search-label",
|
|
184
|
+
style: normalizeStyle(labelStyle.value)
|
|
185
|
+
}, toDisplayString(cell.title), 5),
|
|
186
|
+
createElementVNode("div", _hoisted_4, [
|
|
187
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(resolveComponent)(cell.type)), {
|
|
188
|
+
"model-value": cell.name ? formData[cell.name] : void 0,
|
|
189
|
+
cell,
|
|
190
|
+
disabled: cell.readonly === "2",
|
|
191
|
+
"onUpdate:modelValue": (val) => {
|
|
192
|
+
if (cell.name) formData[cell.name] = val;
|
|
193
|
+
}
|
|
194
|
+
}, null, 8, ["model-value", "cell", "disabled", "onUpdate:modelValue"]))
|
|
195
|
+
])
|
|
196
|
+
]);
|
|
197
|
+
}), 128)),
|
|
198
|
+
__props.showActions ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
199
|
+
createVNode(unref(Button), {
|
|
200
|
+
type: "primary",
|
|
201
|
+
onClick: handleQuery
|
|
202
|
+
}, {
|
|
203
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
204
|
+
createTextVNode("查询", -1)
|
|
205
|
+
])]),
|
|
206
|
+
_: 1
|
|
207
|
+
}),
|
|
208
|
+
createVNode(unref(Button), { onClick: handleReset }, {
|
|
209
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
210
|
+
createTextVNode("重置", -1)
|
|
211
|
+
])]),
|
|
212
|
+
_: 1
|
|
213
|
+
})
|
|
214
|
+
])) : createCommentVNode("", true)
|
|
215
|
+
])),
|
|
216
|
+
createVNode(DesignDevStateButton, {
|
|
217
|
+
title: "DesignSearch",
|
|
218
|
+
state: devState.value,
|
|
219
|
+
"expr-scope": exprScope.value,
|
|
220
|
+
"expr-scope-labels": { data: "当前查询表单的值" },
|
|
221
|
+
"designer-type": "search",
|
|
222
|
+
"designer-category": __props.category,
|
|
223
|
+
"designer-name": __props.name,
|
|
224
|
+
top: __props.devButtonTop
|
|
225
|
+
}, null, 8, ["state", "expr-scope", "designer-category", "designer-name", "top"])
|
|
226
|
+
]);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
export {
|
|
231
|
+
_sfc_main as default
|
|
232
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { resolveDefaultValue } from "../utils/default-value.js";
|
|
2
|
+
function parseSelectOptions(raw) {
|
|
3
|
+
if (!raw) return [];
|
|
4
|
+
return raw.split("\n").map((line) => {
|
|
5
|
+
const [value, ...labelParts] = line.split("|");
|
|
6
|
+
return {
|
|
7
|
+
label: (labelParts.join("|") || value || "").trim(),
|
|
8
|
+
value: (value || "").trim()
|
|
9
|
+
};
|
|
10
|
+
}).filter((opt) => opt.value);
|
|
11
|
+
}
|
|
12
|
+
function mapFieldType(cell) {
|
|
13
|
+
const type = cell.type || "text";
|
|
14
|
+
switch (type) {
|
|
15
|
+
case "text": {
|
|
16
|
+
switch (cell.text_type) {
|
|
17
|
+
case "textarea":
|
|
18
|
+
return "Textarea";
|
|
19
|
+
case "number":
|
|
20
|
+
return "InputNumber";
|
|
21
|
+
case "password":
|
|
22
|
+
return "InputPassword";
|
|
23
|
+
default:
|
|
24
|
+
return "Input";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
case "select":
|
|
28
|
+
return "Select";
|
|
29
|
+
case "date":
|
|
30
|
+
return "DatePicker";
|
|
31
|
+
case "month":
|
|
32
|
+
return "DatePicker";
|
|
33
|
+
case "time":
|
|
34
|
+
return "TimePicker";
|
|
35
|
+
case "tree":
|
|
36
|
+
return "TreeSelect";
|
|
37
|
+
case "radio":
|
|
38
|
+
return "RadioGroup";
|
|
39
|
+
case "checkbox":
|
|
40
|
+
return "CheckboxGroup";
|
|
41
|
+
default:
|
|
42
|
+
return "Input";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function transformCellToSchema(cell) {
|
|
46
|
+
var _a;
|
|
47
|
+
if (!cell.name) return null;
|
|
48
|
+
const schema = {
|
|
49
|
+
component: mapFieldType(cell),
|
|
50
|
+
fieldName: cell.name,
|
|
51
|
+
label: cell.title
|
|
52
|
+
};
|
|
53
|
+
const defaultValue = resolveDefaultValue(cell);
|
|
54
|
+
if (defaultValue !== void 0) {
|
|
55
|
+
schema.defaultValue = defaultValue;
|
|
56
|
+
}
|
|
57
|
+
const componentProps = {};
|
|
58
|
+
if (cell.type === "text" && !cell.text_type) {
|
|
59
|
+
componentProps.placeholder = cell.placeholder || `请输入${cell.title}`;
|
|
60
|
+
}
|
|
61
|
+
if (cell.type === "select" || cell.type === "radio" || cell.type === "checkbox") {
|
|
62
|
+
let options = [];
|
|
63
|
+
if ((_a = cell.dicts) == null ? void 0 : _a.length) {
|
|
64
|
+
options = cell.dicts.map((d) => ({
|
|
65
|
+
// 合并 select_sql 整行数据,树形/其它字段可直接取用(label/value 优先)
|
|
66
|
+
...d.data || {},
|
|
67
|
+
label: d.dictLabel,
|
|
68
|
+
value: d.dictValue
|
|
69
|
+
}));
|
|
70
|
+
} else {
|
|
71
|
+
options = parseSelectOptions(cell.select_options);
|
|
72
|
+
}
|
|
73
|
+
if (options.length > 0) {
|
|
74
|
+
componentProps.options = options;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (cell.type === "date" && cell.dateType) {
|
|
78
|
+
componentProps.valueFormat = cell.dateType.includes("HH") ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
79
|
+
}
|
|
80
|
+
if (cell.type === "month") {
|
|
81
|
+
componentProps.picker = "month";
|
|
82
|
+
componentProps.valueFormat = cell.dateType || "YYYY-MM";
|
|
83
|
+
}
|
|
84
|
+
if (cell.readonly === "2") {
|
|
85
|
+
componentProps.disabled = true;
|
|
86
|
+
}
|
|
87
|
+
schema.componentProps = componentProps;
|
|
88
|
+
return schema;
|
|
89
|
+
}
|
|
90
|
+
function normalizeSearchCells(resp) {
|
|
91
|
+
const arr = Array.isArray(resp) ? resp : resp == null ? void 0 : resp.cells;
|
|
92
|
+
if (!Array.isArray(arr)) return [];
|
|
93
|
+
if (arr.length > 0 && !Array.isArray(arr[0])) {
|
|
94
|
+
return [arr];
|
|
95
|
+
}
|
|
96
|
+
return arr;
|
|
97
|
+
}
|
|
98
|
+
function buildSearchFormOptions(resp) {
|
|
99
|
+
const cells = normalizeSearchCells(resp);
|
|
100
|
+
const schema = cells.flat().map(transformCellToSchema).filter((s) => s !== null);
|
|
101
|
+
return {
|
|
102
|
+
commonConfig: {
|
|
103
|
+
componentProps: {
|
|
104
|
+
allowClear: true
|
|
105
|
+
},
|
|
106
|
+
labelWidth: 80
|
|
107
|
+
},
|
|
108
|
+
schema,
|
|
109
|
+
wrapperClass: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
buildSearchFormOptions,
|
|
114
|
+
normalizeSearchCells
|
|
115
|
+
};
|