@skyfox2000/webui 1.3.19 → 1.3.21
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/lib/AceEditor.d.ts +1 -0
- package/lib/BasicLayout.d.ts +1 -0
- package/lib/Error403.d.ts +1 -0
- package/lib/Error404.d.ts +1 -0
- package/lib/ExcelForm.d.ts +1 -0
- package/lib/MenuLayout.d.ts +1 -0
- package/lib/UploadForm.d.ts +1 -0
- package/lib/assets/modules/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/lib/assets/modules/baseLayout-Bz3oRE5o.js +79 -0
- package/lib/assets/modules/file-upload-CmnCEJze.js +204 -0
- package/lib/assets/modules/index-CAqiqqdd.js +380 -0
- package/lib/assets/modules/index-CvQ24Mzh.js +112 -0
- package/lib/assets/modules/index-D0njzOzQ.js +109 -0
- package/lib/assets/modules/menuTabs-NVgroqVO.js +671 -0
- package/lib/assets/modules/toolIcon-BuqRfX4F.js +50 -0
- package/lib/assets/modules/uploadList-B6MIYOtN.js +2411 -0
- package/lib/assets/modules/uploadList-KG6kpOaY.js +382 -0
- package/lib/components/common/alert/index.vue.d.ts +13 -0
- package/lib/components/common/button/index.vue.d.ts +41 -0
- package/lib/components/common/icon/appicon.vue.d.ts +11 -0
- package/lib/components/common/icon/fullscreen.vue.d.ts +3 -0
- package/lib/components/common/icon/helper.vue.d.ts +23 -0
- package/lib/components/common/icon/index.vue.d.ts +243 -0
- package/lib/components/common/icon/layoutIcon.vue.d.ts +43 -0
- package/lib/components/common/icon/projectIcon.vue.d.ts +59 -0
- package/lib/components/common/icon/toolIcon.vue.d.ts +43 -0
- package/lib/components/common/index.d.ts +22 -0
- package/lib/components/common/loading/index.vue.d.ts +3 -0
- package/lib/components/common/tooltip/index.vue.d.ts +21 -0
- package/lib/components/content/dialog/index.vue.d.ts +35 -0
- package/lib/components/content/drawer/index.vue.d.ts +28 -0
- package/lib/components/content/form/formItem.vue.d.ts +28 -0
- package/lib/components/content/form/index.vue.d.ts +25 -0
- package/lib/components/content/index.d.ts +22 -0
- package/lib/components/content/search/index.vue.d.ts +32 -0
- package/lib/components/content/search/searchItem.vue.d.ts +23 -0
- package/lib/components/content/table/index.vue.d.ts +127 -0
- package/lib/components/content/table/tableOperate.vue.d.ts +18 -0
- package/lib/components/content/toolbar/icontool.vue.d.ts +7 -0
- package/lib/components/content/toolbar/index.vue.d.ts +18 -0
- package/lib/components/content/tree/index.vue.d.ts +46 -0
- package/lib/components/form/aceEditor/aceConfig.d.ts +8 -0
- package/lib/components/form/autoComplete/index.vue.d.ts +101 -0
- package/lib/components/form/cascader/index.vue.d.ts +80 -0
- package/lib/components/form/checkbox/index.vue.d.ts +100 -0
- package/lib/components/form/datePicker/index.vue.d.ts +6 -0
- package/lib/components/form/index.d.ts +41 -0
- package/lib/components/form/input/index.vue.d.ts +29 -0
- package/lib/components/form/input/inputIcon.vue.d.ts +10 -0
- package/lib/components/form/input/inputNumber.vue.d.ts +3 -0
- package/lib/components/form/input/inputPassword.vue.d.ts +3 -0
- package/lib/components/form/propEditor/index.vue.d.ts +15 -0
- package/lib/components/form/radio/index.vue.d.ts +105 -0
- package/lib/components/form/radio/radioStatus.vue.d.ts +31 -0
- package/lib/components/form/rangePicker/index.vue.d.ts +16 -0
- package/lib/components/form/select/index.vue.d.ts +119 -0
- package/lib/components/form/switch/index.vue.d.ts +76 -0
- package/lib/components/form/textarea/index.vue.d.ts +3 -0
- package/lib/components/form/timePicker/index.vue.d.ts +6 -0
- package/lib/components/form/transfer/index.vue.d.ts +38 -0
- package/lib/components/form/transfer/transferTable.vue.d.ts +38 -0
- package/lib/components/form/treeSelect/index.vue.d.ts +47 -0
- package/lib/components/form/upload/uploadList.vue.d.ts +488 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/layout/breadcrumb/index.vue.d.ts +3 -0
- package/lib/components/layout/content/index.vue.d.ts +22 -0
- package/lib/components/layout/datetime/index.vue.d.ts +3 -0
- package/lib/components/layout/header/headerExits.vue.d.ts +3 -0
- package/lib/components/layout/header/index.vue.d.ts +3 -0
- package/lib/components/layout/header/user.vue.d.ts +3 -0
- package/lib/components/layout/index.d.ts +14 -0
- package/lib/components/layout/menu/index.vue.d.ts +6 -0
- package/lib/components/layout/menu/menuTabs.vue.d.ts +3 -0
- package/lib/const/options.d.ts +32 -0
- package/lib/directives/enter-submit.d.ts +4 -0
- package/lib/directives/index.d.ts +2 -0
- package/lib/directives/permission.d.ts +5 -0
- package/lib/es/AceEditor/index.js +167 -0
- package/lib/es/BasicLayout/index.js +54 -0
- package/lib/es/Error403/index.js +39 -0
- package/lib/es/Error404/index.js +39 -0
- package/lib/es/ExcelForm/index.js +491 -0
- package/lib/es/MenuLayout/index.js +54 -0
- package/lib/es/UploadForm/index.js +110 -0
- package/lib/index.d.ts +46 -0
- package/lib/router/index.d.ts +15 -0
- package/lib/stores/appInfo.d.ts +31 -0
- package/lib/stores/hostInfo.d.ts +11 -0
- package/lib/stores/pageInfo.d.ts +18 -0
- package/lib/stores/pinia.d.ts +3 -0
- package/lib/stores/settingInfo.d.ts +8 -0
- package/lib/stores/userInfo.d.ts +25 -0
- package/lib/typings/data.d.ts +80 -0
- package/lib/typings/form.d.ts +206 -0
- package/lib/typings/menu.d.ts +7 -0
- package/lib/typings/option.d.ts +209 -0
- package/lib/typings/page.d.ts +70 -0
- package/lib/typings/table.d.ts +181 -0
- package/lib/typings/tools.d.ts +130 -0
- package/lib/typings/tree.d.ts +76 -0
- package/lib/typings/upload.d.ts +161 -0
- package/lib/typings/urls.d.ts +69 -0
- package/lib/utils/cache.d.ts +23 -0
- package/lib/utils/data.d.ts +6 -0
- package/lib/utils/download.d.ts +6 -0
- package/lib/utils/eventbus.d.ts +16 -0
- package/lib/utils/excel-preview.d.ts +24 -0
- package/lib/utils/excel-view.d.ts +25 -0
- package/lib/utils/export-table.d.ts +12 -0
- package/lib/utils/file-upload.d.ts +17 -0
- package/lib/utils/form-csv.d.ts +18 -0
- package/lib/utils/form-excel.d.ts +36 -0
- package/lib/utils/form-validate.d.ts +29 -0
- package/lib/utils/form.d.ts +9 -0
- package/lib/utils/icon-loader.d.ts +125 -0
- package/lib/utils/isEmpty.d.ts +1 -0
- package/lib/utils/main-openapis.d.ts +8 -0
- package/lib/utils/menu.d.ts +6 -0
- package/lib/utils/options.d.ts +7 -0
- package/lib/utils/page.d.ts +30 -0
- package/lib/utils/table.d.ts +21 -0
- package/lib/utils/tools.d.ts +18 -0
- package/lib/utils/tree.d.ts +3 -0
- package/lib/vite-env.d.ts +8 -0
- package/lib/webui.css +1 -0
- package/lib/webui.es.js +2345 -0
- package/package.json +1 -1
- package/src/components/content/dialog/excelForm.vue +1 -1
- package/src/components/content/form/formItem.vue +5 -0
- package/src/typings/form.d.ts +1 -1
- package/src/typings/tree.d.ts +4 -0
- package/src/utils/form.ts +7 -1
- package/src/utils/table.ts +7 -2
- package/src/utils/tree.ts +4 -2
- package/.cursorignore +0 -8
- package/scripts/userInput.py +0 -2
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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, useOptionFactory, } from './utils/page';
|
|
22
|
+
export { loadOption, unloadOption, getSelectedValues, outFormDataFields, onOptionChanged, getSelectedLabels, } from './utils/options';
|
|
23
|
+
export { downloadBlob, donwloadFromMinio, previewFromMinio, CanPreviewFileExt } 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, createMarkedExcelView, } from './utils/form-excel';
|
|
30
|
+
export { csvToExcelBlob, processCsvFile } from './utils/form-csv';
|
|
31
|
+
export { csvToNormalized, excelToNormalized, toExcel, csvToExcelView, excelToExcelView, normalizedToExcelView, type NormalizedData, type ExcelViewResult, type ExcelMarkCell, type ExcelMarkInfo, } from './utils/excel-view';
|
|
32
|
+
export { filterColumns, mergeColumns, gridQueryList, gridQueryFind, gridRowUpdate, gridStatusUpdate, getRecordDetail, onGridRowExpand, onGridRowEdit, onGridRowDelete, } from './utils/table';
|
|
33
|
+
export { doQuery, doExecute, doSave, doDelete } from './utils/data';
|
|
34
|
+
export { exportSelectedRows, exportResults } from './utils/export-table';
|
|
35
|
+
export { path, AsyncUploader } from './utils/file-upload';
|
|
36
|
+
export { EventPrefix } from './utils/eventbus';
|
|
37
|
+
export { default as eventBus } from './utils/eventbus';
|
|
38
|
+
export { getHostInfo, getAppInfo, userLogin, userLogout, getToken, getUserInfo } from './utils/main-openapis';
|
|
39
|
+
export { router as AppRouter };
|
|
40
|
+
export { pendingNavigation, routes } from './router';
|
|
41
|
+
export { useAppInfo } from './stores/appInfo';
|
|
42
|
+
export { useHostInfo } from './stores/hostInfo';
|
|
43
|
+
export { useUserInfo } from './stores/userInfo';
|
|
44
|
+
export { usePageInfo } from './stores/pageInfo';
|
|
45
|
+
export { useSettingInfo } from './stores/settingInfo';
|
|
46
|
+
export { Alert, 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, TimePicker, 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,11 @@
|
|
|
1
|
+
import { HostInfo, MainOpenApis } from '../../../502424_MicroBase';
|
|
2
|
+
import { StoreDefinition } from 'pinia';
|
|
3
|
+
export declare const useHostInfo: StoreDefinition<"hostInfo", {
|
|
4
|
+
hostInfo: HostInfo;
|
|
5
|
+
}, {}, {
|
|
6
|
+
getSiteHostApi(): string;
|
|
7
|
+
loadHostInfo(hostApi: string, hostKey?: string, mainOpenApis?: MainOpenApis): Promise<void>;
|
|
8
|
+
clear(): void;
|
|
9
|
+
_setHostInfo(hostInfo: HostInfo | null): void;
|
|
10
|
+
getHostInfo(): HostInfo;
|
|
11
|
+
}>;
|
|
@@ -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,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,206 @@
|
|
|
1
|
+
import { AnyData, IUrlInfo, ReqParams } 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?: (params?: ReqParams) => boolean | undefined | void;
|
|
74
|
+
/**
|
|
75
|
+
* 表单保存后处理
|
|
76
|
+
* @param editorCtrl 表单配置数据
|
|
77
|
+
* @param pageCtrl 页面控制器
|
|
78
|
+
*/
|
|
79
|
+
afterSave?: (result: ApiResponse<any>) => 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
|
+
/**
|
|
188
|
+
* 属性编辑器配置项
|
|
189
|
+
*/
|
|
190
|
+
export interface PropConfigItem {
|
|
191
|
+
id: number;
|
|
192
|
+
/**
|
|
193
|
+
* 文本
|
|
194
|
+
*/
|
|
195
|
+
text?: string;
|
|
196
|
+
/**
|
|
197
|
+
* 配置名
|
|
198
|
+
*/
|
|
199
|
+
field: string;
|
|
200
|
+
/**
|
|
201
|
+
* 配置值
|
|
202
|
+
*/
|
|
203
|
+
value: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type { ValidateRule, ValidateRuleItem, ValidateError };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { AnyData, IUrlInfo, ReqParams } from '../../../502417_fapi';
|
|
2
|
+
import { Ref, ShallowRef, PropType } from 'vue';
|
|
3
|
+
import { InputFactoryItems } from './form.d';
|
|
4
|
+
type RawValue = string | number;
|
|
5
|
+
export type SelectValue = RawValue | RawValue[];
|
|
6
|
+
/**
|
|
7
|
+
* 选项基础属性
|
|
8
|
+
*/
|
|
9
|
+
export interface OptionItemProps {
|
|
10
|
+
label: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
value: string | number | undefined;
|
|
13
|
+
key?: string | number;
|
|
14
|
+
role?: string | string[];
|
|
15
|
+
permit?: string;
|
|
16
|
+
[key: string]: AnyData;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 选项类公共属性接口
|
|
21
|
+
*/
|
|
22
|
+
export interface OptionProps {
|
|
23
|
+
/**
|
|
24
|
+
* 选项数据接口
|
|
25
|
+
*/
|
|
26
|
+
url?: IUrlInfo;
|
|
27
|
+
/**
|
|
28
|
+
* 自定义选项数据, 优先级高于optionCtrl.data
|
|
29
|
+
*/
|
|
30
|
+
data?: OptionItemProps[];
|
|
31
|
+
/**
|
|
32
|
+
* 表单数据
|
|
33
|
+
*/
|
|
34
|
+
formData?: Record<string, any>;
|
|
35
|
+
/**
|
|
36
|
+
* 返回文字内容或文字内容数组
|
|
37
|
+
*/
|
|
38
|
+
labels?: string | number | (string | number)[];
|
|
39
|
+
/**
|
|
40
|
+
* 输出字段转换控制
|
|
41
|
+
* - Key:目的字段
|
|
42
|
+
* - Value:源字段,支持模板 ${}
|
|
43
|
+
*/
|
|
44
|
+
outFields?: Record<string, string>;
|
|
45
|
+
/**
|
|
46
|
+
* 通过消息重载数据,只允许改变查询条件
|
|
47
|
+
* - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
|
|
48
|
+
* - 数据组仅用于联动显示
|
|
49
|
+
* - 其它情况使用Query参数
|
|
50
|
+
*/
|
|
51
|
+
reloadEvent?: string;
|
|
52
|
+
/**
|
|
53
|
+
* 通过消息触发事件,只允许改变查询条件
|
|
54
|
+
* - eventBus.emit(changeEvent, { Q参数 } | 数据[])
|
|
55
|
+
* - 数据组仅用于联动显示
|
|
56
|
+
* - 其它情况使用Query参数
|
|
57
|
+
* - 第一个参数为事件名,第二个参数为事件参数模板,支持模板 ${selectedValues}
|
|
58
|
+
*/
|
|
59
|
+
changeEvent?: [string | string[], string];
|
|
60
|
+
/**
|
|
61
|
+
* 选项控制器
|
|
62
|
+
*/
|
|
63
|
+
optionCtrl?: OptionControl;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 选项类props公共属性
|
|
68
|
+
*/
|
|
69
|
+
export const OptionCommProps = {
|
|
70
|
+
/**
|
|
71
|
+
* 选项数据接口
|
|
72
|
+
*/
|
|
73
|
+
url: {
|
|
74
|
+
type: Object as PropType<IUrlInfo>,
|
|
75
|
+
required: false,
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* 选项数据
|
|
79
|
+
*/
|
|
80
|
+
data: {
|
|
81
|
+
type: Array as PropType<OptionItemProps[]>,
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* 返回文字内容或文字内容数组
|
|
86
|
+
*/
|
|
87
|
+
labels: {
|
|
88
|
+
type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
|
|
89
|
+
required: false,
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 表单数据
|
|
93
|
+
*/
|
|
94
|
+
formData: {
|
|
95
|
+
type: Object as PropType<Record<string, any>>,
|
|
96
|
+
required: false,
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* 输出字段转换控制
|
|
100
|
+
* - Key:目的字段,支持 "." 嵌套
|
|
101
|
+
* - Value:源字段,支持模板 ${} 或者 ${index} 或者 ${index}.${key}
|
|
102
|
+
*/
|
|
103
|
+
outFields: {
|
|
104
|
+
type: Object as PropType<Record<string, string>>,
|
|
105
|
+
required: false,
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* 通过消息重载数据,只允许改变查询条件
|
|
109
|
+
* - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
|
|
110
|
+
* - 数据组仅用于联动显示
|
|
111
|
+
* - 其它情况使用Query参数
|
|
112
|
+
*/
|
|
113
|
+
reloadEvent: {
|
|
114
|
+
type: String as PropType<string>,
|
|
115
|
+
required: false,
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* 通过消息触发事件,只允许改变查询条件
|
|
119
|
+
* - eventBus.emit(changeEvent, { Q参数 } | 数据[])
|
|
120
|
+
* - 数据组仅用于联动显示
|
|
121
|
+
* - 其它情况使用Query参数
|
|
122
|
+
* - 第一个参数为事件名,第二个参数为事件参数模板,支持模板 ${selectedValues}
|
|
123
|
+
*/
|
|
124
|
+
changeEvent: {
|
|
125
|
+
type: Array as PropType<[string | string[], string]>,
|
|
126
|
+
required: false,
|
|
127
|
+
},
|
|
128
|
+
optionCtrl: {
|
|
129
|
+
type: Object as PropType<OptionControl>,
|
|
130
|
+
required: false,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 表格控制默认设置
|
|
136
|
+
*/
|
|
137
|
+
export type OptionControlOption = {
|
|
138
|
+
/**
|
|
139
|
+
* 是否显示全部选项
|
|
140
|
+
* - 默认为false
|
|
141
|
+
*/
|
|
142
|
+
all: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* 全部选项值
|
|
145
|
+
* 自定义全部选项的值
|
|
146
|
+
* 如果all为true,则显示全部选项
|
|
147
|
+
* 未设置allValue,则默认[0, 1]
|
|
148
|
+
*/
|
|
149
|
+
allValue: string | number | string[] | number[] | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* 自动加载数据
|
|
152
|
+
*/
|
|
153
|
+
autoload: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* 字段转换控制
|
|
156
|
+
* - Key:目的字段
|
|
157
|
+
* - Value:源字段,支持模板 ${}
|
|
158
|
+
*/
|
|
159
|
+
fieldMap?: Record<string, string>;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 选项数据交互标准定义
|
|
164
|
+
*/
|
|
165
|
+
export type OptionControl = OptionControlOption & {
|
|
166
|
+
/**
|
|
167
|
+
* 输入项工厂
|
|
168
|
+
*/
|
|
169
|
+
inputFactory?: ShallowRef<InputFactoryItems<any>>;
|
|
170
|
+
/**
|
|
171
|
+
* 重新加载数据
|
|
172
|
+
*/
|
|
173
|
+
reload: Ref<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* 当前查询条件
|
|
176
|
+
*/
|
|
177
|
+
optionQuery?: ReqParams;
|
|
178
|
+
/**
|
|
179
|
+
* 当前传入数据
|
|
180
|
+
*/
|
|
181
|
+
data: ShallowRef<OptionItemProps[] | undefined>;
|
|
182
|
+
/**
|
|
183
|
+
* 实际选项数据
|
|
184
|
+
* - 已转换fieldMap
|
|
185
|
+
*/
|
|
186
|
+
options: Ref<OptionItemProps[]>;
|
|
187
|
+
/**
|
|
188
|
+
* 基础选中数据
|
|
189
|
+
*/
|
|
190
|
+
selected: Ref<RawValue | RawValue[] | undefined | null>;
|
|
191
|
+
/**
|
|
192
|
+
* 选中数据
|
|
193
|
+
*/
|
|
194
|
+
selectedOptions: Ref<OptionItemProps | OptionItemProps[] | undefined | null>;
|
|
195
|
+
/**
|
|
196
|
+
* 查询接口
|
|
197
|
+
* - 优先使用
|
|
198
|
+
* - 或使用PageData.urls.option
|
|
199
|
+
*/
|
|
200
|
+
url?: IUrlInfo;
|
|
201
|
+
/**
|
|
202
|
+
* 额外查询参数
|
|
203
|
+
*/
|
|
204
|
+
params?: ReqParams;
|
|
205
|
+
/**
|
|
206
|
+
* 是否正在加载中
|
|
207
|
+
*/
|
|
208
|
+
isOptionLoading: Ref<boolean>;
|
|
209
|
+
};
|