@fecp/vue 1.1.9 → 1.2.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/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/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/cascader/src/cascader.vue2.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/container/index.mjs +6 -6
- 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/packages/mobile/src/components/base/card/Card.vue.mjs +2 -2
- package/es/packages/vue/index.mjs +1 -1
- package/es/packages/vue/src/components/details/footer/Footer.vue.mjs +19 -11
- package/es/packages/vue/src/components/dialog/DialogRenderer.vue2.mjs +403 -0
- package/es/packages/vue/src/components/dialog/index.mjs +68 -0
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +50 -19
- package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +10 -4
- package/es/packages/vue/src/components/forms/subForm/SubForm.vue.mjs +6 -1
- package/es/packages/vue/src/components/forms/subTable/SubTable.vue.mjs +2 -3
- package/es/packages/vue/src/components/forms/text/Text.vue.mjs +81 -8
- package/es/packages/vue/src/components/table/Pagination.vue.mjs +3 -2
- package/es/packages/vue/src/components/table/Table.vue.mjs +59 -18
- package/es/packages/vue/src/components/table/TableColumn.vue.mjs +32 -17
- package/es/packages/vue/src/components/table/TableFilter.vue.mjs +8 -5
- package/es/packages/vue/src/components/table/index.mjs +2 -2
- package/es/packages/vue/src/composables/usePageEvents.mjs +14 -6
- package/es/packages/vue/src/utils/common.mjs +5 -0
- package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +48 -3
- package/es/packages/vue/src/utils/eventFlow/eventFlowHandler.mjs +58 -26
- package/es/packages/vue/src/utils/eventFlowParser.mjs +9 -6
- package/es/packages/vue/src/utils/formulajs/calculate.mjs +1 -1
- package/es/vue.css +293 -208
- package/lib/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/cascader/src/cascader.vue2.js +29 -29
- package/lib/packages/mobile/src/components/base/card/Card.vue.js +2 -2
- package/lib/packages/vue/index.js +1 -1
- package/lib/packages/vue/src/components/details/footer/Footer.vue.js +19 -11
- package/lib/packages/vue/src/components/dialog/DialogRenderer.vue2.js +403 -0
- package/lib/packages/vue/src/components/dialog/index.js +68 -0
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +50 -19
- package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +10 -4
- package/lib/packages/vue/src/components/forms/subForm/SubForm.vue.js +6 -1
- package/lib/packages/vue/src/components/forms/subTable/SubTable.vue.js +0 -1
- package/lib/packages/vue/src/components/forms/text/Text.vue.js +80 -7
- package/lib/packages/vue/src/components/table/Pagination.vue.js +3 -2
- package/lib/packages/vue/src/components/table/Table.vue.js +59 -18
- package/lib/packages/vue/src/components/table/TableColumn.vue.js +31 -16
- package/lib/packages/vue/src/components/table/TableFilter.vue.js +8 -5
- package/lib/packages/vue/src/composables/usePageEvents.js +14 -6
- package/lib/packages/vue/src/utils/common.js +5 -0
- package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +56 -11
- package/lib/packages/vue/src/utils/eventFlow/eventFlowHandler.js +58 -26
- package/lib/packages/vue/src/utils/eventFlowParser.js +9 -6
- package/lib/packages/vue/src/utils/formulajs/calculate.js +1 -1
- package/lib/vue.css +293 -208
- package/package.json +1 -1
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { computed, createElementBlock, openBlock, createBlock, createCommentVNode, unref, Fragment, renderList, withCtx, renderSlot, toDisplayString, mergeProps, toHandlers, createTextVNode, createVNode } from "vue";
|
|
4
|
+
import { getCurrentInstance, computed, createElementBlock, openBlock, createBlock, createCommentVNode, unref, Fragment, renderList, withCtx, renderSlot, toDisplayString, mergeProps, toHandlers, createTextVNode, createVNode } from "vue";
|
|
5
5
|
import "../../../../../node_modules/.pnpm/vxe-table@4.17.47_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/components.mjs";
|
|
6
6
|
import { CopyDocument as copy_document_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";
|
|
7
7
|
import { checkFilterMatch } from "../../utils/parseFilterConfig.mjs";
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
|
-
/* empty css
|
|
12
|
-
/* empty css */
|
|
11
|
+
/* empty css */
|
|
13
12
|
/* empty css */
|
|
13
|
+
import "./index.mjs";
|
|
14
|
+
import "../forms/form/index.mjs";
|
|
15
|
+
import "../../utils/formulajs/functionCore.mjs";
|
|
14
16
|
import { useEventFlow } from "../../utils/eventFlow/eventFlowHandler.mjs";
|
|
15
|
-
|
|
17
|
+
/* empty css */
|
|
18
|
+
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
19
|
+
/* empty css */
|
|
20
|
+
/* empty css */
|
|
16
21
|
import { Decimal } from "../../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.mjs";
|
|
17
22
|
/* empty css */
|
|
18
|
-
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
19
23
|
import { VxeColumn } from "../../../../../node_modules/.pnpm/vxe-table@4.17.47_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/column/index.mjs";
|
|
20
24
|
import { ElLink } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/link/index.mjs";
|
|
21
25
|
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";
|
|
@@ -72,10 +76,10 @@ const _sfc_main = {
|
|
|
72
76
|
type: Object,
|
|
73
77
|
default: () => ({})
|
|
74
78
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
localConfig: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: () => {
|
|
82
|
+
}
|
|
79
83
|
},
|
|
80
84
|
// 表格组件引用(用于表格刷新等操作)
|
|
81
85
|
tableRef: {
|
|
@@ -86,10 +90,19 @@ const _sfc_main = {
|
|
|
86
90
|
tableData: {
|
|
87
91
|
type: Array,
|
|
88
92
|
default: () => []
|
|
93
|
+
},
|
|
94
|
+
readonly: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
isDialog: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
89
101
|
}
|
|
90
102
|
},
|
|
91
103
|
setup(__props) {
|
|
92
104
|
const props = __props;
|
|
105
|
+
const instance = getCurrentInstance();
|
|
93
106
|
const visibleFields = computed(() => {
|
|
94
107
|
let fields = props.fieldsData.filter((field) => field.isShow);
|
|
95
108
|
if (props.modeKey && props.modes.length) {
|
|
@@ -247,8 +260,8 @@ const _sfc_main = {
|
|
|
247
260
|
});
|
|
248
261
|
const { getEventHandlers: createEventHandlers } = useEventFlow({
|
|
249
262
|
fields: props.fieldsData,
|
|
250
|
-
|
|
251
|
-
|
|
263
|
+
instance,
|
|
264
|
+
localConfig: props.localConfig,
|
|
252
265
|
components: {
|
|
253
266
|
table: props.tableRef
|
|
254
267
|
}
|
|
@@ -259,16 +272,18 @@ const _sfc_main = {
|
|
|
259
272
|
const _component_el_icon = ElIcon;
|
|
260
273
|
const _component_el_button = ElButton;
|
|
261
274
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
262
|
-
__props.selectMode === "multiple" ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
275
|
+
!__props.readonly && __props.selectMode === "multiple" ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
263
276
|
key: 0,
|
|
264
277
|
type: "checkbox",
|
|
265
278
|
width: 50,
|
|
266
|
-
fixed: "left"
|
|
279
|
+
fixed: "left",
|
|
280
|
+
align: "center"
|
|
267
281
|
})) : createCommentVNode("", true),
|
|
268
|
-
__props.selectMode === "single" ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
282
|
+
!__props.readonly && __props.selectMode === "single" ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
269
283
|
key: 1,
|
|
270
284
|
type: "radio",
|
|
271
285
|
width: 50,
|
|
286
|
+
align: "center",
|
|
272
287
|
fixed: "left"
|
|
273
288
|
})) : createCommentVNode("", true),
|
|
274
289
|
__props.showIndex ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
@@ -301,7 +316,7 @@ const _sfc_main = {
|
|
|
301
316
|
field
|
|
302
317
|
}, () => [
|
|
303
318
|
field.prefix ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(field.prefix), 1)) : createCommentVNode("", true),
|
|
304
|
-
field.isLink ? (openBlock(), createBlock(_component_el_link, mergeProps({
|
|
319
|
+
field.isLink && !__props.isDialog ? (openBlock(), createBlock(_component_el_link, mergeProps({
|
|
305
320
|
key: 1,
|
|
306
321
|
type: "primary"
|
|
307
322
|
}, toHandlers(getEventHandlers(row, field, field.linkConfig))), {
|
|
@@ -328,7 +343,7 @@ const _sfc_main = {
|
|
|
328
343
|
_: 2
|
|
329
344
|
}, 1032, ["field", "title", "width", "min-width", "fixed", "align", "header-align", "sortable", "show-overflow"]);
|
|
330
345
|
}), 128)),
|
|
331
|
-
shouldShowOptColumn.value ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
346
|
+
!__props.readonly && shouldShowOptColumn.value ? (openBlock(), createBlock(unref(VxeColumn), {
|
|
332
347
|
key: 3,
|
|
333
348
|
title: "操作",
|
|
334
349
|
width: optColumnWidth.value,
|
|
@@ -356,7 +371,7 @@ const _sfc_main = {
|
|
|
356
371
|
};
|
|
357
372
|
}
|
|
358
373
|
};
|
|
359
|
-
const TableColumn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
374
|
+
const TableColumn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4405f869"]]);
|
|
360
375
|
export {
|
|
361
376
|
TableColumn as default
|
|
362
377
|
};
|
|
@@ -43,7 +43,7 @@ const _sfc_main = {
|
|
|
43
43
|
emits: ["search", "reset"],
|
|
44
44
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
45
|
useCssVars((_ctx) => ({
|
|
46
|
-
"
|
|
46
|
+
"f2b12ff4": `${config.value.collapseRows * 90}px`
|
|
47
47
|
}));
|
|
48
48
|
const props = __props;
|
|
49
49
|
const emit = __emit;
|
|
@@ -77,12 +77,15 @@ const _sfc_main = {
|
|
|
77
77
|
return fieldCount > maxVisibleFields;
|
|
78
78
|
});
|
|
79
79
|
const isSingleLine = computed(() => {
|
|
80
|
+
const totalRows = Math.ceil(
|
|
81
|
+
completeFilterFields.value.length / config.value.columnCount
|
|
82
|
+
);
|
|
83
|
+
if (totalRows === 1) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
80
86
|
if (isCollapsed.value) {
|
|
81
87
|
return config.value.collapseRows === 1;
|
|
82
88
|
} else {
|
|
83
|
-
const totalRows = Math.ceil(
|
|
84
|
-
completeFilterFields.value.length / config.value.columnCount
|
|
85
|
-
);
|
|
86
89
|
return totalRows === 1;
|
|
87
90
|
}
|
|
88
91
|
});
|
|
@@ -300,7 +303,7 @@ const _sfc_main = {
|
|
|
300
303
|
};
|
|
301
304
|
}
|
|
302
305
|
};
|
|
303
|
-
const TableFilter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
306
|
+
const TableFilter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ae5195b7"]]);
|
|
304
307
|
export {
|
|
305
308
|
TableFilter as default
|
|
306
309
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _Table 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);
|
|
4
4
|
export {
|
|
5
5
|
Table,
|
|
6
6
|
Table as default
|
|
@@ -3,11 +3,16 @@ import { onUnmounted, onBeforeUnmount, onMounted } from "vue";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
/* empty css */
|
|
7
6
|
/* empty css */
|
|
8
|
-
/* empty css */
|
|
9
7
|
/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
import "../components/table/index.mjs";
|
|
10
|
+
import "../components/forms/form/index.mjs";
|
|
11
|
+
import "../utils/formulajs/functionCore.mjs";
|
|
10
12
|
import { useEventFlow } from "../utils/eventFlow/eventFlowHandler.mjs";
|
|
13
|
+
/* empty css */
|
|
14
|
+
/* empty css */
|
|
15
|
+
/* empty css */
|
|
11
16
|
function usePageEvents(getOptions) {
|
|
12
17
|
if (typeof getOptions !== "function") {
|
|
13
18
|
const staticOptions = getOptions;
|
|
@@ -15,7 +20,7 @@ function usePageEvents(getOptions) {
|
|
|
15
20
|
}
|
|
16
21
|
const executeEvent = async (eventName) => {
|
|
17
22
|
const options = getOptions();
|
|
18
|
-
const { pageEventConfig,
|
|
23
|
+
const { pageEventConfig, instance, formData, localConfig, components, fields, initSearchData } = options;
|
|
19
24
|
if (!pageEventConfig || !Array.isArray(pageEventConfig) || pageEventConfig.length === 0) {
|
|
20
25
|
console.log(`页面事件 ${eventName} 未配置或配置未加载完成,跳过执行`);
|
|
21
26
|
return;
|
|
@@ -27,9 +32,12 @@ function usePageEvents(getOptions) {
|
|
|
27
32
|
}
|
|
28
33
|
const { getEventHandlers: createEventHandlers } = useEventFlow({
|
|
29
34
|
fields: fields || [],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
components: components || {}
|
|
35
|
+
instance,
|
|
36
|
+
localConfig: localConfig || {},
|
|
37
|
+
components: components || {},
|
|
38
|
+
metadata: {
|
|
39
|
+
initSearchData
|
|
40
|
+
}
|
|
33
41
|
});
|
|
34
42
|
const handler = createEventHandlers(
|
|
35
43
|
{},
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import cloneDeep$1 from "../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.mjs";
|
|
2
|
+
import isEqual$1 from "../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isEqual.mjs";
|
|
2
3
|
function cloneDeep(data) {
|
|
3
4
|
return cloneDeep$1(data);
|
|
4
5
|
}
|
|
6
|
+
function isEqual(data1, data2) {
|
|
7
|
+
return isEqual$1(data1, data2);
|
|
8
|
+
}
|
|
5
9
|
function removeEmptyValues(data) {
|
|
6
10
|
if (typeof data !== "object" || data === null) {
|
|
7
11
|
return data;
|
|
@@ -24,5 +28,6 @@ function removeEmptyValues(data) {
|
|
|
24
28
|
}
|
|
25
29
|
export {
|
|
26
30
|
cloneDeep,
|
|
31
|
+
isEqual,
|
|
27
32
|
removeEmptyValues
|
|
28
33
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createDataSource } from "../datasource.mjs";
|
|
2
2
|
import { parseRouteParams } from "../parseRouteParams.mjs";
|
|
3
3
|
import { removeEmptyValues } from "../common.mjs";
|
|
4
|
+
import { openDialog } from "../../components/dialog/index.mjs";
|
|
4
5
|
/* empty css */
|
|
5
6
|
/* empty css */
|
|
6
7
|
/* empty css */
|
|
@@ -9,6 +10,17 @@ import { removeEmptyValues } from "../common.mjs";
|
|
|
9
10
|
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";
|
|
10
11
|
import { ElMessageBox } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message-box/index.mjs";
|
|
11
12
|
async function handlePageJump(node, data, fields, context) {
|
|
13
|
+
const dialogDoms = document.querySelectorAll(".el-modal-dialog");
|
|
14
|
+
if ((dialogDoms == null ? void 0 : dialogDoms.length) > 0) {
|
|
15
|
+
for (let i in dialogDoms) {
|
|
16
|
+
if (!dialogDoms[i].style.display) {
|
|
17
|
+
return {
|
|
18
|
+
success: true,
|
|
19
|
+
message: "页面存在弹层,跳过页面跳转"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
12
24
|
const basic = node.basic || {};
|
|
13
25
|
const transitionType = basic.transitionType || "page";
|
|
14
26
|
const params = parseRouteParams(basic.routeParams, data, fields);
|
|
@@ -133,7 +145,7 @@ async function handleApiCall(node, data, fields, context, params) {
|
|
|
133
145
|
message: "数据源配置不完整,缺少 dataSourceId"
|
|
134
146
|
};
|
|
135
147
|
}
|
|
136
|
-
const dataSources = context.dataSources || [];
|
|
148
|
+
const dataSources = context.localConfig.dataSources || [];
|
|
137
149
|
const dataSourceConfig = dataSources.find((ds) => ds.id === basic.dataSourceId);
|
|
138
150
|
if (!dataSourceConfig) {
|
|
139
151
|
return {
|
|
@@ -289,7 +301,9 @@ async function handleFormSetValue(node, data, fields, context) {
|
|
|
289
301
|
console.error("form-setValue: 缺少 dataSourceId 配置");
|
|
290
302
|
return;
|
|
291
303
|
}
|
|
292
|
-
const
|
|
304
|
+
const metadata = context.metadata || {};
|
|
305
|
+
const initSearchData = (metadata == null ? void 0 : metadata.initSearchData) || {};
|
|
306
|
+
const result = await handleApiCall(node, data, fields, context, initSearchData);
|
|
293
307
|
if (!result.success) {
|
|
294
308
|
return result;
|
|
295
309
|
}
|
|
@@ -416,6 +430,35 @@ async function handleFormSubmit(node, data, fields, context) {
|
|
|
416
430
|
};
|
|
417
431
|
}
|
|
418
432
|
}
|
|
433
|
+
async function handleDialog(node, data, fields, context) {
|
|
434
|
+
const basic = node.basic || {};
|
|
435
|
+
if (!(basic == null ? void 0 : basic.dialogId)) {
|
|
436
|
+
console.error("ui-dialog: 缺少 dialogId 配置");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const dialogList = context.localConfig.dialogs || [];
|
|
440
|
+
const dialog = dialogList.find((item) => item.id == (basic == null ? void 0 : basic.dialogId));
|
|
441
|
+
if (!dialog) {
|
|
442
|
+
console.error("ui-dialog: 未找到匹配的弹层配置," + (basic == null ? void 0 : basic.dialogId));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
openDialog(
|
|
446
|
+
null,
|
|
447
|
+
dialog,
|
|
448
|
+
context.instance,
|
|
449
|
+
context.ctx,
|
|
450
|
+
fields,
|
|
451
|
+
data
|
|
452
|
+
).then((result) => {
|
|
453
|
+
console.log("确定", result);
|
|
454
|
+
}).catch(() => {
|
|
455
|
+
console.log("取消");
|
|
456
|
+
});
|
|
457
|
+
return {
|
|
458
|
+
success: true,
|
|
459
|
+
message: `弹层 ${dialog.name} 已打开`
|
|
460
|
+
};
|
|
461
|
+
}
|
|
419
462
|
const defaultActionHandlers = {
|
|
420
463
|
"page-jump": handlePageJump,
|
|
421
464
|
"page-go-back": handlePageGoBack,
|
|
@@ -425,7 +468,8 @@ const defaultActionHandlers = {
|
|
|
425
468
|
"table-refresh": handleTableRefresh,
|
|
426
469
|
"form-setValue": handleFormSetValue,
|
|
427
470
|
"form-submit": handleFormSubmit,
|
|
428
|
-
"custom": handleCustomAction
|
|
471
|
+
"custom": handleCustomAction,
|
|
472
|
+
"ui-dialog": handleDialog
|
|
429
473
|
};
|
|
430
474
|
export {
|
|
431
475
|
defaultActionHandlers as default,
|
|
@@ -433,6 +477,7 @@ export {
|
|
|
433
477
|
handleApiCall,
|
|
434
478
|
handleConfirm,
|
|
435
479
|
handleCustomAction,
|
|
480
|
+
handleDialog,
|
|
436
481
|
handleMessage,
|
|
437
482
|
handlePageGoBack,
|
|
438
483
|
handlePageJump,
|
|
@@ -1,38 +1,69 @@
|
|
|
1
1
|
import { createEventFlowParser } from "../eventFlowParser.mjs";
|
|
2
|
+
async function executeEventFlow(params) {
|
|
3
|
+
const {
|
|
4
|
+
eventFlow,
|
|
5
|
+
fields = [],
|
|
6
|
+
instance = null,
|
|
7
|
+
localConfig = {},
|
|
8
|
+
components = {},
|
|
9
|
+
onSuccess,
|
|
10
|
+
onError,
|
|
11
|
+
row,
|
|
12
|
+
item,
|
|
13
|
+
metadata
|
|
14
|
+
} = params;
|
|
15
|
+
if (!eventFlow) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const parser = createEventFlowParser({
|
|
20
|
+
eventFlow,
|
|
21
|
+
fields,
|
|
22
|
+
data: row,
|
|
23
|
+
instance,
|
|
24
|
+
localConfig,
|
|
25
|
+
components,
|
|
26
|
+
metadata
|
|
27
|
+
});
|
|
28
|
+
const result = await parser.start();
|
|
29
|
+
console.log("事件流执行完成:", result);
|
|
30
|
+
parser.destroy();
|
|
31
|
+
if (onSuccess) {
|
|
32
|
+
onSuccess(result, row, item);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("事件流执行失败:", error);
|
|
37
|
+
if (onError) {
|
|
38
|
+
onError(error, row, item);
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
2
43
|
function createEventFlowHandler(options = {}) {
|
|
3
44
|
const {
|
|
4
45
|
fields = [],
|
|
5
|
-
|
|
46
|
+
instance = null,
|
|
6
47
|
onSuccess,
|
|
7
48
|
onError,
|
|
8
|
-
|
|
9
|
-
components = {}
|
|
49
|
+
localConfig = {},
|
|
50
|
+
components = {},
|
|
51
|
+
metadata = {}
|
|
10
52
|
} = options;
|
|
11
53
|
return async function handleEvent(row, item, eventConfig) {
|
|
12
54
|
if (eventConfig && eventConfig.eventFlow) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (onSuccess) {
|
|
26
|
-
onSuccess(result, row, item);
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error("事件流执行失败:", error);
|
|
31
|
-
if (onError) {
|
|
32
|
-
onError(error, row, item);
|
|
33
|
-
}
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
55
|
+
return await executeEventFlow({
|
|
56
|
+
eventFlow: eventConfig.eventFlow,
|
|
57
|
+
fields,
|
|
58
|
+
instance,
|
|
59
|
+
localConfig,
|
|
60
|
+
components,
|
|
61
|
+
onSuccess,
|
|
62
|
+
onError,
|
|
63
|
+
row,
|
|
64
|
+
item,
|
|
65
|
+
metadata
|
|
66
|
+
});
|
|
36
67
|
}
|
|
37
68
|
};
|
|
38
69
|
}
|
|
@@ -57,6 +88,7 @@ function useEventFlow(options = {}) {
|
|
|
57
88
|
}
|
|
58
89
|
export {
|
|
59
90
|
createEventFlowHandler,
|
|
91
|
+
executeEventFlow,
|
|
60
92
|
getEventHandlers,
|
|
61
93
|
useEventFlow
|
|
62
94
|
};
|
|
@@ -30,6 +30,7 @@ class EventFlowParser {
|
|
|
30
30
|
results: []
|
|
31
31
|
// 每个节点的执行结果
|
|
32
32
|
};
|
|
33
|
+
this.metadata = options.metadata || {};
|
|
33
34
|
this.actionHandlers = {
|
|
34
35
|
...defaultActionHandlers,
|
|
35
36
|
...options.customActionHandlers
|
|
@@ -260,7 +261,7 @@ class EventFlowParser {
|
|
|
260
261
|
if (actionResult.shouldShowError !== false) {
|
|
261
262
|
ElMessage.error(errorMessage);
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
+
throw new Error(errorMessage);
|
|
264
265
|
}
|
|
265
266
|
if ((_b = node.advanced) == null ? void 0 : _b.blockCondition) {
|
|
266
267
|
const shouldBlock = checkFilterMatch(
|
|
@@ -289,17 +290,19 @@ class EventFlowParser {
|
|
|
289
290
|
* 执行动作
|
|
290
291
|
*/
|
|
291
292
|
async executeAction(node) {
|
|
292
|
-
var _a, _b, _c;
|
|
293
|
+
var _a, _b, _c, _d, _e, _f;
|
|
293
294
|
const handler = this.actionHandlers[node.actionType];
|
|
294
295
|
if (!handler) {
|
|
295
296
|
throw new Error(`未找到动作处理器: ${node.actionType}`);
|
|
296
297
|
}
|
|
297
298
|
const context = {
|
|
298
299
|
parser: this,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
instance: (_a = this.options) == null ? void 0 : _a.instance,
|
|
301
|
+
ctx: (_c = (_b = this.options) == null ? void 0 : _b.instance) == null ? void 0 : _c.proxy,
|
|
302
|
+
customActions: (_d = this.options) == null ? void 0 : _d.customActions,
|
|
303
|
+
localConfig: (_e = this.options) == null ? void 0 : _e.localConfig,
|
|
304
|
+
components: this.components,
|
|
305
|
+
metadata: (_f = this.options) == null ? void 0 : _f.metadata
|
|
303
306
|
};
|
|
304
307
|
return await handler(node, this.data, this.fields, context);
|
|
305
308
|
}
|