@skyfox2000/webui 1.0.14 → 1.2.0
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/assets/modules/file-upload-CBUcsUnR.js +170 -0
- package/lib/assets/modules/form-validate-CgX7aR7T.js +297 -0
- package/lib/assets/modules/index-Civhd8xG.js +112 -0
- package/lib/assets/modules/index-DQMdt51R.js +726 -0
- package/lib/assets/modules/{index-BEWJ_qAH.js → index-DmWrkTXX.js} +1 -1
- package/lib/assets/modules/{menuTabs-BXdbFZor.js → menuTabs-BRYvFWA-.js} +131 -121
- package/lib/assets/modules/settingInfo-BZakNKIN.js +999 -0
- package/lib/assets/modules/uploadList-B7XoxGOh.js +278 -0
- package/lib/components/common/icon/index.vue.d.ts +1 -1
- package/lib/components/content/dialog/index.vue.d.ts +1 -1
- package/lib/components/content/drawer/index.vue.d.ts +1 -1
- package/lib/components/content/form/index.vue.d.ts +1 -1
- package/lib/components/content/search/index.vue.d.ts +1 -1
- package/lib/components/content/table/index.vue.d.ts +1 -1
- package/lib/components/content/table/tableOperate.vue.d.ts +1 -1
- package/lib/components/content/toolbar/icontool.vue.d.ts +1 -1
- package/lib/components/content/toolbar/index.vue.d.ts +1 -1
- package/lib/components/content/tree/index.vue.d.ts +1 -1
- package/lib/components/form/transfer/transferTable.vue.d.ts +1 -1
- package/lib/components/form/treeSelect/index.vue.d.ts +1 -1
- package/lib/components/form/upload/uploadList.vue.d.ts +1 -1
- 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 +9 -8
- package/lib/es/BasicLayout/index.js +28 -24
- package/lib/es/Error403/index.js +15 -10
- package/lib/es/Error404/index.js +15 -10
- package/lib/es/ExcelForm/index.js +380 -175
- package/lib/es/UploadForm/index.js +23 -20
- package/lib/index.d.ts +42 -2
- package/lib/router/index.d.ts +16 -0
- package/lib/stores/appInfo.d.ts +34 -0
- package/lib/stores/hostInfo.d.ts +9 -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 +21 -0
- package/lib/typings/data.d.ts +80 -0
- package/lib/typings/form.d.ts +171 -0
- package/lib/typings/menu.d.ts +7 -0
- package/lib/typings/option.d.ts +175 -0
- package/lib/typings/page.d.ts +69 -0
- package/lib/typings/table.d.ts +181 -0
- package/lib/typings/tools.d.ts +130 -0
- package/lib/typings/tree.d.ts +72 -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 +4 -0
- package/lib/utils/eventbus.d.ts +16 -0
- package/lib/utils/export-table.d.ts +12 -0
- package/lib/utils/file-upload.d.ts +15 -0
- package/lib/utils/form-excel.d.ts +30 -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 +9 -0
- package/lib/utils/menu.d.ts +6 -0
- package/lib/utils/options.d.ts +10 -0
- package/lib/utils/page.d.ts +25 -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 -1
- package/lib/webui.es.js +890 -724
- package/package.json +7 -6
- package/src/components/common/icon/appicon.vue +1 -1
- package/src/components/common/icon/fullscreen.vue +2 -1
- package/src/components/common/icon/index.vue +1 -1
- package/src/components/common/icon/layoutIcon.vue +1 -1
- package/src/components/common/icon/projectIcon.vue +1 -1
- package/src/components/common/icon/toolIcon.vue +1 -1
- package/src/components/content/dialog/excelForm.vue +2 -2
- package/src/components/content/dialog/index.vue +1 -1
- package/src/components/content/dialog/uploadForm.vue +7 -6
- package/src/components/content/drawer/index.vue +43 -18
- package/src/components/content/form/formItem.vue +1 -1
- package/src/components/content/form/index.vue +1 -1
- package/src/components/content/search/index.vue +1 -1
- package/src/components/content/search/searchItem.vue +1 -1
- package/src/components/content/table/index.vue +3 -3
- package/src/components/content/table/tableOperate.vue +2 -2
- package/src/components/content/toolbar/icontool.vue +2 -2
- package/src/components/content/toolbar/index.vue +3 -2
- package/src/components/content/tree/index.vue +1 -1
- package/src/components/error/error403.vue +2 -2
- package/src/components/error/error404.vue +2 -2
- package/src/components/form/autoComplete/index.vue +1 -1
- package/src/components/form/cascader/index.vue +1 -2
- package/src/components/form/checkbox/index.vue +11 -5
- package/src/components/form/datePicker/index.vue +1 -1
- package/src/components/form/input/index.vue +1 -1
- package/src/components/form/input/inputNumber.vue +1 -1
- package/src/components/form/input/inputPassword.vue +1 -1
- package/src/components/form/radio/index.vue +1 -1
- package/src/components/form/radio/radioStatus.vue +1 -1
- package/src/components/form/rangePicker/index.vue +1 -1
- package/src/components/form/select/index.vue +1 -1
- package/src/components/form/switch/index.vue +7 -3
- package/src/components/form/textarea/index.vue +1 -1
- package/src/components/form/transfer/index.vue +1 -1
- package/src/components/form/transfer/transferTable.vue +42 -22
- package/src/components/form/treeSelect/index.vue +2 -3
- package/src/components/form/upload/uploadList.vue +1 -1
- package/src/components/layout/breadcrumb/index.vue +1 -1
- package/src/components/layout/header/headerExits.vue +1 -1
- package/src/components/layout/header/index.vue +1 -1
- package/src/components/layout/header/user.vue +2 -1
- package/src/components/layout/menu/index.vue +9 -3
- package/src/components/layout/menu/menuTabs.vue +10 -12
- package/src/components/layout/page/basicLayout.vue +1 -1
- package/src/const/options.ts +114 -0
- package/src/directives/enter-submit.ts +13 -0
- package/src/directives/index.ts +26 -0
- package/src/directives/permission.ts +144 -0
- package/src/index.ts +201 -0
- package/src/router/index.ts +196 -0
- package/src/stores/appInfo.ts +471 -0
- package/src/stores/hostInfo.ts +117 -0
- package/src/stores/pageInfo.ts +131 -0
- package/src/stores/pinia.ts +10 -0
- package/src/stores/settingInfo.ts +53 -0
- package/src/stores/userInfo.ts +392 -0
- package/src/typings/data.d.ts +81 -0
- package/src/typings/form.d.ts +172 -0
- package/src/typings/menu.d.ts +7 -0
- package/src/typings/option.d.ts +177 -0
- package/src/typings/page.d.ts +70 -0
- package/src/typings/table.d.ts +182 -0
- package/src/typings/tools.d.ts +131 -0
- package/src/typings/tree.d.ts +73 -0
- package/src/typings/upload.d.ts +162 -0
- package/src/typings/urls.d.ts +70 -0
- package/src/utils/cache.ts +175 -0
- package/src/utils/data.ts +189 -0
- package/src/utils/download.ts +80 -0
- package/src/utils/eventbus.ts +78 -0
- package/src/utils/export-table.ts +155 -0
- package/src/utils/file-upload.ts +304 -0
- package/src/utils/form-excel.ts +523 -0
- package/src/utils/form-validate.ts +368 -0
- package/src/utils/form.ts +188 -0
- package/src/utils/icon-loader.ts +412 -0
- package/src/utils/isEmpty.ts +18 -0
- package/src/utils/main-openapis.ts +72 -0
- package/src/utils/menu.ts +89 -0
- package/src/utils/options.ts +324 -0
- package/src/utils/page.ts +262 -0
- package/src/utils/table.ts +274 -0
- package/src/utils/tools.ts +362 -0
- package/src/utils/tree.ts +28 -0
- package/tsconfig.json +1 -8
- package/vite.config.ts +7 -4
- package/lib/assets/modules/index-BahGnrAq.js +0 -415
- package/lib/assets/modules/index-BoKIa2sr.js +0 -109
- package/lib/assets/modules/index-D47Ci-T3.js +0 -107
- package/lib/assets/modules/uploadList-Dzlg47V0.js +0 -182
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { AnyData, IUrlInfo } from '@skyfox2000/fapi';
|
|
2
|
+
import { PageControl } from './page';
|
|
3
|
+
import Validator, { RuleItem, ValidateError } from 'async-validator';
|
|
4
|
+
import { Ref, DefineProps } from 'vue';
|
|
5
|
+
import { GridControl } from './table';
|
|
6
|
+
|
|
7
|
+
interface ValidateRuleItem extends RuleItem {
|
|
8
|
+
errors?: ValidateError[];
|
|
9
|
+
}
|
|
10
|
+
type ValidateRule =
|
|
11
|
+
| ValidateRuleItem
|
|
12
|
+
| (ValidateRuleItem[] & {
|
|
13
|
+
required?: boolean;
|
|
14
|
+
errors?: ValidateError[];
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 弹窗控制默认设置
|
|
19
|
+
*/
|
|
20
|
+
export interface EditorControlOption {
|
|
21
|
+
/**
|
|
22
|
+
* 主键名,默认为Id
|
|
23
|
+
*/
|
|
24
|
+
primaryKey: string | 'Id' | 'id';
|
|
25
|
+
/**
|
|
26
|
+
* 保存后自动关闭窗口
|
|
27
|
+
*/
|
|
28
|
+
autoClose: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 弹窗自动获取详情并赋值给formData
|
|
31
|
+
* - 默认 false,使用表格的数据
|
|
32
|
+
* - true 自动获取详情并赋值给formData
|
|
33
|
+
*/
|
|
34
|
+
autoDetail: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 保存按钮是否可见
|
|
37
|
+
*/
|
|
38
|
+
saveBtnVisible: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 另存为按钮是否可见
|
|
41
|
+
*/
|
|
42
|
+
saveAsBtnVisible: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 页面表单数据交互标准定义
|
|
47
|
+
*/
|
|
48
|
+
export type EditorControl<T> = EditorControlOption & {
|
|
49
|
+
/**
|
|
50
|
+
* 表单名称
|
|
51
|
+
*/
|
|
52
|
+
readonly name: string;
|
|
53
|
+
/**
|
|
54
|
+
* 表单是否可见
|
|
55
|
+
*/
|
|
56
|
+
visible: Ref<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* 表单默认数据
|
|
59
|
+
*/
|
|
60
|
+
default: Readonly<T>;
|
|
61
|
+
/**
|
|
62
|
+
* 所属页面控制器
|
|
63
|
+
*/
|
|
64
|
+
page: PageControl<AnyData>;
|
|
65
|
+
/**
|
|
66
|
+
* 所属表格控制器
|
|
67
|
+
*/
|
|
68
|
+
grid?: GridControl<AnyData>;
|
|
69
|
+
/**
|
|
70
|
+
* 表单保存前判断
|
|
71
|
+
* @param editorCtrl 表单配置数据
|
|
72
|
+
* @returns 是否保存
|
|
73
|
+
*/
|
|
74
|
+
beforeSave?: () => boolean | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* 表单保存后处理
|
|
77
|
+
* @param editorCtrl 表单配置数据
|
|
78
|
+
* @param pageCtrl 页面控制器
|
|
79
|
+
*/
|
|
80
|
+
afterSave?: () => void | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* 表单数据
|
|
83
|
+
* - Model对象
|
|
84
|
+
*/
|
|
85
|
+
formData: Ref<T>;
|
|
86
|
+
/**
|
|
87
|
+
* 更新数据
|
|
88
|
+
* - 自定义对象
|
|
89
|
+
*/
|
|
90
|
+
updateData: Ref<Record<string, any> | undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* 表单验证条件
|
|
93
|
+
* - errors 验证失败信息数组
|
|
94
|
+
*/
|
|
95
|
+
formRules: Ref<Record<string, ValidateRule> | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* 验证器
|
|
98
|
+
*/
|
|
99
|
+
ruleValidator?: Validator;
|
|
100
|
+
/**
|
|
101
|
+
* 验证结果
|
|
102
|
+
*/
|
|
103
|
+
ruleResults: Ref<Record<string, ValidateError[]> | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* 表单存储接口
|
|
106
|
+
* - 优先使用
|
|
107
|
+
* - 或使用PageData.urls.save
|
|
108
|
+
*/
|
|
109
|
+
saveUrl?: IUrlInfo;
|
|
110
|
+
/**
|
|
111
|
+
* 获取详情接口
|
|
112
|
+
*/
|
|
113
|
+
detailUrl?: IUrlInfo;
|
|
114
|
+
/**
|
|
115
|
+
* 表单是否正在执行存储
|
|
116
|
+
*/
|
|
117
|
+
isFormSaving: Ref<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* 表单详情加载中
|
|
120
|
+
*/
|
|
121
|
+
isFormLoading: Ref<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* 上级表单
|
|
124
|
+
*/
|
|
125
|
+
parentEditor?: EditorControl<any>;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 输入项工厂结构
|
|
130
|
+
*/
|
|
131
|
+
export interface InputFactoryItems<T> {
|
|
132
|
+
/**
|
|
133
|
+
* 页面表单数据
|
|
134
|
+
*/
|
|
135
|
+
editorCtrl: EditorControl<T> | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* 表单项Label文字
|
|
138
|
+
*/
|
|
139
|
+
labelText: Ref<string>;
|
|
140
|
+
/**
|
|
141
|
+
* 输入项错误列表
|
|
142
|
+
*/
|
|
143
|
+
// ruleErrors: Ref<ValidateError[] | undefined>;
|
|
144
|
+
/**
|
|
145
|
+
* 输入项验证规则名
|
|
146
|
+
*/
|
|
147
|
+
ruleKey: Ref<string>;
|
|
148
|
+
/**
|
|
149
|
+
* 输入项错误状态
|
|
150
|
+
*/
|
|
151
|
+
errInfo?: Ref<{ msg: string; errClass: string }>;
|
|
152
|
+
/**
|
|
153
|
+
* 输入项属性
|
|
154
|
+
*/
|
|
155
|
+
inputProps?: DefineProps;
|
|
156
|
+
/**
|
|
157
|
+
* 输入项reload事件处理
|
|
158
|
+
* @param event 事件名
|
|
159
|
+
* @param data 参数
|
|
160
|
+
* @returns
|
|
161
|
+
*/
|
|
162
|
+
reloadHandler?: (event: string, data: Record<string, AnyData> | AnyData[]) => void;
|
|
163
|
+
/**
|
|
164
|
+
* 输入项事件
|
|
165
|
+
* @param evt 事件
|
|
166
|
+
* @param args 参数
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
inputEmit?: (evt: any, ...args) => void;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type { ValidateRule, ValidateRuleItem, ValidateError };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { AnyData, IUrlInfo, ReqParams } from '@skyfox2000/fapi';
|
|
2
|
+
|
|
3
|
+
type RawValue = string | number;
|
|
4
|
+
export type SelectValue = RawValue | RawValue[];
|
|
5
|
+
/**
|
|
6
|
+
* 选项基础属性
|
|
7
|
+
*/
|
|
8
|
+
export interface OptionItemProps {
|
|
9
|
+
label: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
value: string | number | undefined;
|
|
12
|
+
key?: string | number;
|
|
13
|
+
role?: string | string[];
|
|
14
|
+
permit?: string;
|
|
15
|
+
[key: string]: AnyData;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 选项类公共属性接口
|
|
20
|
+
*/
|
|
21
|
+
export interface OptionProps {
|
|
22
|
+
/**
|
|
23
|
+
* 自动接口加载数据
|
|
24
|
+
* - 默认为true
|
|
25
|
+
*/
|
|
26
|
+
autoload?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 是否显示全部选项
|
|
29
|
+
* - 默认为false
|
|
30
|
+
*/
|
|
31
|
+
all?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 选择项数据
|
|
34
|
+
*/
|
|
35
|
+
data?: Record<string, any>[];
|
|
36
|
+
/**
|
|
37
|
+
* 字段转换控制
|
|
38
|
+
* - Key:目的字段
|
|
39
|
+
* - Value:源字段,支持模板 ${}
|
|
40
|
+
*/
|
|
41
|
+
fieldMap?: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* 接口定义
|
|
44
|
+
*/
|
|
45
|
+
url?: IUrlInfo;
|
|
46
|
+
/**
|
|
47
|
+
* 接口自定义QOD参数
|
|
48
|
+
*/
|
|
49
|
+
params?: ReqParams;
|
|
50
|
+
/**
|
|
51
|
+
* 表单数据
|
|
52
|
+
*/
|
|
53
|
+
formData?: Record<string, any>;
|
|
54
|
+
/**
|
|
55
|
+
* 返回文字内容或文字内容数组
|
|
56
|
+
*/
|
|
57
|
+
labels?: string | number | (string | number)[];
|
|
58
|
+
/**
|
|
59
|
+
* 输出字段转换控制
|
|
60
|
+
* - Key:目的字段
|
|
61
|
+
* - Value:源字段,支持模板 ${}
|
|
62
|
+
*/
|
|
63
|
+
outFields?: Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* 通过消息重载数据,只允许改变查询条件
|
|
66
|
+
* - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
|
|
67
|
+
* - 数据组仅用于联动显示
|
|
68
|
+
* - 其它情况使用Query参数
|
|
69
|
+
*/
|
|
70
|
+
reloadEvent?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 通过消息触发事件,只允许改变查询条件
|
|
73
|
+
* - eventBus.emit(changeEvent, { Q参数 } | 数据[])
|
|
74
|
+
* - 数据组仅用于联动显示
|
|
75
|
+
* - 其它情况使用Query参数
|
|
76
|
+
*/
|
|
77
|
+
changeEvent?: string | string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
import type { PropType } from 'vue';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 选项类props公共属性
|
|
84
|
+
*/
|
|
85
|
+
export const OptionCommProps = {
|
|
86
|
+
/**
|
|
87
|
+
* 自动接口加载数据
|
|
88
|
+
* - 默认为true
|
|
89
|
+
*/
|
|
90
|
+
autoload: {
|
|
91
|
+
type: Boolean as PropType<boolean>,
|
|
92
|
+
required: false,
|
|
93
|
+
default: true,
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* 是否显示全部选项
|
|
97
|
+
* - 默认为false
|
|
98
|
+
*/
|
|
99
|
+
all: {
|
|
100
|
+
type: Boolean as PropType<boolean>,
|
|
101
|
+
required: false,
|
|
102
|
+
default: false,
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* 选择项数据
|
|
106
|
+
*/
|
|
107
|
+
data: {
|
|
108
|
+
type: Array as PropType<Record<string, any>[]>,
|
|
109
|
+
required: false,
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* 字段转换控制
|
|
113
|
+
* - Key:目的字段
|
|
114
|
+
* - Value:源字段,支持模板 ${}
|
|
115
|
+
*/
|
|
116
|
+
fieldMap: {
|
|
117
|
+
type: Object as PropType<Record<string, string>>,
|
|
118
|
+
required: false,
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* 接口定义
|
|
122
|
+
*/
|
|
123
|
+
url: {
|
|
124
|
+
type: Object as PropType<IUrlInfo>,
|
|
125
|
+
required: false,
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* 接口自定义QOD参数
|
|
129
|
+
*/
|
|
130
|
+
params: {
|
|
131
|
+
type: Object as PropType<ReqParams>,
|
|
132
|
+
required: false,
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* 返回文字内容或文字内容数组
|
|
136
|
+
*/
|
|
137
|
+
labels: {
|
|
138
|
+
type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
|
|
139
|
+
required: false,
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* 表单数据
|
|
143
|
+
*/
|
|
144
|
+
formData: {
|
|
145
|
+
type: Object as PropType<Record<string, any>>,
|
|
146
|
+
required: false,
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* 输出字段转换控制
|
|
150
|
+
* - Key:目的字段
|
|
151
|
+
* - Value:源字段,支持模板 ${}
|
|
152
|
+
*/
|
|
153
|
+
outFields: {
|
|
154
|
+
type: Object as PropType<Record<string, string>>,
|
|
155
|
+
required: false,
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* 通过消息重载数据,只允许改变查询条件
|
|
159
|
+
* - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
|
|
160
|
+
* - 数据组仅用于联动显示
|
|
161
|
+
* - 其它情况使用Query参数
|
|
162
|
+
*/
|
|
163
|
+
reloadEvent: {
|
|
164
|
+
type: String as PropType<string>,
|
|
165
|
+
required: false,
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* 通过消息触发事件,只允许改变查询条件
|
|
169
|
+
* - eventBus.emit(changeEvent, { Q参数 } | 数据[])
|
|
170
|
+
* - 数据组仅用于联动显示
|
|
171
|
+
* - 其它情况使用Query参数
|
|
172
|
+
*/
|
|
173
|
+
changeEvent: {
|
|
174
|
+
type: [String, Array] as PropType<string | string[]>,
|
|
175
|
+
required: false,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReqParams } from '@skyfox2000/fapi';
|
|
2
|
+
import { EditorControl } from './form';
|
|
3
|
+
import { ApiUrls } from './urls';
|
|
4
|
+
import { GridControl } from './table';
|
|
5
|
+
import { TreeControl } from './tree';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 主键类型
|
|
9
|
+
*/
|
|
10
|
+
export type PrimaryKey = number | string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 页面数据传递键名
|
|
14
|
+
*/
|
|
15
|
+
export enum ProviderKeys {
|
|
16
|
+
'PageControl' = 'Page.PageControl',
|
|
17
|
+
'EditorControl' = 'Page.EditorControl',
|
|
18
|
+
'GridControl' = 'Page.GridControl',
|
|
19
|
+
'LabelText' = 'FormItem.LabelText',
|
|
20
|
+
'RuleKey' = 'FormItem.RuleKey',
|
|
21
|
+
'ErrInfo' = 'FormItem.ErrInfo',
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 页面控制默认设置
|
|
25
|
+
*/
|
|
26
|
+
export interface PageControlOption {
|
|
27
|
+
/**
|
|
28
|
+
* 主键名,默认为Id
|
|
29
|
+
*/
|
|
30
|
+
primaryKey: string | 'Id' | 'id';
|
|
31
|
+
/**
|
|
32
|
+
* 记录行状态,默认为Enabled
|
|
33
|
+
*/
|
|
34
|
+
statusKey: string | 'Enabled' | 'enabled';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 页面数据交互标准定义
|
|
39
|
+
*/
|
|
40
|
+
export type PageControl<T> = ApiUrls &
|
|
41
|
+
PageControlOption & {
|
|
42
|
+
/**
|
|
43
|
+
* 控制编辑表单显示
|
|
44
|
+
*/
|
|
45
|
+
editor?: EditorControl<T>;
|
|
46
|
+
/**
|
|
47
|
+
* 控制左侧树数据
|
|
48
|
+
*/
|
|
49
|
+
tree?: TreeControl;
|
|
50
|
+
/**
|
|
51
|
+
* 控制表格数据
|
|
52
|
+
*/
|
|
53
|
+
grid?: GridControl<T>;
|
|
54
|
+
/**
|
|
55
|
+
* 当前页面默认条件
|
|
56
|
+
*/
|
|
57
|
+
searchQuery?: ReqParams;
|
|
58
|
+
/**
|
|
59
|
+
* 其它弹窗配置
|
|
60
|
+
*/
|
|
61
|
+
subEditor?: {
|
|
62
|
+
[key: string]: EditorControl<any>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 其它表格配置
|
|
66
|
+
*/
|
|
67
|
+
subGrid?: {
|
|
68
|
+
[key: string]: GridControl<any>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { ButtonTools } from './tools';
|
|
3
|
+
import { PageControl, PrimaryKey } from './page';
|
|
4
|
+
import { EditorControl } from './form';
|
|
5
|
+
import { AnyData, IUrlInfo, ReqParams, FindResult } from '@skyfox2000/fapi';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 表格控制默认设置
|
|
9
|
+
*/
|
|
10
|
+
export interface GridControlOption {
|
|
11
|
+
/**
|
|
12
|
+
* 自动加载表格,默认true
|
|
13
|
+
*/
|
|
14
|
+
autoload: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 主键名,默认为Id
|
|
17
|
+
*/
|
|
18
|
+
primaryKey: string | 'Id' | 'id';
|
|
19
|
+
/**
|
|
20
|
+
* 记录行状态,默认为Enabled
|
|
21
|
+
*/
|
|
22
|
+
statusKey: string | 'Enabled' | 'enabled';
|
|
23
|
+
/**
|
|
24
|
+
* 是否支持多行选择
|
|
25
|
+
*/
|
|
26
|
+
selectable: Ref<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* 搜索栏是否可见
|
|
29
|
+
*/
|
|
30
|
+
searchBar: Ref<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* 分页数量,默认10
|
|
33
|
+
*/
|
|
34
|
+
pageSize: Ref<number>;
|
|
35
|
+
/**
|
|
36
|
+
* 主操作按钮列表
|
|
37
|
+
* - 空[]则不显示
|
|
38
|
+
* - 外部控制可用状态
|
|
39
|
+
* - 默认:New
|
|
40
|
+
* - 可用:
|
|
41
|
+
* - New 新增
|
|
42
|
+
* - 下载表格
|
|
43
|
+
*/
|
|
44
|
+
buttons: Ref<ButtonTools>;
|
|
45
|
+
/**
|
|
46
|
+
* 平铺数量,超过N个的按钮,会折叠成下拉菜单
|
|
47
|
+
* 默认值:3
|
|
48
|
+
*/
|
|
49
|
+
flat?: number;
|
|
50
|
+
/**
|
|
51
|
+
* 常用操作图标,默认显示,空[]则不显示
|
|
52
|
+
*
|
|
53
|
+
* tool开头的可通过后端权限控制
|
|
54
|
+
* - 默认:Reload/RowHeight/TableHeadset/Fullscreen
|
|
55
|
+
* - 可用
|
|
56
|
+
* - Reload: 刷新表格
|
|
57
|
+
* - Query: 展开搜索栏
|
|
58
|
+
* - RowHeight: 行高调整
|
|
59
|
+
* - tool.multiple.checkbox: 显示多选框
|
|
60
|
+
* - tool.expand.rows: 展开记录行
|
|
61
|
+
* - tool.export.excel: 导出Excel
|
|
62
|
+
* - tool.export.excel.all: 全部记录
|
|
63
|
+
* - tool.export.pdf: 导出PDF
|
|
64
|
+
* - TableHeadset: 表头设置
|
|
65
|
+
* - Fullscreen: 设置全屏
|
|
66
|
+
*/
|
|
67
|
+
tools: string[];
|
|
68
|
+
/**
|
|
69
|
+
* 远程分页,标准接口需改为find
|
|
70
|
+
* 非标准接口需要返回data.total字段
|
|
71
|
+
*/
|
|
72
|
+
remotePage: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 是否全部行展开
|
|
75
|
+
*/
|
|
76
|
+
rowExpand: Ref<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* 默认行高
|
|
79
|
+
* - 大 / 中 / 小
|
|
80
|
+
*/
|
|
81
|
+
tableSize: Ref<'large' | 'middle' | 'small'>;
|
|
82
|
+
/**
|
|
83
|
+
* 表格行操作
|
|
84
|
+
* - 默认:Edit/Delete
|
|
85
|
+
* - 可用:
|
|
86
|
+
* - Edit 编辑
|
|
87
|
+
* - Delete 删除
|
|
88
|
+
*/
|
|
89
|
+
operates: ButtonTools;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 页面表格数据交互标准定义
|
|
93
|
+
*/
|
|
94
|
+
export type GridControl<T> = GridControlOption & {
|
|
95
|
+
/**
|
|
96
|
+
* 重新加载表格数据
|
|
97
|
+
*/
|
|
98
|
+
reload: Ref<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* 所属页面控制器
|
|
101
|
+
*/
|
|
102
|
+
page: PageControl<AnyData>;
|
|
103
|
+
/**
|
|
104
|
+
* 编辑表单控制器
|
|
105
|
+
*/
|
|
106
|
+
editor?: EditorControl<T>;
|
|
107
|
+
/**
|
|
108
|
+
* 当前表格点击的数据行
|
|
109
|
+
*/
|
|
110
|
+
rowData: Ref<T | undefined>;
|
|
111
|
+
/**
|
|
112
|
+
* 选择的数据行
|
|
113
|
+
*/
|
|
114
|
+
selectRows: Ref<T[]>;
|
|
115
|
+
/**
|
|
116
|
+
* 选择的数据行主键
|
|
117
|
+
*/
|
|
118
|
+
selectKeys: Ref<PrimaryKey[]>;
|
|
119
|
+
/**
|
|
120
|
+
* 当前页码
|
|
121
|
+
*/
|
|
122
|
+
pageNo: Ref<number>;
|
|
123
|
+
/**
|
|
124
|
+
* 总数量
|
|
125
|
+
*/
|
|
126
|
+
total: Ref<number>;
|
|
127
|
+
/**
|
|
128
|
+
* 表格列
|
|
129
|
+
*/
|
|
130
|
+
columns: Ref<Record<string, any>[]>;
|
|
131
|
+
/**
|
|
132
|
+
* 当前表格查询条件
|
|
133
|
+
*/
|
|
134
|
+
gridQuery?: ReqParams;
|
|
135
|
+
/**
|
|
136
|
+
* 当前表格全部数据
|
|
137
|
+
*/
|
|
138
|
+
tableData: ShallowRef<T[] | undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* 数据行展开数据,主键为行主键
|
|
141
|
+
* - 通过gridData.expandRows[record.Id]获取数据
|
|
142
|
+
*/
|
|
143
|
+
expandRows: Ref<Record<string, AnyData>>;
|
|
144
|
+
/**
|
|
145
|
+
* 表格查询接口
|
|
146
|
+
* - 优先使用
|
|
147
|
+
* - 或使用PageData.urls.list
|
|
148
|
+
*/
|
|
149
|
+
gridUrl?: IUrlInfo;
|
|
150
|
+
/**
|
|
151
|
+
* 表格更新接口
|
|
152
|
+
* - 优先使用
|
|
153
|
+
* - 或使用PageData.urls.update
|
|
154
|
+
*/
|
|
155
|
+
updateUrl?: IUrlInfo;
|
|
156
|
+
/**
|
|
157
|
+
* 表格删除接口
|
|
158
|
+
* - 优先使用
|
|
159
|
+
* - 或使用PageData.urls.delete
|
|
160
|
+
*/
|
|
161
|
+
deleteUrl?: IUrlInfo;
|
|
162
|
+
/**
|
|
163
|
+
* 表格是否正在加载中
|
|
164
|
+
*/
|
|
165
|
+
isGridLoading: Ref<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* 表格是否正在存储中
|
|
168
|
+
*/
|
|
169
|
+
isGridSaving: Ref<boolean>;
|
|
170
|
+
/**
|
|
171
|
+
* 表格数据加载后回调
|
|
172
|
+
*/
|
|
173
|
+
afterLoad?: (result: FindResult | T[] | null) => void;
|
|
174
|
+
/**
|
|
175
|
+
* 表格数据更新后回调
|
|
176
|
+
*/
|
|
177
|
+
afterUpdate?: (record: T) => void;
|
|
178
|
+
/**
|
|
179
|
+
* 表格数据删除后回调
|
|
180
|
+
*/
|
|
181
|
+
afterDelete?: (record: T) => void;
|
|
182
|
+
};
|