@fecp/vue 1.1.2 → 1.1.4
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/es/_virtual/bessel.mjs +7 -0
- package/es/_virtual/bessel2.mjs +4 -0
- package/es/_virtual/index.mjs +1 -1
- package/es/_virtual/index2.mjs +1 -1
- package/es/_virtual/jstat.mjs +7 -0
- package/es/_virtual/jstat2.mjs +4 -0
- package/es/node_modules/.pnpm/@formulajs_formulajs@4.5.6/node_modules/@formulajs/formulajs/lib/esm/index.mjs +7150 -0
- package/es/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vueuse/shared/index.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/index.esm.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/clipboard.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/commands.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/config.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/event.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/formats.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/i18n.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/icon.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/interceptor.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/menus.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/permission.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/renderer.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/resize.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/store.mjs +1 -1
- package/es/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/vm.mjs +1 -1
- package/es/node_modules/.pnpm/bessel@1.0.2/node_modules/bessel/bessel.mjs +226 -0
- package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/container/index.mjs +7 -7
- package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/form/src/hooks/use-form-common-props.mjs +1 -1
- package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/input/src/input.vue2.mjs +1 -1
- package/es/node_modules/.pnpm/jstat@1.9.6/node_modules/jstat/dist/jstat.mjs +3853 -0
- package/es/packages/mobile/src/components/form/field/Field.vue.mjs +1 -1
- package/es/packages/mobile/src/utils/formatterUtil.mjs +1 -1
- package/es/packages/mobile/src/utils/optionUtil.mjs +1 -1
- package/es/packages/vue/index.mjs +4 -0
- package/es/packages/vue/src/components/all.mjs +4 -0
- package/es/packages/vue/src/components/details/header/Header.vue.mjs +1 -1
- package/es/packages/vue/src/components/forms/checkbox/Checkbox.vue.mjs +8 -2
- package/es/packages/vue/src/components/forms/date/Date.vue.mjs +6 -6
- package/es/packages/vue/src/components/forms/divider/Divider.vue.mjs +15 -20
- package/es/packages/vue/src/components/forms/divider/index.mjs +2 -2
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +276 -54
- package/es/packages/vue/src/components/forms/form/index.mjs +2 -2
- package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +78 -50
- package/es/packages/vue/src/components/forms/h2/H2.vue.mjs +16 -7
- package/es/packages/vue/src/components/forms/multipleSelection/MultipleSelection.vue.mjs +1 -1
- package/es/packages/vue/src/components/forms/number/Number.vue.mjs +18 -12
- package/es/packages/vue/src/components/forms/radio/Radio.vue.mjs +5 -3
- package/es/packages/vue/src/components/forms/select/Select.vue.mjs +6 -4
- package/es/packages/vue/src/components/forms/subForm/SubForm.vue.mjs +90 -0
- package/es/packages/vue/src/components/forms/subForm/index.mjs +7 -0
- package/es/packages/vue/src/components/forms/subTable/SubTable.vue.mjs +109 -0
- package/es/packages/vue/src/components/forms/subTable/index.mjs +7 -0
- package/es/packages/vue/src/components/forms/switch/Switch.vue.mjs +1 -1
- package/es/packages/vue/src/components/forms/text/Text.vue.mjs +7 -4
- package/es/packages/vue/src/components/forms/text/index.mjs +2 -2
- package/es/packages/vue/src/components/forms/textarea/Textarea.vue.mjs +7 -4
- package/es/packages/vue/src/components/table/CustomButtons.vue.mjs +17 -17
- package/es/packages/vue/src/components/table/Table.vue.mjs +193 -72
- package/es/packages/vue/src/components/table/TableColumn.vue.mjs +46 -5
- package/es/packages/vue/src/components/table/TableFilter.vue.mjs +306 -0
- package/es/packages/vue/src/components/table/index.mjs +2 -2
- package/es/packages/vue/src/composables/usePageEvents.mjs +4 -5
- package/es/packages/vue/src/utils/common.mjs +5 -0
- package/es/packages/vue/src/utils/datasource.mjs +27 -1
- package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +19 -2
- package/es/packages/vue/src/utils/formulajs/calculate.mjs +57 -0
- package/es/packages/vue/src/utils/formulajs/functionCore.mjs +17 -0
- package/es/packages/vue/src/utils/parseRouteParams.mjs +3 -2
- package/es/vue.css +255 -48
- package/lib/_virtual/bessel.js +7 -0
- package/lib/_virtual/bessel2.js +4 -0
- package/lib/_virtual/index.js +1 -1
- package/lib/_virtual/index2.js +1 -1
- package/lib/_virtual/jstat.js +7 -0
- package/lib/_virtual/jstat2.js +4 -0
- package/lib/node_modules/.pnpm/@formulajs_formulajs@4.5.6/node_modules/@formulajs/formulajs/lib/esm/index.js +7150 -0
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/index.esm.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/clipboard.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/commands.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/config.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/event.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/formats.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/i18n.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/icon.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/interceptor.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/menus.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/permission.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/renderer.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/resize.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/store.js +1 -1
- package/lib/node_modules/.pnpm/@vxe-ui_core@4.3.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vxe-ui/core/es/src/vm.js +1 -1
- package/lib/node_modules/.pnpm/bessel@1.0.2/node_modules/bessel/bessel.js +226 -0
- package/lib/node_modules/.pnpm/jstat@1.9.6/node_modules/jstat/dist/jstat.js +3853 -0
- package/lib/packages/mobile/src/components/form/field/Field.vue.js +1 -1
- package/lib/packages/mobile/src/utils/formatterUtil.js +1 -1
- package/lib/packages/mobile/src/utils/optionUtil.js +1 -1
- package/lib/packages/vue/index.js +13 -9
- package/lib/packages/vue/src/components/all.js +10 -6
- package/lib/packages/vue/src/components/details/header/Header.vue.js +1 -1
- package/lib/packages/vue/src/components/forms/checkbox/Checkbox.vue.js +8 -2
- package/lib/packages/vue/src/components/forms/date/Date.vue.js +6 -6
- package/lib/packages/vue/src/components/forms/divider/Divider.vue.js +14 -19
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +275 -53
- package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +63 -35
- package/lib/packages/vue/src/components/forms/h2/H2.vue.js +15 -6
- package/lib/packages/vue/src/components/forms/multipleSelection/MultipleSelection.vue.js +1 -1
- package/lib/packages/vue/src/components/forms/number/Number.vue.js +18 -12
- package/lib/packages/vue/src/components/forms/radio/Radio.vue.js +5 -3
- package/lib/packages/vue/src/components/forms/select/Select.vue.js +6 -4
- package/lib/packages/vue/src/components/forms/subForm/SubForm.vue.js +90 -0
- package/lib/packages/vue/src/components/forms/subForm/index.js +7 -0
- package/lib/packages/vue/src/components/forms/subTable/SubTable.vue.js +109 -0
- package/lib/packages/vue/src/components/forms/subTable/index.js +7 -0
- package/lib/packages/vue/src/components/forms/switch/Switch.vue.js +1 -1
- package/lib/packages/vue/src/components/forms/text/Text.vue.js +7 -4
- package/lib/packages/vue/src/components/forms/textarea/Textarea.vue.js +7 -4
- package/lib/packages/vue/src/components/table/CustomButtons.vue.js +16 -16
- package/lib/packages/vue/src/components/table/Table.vue.js +195 -74
- package/lib/packages/vue/src/components/table/TableColumn.vue.js +46 -5
- package/lib/packages/vue/src/components/table/TableFilter.vue.js +306 -0
- package/lib/packages/vue/src/composables/usePageEvents.js +4 -5
- package/lib/packages/vue/src/utils/common.js +5 -0
- package/lib/packages/vue/src/utils/datasource.js +27 -1
- package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +19 -2
- package/lib/packages/vue/src/utils/formulajs/calculate.js +57 -0
- package/lib/packages/vue/src/utils/formulajs/functionCore.js +17 -0
- package/lib/packages/vue/src/utils/parseRouteParams.js +3 -2
- package/lib/vue.css +255 -48
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/theme-chalk/el-date-picker.css.mjs";
|
|
9
|
+
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
|
+
/* empty css */
|
|
12
|
+
import { useCssVars, computed, ref, watch, createElementBlock, openBlock, Fragment, createBlock, createCommentVNode, normalizeStyle, withCtx, createElementVNode, normalizeClass, renderList, withDirectives, createVNode, resolveDynamicComponent, mergeProps, vShow, unref, createTextVNode, toDisplayString } from "vue";
|
|
13
|
+
import { Search as search_default, Refresh as refresh_default, DArrowRight as d_arrow_right_default, DArrowLeft as d_arrow_left_default } from "../../../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.2_vue@3.5.13_typescript@5.7.3_/node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
14
|
+
import { Text } from "../forms/text/index.mjs";
|
|
15
|
+
import { Select } from "../forms/select/index.mjs";
|
|
16
|
+
import { MultipleSelection } from "../forms/multipleSelection/index.mjs";
|
|
17
|
+
import { Date } from "../forms/date/index.mjs";
|
|
18
|
+
import { Number } from "../forms/number/index.mjs";
|
|
19
|
+
/* empty css */
|
|
20
|
+
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
21
|
+
import { ElForm, ElFormItem } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/form/index.mjs";
|
|
22
|
+
import { ElDatePicker } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/date-picker/index.mjs";
|
|
23
|
+
import { ElInputNumber } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/input-number/index.mjs";
|
|
24
|
+
import { ElButton } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/button/index.mjs";
|
|
25
|
+
import { ElDivider } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/divider/index.mjs";
|
|
26
|
+
import { ElIcon } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/icon/index.mjs";
|
|
27
|
+
const _hoisted_1 = {
|
|
28
|
+
key: 1,
|
|
29
|
+
style: { "display": "flex", "align-items": "center", "gap": "8px", "width": "100%" }
|
|
30
|
+
};
|
|
31
|
+
const _sfc_main = {
|
|
32
|
+
__name: "TableFilter",
|
|
33
|
+
props: {
|
|
34
|
+
queryConfig: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: () => ({})
|
|
37
|
+
},
|
|
38
|
+
fieldsData: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: ["search", "reset"],
|
|
44
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
|
+
useCssVars((_ctx) => ({
|
|
46
|
+
"3f99436f": `${config.value.collapseRows * 90}px`
|
|
47
|
+
}));
|
|
48
|
+
const props = __props;
|
|
49
|
+
const emit = __emit;
|
|
50
|
+
const config = computed(() => {
|
|
51
|
+
var _a, _b, _c, _d, _e;
|
|
52
|
+
return {
|
|
53
|
+
enabled: ((_a = props.queryConfig) == null ? void 0 : _a.enabled) ?? false,
|
|
54
|
+
mode: ((_b = props.queryConfig) == null ? void 0 : _b.mode) || "fixed",
|
|
55
|
+
columnCount: ((_c = props.queryConfig) == null ? void 0 : _c.columnCount) || 3,
|
|
56
|
+
collapseRows: ((_d = props.queryConfig) == null ? void 0 : _d.collapseRows) || 2,
|
|
57
|
+
filterFields: ((_e = props.queryConfig) == null ? void 0 : _e.filterFields) || []
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
const getFieldConfig = (fieldId) => {
|
|
61
|
+
return props.fieldsData.find((field) => field.id === fieldId) || {};
|
|
62
|
+
};
|
|
63
|
+
const completeFilterFields = computed(() => {
|
|
64
|
+
return config.value.filterFields.map((filterField) => {
|
|
65
|
+
const fieldConfig = getFieldConfig(filterField.fieldId);
|
|
66
|
+
return {
|
|
67
|
+
...filterField,
|
|
68
|
+
...fieldConfig
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const filterValues = ref({});
|
|
73
|
+
const isCollapsed = ref(true);
|
|
74
|
+
const shouldShowToggle = computed(() => {
|
|
75
|
+
const fieldCount = completeFilterFields.value.length;
|
|
76
|
+
const maxVisibleFields = config.value.columnCount * config.value.collapseRows;
|
|
77
|
+
return fieldCount > maxVisibleFields;
|
|
78
|
+
});
|
|
79
|
+
const isSingleLine = computed(() => {
|
|
80
|
+
if (isCollapsed.value) {
|
|
81
|
+
return config.value.collapseRows === 1;
|
|
82
|
+
} else {
|
|
83
|
+
const totalRows = Math.ceil(
|
|
84
|
+
completeFilterFields.value.length / config.value.columnCount
|
|
85
|
+
);
|
|
86
|
+
return totalRows === 1;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const getFilterComponent = (fieldType) => {
|
|
90
|
+
const componentMap = {
|
|
91
|
+
text: Text,
|
|
92
|
+
select: Select,
|
|
93
|
+
date: Date,
|
|
94
|
+
number: Number,
|
|
95
|
+
multipleSelection: MultipleSelection,
|
|
96
|
+
switch: Select
|
|
97
|
+
};
|
|
98
|
+
return componentMap[fieldType] || Text;
|
|
99
|
+
};
|
|
100
|
+
const getComponentConfig = (field) => {
|
|
101
|
+
return { ...field };
|
|
102
|
+
};
|
|
103
|
+
const getPlaceholder = (field, type = "default") => {
|
|
104
|
+
const placeholderMap = {
|
|
105
|
+
text: "请输入",
|
|
106
|
+
select: "请选择",
|
|
107
|
+
date: type === "start" ? "开始日期" : type === "end" ? "结束日期" : "请选择日期",
|
|
108
|
+
number: "请输入",
|
|
109
|
+
number_min: "最小值",
|
|
110
|
+
number_max: "最大值",
|
|
111
|
+
radio: "请选择",
|
|
112
|
+
checkbox: "请选择",
|
|
113
|
+
switch: "请选择"
|
|
114
|
+
};
|
|
115
|
+
if (field.fieldType === "date") {
|
|
116
|
+
return placeholderMap.date;
|
|
117
|
+
}
|
|
118
|
+
if (field.fieldType === "number") {
|
|
119
|
+
return type === "min" ? placeholderMap.number_min : type === "max" ? placeholderMap.number_max : placeholderMap.number;
|
|
120
|
+
}
|
|
121
|
+
return `${placeholderMap[field.fieldType] || "请输入"}${field.label || ""}`;
|
|
122
|
+
};
|
|
123
|
+
const toggleCollapse = () => {
|
|
124
|
+
isCollapsed.value = !isCollapsed.value;
|
|
125
|
+
};
|
|
126
|
+
const handleSearch = () => {
|
|
127
|
+
const filters = {};
|
|
128
|
+
Object.keys(filterValues.value).forEach((key) => {
|
|
129
|
+
const value = filterValues.value[key];
|
|
130
|
+
if (value !== "" && value !== null && value !== void 0) {
|
|
131
|
+
const fieldConfig = completeFilterFields.value.find(
|
|
132
|
+
(field) => field.id == key
|
|
133
|
+
);
|
|
134
|
+
const fieldName = (fieldConfig == null ? void 0 : fieldConfig.fieldName) || key;
|
|
135
|
+
const maxKey = `${key}_max`;
|
|
136
|
+
const maxValue = filterValues.value[maxKey];
|
|
137
|
+
if (maxValue !== "" && maxValue !== null && maxValue !== void 0) {
|
|
138
|
+
filters[fieldName] = value + "|" + maxValue;
|
|
139
|
+
} else if (key.endsWith("_max")) {
|
|
140
|
+
return;
|
|
141
|
+
} else {
|
|
142
|
+
if (Array.isArray(value)) {
|
|
143
|
+
filters[fieldName] = value.join("|");
|
|
144
|
+
} else {
|
|
145
|
+
filters[fieldName] = value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
emit("search", { filters });
|
|
151
|
+
};
|
|
152
|
+
const handleReset = () => {
|
|
153
|
+
filterValues.value = {};
|
|
154
|
+
emit("reset");
|
|
155
|
+
};
|
|
156
|
+
watch(
|
|
157
|
+
() => props.queryConfig,
|
|
158
|
+
() => {
|
|
159
|
+
filterValues.value = {};
|
|
160
|
+
isCollapsed.value = true;
|
|
161
|
+
},
|
|
162
|
+
{ deep: true }
|
|
163
|
+
);
|
|
164
|
+
__expose({
|
|
165
|
+
getFilterValues: () => filterValues.value,
|
|
166
|
+
setFilterValues: (values) => {
|
|
167
|
+
filterValues.value = { ...values };
|
|
168
|
+
},
|
|
169
|
+
reset: handleReset
|
|
170
|
+
});
|
|
171
|
+
return (_ctx, _cache) => {
|
|
172
|
+
const _component_el_date_picker = ElDatePicker;
|
|
173
|
+
const _component_el_input_number = ElInputNumber;
|
|
174
|
+
const _component_el_form_item = ElFormItem;
|
|
175
|
+
const _component_el_button = ElButton;
|
|
176
|
+
const _component_el_form = ElForm;
|
|
177
|
+
const _component_el_icon = ElIcon;
|
|
178
|
+
const _component_el_divider = ElDivider;
|
|
179
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
180
|
+
config.value.enabled ? (openBlock(), createBlock(_component_el_form, {
|
|
181
|
+
key: 0,
|
|
182
|
+
model: filterValues.value,
|
|
183
|
+
class: "fec-table-filter",
|
|
184
|
+
"label-width": "100px",
|
|
185
|
+
"label-position": "right",
|
|
186
|
+
style: normalizeStyle({ "--column-count": config.value.columnCount })
|
|
187
|
+
}, {
|
|
188
|
+
default: withCtx(() => [
|
|
189
|
+
createElementVNode("div", {
|
|
190
|
+
class: normalizeClass(["filter-fields", { "is-collapsed": isCollapsed.value }])
|
|
191
|
+
}, [
|
|
192
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(completeFilterFields.value, (field, index) => {
|
|
193
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
194
|
+
key: field.id,
|
|
195
|
+
class: "filter-field"
|
|
196
|
+
}, [
|
|
197
|
+
createVNode(_component_el_form_item, {
|
|
198
|
+
label: field.label || "筛选条件"
|
|
199
|
+
}, {
|
|
200
|
+
default: withCtx(() => [
|
|
201
|
+
field.fieldType == "date" ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
202
|
+
key: 0,
|
|
203
|
+
modelValue: filterValues.value[field.fieldId],
|
|
204
|
+
"onUpdate:modelValue": ($event) => filterValues.value[field.fieldId] = $event,
|
|
205
|
+
type: "daterange",
|
|
206
|
+
"start-placeholder": getPlaceholder(field, "start"),
|
|
207
|
+
"end-placeholder": getPlaceholder(field, "end"),
|
|
208
|
+
format: "YYYY-MM-DD",
|
|
209
|
+
"value-format": "YYYYMMDD",
|
|
210
|
+
clearable: "",
|
|
211
|
+
style: { "width": "100%" }
|
|
212
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "start-placeholder", "end-placeholder"])) : field.fieldType == "number" ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
213
|
+
createVNode(_component_el_input_number, {
|
|
214
|
+
modelValue: filterValues.value[field.fieldId],
|
|
215
|
+
"onUpdate:modelValue": ($event) => filterValues.value[field.fieldId] = $event,
|
|
216
|
+
placeholder: getPlaceholder(field, "min"),
|
|
217
|
+
controls: false,
|
|
218
|
+
"controls-position": "right",
|
|
219
|
+
style: { "flex": "1" },
|
|
220
|
+
clearable: ""
|
|
221
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
|
|
222
|
+
_cache[0] || (_cache[0] = createElementVNode("span", null, "-", -1)),
|
|
223
|
+
createVNode(_component_el_input_number, {
|
|
224
|
+
modelValue: filterValues.value[`${field.fieldId}_max`],
|
|
225
|
+
"onUpdate:modelValue": ($event) => filterValues.value[`${field.fieldId}_max`] = $event,
|
|
226
|
+
placeholder: getPlaceholder(field, "max"),
|
|
227
|
+
controls: false,
|
|
228
|
+
"controls-position": "right",
|
|
229
|
+
style: { "flex": "1" },
|
|
230
|
+
clearable: ""
|
|
231
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
|
|
232
|
+
])) : (openBlock(), createBlock(resolveDynamicComponent(getFilterComponent(field.fieldType)), mergeProps({
|
|
233
|
+
key: 2,
|
|
234
|
+
modelValue: filterValues.value[field.fieldId],
|
|
235
|
+
"onUpdate:modelValue": ($event) => filterValues.value[field.fieldId] = $event,
|
|
236
|
+
config: { ...field, eventHandlers: {} },
|
|
237
|
+
ref_for: true
|
|
238
|
+
}, getComponentConfig(field), {
|
|
239
|
+
placeholder: getPlaceholder(field)
|
|
240
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "config", "placeholder"]))
|
|
241
|
+
]),
|
|
242
|
+
_: 2
|
|
243
|
+
}, 1032, ["label"])
|
|
244
|
+
])), [
|
|
245
|
+
[
|
|
246
|
+
vShow,
|
|
247
|
+
!isCollapsed.value || index < config.value.columnCount * config.value.collapseRows
|
|
248
|
+
]
|
|
249
|
+
]);
|
|
250
|
+
}), 128))
|
|
251
|
+
], 2),
|
|
252
|
+
createElementVNode("div", {
|
|
253
|
+
class: normalizeClass(["filter-actions", { inline: isSingleLine.value }])
|
|
254
|
+
}, [
|
|
255
|
+
createVNode(_component_el_button, {
|
|
256
|
+
type: "primary",
|
|
257
|
+
onClick: handleSearch,
|
|
258
|
+
icon: unref(search_default)
|
|
259
|
+
}, {
|
|
260
|
+
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
261
|
+
createTextVNode("搜索")
|
|
262
|
+
])),
|
|
263
|
+
_: 1
|
|
264
|
+
}, 8, ["icon"]),
|
|
265
|
+
createVNode(_component_el_button, {
|
|
266
|
+
onClick: handleReset,
|
|
267
|
+
icon: unref(refresh_default)
|
|
268
|
+
}, {
|
|
269
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
270
|
+
createTextVNode("重置")
|
|
271
|
+
])),
|
|
272
|
+
_: 1
|
|
273
|
+
}, 8, ["icon"])
|
|
274
|
+
], 2)
|
|
275
|
+
]),
|
|
276
|
+
_: 1
|
|
277
|
+
}, 8, ["model", "style"])) : createCommentVNode("", true),
|
|
278
|
+
shouldShowToggle.value ? (openBlock(), createBlock(_component_el_divider, {
|
|
279
|
+
key: 1,
|
|
280
|
+
"border-style": "dashed",
|
|
281
|
+
class: "filter-divider"
|
|
282
|
+
}, {
|
|
283
|
+
default: withCtx(() => [
|
|
284
|
+
createElementVNode("div", {
|
|
285
|
+
onClick: toggleCollapse,
|
|
286
|
+
class: "collapse-toggle"
|
|
287
|
+
}, [
|
|
288
|
+
createElementVNode("span", null, toDisplayString(isCollapsed.value ? "更多筛选项" : "收起"), 1),
|
|
289
|
+
createVNode(_component_el_icon, { style: { "transform": "rotate(90deg)" } }, {
|
|
290
|
+
default: withCtx(() => [
|
|
291
|
+
isCollapsed.value ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(d_arrow_left_default), { key: 1 }))
|
|
292
|
+
]),
|
|
293
|
+
_: 1
|
|
294
|
+
})
|
|
295
|
+
])
|
|
296
|
+
]),
|
|
297
|
+
_: 1
|
|
298
|
+
})) : createCommentVNode("", true)
|
|
299
|
+
], 64);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const TableFilter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e72fcecc"]]);
|
|
304
|
+
export {
|
|
305
|
+
TableFilter as default
|
|
306
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Table$1 from "./Table.vue.mjs";
|
|
2
2
|
import install from "../../utils/install.mjs";
|
|
3
|
-
const Table = install.withInstall("Table",
|
|
3
|
+
const Table = install.withInstall("Table", Table$1);
|
|
4
4
|
export {
|
|
5
5
|
Table,
|
|
6
6
|
Table as default
|
|
@@ -12,10 +12,9 @@ function usePageEvents(getOptions) {
|
|
|
12
12
|
const staticOptions = getOptions;
|
|
13
13
|
getOptions = () => staticOptions;
|
|
14
14
|
}
|
|
15
|
-
const executeEvent = (eventName) => {
|
|
16
|
-
var _a;
|
|
15
|
+
const executeEvent = async (eventName) => {
|
|
17
16
|
const options = getOptions();
|
|
18
|
-
const { pageEventConfig, ctx, formData, localConfig, components } = options;
|
|
17
|
+
const { pageEventConfig, ctx, formData, localConfig, components, fields } = options;
|
|
19
18
|
if (!pageEventConfig || !Array.isArray(pageEventConfig) || pageEventConfig.length === 0) {
|
|
20
19
|
console.log(`页面事件 ${eventName} 未配置或配置未加载完成,跳过执行`);
|
|
21
20
|
return;
|
|
@@ -26,7 +25,7 @@ function usePageEvents(getOptions) {
|
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
27
|
const { getEventHandlers: createEventHandlers } = useEventFlow({
|
|
29
|
-
fields:
|
|
28
|
+
fields: fields || [],
|
|
30
29
|
ctx,
|
|
31
30
|
dataSources: (localConfig == null ? void 0 : localConfig.dataSources) || [],
|
|
32
31
|
components: components || {}
|
|
@@ -39,7 +38,7 @@ function usePageEvents(getOptions) {
|
|
|
39
38
|
const eventKeys = Object.keys(handler);
|
|
40
39
|
if (eventKeys.length > 0) {
|
|
41
40
|
console.log(`执行页面事件 ${eventName}`);
|
|
42
|
-
handler[eventKeys[0]]();
|
|
41
|
+
await handler[eventKeys[0]]();
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
44
|
const handleCreated = (checkConfigLoaded) => {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import cloneDeep$1 from "../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.mjs";
|
|
2
|
+
function cloneDeep(data) {
|
|
3
|
+
return cloneDeep$1(data);
|
|
4
|
+
}
|
|
1
5
|
function removeEmptyValues(data) {
|
|
2
6
|
if (typeof data !== "object" || data === null) {
|
|
3
7
|
return data;
|
|
@@ -19,5 +23,6 @@ function removeEmptyValues(data) {
|
|
|
19
23
|
return result;
|
|
20
24
|
}
|
|
21
25
|
export {
|
|
26
|
+
cloneDeep,
|
|
22
27
|
removeEmptyValues
|
|
23
28
|
};
|
|
@@ -6,8 +6,10 @@ import { parseRouteParams } from "./parseRouteParams.mjs";
|
|
|
6
6
|
import { ElMessage } from "../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.mjs";
|
|
7
7
|
class DataSourceManager {
|
|
8
8
|
constructor(options = {}) {
|
|
9
|
+
this.templateId = options.templateId;
|
|
9
10
|
this.http = options.http;
|
|
10
11
|
this.params = options.params || {};
|
|
12
|
+
this.initSearchData = options.initSearchData || {};
|
|
11
13
|
this.dataSources = options.dataSources || [];
|
|
12
14
|
this.currentDataSourceId = options.currentDataSourceId;
|
|
13
15
|
this.pagination = options.pagination || false;
|
|
@@ -38,6 +40,9 @@ class DataSourceManager {
|
|
|
38
40
|
const currentDs = this.getCurrentDataSource();
|
|
39
41
|
if (!currentDs) return {};
|
|
40
42
|
const params = { ...this.params };
|
|
43
|
+
if (this.templateId) {
|
|
44
|
+
params.tableId = this.templateId;
|
|
45
|
+
}
|
|
41
46
|
if (currentDs.params && Array.isArray(currentDs.params)) {
|
|
42
47
|
const parsedParams = parseRouteParams(
|
|
43
48
|
currentDs.params,
|
|
@@ -53,7 +58,7 @@ class DataSourceManager {
|
|
|
53
58
|
if (this.sortRules && this.sortRules.length > 0) {
|
|
54
59
|
params.sortRules = this.sortRules;
|
|
55
60
|
}
|
|
56
|
-
return { ...params, ...extraParams };
|
|
61
|
+
return { ...this.initSearchData, ...params, ...extraParams };
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
59
64
|
* 根据内容类型处理请求数据
|
|
@@ -271,6 +276,27 @@ class DataSourceManager {
|
|
|
271
276
|
getPagination() {
|
|
272
277
|
return this.pagination;
|
|
273
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* 获取当前请求参数
|
|
281
|
+
*/
|
|
282
|
+
getParams() {
|
|
283
|
+
return this.params;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* 更新请求参数
|
|
287
|
+
*/
|
|
288
|
+
updateParams(newParams) {
|
|
289
|
+
this.params = { ...this.params, ...newParams };
|
|
290
|
+
}
|
|
291
|
+
updateInitSearchData(newParams) {
|
|
292
|
+
this.initSearchData = newParams;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 清空请求参数
|
|
296
|
+
*/
|
|
297
|
+
clearParams() {
|
|
298
|
+
this.params = {};
|
|
299
|
+
}
|
|
274
300
|
/**
|
|
275
301
|
* 销毁
|
|
276
302
|
*/
|
|
@@ -327,7 +327,7 @@ async function handleFormSetValue(node, data, fields, context) {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
async function handleFormSubmit(node, data, fields, context) {
|
|
330
|
-
var _a, _b, _c, _d, _e;
|
|
330
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
331
331
|
const basic = node.basic || {};
|
|
332
332
|
if (!(basic == null ? void 0 : basic.dataSourceId)) {
|
|
333
333
|
console.error("form-setValue: 缺少 dataSourceId 配置");
|
|
@@ -358,7 +358,7 @@ async function handleFormSubmit(node, data, fields, context) {
|
|
|
358
358
|
}
|
|
359
359
|
if (typeof getFormDataMethod === "function") {
|
|
360
360
|
try {
|
|
361
|
-
|
|
361
|
+
let formData = getFormDataMethod();
|
|
362
362
|
if (basic.fieldMapping && Array.isArray(basic.fieldMapping)) {
|
|
363
363
|
basic.fieldMapping.forEach((mapping) => {
|
|
364
364
|
const { field, value } = mapping;
|
|
@@ -377,6 +377,23 @@ async function handleFormSubmit(node, data, fields, context) {
|
|
|
377
377
|
if (!result.success) {
|
|
378
378
|
return result;
|
|
379
379
|
}
|
|
380
|
+
if (basic.returnToForm) {
|
|
381
|
+
formData = removeEmptyValues(result.data || {});
|
|
382
|
+
delete formData.pageNo;
|
|
383
|
+
delete formData.pageSize;
|
|
384
|
+
const formComponent2 = (_f = context.components) == null ? void 0 : _f.form;
|
|
385
|
+
const setFormDataMethod = (_h = (_g = formComponent2 == null ? void 0 : formComponent2.$) == null ? void 0 : _g.exposed) == null ? void 0 : _h.setFormData;
|
|
386
|
+
if (typeof setFormDataMethod === "function") {
|
|
387
|
+
setFormDataMethod(formData);
|
|
388
|
+
} else {
|
|
389
|
+
console.error("未找到表单组件的 setFormData 方法");
|
|
390
|
+
return {
|
|
391
|
+
success: false,
|
|
392
|
+
message: "表单组件未正确配置或 setFormData 方法未暴露",
|
|
393
|
+
shouldShowError: true
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}
|
|
380
397
|
return {
|
|
381
398
|
success: true,
|
|
382
399
|
message: "表单提交成功"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import functionCore from "./functionCore.mjs";
|
|
2
|
+
import "vue";
|
|
3
|
+
function calculate(params) {
|
|
4
|
+
const { text, value = {} } = params;
|
|
5
|
+
if (!text) return new Error("非法公式");
|
|
6
|
+
try {
|
|
7
|
+
let str = text;
|
|
8
|
+
let offset = 0;
|
|
9
|
+
const regex = /\{(\w+)\}/g;
|
|
10
|
+
let match;
|
|
11
|
+
const fields = [];
|
|
12
|
+
while ((match = regex.exec(text)) !== null) {
|
|
13
|
+
fields.push({
|
|
14
|
+
enCode: match[1],
|
|
15
|
+
startIndex: match.index,
|
|
16
|
+
endIndex: match.index + match[0].length
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
for (const field of fields) {
|
|
20
|
+
const { enCode, startIndex, endIndex } = field;
|
|
21
|
+
let data = value[enCode];
|
|
22
|
+
if (enCode.indexOf(".") > -1) {
|
|
23
|
+
const [key, subKey] = enCode.split(".");
|
|
24
|
+
if (value[key]) data = value[key].map((o) => o[subKey]);
|
|
25
|
+
}
|
|
26
|
+
if (data !== void 0) {
|
|
27
|
+
data = JSON.stringify(data);
|
|
28
|
+
const actualStart = startIndex + offset;
|
|
29
|
+
const actualEnd = endIndex + offset;
|
|
30
|
+
str = str.slice(0, actualStart) + data.toString() + str.slice(actualEnd);
|
|
31
|
+
offset += data.toString().length - (endIndex - startIndex);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const result = functionCore.executeFunction(str);
|
|
35
|
+
return result;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
const errorTypes = {
|
|
38
|
+
TypeError: () => "类型错误",
|
|
39
|
+
RangeError: () => "范围错误",
|
|
40
|
+
SyntaxError: () => "语法错误",
|
|
41
|
+
ReferenceError: () => {
|
|
42
|
+
const regex = /^(\w+)\s+is\s+not\s+defined$/;
|
|
43
|
+
const match = e.message.match(regex);
|
|
44
|
+
return match ? `${match[1]} 未定义` : "未定义的变量";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const errorType = errorTypes[e.constructor.name];
|
|
48
|
+
const errorMessage = (errorType == null ? void 0 : errorType()) || `其他错误: ${e.message}`;
|
|
49
|
+
return {
|
|
50
|
+
error: true,
|
|
51
|
+
message: errorMessage
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
calculate
|
|
57
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as index from "../../../../../node_modules/.pnpm/@formulajs_formulajs@4.5.6/node_modules/@formulajs/formulajs/lib/esm/index.mjs";
|
|
2
|
+
class FunctionCore {
|
|
3
|
+
constructor() {
|
|
4
|
+
Object.assign(FunctionCore.prototype, index);
|
|
5
|
+
}
|
|
6
|
+
executeFunction(str) {
|
|
7
|
+
const fn = new Function(
|
|
8
|
+
"with(this) { return " + str + "; }"
|
|
9
|
+
// 使用 `with` 来确保从当前实例中查找函数
|
|
10
|
+
).bind(this);
|
|
11
|
+
return fn();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const functionCore = new FunctionCore();
|
|
15
|
+
export {
|
|
16
|
+
functionCore as default
|
|
17
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeEmptyValues } from "./common.mjs";
|
|
1
2
|
function parseSingleParamValue(value, data, fields) {
|
|
2
3
|
if (typeof value !== "object" || value === null) {
|
|
3
4
|
return value;
|
|
@@ -17,7 +18,7 @@ function parseSingleParamValue(value, data, fields) {
|
|
|
17
18
|
return {};
|
|
18
19
|
} else if (type === "urlParam") {
|
|
19
20
|
const urlParams = new URLSearchParams(window.location.search);
|
|
20
|
-
return urlParams.get(value.value) ||
|
|
21
|
+
return urlParams.get(value.value) || null;
|
|
21
22
|
} else {
|
|
22
23
|
return value.value !== void 0 ? value.value : value;
|
|
23
24
|
}
|
|
@@ -32,7 +33,7 @@ function parseRouteParams(routeParams, data, fields) {
|
|
|
32
33
|
if (!key) return;
|
|
33
34
|
params[key] = parseSingleParamValue(param.value, data, fields);
|
|
34
35
|
});
|
|
35
|
-
return params;
|
|
36
|
+
return removeEmptyValues(params);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
39
|
parseRouteParams,
|