@skyfox2000/webui 1.2.10 → 1.2.12

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.
Files changed (121) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/lib/AceEditor.d.ts +1 -0
  3. package/lib/BasicLayout.d.ts +1 -0
  4. package/lib/Error403.d.ts +1 -0
  5. package/lib/Error404.d.ts +1 -0
  6. package/lib/ExcelForm.d.ts +1 -0
  7. package/lib/UploadForm.d.ts +1 -0
  8. package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  9. package/lib/assets/modules/file-upload-CGyzCx7I.js +204 -0
  10. package/lib/assets/modules/form-excel-DWirWVPA.js +235 -0
  11. package/lib/assets/modules/index-C1zkNPmi.js +109 -0
  12. package/lib/assets/modules/index-Czk7DDWM.js +112 -0
  13. package/lib/assets/modules/menuTabs-BOax-dro.js +671 -0
  14. package/lib/assets/modules/toolIcon-vJF7OgP6.js +50 -0
  15. package/lib/assets/modules/uploadList-BW23uSvi.js +369 -0
  16. package/lib/assets/modules/uploadList-DaUjVXLU.js +2267 -0
  17. package/lib/components/common/button/index.vue.d.ts +41 -0
  18. package/lib/components/common/icon/appicon.vue.d.ts +11 -0
  19. package/lib/components/common/icon/fullscreen.vue.d.ts +3 -0
  20. package/lib/components/common/icon/helper.vue.d.ts +22 -0
  21. package/lib/components/common/icon/index.vue.d.ts +243 -0
  22. package/lib/components/common/icon/layoutIcon.vue.d.ts +43 -0
  23. package/lib/components/common/icon/projectIcon.vue.d.ts +59 -0
  24. package/lib/components/common/icon/toolIcon.vue.d.ts +43 -0
  25. package/lib/components/common/index.d.ts +20 -0
  26. package/lib/components/common/loading/index.vue.d.ts +3 -0
  27. package/lib/components/common/tooltip/index.vue.d.ts +21 -0
  28. package/lib/components/content/dialog/index.vue.d.ts +35 -0
  29. package/lib/components/content/drawer/index.vue.d.ts +28 -0
  30. package/lib/components/content/form/formItem.vue.d.ts +27 -0
  31. package/lib/components/content/form/index.vue.d.ts +25 -0
  32. package/lib/components/content/index.d.ts +22 -0
  33. package/lib/components/content/search/index.vue.d.ts +30 -0
  34. package/lib/components/content/search/searchItem.vue.d.ts +23 -0
  35. package/lib/components/content/table/index.vue.d.ts +36 -0
  36. package/lib/components/content/table/tableOperate.vue.d.ts +18 -0
  37. package/lib/components/content/toolbar/icontool.vue.d.ts +7 -0
  38. package/lib/components/content/toolbar/index.vue.d.ts +18 -0
  39. package/lib/components/content/tree/index.vue.d.ts +46 -0
  40. package/lib/components/form/aceEditor/aceConfig.d.ts +8 -0
  41. package/lib/components/form/autoComplete/index.vue.d.ts +176 -0
  42. package/lib/components/form/cascader/index.vue.d.ts +120 -0
  43. package/lib/components/form/checkbox/index.vue.d.ts +139 -0
  44. package/lib/components/form/datePicker/index.vue.d.ts +6 -0
  45. package/lib/components/form/index.d.ts +39 -0
  46. package/lib/components/form/input/index.vue.d.ts +26 -0
  47. package/lib/components/form/input/inputIcon.vue.d.ts +10 -0
  48. package/lib/components/form/input/inputNumber.vue.d.ts +3 -0
  49. package/lib/components/form/input/inputPassword.vue.d.ts +3 -0
  50. package/lib/components/form/propEditor/index.vue.d.ts +21 -0
  51. package/lib/components/form/radio/index.vue.d.ts +144 -0
  52. package/lib/components/form/radio/radioStatus.vue.d.ts +31 -0
  53. package/lib/components/form/rangePicker/index.vue.d.ts +16 -0
  54. package/lib/components/form/select/index.vue.d.ts +153 -0
  55. package/lib/components/form/switch/index.vue.d.ts +43 -0
  56. package/lib/components/form/textarea/index.vue.d.ts +3 -0
  57. package/lib/components/form/transfer/index.vue.d.ts +38 -0
  58. package/lib/components/form/transfer/transferTable.vue.d.ts +38 -0
  59. package/lib/components/form/treeSelect/index.vue.d.ts +38 -0
  60. package/lib/components/form/upload/uploadList.vue.d.ts +487 -0
  61. package/lib/components/index.d.ts +4 -0
  62. package/lib/components/layout/breadcrumb/index.vue.d.ts +3 -0
  63. package/lib/components/layout/content/index.vue.d.ts +22 -0
  64. package/lib/components/layout/datetime/index.vue.d.ts +3 -0
  65. package/lib/components/layout/header/headerExits.vue.d.ts +3 -0
  66. package/lib/components/layout/header/index.vue.d.ts +3 -0
  67. package/lib/components/layout/header/user.vue.d.ts +3 -0
  68. package/lib/components/layout/index.d.ts +14 -0
  69. package/lib/components/layout/menu/index.vue.d.ts +6 -0
  70. package/lib/components/layout/menu/menuTabs.vue.d.ts +3 -0
  71. package/lib/const/options.d.ts +32 -0
  72. package/lib/directives/enter-submit.d.ts +4 -0
  73. package/lib/directives/index.d.ts +2 -0
  74. package/lib/directives/permission.d.ts +5 -0
  75. package/lib/es/AceEditor/index.js +167 -0
  76. package/lib/es/BasicLayout/index.js +101 -0
  77. package/lib/es/Error403/index.js +39 -0
  78. package/lib/es/Error404/index.js +39 -0
  79. package/lib/es/ExcelForm/index.js +321 -0
  80. package/lib/es/UploadForm/index.js +110 -0
  81. package/lib/index.d.ts +45 -0
  82. package/lib/router/index.d.ts +15 -0
  83. package/lib/stores/appInfo.d.ts +31 -0
  84. package/lib/stores/hostInfo.d.ts +9 -0
  85. package/lib/stores/pageInfo.d.ts +18 -0
  86. package/lib/stores/pinia.d.ts +3 -0
  87. package/lib/stores/settingInfo.d.ts +8 -0
  88. package/lib/stores/userInfo.d.ts +25 -0
  89. package/lib/typings/data.d.ts +80 -0
  90. package/lib/typings/form.d.ts +187 -0
  91. package/lib/typings/menu.d.ts +7 -0
  92. package/lib/typings/option.d.ts +189 -0
  93. package/lib/typings/page.d.ts +70 -0
  94. package/lib/typings/table.d.ts +181 -0
  95. package/lib/typings/tools.d.ts +130 -0
  96. package/lib/typings/tree.d.ts +72 -0
  97. package/lib/typings/upload.d.ts +161 -0
  98. package/lib/typings/urls.d.ts +69 -0
  99. package/lib/utils/cache.d.ts +23 -0
  100. package/lib/utils/data.d.ts +6 -0
  101. package/lib/utils/download.d.ts +4 -0
  102. package/lib/utils/eventbus.d.ts +16 -0
  103. package/lib/utils/export-table.d.ts +12 -0
  104. package/lib/utils/file-upload.d.ts +17 -0
  105. package/lib/utils/form-excel.d.ts +33 -0
  106. package/lib/utils/form-validate.d.ts +29 -0
  107. package/lib/utils/form.d.ts +9 -0
  108. package/lib/utils/icon-loader.d.ts +125 -0
  109. package/lib/utils/isEmpty.d.ts +1 -0
  110. package/lib/utils/main-openapis.d.ts +8 -0
  111. package/lib/utils/menu.d.ts +6 -0
  112. package/lib/utils/options.d.ts +10 -0
  113. package/lib/utils/page.d.ts +25 -0
  114. package/lib/utils/table.d.ts +21 -0
  115. package/lib/utils/tools.d.ts +18 -0
  116. package/lib/utils/tree.d.ts +3 -0
  117. package/lib/vite-env.d.ts +8 -0
  118. package/lib/webui.css +1 -0
  119. package/lib/webui.es.js +2262 -0
  120. package/package.json +4 -4
  121. package/src/components/content/form/formItem.vue +2 -2
@@ -0,0 +1,110 @@
1
+ import { defineComponent as y, ref as f, watch as S, onMounted as z, createBlock as D, openBlock as F, unref as u, withCtx as s, createVNode as m, createTextVNode as C } from "vue";
2
+ import { _ as c } from "../../assets/modules/index-C1zkNPmi.js";
3
+ import { Modal as _, Space as k } from "ant-design-vue";
4
+ import { ResStatus as E } from "@skyfox2000/fapi";
5
+ import { a1 as h } from "../../assets/modules/uploadList-DaUjVXLU.js";
6
+ import "@skyfox2000/microbase";
7
+ import L from "vue-m-message";
8
+ import "async-validator";
9
+ import "dayjs";
10
+ import { A as N } from "../../assets/modules/file-upload-CGyzCx7I.js";
11
+ import "vue-draggable-next";
12
+ import { U as B } from "../../assets/modules/uploadList-BW23uSvi.js";
13
+ const K = /* @__PURE__ */ y({
14
+ __name: "uploadForm",
15
+ props: {
16
+ fileExt: {},
17
+ gridCtrl: {},
18
+ maxCount: {},
19
+ maxConcurrent: {},
20
+ uploadForm: {},
21
+ uploadUrl: {},
22
+ downloadUrl: {},
23
+ continueOnError: { type: Boolean }
24
+ },
25
+ emits: ["before:file-list", "before:upload", "after:upload", "on:progress"],
26
+ setup(w, { emit: g }) {
27
+ const l = w, a = l.uploadForm, p = f(!1), x = l.maxCount ?? 1, U = l.maxConcurrent ?? 3, n = f([]), d = g;
28
+ S(
29
+ () => a.visible.value,
30
+ () => {
31
+ p.value = a.visible.value;
32
+ }
33
+ );
34
+ const r = f(l.uploadUrl), t = f(l.downloadUrl), b = async () => {
35
+ d("before:upload", n.value), await new N(r.value, U).doUpload(
36
+ n.value,
37
+ a.isFormLoading,
38
+ l.continueOnError,
39
+ async (o, i) => {
40
+ d("after:upload", o, i), o && a.formData.value && (await h(l.gridCtrl, a.formData.value)).status === E.SUCCESS && (a.visible.value = !1);
41
+ },
42
+ (o) => {
43
+ d("on:progress", o);
44
+ }
45
+ );
46
+ };
47
+ z(() => {
48
+ const e = l.gridCtrl.page;
49
+ if (r.value = r.value ?? e.urls.upload, t.value = t.value ?? e.urls.download, !r.value) {
50
+ L.error("未配置文件上传地址!");
51
+ return;
52
+ }
53
+ r.value.api || (r.value.api = e.api), r.value.authorize === void 0 && (r.value.authorize = e.authorize), t.value && (t.value.api || (t.value.api = e.api), t.value.authorize === void 0 && (t.value.authorize = e.authorize));
54
+ for (const i in a.formData.value)
55
+ l.gridCtrl.rowData.value && (a.formData.value[i] = l.gridCtrl.rowData.value[i]);
56
+ const o = [];
57
+ d("before:file-list", a, o), n.value.push(...o), p.value = a.visible.value;
58
+ });
59
+ const v = () => {
60
+ a.visible.value = !1;
61
+ };
62
+ return (e, o) => (F(), D(u(_), {
63
+ title: "文件上传",
64
+ open: p.value,
65
+ "onUpdate:open": o[1] || (o[1] = (i) => p.value = i),
66
+ wrapClassName: "modal mx-auto " + (e.$attrs.width ? "w-[" + e.$attrs.width + "]" : "w-[430px]"),
67
+ onClose: v
68
+ }, {
69
+ footer: s(() => [
70
+ m(u(k), null, {
71
+ default: s(() => [
72
+ m(u(c), { onClick: v }, {
73
+ default: s(() => o[2] || (o[2] = [
74
+ C("取消")
75
+ ])),
76
+ _: 1,
77
+ __: [2]
78
+ }),
79
+ m(u(c), {
80
+ onClick: b,
81
+ type: "primary",
82
+ loading: u(a).isFormSaving.value
83
+ }, {
84
+ default: s(() => o[3] || (o[3] = [
85
+ C(" 上传文件并保存 ")
86
+ ])),
87
+ _: 1,
88
+ __: [3]
89
+ }, 8, ["loading"])
90
+ ]),
91
+ _: 1
92
+ })
93
+ ]),
94
+ default: s(() => [
95
+ m(B, {
96
+ "file-list": n.value,
97
+ "onUpdate:fileList": o[0] || (o[0] = (i) => n.value = i),
98
+ "upload-url": r.value,
99
+ "download-url": t.value,
100
+ "max-count": u(x),
101
+ "file-ext": e.fileExt
102
+ }, null, 8, ["file-list", "upload-url", "download-url", "max-count", "file-ext"])
103
+ ]),
104
+ _: 1
105
+ }, 8, ["open", "wrapClassName"]));
106
+ }
107
+ });
108
+ export {
109
+ K as default
110
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { default as router } from './router';
2
+ export { pinia } from './stores/pinia';
3
+ export type { AnyControl, PostOptions, ExecuteOptions, } from './typings/data.d';
4
+ export type { PageControl, PageControlOption, PrimaryKey, } from './typings/page.d';
5
+ export { ProviderKeys } from './typings/page.d';
6
+ export type { GridControl, GridControlOption, } from './typings/table.d';
7
+ export type { EditorControl, EditorControlOption, InputFactoryItems, ValidateRule, ValidateRuleItem, ValidateError, } from './typings/form.d';
8
+ export type { ButtonTool, ButtonTools, ButtonType, IconTool, RowRecord, } from './typings/tools.d';
9
+ export type { TreeControl, TreeControlOption, TreeNode, } from './typings/tree.d';
10
+ export type { UploadFile, MinioFile, ExcelFileParams, } from './typings/upload.d';
11
+ export { UploadStatus } from './typings/upload.d';
12
+ export type { ApiUrls, ReqUrls, } from './typings/urls.d';
13
+ export type { OptionItemProps, OptionProps, SelectValue, } from './typings/option.d';
14
+ export type { BreadcrumbRoute, } from './typings/menu.d';
15
+ export { OPTIONS } from './const/options';
16
+ export { OptionCommProps } from './typings/option.d';
17
+ export { initDirective } from './directives/index';
18
+ export { isEmpty } from './utils/isEmpty';
19
+ export { queryTree } from './utils/tree';
20
+ export { getToolByKey, getToolGroup, getToolStatus, getToolVisible, onReloadClick, onToolClicked, onFullscreenClick, onColumnVisibleChanged, defaultTools, useToolFactory, } from './utils/tools';
21
+ export { initPageFactory, useEditorFactory, useGridFactory, useTreeFactory, usePageFactory } from './utils/page';
22
+ export { loadOption, unloadOption, getSelectedValues, outFormDataFields, onOptionChanged, getSelectedLabels, } from './utils/options';
23
+ export { downloadBlob, donwloadFromMinio } from './utils/download';
24
+ export { ICONS_LIB, checkIconsExpired, circleLoading, createFromIconfont, parseIcons, getIconTransform, } from './utils/icon-loader';
25
+ export { CacheKeys, Cache, initCacheCheck } from './utils/cache';
26
+ export { initMenu, crumbs, showBreadcrumb } from './utils/menu';
27
+ export { onFormSave, onFormSaveAs, onFormClose, saveForm, getFormDetail, openNewForm, setFormData } from './utils/form';
28
+ export { initValidate, formValidate, validateData, resetRules, getRuleTexts, useInputFactory, useFormItemFactory, } from './utils/form-validate';
29
+ export { validateExcel, checkExcelDuplicates, processExcelFile, appendExcelData } from './utils/form-excel';
30
+ export type { ExcelMarkCell, ExcelMarkInfo } from './utils/form-excel';
31
+ export { filterColumns, mergeColumns, gridQueryList, gridQueryFind, gridRowUpdate, gridStatusUpdate, getRecordDetail, onGridRowExpand, onGridRowEdit, onGridRowDelete, } from './utils/table';
32
+ export { doQuery, doExecute, doSave, doDelete } from './utils/data';
33
+ export { exportSelectedRows, exportResults } from './utils/export-table';
34
+ export { path, AsyncUploader } from './utils/file-upload';
35
+ export { EventPrefix } from './utils/eventbus';
36
+ export { default as eventBus } from './utils/eventbus';
37
+ export { getHostInfo, getAppInfo, userLogin, userLogout, getToken, getUserInfo } from './utils/main-openapis';
38
+ export { router as AppRouter };
39
+ export { pendingNavigation, routes } from './router';
40
+ export { useAppInfo } from './stores/appInfo';
41
+ export { useHostInfo } from './stores/hostInfo';
42
+ export { useUserInfo } from './stores/userInfo';
43
+ export { usePageInfo } from './stores/pageInfo';
44
+ export { useSettingInfo } from './stores/settingInfo';
45
+ export { Button, Tooltip, AppIcon, Fullscreen, Helper, Icon, LayoutIcon, ProjectIcon, ToolIcon, Loading, Dialog, Drawer, Form, FormItem, Search, SearchItem, Table, TableOperate, Toolbar, Icontool, Tree, AutoComplete, Cascader, Checkbox, DatePicker, Input, InputIcon, InputPassword, InputNumber, PropEditor, type PropConfigItem, Radio, RadioStatus, RangePicker, Select, Switch, Textarea, Transfer, TransferTable, TreeSelect, UploadList, Breadcrumb, Content, Datetime, Header, HeaderExits, Menu, MenuTabs, } from './components/index';
@@ -0,0 +1,15 @@
1
+ import { RouteRecord } from '../../../502424_MicroBase';
2
+ import { RouteLocationNormalizedGeneric, RouteRecordRaw, Router } from 'vue-router';
3
+ import { Ref } from 'vue';
4
+ export declare const LOGIN_PATH = "/login/";
5
+ declare const routes: RouteRecord[];
6
+ export declare const addAppRoutes: (subRoutes: RouteRecord[]) => void;
7
+ export declare const flattenRoute: (route: RouteRecordRaw, flattenRoutes: Record<string, RouteRecord>, parent?: RouteRecord, parentPath?: string) => void;
8
+ declare const router: Router;
9
+ export { routes };
10
+ export declare const pendingNavigation: Ref<{
11
+ to: RouteLocationNormalizedGeneric;
12
+ next: Function;
13
+ } | null>;
14
+ export declare const continueNavigation: (defaultPage: string) => void;
15
+ export default router;
@@ -0,0 +1,31 @@
1
+ import { RouteRecordRaw } from 'vue-router';
2
+ import { AppInfo, RouteRecord } from '../../../502424_MicroBase';
3
+ import { Component } from 'vue';
4
+ import { StoreDefinition } from 'pinia';
5
+ export declare const useAppInfo: StoreDefinition<"appInfo", {
6
+ appInfo: AppInfo & {
7
+ Routes: RouteRecordRaw[];
8
+ flattenRoutes: Record<string, RouteRecord>;
9
+ defaultPage: string;
10
+ };
11
+ appList: AppInfo[];
12
+ CachedComponents: string[];
13
+ ExcludeComponents: string[];
14
+ menuLoaded: boolean;
15
+ }, {}, {
16
+ loadAppList(appList?: AppInfo[]): Promise<void>;
17
+ getRemoteAppList(): Promise<void>;
18
+ toDefaultApp(url?: string): Promise<void>;
19
+ setActiveApp(key: string, appRoutes?: RouteRecord[]): Promise<void>;
20
+ setAppRoutes(appRoutes: RouteRecord[]): void;
21
+ formatRoute(path: string): string;
22
+ push(path: string): void;
23
+ findRoute(key: string): RouteRecord | undefined;
24
+ cacheComponent(component: Component, route: {
25
+ path: string;
26
+ }): Component;
27
+ excludeComponent(path: string): void;
28
+ matchedRoutes(key: string): RouteRecord[];
29
+ clean(): void;
30
+ logout(): void;
31
+ }>;
@@ -0,0 +1,9 @@
1
+ import { HostInfo, MainOpenApis } from '../../../502424_MicroBase';
2
+ import { StoreDefinition } from 'pinia';
3
+ export declare const useHostInfo: StoreDefinition<"hostInfo", {
4
+ hostInfo: HostInfo;
5
+ }, {}, {
6
+ loadHostInfo(hostApi: string, hostKey?: string, mainOpenApis?: MainOpenApis): Promise<void>;
7
+ _setHostInfo(hostInfo: HostInfo): void;
8
+ getHostInfo(): HostInfo;
9
+ }>;
@@ -0,0 +1,18 @@
1
+ import { StoreDefinition } from 'pinia';
2
+ interface TabPaneProps {
3
+ key: string;
4
+ title: string;
5
+ closable?: boolean;
6
+ keepAlive?: boolean;
7
+ content: any;
8
+ }
9
+ interface PageInfo {
10
+ TabActive: string;
11
+ TabPanes: TabPaneProps[];
12
+ TabEnabled: boolean;
13
+ }
14
+ export declare const usePageInfo: StoreDefinition<"pageInfo", PageInfo, {}, {
15
+ removeTabPane(path: string): void;
16
+ setTabActive(path: string): Promise<void>;
17
+ }>;
18
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Pinia } from 'pinia';
2
+ declare const pinia: Pinia;
3
+ export { pinia };
@@ -0,0 +1,8 @@
1
+ import { SettingInfo } from '../../../502424_MicroBase';
2
+ import { StoreDefinition } from 'pinia';
3
+ export declare const useSettingInfo: StoreDefinition<"settingInfo", SettingInfo, {}, {
4
+ setFullscreen(status: boolean): void;
5
+ setMenuCollapse(status: boolean): void;
6
+ getTableColumns(pageUrl: string): Record<string, any>[];
7
+ setTableColumns(pageUrl: string, columns: Record<string, any>[]): void;
8
+ }>;
@@ -0,0 +1,25 @@
1
+ import { ApiResponse } from '../../../502417_fapi';
2
+ import { LoginInfo, UserInfo } from '../../../502424_MicroBase';
3
+ import { StoreDefinition } from 'pinia';
4
+ interface UserState {
5
+ isLogin: boolean;
6
+ userInfo: UserInfo;
7
+ token?: string;
8
+ refreshToken?: string;
9
+ }
10
+ export declare const useUserInfo: StoreDefinition<"userInfo", UserState, {}, {
11
+ init(): void;
12
+ login(loginInfo: LoginInfo, redirect?: boolean): Promise<ApiResponse<LoginInfo> | void>;
13
+ getRolePermits(appId: string): Promise<boolean>;
14
+ hasRole(role: string | string[]): boolean;
15
+ hasPermit(url: string, permitCode: string): boolean;
16
+ getUserInfo(): UserInfo;
17
+ setUserInfo(userInfo: UserInfo, token: string): void;
18
+ getToken(): string;
19
+ isSuperAdmin(): boolean;
20
+ isAdmin(): boolean;
21
+ getUserLevel(): string;
22
+ clean(): Promise<void>;
23
+ logout(): Promise<void>;
24
+ }>;
25
+ export {};
@@ -0,0 +1,80 @@
1
+ import { Ref } from 'vue';
2
+ import { PageControl } from './page';
3
+ import { AnyData, ApiResponse, IUrlInfo, ReqParams } from '../../../502417_fapi';
4
+ /**
5
+ * 任何控制对象的通用接口
6
+ * 包括TreeControl和GridControl等
7
+ */
8
+ export interface AnyControl {
9
+ /**
10
+ * 所属页面控制器
11
+ */
12
+ page: PageControl<AnyData>;
13
+
14
+ /**
15
+ * URL信息
16
+ */
17
+ url?: IUrlInfo;
18
+
19
+ /**
20
+ * 是否重新加载相关数据
21
+ */
22
+ reload?: Ref<boolean>;
23
+ }
24
+
25
+ /**
26
+ * 通用选项
27
+ */
28
+ export interface PostOptions<T> {
29
+ /**
30
+ * Page页面URL的Key
31
+ */
32
+ urlKey: string;
33
+
34
+ /**
35
+ * 自定义URL,优先使用
36
+ */
37
+ url?: IUrlInfo;
38
+
39
+ /**
40
+ * 执行提示文字
41
+ * - false时,不显示提示文字
42
+ * - 空时,显示默认文字
43
+ */
44
+ loadingText?: string | boolean;
45
+
46
+ /**
47
+ * 是否隐藏错误提示
48
+ */
49
+ hideErrorToast?: boolean;
50
+
51
+ /**
52
+ * 执行参数
53
+ */
54
+ params?: ReqParams;
55
+
56
+ /**
57
+ * 处理参数的函数
58
+ */
59
+ processParams?: (params: ReqParams) => ReqParams;
60
+
61
+ /**
62
+ * 加载状态引用
63
+ */
64
+ loadingState?: Ref<boolean>;
65
+ }
66
+
67
+ /**
68
+ * 执行选项
69
+ */
70
+ export interface ExecuteOptions<T> extends PostOptions<T> {
71
+ /**
72
+ * 主键字段名
73
+ */
74
+ primaryKey?: string;
75
+
76
+ /**
77
+ * 状态字段名
78
+ */
79
+ statusKey?: string;
80
+ }
@@ -0,0 +1,187 @@
1
+ import { AnyData, IUrlInfo } from '../../../502417_fapi';
2
+ import { PageControl } from './page';
3
+ import { default as Validator, RuleItem, ValidateError } from 'async-validator';
4
+ import { Ref, DefineProps } from 'vue';
5
+ import { GridControl } from './table';
6
+ interface ValidateRuleItem extends RuleItem {
7
+ errors?: ValidateError[];
8
+ }
9
+ type ValidateRule =
10
+ | ValidateRuleItem
11
+ | (ValidateRuleItem[] & {
12
+ required?: boolean;
13
+ errors?: ValidateError[];
14
+ });
15
+
16
+ /**
17
+ * 弹窗控制默认设置
18
+ */
19
+ export interface EditorControlOption {
20
+ /**
21
+ * 主键名,默认为Id
22
+ */
23
+ primaryKey: string | 'Id' | 'id';
24
+ /**
25
+ * 保存后自动关闭窗口
26
+ */
27
+ autoClose: boolean;
28
+ /**
29
+ * 弹窗自动获取详情并赋值给formData
30
+ * - 默认 false,使用表格的数据
31
+ * - true 自动获取详情并赋值给formData
32
+ */
33
+ autoDetail: boolean;
34
+ /**
35
+ * 保存按钮是否可见
36
+ */
37
+ saveBtnVisible: boolean;
38
+ /**
39
+ * 另存为按钮是否可见
40
+ */
41
+ saveAsBtnVisible: boolean;
42
+ }
43
+
44
+ /**
45
+ * 页面表单数据交互标准定义
46
+ */
47
+ export type EditorControl<T> = EditorControlOption & {
48
+ /**
49
+ * 表单名称
50
+ */
51
+ readonly name: string;
52
+ /**
53
+ * 表单是否可见
54
+ */
55
+ visible: Ref<boolean>;
56
+ /**
57
+ * 表单默认数据
58
+ */
59
+ default: Readonly<T>;
60
+ /**
61
+ * 所属页面控制器
62
+ */
63
+ page: PageControl<AnyData>;
64
+ /**
65
+ * 所属表格控制器
66
+ */
67
+ grid?: GridControl<AnyData>;
68
+ /**
69
+ * 表单保存前判断
70
+ * @param editorCtrl 表单配置数据
71
+ * @returns 是否保存
72
+ */
73
+ beforeSave?: () => boolean | undefined;
74
+ /**
75
+ * 表单保存后处理
76
+ * @param editorCtrl 表单配置数据
77
+ * @param pageCtrl 页面控制器
78
+ */
79
+ afterSave?: () => void | undefined;
80
+ /**
81
+ * 表单数据
82
+ * - Model对象
83
+ */
84
+ formData: Ref<T>;
85
+ /**
86
+ * 更新数据
87
+ * - 自定义对象
88
+ */
89
+ updateData: Ref<Record<string, any> | undefined>;
90
+ /**
91
+ * 表单验证条件
92
+ * - errors 验证失败信息数组
93
+ */
94
+ formRules: Ref<Record<string, ValidateRule> | undefined>;
95
+ /**
96
+ * 验证器
97
+ */
98
+ ruleValidator?: Validator;
99
+ /**
100
+ * 验证结果
101
+ * @example
102
+ * ```ts
103
+ * const ruleResults: Record<string, ValidateError[]> = {};
104
+ * fieldNames.forEach((fieldName) => {
105
+ * const rule = formRules[fieldName];
106
+ * if (rule) {
107
+ * ruleResults[fieldName] = [
108
+ * {
109
+ * field: fieldName,
110
+ * fieldValue: fieldValue,
111
+ * message: `数据重复`,
112
+ * },
113
+ * ];
114
+ * }
115
+ * });
116
+ * ```
117
+ */
118
+ ruleResults: Ref<Record<string, ValidateError[]> | undefined>;
119
+ /**
120
+ * 表单存储接口
121
+ * - 优先使用
122
+ * - 或使用PageData.urls.save
123
+ */
124
+ saveUrl?: IUrlInfo;
125
+ /**
126
+ * 获取详情接口
127
+ */
128
+ detailUrl?: IUrlInfo;
129
+ /**
130
+ * 表单是否正在执行存储
131
+ */
132
+ isFormSaving: Ref<boolean>;
133
+ /**
134
+ * 表单详情加载中
135
+ */
136
+ isFormLoading: Ref<boolean>;
137
+ /**
138
+ * 上级表单
139
+ */
140
+ parentEditor?: EditorControl<any>;
141
+ };
142
+
143
+ /**
144
+ * 输入项工厂结构
145
+ */
146
+ export interface InputFactoryItems<T> {
147
+ /**
148
+ * 页面表单数据
149
+ */
150
+ editorCtrl: EditorControl<T> | undefined;
151
+ /**
152
+ * 表单项Label文字
153
+ */
154
+ labelText: Ref<string>;
155
+ /**
156
+ * 输入项错误列表
157
+ */
158
+ // ruleErrors: Ref<ValidateError[] | undefined>;
159
+ /**
160
+ * 输入项验证规则名
161
+ */
162
+ ruleKey: Ref<string>;
163
+ /**
164
+ * 输入项错误状态
165
+ */
166
+ errInfo?: Ref<{ msg: string; errClass: string }>;
167
+ /**
168
+ * 输入项属性
169
+ */
170
+ inputProps?: DefineProps;
171
+ /**
172
+ * 输入项reload事件处理
173
+ * @param event 事件名
174
+ * @param params 参数
175
+ * @returns
176
+ */
177
+ reloadHandler?: (event: string, params: Record<string, AnyData> | AnyData[]) => void;
178
+ /**
179
+ * 输入项事件
180
+ * @param evt 事件
181
+ * @param args 参数
182
+ * @returns
183
+ */
184
+ inputEmit?: (evt: any, ...args) => void;
185
+ }
186
+
187
+ export type { ValidateRule, ValidateRuleItem, ValidateError };
@@ -0,0 +1,7 @@
1
+ export interface BreadcrumbRoute {
2
+ index?: number;
3
+ path: string;
4
+ breadcrumbName: string;
5
+ icon?: string;
6
+ children?: Array<BreadcrumbRoute>;
7
+ }