@airpower/web 0.1.3 → 0.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/README.md +12 -9
- package/dist/base/AbstractService.d.ts +30 -0
- package/dist/base/IEntity.d.ts +11 -0
- package/dist/base/RootEntity.d.ts +24 -0
- package/dist/base/RootModel.d.ts +8 -0
- package/dist/base/index.d.ts +4 -0
- package/dist/components/button/Button.vue.d.ts +114 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/type.d.ts +1 -0
- package/dist/components/copy/Copy.vue.d.ts +49 -0
- package/dist/components/copy/index.d.ts +2 -0
- package/dist/components/datetime/DateTime.vue.d.ts +68 -0
- package/dist/components/datetime/index.d.ts +2 -0
- package/dist/components/desensitize/Desensitize.vue.d.ts +84 -0
- package/dist/components/desensitize/index.d.ts +2 -0
- package/dist/components/dialog/Dialog.vue.d.ts +342 -0
- package/dist/components/dialog/DialogProps.d.ts +191 -0
- package/dist/components/dialog/DialogUtil.d.ts +48 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/empty/Empty.vue.d.ts +18 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/form/FormField.vue.d.ts +54 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/frame/Frame.vue.d.ts +32 -0
- package/dist/components/frame/index.d.ts +2 -0
- package/dist/components/group/Group.vue.d.ts +144 -0
- package/dist/components/group/index.d.ts +2 -0
- package/dist/components/image/Image.vue.d.ts +48 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/index.d.ts +24 -2
- package/dist/components/input/DateTimeType.d.ts +27 -0
- package/dist/components/input/Input.vue.d.ts +50 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/menu/ChildMenu.vue.d.ts +17 -0
- package/dist/components/menu/IMenu.d.ts +24 -0
- package/dist/components/menu/Menu.vue.d.ts +20 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/money/Money.vue.d.ts +71 -0
- package/dist/components/money/index.d.ts +3 -0
- package/dist/components/money/type.d.ts +1 -0
- package/dist/components/page/Page.vue.d.ts +18 -0
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/panel/Panel.vue.d.ts +115 -0
- package/dist/components/panel/index.d.ts +2 -0
- package/dist/components/payload/IPayload.d.ts +11 -0
- package/dist/components/payload/Payload.vue.d.ts +35 -0
- package/dist/components/payload/index.d.ts +3 -0
- package/dist/components/phone/Call.vue.d.ts +56 -0
- package/dist/components/phone/Phone.vue.d.ts +69 -0
- package/dist/components/phone/index.d.ts +3 -0
- package/dist/components/qrcode/Qrcode.vue.d.ts +34 -0
- package/dist/components/qrcode/index.d.ts +2 -0
- package/dist/components/select/Select.vue.d.ts +47 -0
- package/dist/components/select/Selector.vue.d.ts +107 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/tab/Tab.vue.d.ts +35 -0
- package/dist/components/tab/Tabs.vue.d.ts +17 -0
- package/dist/components/tab/index.d.ts +3 -0
- package/dist/components/table/Table.vue.d.ts +157 -0
- package/dist/components/table/component/ColumnSelector.vue.d.ts +20 -0
- package/dist/components/table/component/CopyColumn.vue.d.ts +18 -0
- package/dist/components/table/component/EnumColumn.vue.d.ts +20 -0
- package/dist/components/table/component/Export.vue.d.ts +44 -0
- package/dist/components/table/component/index.d.ts +5 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/useTableButton.d.ts +74 -0
- package/dist/components/table/useTableColumn.d.ts +36 -0
- package/dist/components/table/useTableSelect.d.ts +24 -0
- package/dist/components/tree/TreeBox.vue.d.ts +43 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/upload/IUploadProps.d.ts +62 -0
- package/dist/components/upload/Upload.vue.d.ts +47 -0
- package/dist/components/upload/index.d.ts +3 -0
- package/dist/components/user/IUser.d.ts +14 -0
- package/dist/components/user/User.vue.d.ts +67 -0
- package/dist/components/user/index.d.ts +3 -0
- package/dist/config/WebConfig.d.ts +306 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/curd/AbstractCurdService.d.ts +138 -0
- package/dist/curd/index.d.ts +2 -0
- package/dist/curd/type.d.ts +8 -0
- package/dist/decorator/@Field/Field.d.ts +28 -0
- package/dist/decorator/@Field/IFieldConfig.d.ts +18 -0
- package/dist/decorator/@Field/index.d.ts +2 -0
- package/dist/decorator/@Form/Form.d.ts +24 -0
- package/dist/decorator/@Form/FormTrim.d.ts +19 -0
- package/dist/decorator/@Form/IFormField.d.ts +224 -0
- package/dist/decorator/@Form/index.d.ts +3 -0
- package/dist/decorator/@Model/IModelConfig.d.ts +69 -0
- package/dist/decorator/@Model/Model.d.ts +12 -0
- package/dist/decorator/@Model/index.d.ts +2 -0
- package/dist/decorator/@Search/ISearchField.d.ts +29 -0
- package/dist/decorator/@Search/Search.d.ts +24 -0
- package/dist/decorator/@Search/index.d.ts +2 -0
- package/dist/decorator/{@table → @Table}/IElementTableColumn.d.ts +1 -1
- package/dist/decorator/@Table/ITableColumn.d.ts +63 -0
- package/dist/decorator/{@table → @Table}/Table.d.ts +5 -5
- package/dist/decorator/{@table → @Table}/index.d.ts +1 -1
- package/dist/decorator/common/IBaseField.d.ts +12 -0
- package/dist/decorator/common/index.d.ts +1 -0
- package/dist/decorator/index.d.ts +6 -1
- package/dist/enum/DisableEnum.d.ts +10 -0
- package/dist/enum/IWebEnum.d.ts +13 -0
- package/dist/enum/WebColor.d.ts +23 -0
- package/dist/enum/WebEnum.d.ts +20 -0
- package/dist/enum/index.d.ts +5 -0
- package/dist/enum/type.d.ts +8 -0
- package/dist/{controller/interface/IDetailControllerOption.d.ts → hooks/detail/IDetailOption.d.ts} +3 -4
- package/dist/hooks/detail/IDetailResult.d.ts +30 -0
- package/dist/hooks/detail/index.d.ts +3 -0
- package/dist/hooks/detail/useDetail.d.ts +13 -0
- package/dist/{controller/interface/IUseEditorOption.d.ts → hooks/editor/IEditorOption.d.ts} +13 -5
- package/dist/hooks/editor/IEditorResult.d.ts +29 -0
- package/dist/hooks/editor/index.d.ts +3 -0
- package/dist/hooks/editor/useEditor.d.ts +13 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/{controller/interface/ITableControllerOption.d.ts → hooks/table/base/IBaseTableOption.d.ts} +5 -5
- package/dist/hooks/table/base/IBaseTableResult.d.ts +81 -0
- package/dist/hooks/table/base/index.d.ts +3 -0
- package/dist/hooks/table/base/useBaseTable.d.ts +11 -0
- package/dist/hooks/table/index.d.ts +4 -0
- package/dist/hooks/table/list/ITableOption.d.ts +8 -0
- package/dist/hooks/table/list/ITableResult.d.ts +33 -0
- package/dist/hooks/table/list/index.d.ts +3 -0
- package/dist/hooks/table/list/useTable.d.ts +11 -0
- package/dist/hooks/table/selector/ISelectorOption.d.ts +8 -0
- package/dist/hooks/table/selector/ISelectorResult.d.ts +19 -0
- package/dist/hooks/table/selector/index.d.ts +3 -0
- package/dist/hooks/table/selector/useSelector.d.ts +13 -0
- package/dist/{controller/interface/ITableTreeControllerOption.d.ts → hooks/table/tree/ITableTreeOption.d.ts} +5 -5
- package/dist/hooks/table/tree/ITableTreeResult.d.ts +13 -0
- package/dist/hooks/table/tree/index.d.ts +3 -0
- package/dist/hooks/table/tree/useTableTree.d.ts +12 -0
- package/dist/i18n/WebI18n.d.ts +52 -3
- package/dist/index.d.ts +7 -4
- package/dist/main.js +9229 -0
- package/dist/model/export/ExportModel.d.ts +24 -0
- package/dist/model/export/index.d.ts +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/query/QueryPage.d.ts +15 -0
- package/dist/model/query/QueryRequest.d.ts +27 -0
- package/dist/model/query/QueryRequestPage.d.ts +13 -0
- package/dist/model/query/QueryResponsePage.d.ts +30 -0
- package/dist/model/query/QuerySort.d.ts +26 -0
- package/dist/model/query/index.d.ts +6 -0
- package/dist/model/query/type.d.ts +4 -0
- package/dist/model/tree/ITree.d.ts +21 -0
- package/dist/model/tree/index.d.ts +1 -0
- package/dist/type/index.d.ts +1 -0
- package/dist/util/feedback/FeedbackUtil.d.ts +97 -0
- package/dist/util/feedback/index.d.ts +2 -0
- package/dist/util/feedback/type.d.ts +1 -0
- package/dist/util/file/IFile.d.ts +10 -0
- package/dist/util/file/WebFileUtil.d.ts +11 -0
- package/dist/util/file/index.d.ts +1 -0
- package/dist/util/http/Http.d.ts +121 -0
- package/dist/util/http/HttpResponse.d.ts +19 -0
- package/dist/util/http/enum/HttpContentType.d.ts +27 -0
- package/dist/util/http/enum/HttpHeader.d.ts +15 -0
- package/dist/util/http/enum/HttpMethod.d.ts +12 -0
- package/dist/util/http/enum/HttpStatus.d.ts +31 -0
- package/dist/util/http/enum/index.d.ts +4 -0
- package/dist/util/http/index.d.ts +4 -0
- package/dist/util/http/type.d.ts +13 -0
- package/dist/util/index.d.ts +5 -1
- package/dist/util/permission/PermissionAction.d.ts +42 -0
- package/dist/util/permission/PermissionUtil.d.ts +50 -0
- package/dist/util/permission/index.d.ts +2 -0
- package/dist/util/validator/WebValidator.d.ts +198 -0
- package/dist/util/validator/index.d.ts +2 -0
- package/dist/util/validator/type.d.ts +24 -0
- package/dist/web.css +1531 -0
- package/package.json +15 -12
- package/dist/airpower.web.js +0 -490
- package/dist/components/WebTable.vue.d.ts +0 -22
- package/dist/controller/DetailController.d.ts +0 -29
- package/dist/controller/EditorController.d.ts +0 -11
- package/dist/controller/index.d.ts +0 -4
- package/dist/controller/interface/index.d.ts +0 -4
- package/dist/controller/table/BaseTableController.d.ts +0 -68
- package/dist/controller/table/TableController.d.ts +0 -36
- package/dist/controller/table/TableTreeController.d.ts +0 -16
- package/dist/controller/table/index.d.ts +0 -3
- package/dist/decorator/@table/ITableFieldConfig.d.ts +0 -23
- package/dist/http/WebHttp.d.ts +0 -18
- package/dist/http/index.d.ts +0 -1
- package/dist/service/AbstractWebService.d.ts +0 -27
- package/dist/service/index.d.ts +0 -1
- package/dist/shared/index.d.ts +0 -1
- package/dist/util/WebAccessTokenUtil.d.ts +0 -20
- /package/dist/decorator/{@table → @Table}/TableType.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airpower/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "AirPower-Web",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hamm",
|
|
@@ -19,41 +19,44 @@
|
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"AirPower",
|
|
22
|
-
"AirPower-Core",
|
|
23
22
|
"AirPower-Web",
|
|
24
23
|
"class-transformer",
|
|
25
24
|
"typescript",
|
|
26
25
|
"oop",
|
|
27
26
|
"class"
|
|
28
27
|
],
|
|
29
|
-
"main": "dist/
|
|
30
|
-
"module": "dist/
|
|
28
|
+
"main": "dist/main.js",
|
|
29
|
+
"module": "dist/main.js",
|
|
31
30
|
"types": "dist/index.d.ts",
|
|
32
31
|
"files": [
|
|
33
32
|
"dist",
|
|
34
33
|
"docs"
|
|
35
34
|
],
|
|
36
35
|
"scripts": {
|
|
37
|
-
"build": "tsc && vite build",
|
|
36
|
+
"build": "eslint && tsc && vite build",
|
|
38
37
|
"lint": "eslint src --ext .ts",
|
|
39
38
|
"preview": "vite preview"
|
|
40
39
|
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"axios": "^1.8.4",
|
|
43
|
-
"element-plus": "^2.9.7",
|
|
44
|
-
"vue": "^3.5.13"
|
|
45
|
-
},
|
|
40
|
+
"peerDependencies": {},
|
|
46
41
|
"dependencies": {
|
|
47
|
-
"@airpower/
|
|
42
|
+
"@airpower/enum": "^0.0.10",
|
|
43
|
+
"@airpower/i18n": "^0.0.4",
|
|
44
|
+
"@airpower/transformer": "^0.1.0",
|
|
45
|
+
"@airpower/util": "^0.1.2",
|
|
46
|
+
"@element-plus/icons-vue": "^2.3.1",
|
|
48
47
|
"axios": "^1.8.4",
|
|
49
48
|
"element-plus": "^2.9.7",
|
|
50
|
-
"vue": "^3.
|
|
49
|
+
"qrcode.vue": "^3.6.0",
|
|
50
|
+
"vue": "^3.5.13",
|
|
51
|
+
"vue-clipboard3": "^2.0.0",
|
|
52
|
+
"vue-router": "^4.5.0"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@antfu/eslint-config": "^4.11.0",
|
|
54
56
|
"@types/node": "^22.13.14",
|
|
55
57
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
56
58
|
"eslint": "^9.23.0",
|
|
59
|
+
"sass-embedded": "^1.86.3",
|
|
57
60
|
"typescript": "^5.8.2",
|
|
58
61
|
"vite": "^6.2.0",
|
|
59
62
|
"vite-plugin-dts": "^4.5.3"
|
package/dist/airpower.web.js
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList, ref } from "vue";
|
|
5
|
-
import { DecoratorUtil, getFieldConfig, ClassTransformer, I18n, QueryPageResponse, QueryPageRequest, Page, HttpConfig, AbstractHttp, HttpResponse, HttpStatus, AbstractEntityService } from "@airpower/core";
|
|
6
|
-
export * from "@airpower/core";
|
|
7
|
-
import { ElTable, ElTableColumn, ElMessageBox, ElMessage } from "element-plus";
|
|
8
|
-
import axios from "axios";
|
|
9
|
-
const FIELD_CONFIG_KEY = "Table";
|
|
10
|
-
const FIELD_LIST_KEY = "TableList";
|
|
11
|
-
function Table(config = {}) {
|
|
12
|
-
return (target, key) => {
|
|
13
|
-
config.key = key;
|
|
14
|
-
return DecoratorUtil.setFieldConfig(target, key, FIELD_CONFIG_KEY, config, FIELD_LIST_KEY);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getTableConfig(target, key) {
|
|
18
|
-
const formConfig = DecoratorUtil.getFieldConfig(target, key, FIELD_CONFIG_KEY, true);
|
|
19
|
-
if (!formConfig) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
if (!formConfig.enums) {
|
|
23
|
-
const props = getFieldConfig(target, key);
|
|
24
|
-
if (props && props.enums) {
|
|
25
|
-
formConfig.enums = props.enums;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return formConfig;
|
|
29
|
-
}
|
|
30
|
-
function getTableFieldList(target) {
|
|
31
|
-
return DecoratorUtil.getFieldList(target, FIELD_LIST_KEY);
|
|
32
|
-
}
|
|
33
|
-
function getTableConfigList(target, keyList) {
|
|
34
|
-
return DecoratorUtil.getFieldConfigList(target, FIELD_LIST_KEY, FIELD_CONFIG_KEY, keyList).sort((a, b) => (b.orderNumber || 0) - (a.orderNumber || 0)).map((item) => {
|
|
35
|
-
const props = getFieldConfig(target, item.key);
|
|
36
|
-
item.label = item.label || props.label || item.key;
|
|
37
|
-
if (!item.enums) {
|
|
38
|
-
const fieldConfig = getFieldConfig(target, item.key);
|
|
39
|
-
if (fieldConfig && fieldConfig.enums) {
|
|
40
|
-
item.enums = fieldConfig.enums;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return item;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
47
|
-
__name: "WebTable",
|
|
48
|
-
props: {
|
|
49
|
-
/**
|
|
50
|
-
* ### 表格列配置
|
|
51
|
-
*/
|
|
52
|
-
columns: {
|
|
53
|
-
type: Array
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* ### 表格数据
|
|
57
|
-
*/
|
|
58
|
-
data: {
|
|
59
|
-
type: Array,
|
|
60
|
-
required: true
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* ### 表格实体类
|
|
64
|
-
*/
|
|
65
|
-
clazz: {
|
|
66
|
-
type: Function,
|
|
67
|
-
required: true
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* ### 表格ID
|
|
71
|
-
* 如传入,选择表格列后会自动缓存
|
|
72
|
-
*/
|
|
73
|
-
tableId: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: ""
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
setup(__props) {
|
|
79
|
-
const props = __props;
|
|
80
|
-
const tableColumns = computed(() => {
|
|
81
|
-
if (props.columns && props.columns.length > 0) {
|
|
82
|
-
return props.columns;
|
|
83
|
-
}
|
|
84
|
-
const instance = ClassTransformer.newInstance(props.clazz);
|
|
85
|
-
return getTableConfigList(instance, []);
|
|
86
|
-
});
|
|
87
|
-
return (_ctx, _cache) => {
|
|
88
|
-
return openBlock(), createBlock(unref(ElTable), mergeProps({
|
|
89
|
-
data: __props.data,
|
|
90
|
-
"row-key": "id"
|
|
91
|
-
}, _ctx.$attrs, toHandlers(_ctx.$attrs)), {
|
|
92
|
-
default: withCtx(() => [
|
|
93
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(tableColumns.value, (item) => {
|
|
94
|
-
return openBlock(), createBlock(unref(ElTableColumn), mergeProps({
|
|
95
|
-
key: item.key,
|
|
96
|
-
prop: item.key,
|
|
97
|
-
ref_for: true
|
|
98
|
-
}, item), null, 16, ["prop"]);
|
|
99
|
-
}), 128))
|
|
100
|
-
]),
|
|
101
|
-
_: 1
|
|
102
|
-
}, 16, ["data"]);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
class WebI18n extends I18n {
|
|
107
|
-
constructor() {
|
|
108
|
-
super(...arguments);
|
|
109
|
-
__publicField(this, "Detail", "详情");
|
|
110
|
-
__publicField(this, "Edit", "编辑");
|
|
111
|
-
__publicField(this, "Add", "添加");
|
|
112
|
-
__publicField(this, "EditSuccess", "编辑成功");
|
|
113
|
-
__publicField(this, "AddSuccess", "添加成功");
|
|
114
|
-
__publicField(this, "DeleteSuccess", "删除成功");
|
|
115
|
-
__publicField(this, "SelectPlease", "请选择");
|
|
116
|
-
__publicField(this, "DisableSuccess", "禁用成功");
|
|
117
|
-
__publicField(this, "EnableSuccess", "启用成功");
|
|
118
|
-
__publicField(this, "Confirm", "确定");
|
|
119
|
-
__publicField(this, "Cancel", "取消");
|
|
120
|
-
__publicField(this, "ConfirmPlease", "请确认");
|
|
121
|
-
__publicField(this, "ConfirmToDisable", "是否确认禁用当前选择的数据?");
|
|
122
|
-
__publicField(this, "ConfirmToEnable", "是否确认启用当前选择的数据?");
|
|
123
|
-
__publicField(this, "ConfirmToDelete", "是否确认删除当前选择的数据?");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
class DetailController {
|
|
127
|
-
/**
|
|
128
|
-
* ### 创建表格控制器
|
|
129
|
-
* @param ServiceClass 服务类
|
|
130
|
-
* @param props `defineProps` 的返回值
|
|
131
|
-
* @param option `可选` 更多的配置
|
|
132
|
-
*/
|
|
133
|
-
constructor(ServiceClass, props, option = {}) {
|
|
134
|
-
__publicField(this, "isLoading", ref(false));
|
|
135
|
-
__publicField(this, "formData");
|
|
136
|
-
__publicField(this, "title", ref(WebI18n.get().Detail));
|
|
137
|
-
__publicField(this, "service");
|
|
138
|
-
__publicField(this, "option", {});
|
|
139
|
-
this.service = ClassTransformer.newInstance(ServiceClass);
|
|
140
|
-
this.service.setLoading(this.isLoading);
|
|
141
|
-
this.option = option;
|
|
142
|
-
this.formData = ref(props.param ? props.param.copy() : ClassTransformer.newInstance(this.service.entityClass));
|
|
143
|
-
this.getDetail();
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* ### 查询详情方法
|
|
147
|
-
*/
|
|
148
|
-
async getDetail() {
|
|
149
|
-
if (this.formData.value.id) {
|
|
150
|
-
this.formData.value = await this.service.getDetail(this.formData.value.id, this.option.apiUrl);
|
|
151
|
-
if (this.option.afterGetDetail) {
|
|
152
|
-
const result = this.option.afterGetDetail(this.formData.value);
|
|
153
|
-
if (result) {
|
|
154
|
-
this.formData.value = result;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
class EditorController extends DetailController {
|
|
161
|
-
async getDetail() {
|
|
162
|
-
this.title.value = this.formData.value.id ? WebI18n.get().Edit : WebI18n.get().Add;
|
|
163
|
-
return super.getDetail();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
class BaseTableController {
|
|
167
|
-
/**
|
|
168
|
-
* ### 创建表格控制器
|
|
169
|
-
* @param ServiceClass 服务类
|
|
170
|
-
*/
|
|
171
|
-
constructor(ServiceClass) {
|
|
172
|
-
__publicField(this, "request");
|
|
173
|
-
__publicField(this, "response", ref(new QueryPageResponse()));
|
|
174
|
-
__publicField(this, "list", ref([]));
|
|
175
|
-
__publicField(this, "selectList", ref([]));
|
|
176
|
-
__publicField(this, "isLoading", ref(false));
|
|
177
|
-
__publicField(this, "service");
|
|
178
|
-
__publicField(this, "option", {});
|
|
179
|
-
this.service = ClassTransformer.newInstance(ServiceClass);
|
|
180
|
-
this.request = ref(new QueryPageRequest(this.service.entityClass));
|
|
181
|
-
this.service.setLoading(this.isLoading);
|
|
182
|
-
this.getList();
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* ### 设置配置
|
|
186
|
-
* @param option 更多配置
|
|
187
|
-
*/
|
|
188
|
-
setOption(option) {
|
|
189
|
-
this.option = option;
|
|
190
|
-
if (option.defaultFilter) {
|
|
191
|
-
this.request.value.filter = option.defaultFilter;
|
|
192
|
-
}
|
|
193
|
-
return this;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* ### 查询列表事件
|
|
197
|
-
*/
|
|
198
|
-
async getList() {
|
|
199
|
-
let req = this.request.value;
|
|
200
|
-
if (this.option.beforeSearch) {
|
|
201
|
-
const result = this.option.beforeSearch(req);
|
|
202
|
-
if (result) {
|
|
203
|
-
req = result;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (this.option.treeList) {
|
|
207
|
-
this.list.value = await this.service.getTreeList(req, this.option.apiUrl);
|
|
208
|
-
} else if (!this.option.unPaginate) {
|
|
209
|
-
this.response.value = await this.service.getPage(req, this.option.apiUrl);
|
|
210
|
-
this.list.value = this.response.value.list;
|
|
211
|
-
} else {
|
|
212
|
-
this.list.value = await this.service.getList(req, this.option.apiUrl);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* ### 搜索
|
|
217
|
-
* @param req 请求对象
|
|
218
|
-
*/
|
|
219
|
-
async search(req) {
|
|
220
|
-
this.request.value = req;
|
|
221
|
-
this.getList();
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* ### 重新加载数据
|
|
225
|
-
* 会自动返回第一页
|
|
226
|
-
*/
|
|
227
|
-
async reload() {
|
|
228
|
-
if (!this.request.value.page) {
|
|
229
|
-
this.request.value.page = new Page();
|
|
230
|
-
}
|
|
231
|
-
this.request.value.page.pageNum = 1;
|
|
232
|
-
this.search(this.request.value);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* ### 添加事件
|
|
236
|
-
*/
|
|
237
|
-
async add() {
|
|
238
|
-
if (!this.option.editView) {
|
|
239
|
-
console.error("请为 useAirTableList 的 option 传入 editView");
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
} finally {
|
|
244
|
-
this.getList();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* ### 点击表格行详情事件
|
|
249
|
-
* @param row 行数据
|
|
250
|
-
*/
|
|
251
|
-
async detail(row) {
|
|
252
|
-
if (!this.option.detailView) {
|
|
253
|
-
console.error("请为 useAirTableList 的 option 传入 detailView");
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
console.warn("需要弹出并携带数据", row, this.option.detailView);
|
|
258
|
-
} finally {
|
|
259
|
-
this.reload();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* ### 排序变更事件
|
|
264
|
-
* @param sort 排序对象
|
|
265
|
-
*/
|
|
266
|
-
async sortChanged(sort) {
|
|
267
|
-
this.request.value.sort = sort;
|
|
268
|
-
this.request.value.page = new Page();
|
|
269
|
-
this.getList();
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* ### 选择变更事件
|
|
273
|
-
* @param list 选择列表
|
|
274
|
-
*/
|
|
275
|
-
async selectChanged(list) {
|
|
276
|
-
this.selectList.value = list;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* ### 分页变更事件
|
|
280
|
-
* @param page 分页对象
|
|
281
|
-
*/
|
|
282
|
-
async pageChanged(page) {
|
|
283
|
-
this.request.value.page = page;
|
|
284
|
-
this.getList();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
class TableController extends BaseTableController {
|
|
288
|
-
/**
|
|
289
|
-
* ### 表格行编辑事件
|
|
290
|
-
* @param row 行数据
|
|
291
|
-
*/
|
|
292
|
-
async edit(row) {
|
|
293
|
-
if (!this.option.editView) {
|
|
294
|
-
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
try {
|
|
298
|
-
console.warn("需要弹出并携带数据", row, this.option.editView);
|
|
299
|
-
} finally {
|
|
300
|
-
this.getList();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* ### 表格行删除事件
|
|
305
|
-
* @param row 行数据
|
|
306
|
-
*/
|
|
307
|
-
async delete(row) {
|
|
308
|
-
await this.confirmPlease(WebI18n.get().ConfirmToDelete);
|
|
309
|
-
await this.service.delete(row.id, WebI18n.get().DeleteSuccess);
|
|
310
|
-
this.getList();
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* ### 表格行禁用事件
|
|
314
|
-
* @param row 行数据
|
|
315
|
-
*/
|
|
316
|
-
async disable(row) {
|
|
317
|
-
await this.confirmPlease(WebI18n.get().ConfirmToDisable);
|
|
318
|
-
await this.service.disable(row.id, WebI18n.get().DisableSuccess);
|
|
319
|
-
this.getList();
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* ### 表格行启用事件
|
|
323
|
-
* @param row 行数据
|
|
324
|
-
*/
|
|
325
|
-
async enable(row) {
|
|
326
|
-
await this.confirmPlease(WebI18n.get().ConfirmToEnable);
|
|
327
|
-
await this.service.enable(row.id, WebI18n.get().EnableSuccess);
|
|
328
|
-
this.getList();
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* ### 确认提示
|
|
332
|
-
* @param message 提示信息
|
|
333
|
-
*/
|
|
334
|
-
async confirmPlease(message) {
|
|
335
|
-
await ElMessageBox.confirm(
|
|
336
|
-
message,
|
|
337
|
-
WebI18n.get().ConfirmPlease,
|
|
338
|
-
{
|
|
339
|
-
confirmButtonText: WebI18n.get().Confirm,
|
|
340
|
-
cancelButtonText: WebI18n.get().Cancel,
|
|
341
|
-
type: "warning"
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
class TableTreeController extends TableController {
|
|
347
|
-
/**
|
|
348
|
-
* ### 树表格添加子项事件
|
|
349
|
-
* @param row 行数据
|
|
350
|
-
*/
|
|
351
|
-
async onAddRow(row) {
|
|
352
|
-
if (!this.option.editView) {
|
|
353
|
-
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
try {
|
|
357
|
-
let param = ClassTransformer.newInstance(this.service.entityClass);
|
|
358
|
-
param.parentId = row.id;
|
|
359
|
-
if (this.option.beforeAddRow) {
|
|
360
|
-
const result = this.option.beforeAddRow(param, row);
|
|
361
|
-
if (result !== void 0) {
|
|
362
|
-
param = result;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
console.warn("需要弹出并携带数据", param, this.option.editView);
|
|
366
|
-
} finally {
|
|
367
|
-
this.reload();
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
class WebAccessTokenUtil {
|
|
372
|
-
/**
|
|
373
|
-
* ### 获取AccessToken
|
|
374
|
-
*/
|
|
375
|
-
static getAccessToken() {
|
|
376
|
-
var _a;
|
|
377
|
-
return ((_a = localStorage.getItem(HttpConfig.authorizationHeaderKey)) == null ? void 0 : _a.toString()) || "";
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* ### 设置AccessToken
|
|
381
|
-
* @param accessToken AccessToken
|
|
382
|
-
*/
|
|
383
|
-
static setAccessToken(accessToken) {
|
|
384
|
-
localStorage.setItem(HttpConfig.authorizationHeaderKey, accessToken);
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* ### 移除AccessToken
|
|
388
|
-
*/
|
|
389
|
-
static removeAccessToken() {
|
|
390
|
-
localStorage.removeItem(HttpConfig.authorizationHeaderKey);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
class WebHttp extends AbstractHttp {
|
|
394
|
-
constructor() {
|
|
395
|
-
super(...arguments);
|
|
396
|
-
/**
|
|
397
|
-
* ### 加载状态
|
|
398
|
-
*/
|
|
399
|
-
__publicField(this, "loading", ref(false));
|
|
400
|
-
}
|
|
401
|
-
async request(body) {
|
|
402
|
-
const axiosConfig = {};
|
|
403
|
-
axiosConfig.url = this.getUrl();
|
|
404
|
-
axiosConfig.headers = this.getHttpHeaders();
|
|
405
|
-
axiosConfig.timeout = this.getTimeout();
|
|
406
|
-
axiosConfig.method = this.getMethod();
|
|
407
|
-
axiosConfig.data = body;
|
|
408
|
-
const response = new HttpResponse();
|
|
409
|
-
try {
|
|
410
|
-
const res = await axios.request(axiosConfig);
|
|
411
|
-
if (res.status !== HttpStatus.OK) {
|
|
412
|
-
response.code = res.status;
|
|
413
|
-
response.message = res.statusText;
|
|
414
|
-
response.data = res;
|
|
415
|
-
return response;
|
|
416
|
-
}
|
|
417
|
-
response.code = res.data.code;
|
|
418
|
-
response.message = res.data.message;
|
|
419
|
-
response.data = res.data.data;
|
|
420
|
-
return response;
|
|
421
|
-
} catch (e) {
|
|
422
|
-
response.code = HttpStatus.INTERNAL_SERVER_ERROR;
|
|
423
|
-
response.message = e.message;
|
|
424
|
-
response.data = e;
|
|
425
|
-
return response;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* # 获取AccessToken
|
|
430
|
-
*/
|
|
431
|
-
getAccessToken() {
|
|
432
|
-
return WebAccessTokenUtil.getAccessToken();
|
|
433
|
-
}
|
|
434
|
-
startLoading() {
|
|
435
|
-
this.loading.value = true;
|
|
436
|
-
}
|
|
437
|
-
stopLoading() {
|
|
438
|
-
this.loading.value = false;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
class AbstractWebService extends AbstractEntityService {
|
|
442
|
-
constructor() {
|
|
443
|
-
super(...arguments);
|
|
444
|
-
/**
|
|
445
|
-
* ### 是否正在加载中
|
|
446
|
-
*/
|
|
447
|
-
__publicField(this, "loading", ref(false));
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* ### 设置加载状态
|
|
451
|
-
* @param loading 加载状态
|
|
452
|
-
*/
|
|
453
|
-
setLoading(loading) {
|
|
454
|
-
this.loading = loading;
|
|
455
|
-
return this;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* ### 创建一个 `Http` 对象
|
|
459
|
-
* @param url 请求的 `URL`
|
|
460
|
-
*/
|
|
461
|
-
createHttp(url) {
|
|
462
|
-
const http = WebHttp.create(url, (error) => {
|
|
463
|
-
ElMessage.error(error.message);
|
|
464
|
-
});
|
|
465
|
-
http.loading = this.loading;
|
|
466
|
-
return http;
|
|
467
|
-
}
|
|
468
|
-
showSuccess(successMessage) {
|
|
469
|
-
ElMessage.success(successMessage);
|
|
470
|
-
}
|
|
471
|
-
showError(errorMessage) {
|
|
472
|
-
ElMessage.error(errorMessage);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
export {
|
|
476
|
-
AbstractWebService,
|
|
477
|
-
BaseTableController,
|
|
478
|
-
DetailController,
|
|
479
|
-
EditorController,
|
|
480
|
-
Table,
|
|
481
|
-
TableController,
|
|
482
|
-
TableTreeController,
|
|
483
|
-
WebAccessTokenUtil,
|
|
484
|
-
WebHttp,
|
|
485
|
-
WebI18n,
|
|
486
|
-
_sfc_main as WebTable,
|
|
487
|
-
getTableConfig,
|
|
488
|
-
getTableConfigList,
|
|
489
|
-
getTableFieldList
|
|
490
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ClassConstructor, Entity } from '@airpower/core';
|
|
2
|
-
import { ITableFieldConfig } from '../decorator';
|
|
3
|
-
declare const _default: <E extends Entity>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{
|
|
5
|
-
tableId: string;
|
|
6
|
-
}> & Omit<{
|
|
7
|
-
readonly data: E[];
|
|
8
|
-
readonly clazz: ClassConstructor<E>;
|
|
9
|
-
readonly tableId: string;
|
|
10
|
-
readonly columns?: ITableFieldConfig[] | undefined;
|
|
11
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "tableId">, "columns" | "data" | "clazz" | "tableId"> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
12
|
-
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
13
|
-
attrs: any;
|
|
14
|
-
slots: {};
|
|
15
|
-
emit: {};
|
|
16
|
-
}>) => import('vue').VNode & {
|
|
17
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
18
|
-
};
|
|
19
|
-
export default _default;
|
|
20
|
-
type __VLS_PrettifyLocal<T> = {
|
|
21
|
-
[K in keyof T]: T[K];
|
|
22
|
-
} & {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Entity, IJson } from '@airpower/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { AbstractWebService } from '../service';
|
|
4
|
-
import { IDetailControllerOption } from './interface';
|
|
5
|
-
/**
|
|
6
|
-
* # 详情控制器
|
|
7
|
-
*
|
|
8
|
-
* @author Hamm.cn
|
|
9
|
-
*/
|
|
10
|
-
export declare class DetailController<E extends Entity, S extends AbstractWebService<E>, O extends IDetailControllerOption<E> = IDetailControllerOption<E>> {
|
|
11
|
-
isLoading: Ref<boolean, boolean>;
|
|
12
|
-
formData: Ref<E>;
|
|
13
|
-
title: Ref<string, string>;
|
|
14
|
-
protected service: S;
|
|
15
|
-
protected option: O;
|
|
16
|
-
/**
|
|
17
|
-
* ### 创建表格控制器
|
|
18
|
-
* @param ServiceClass 服务类
|
|
19
|
-
* @param props `defineProps` 的返回值
|
|
20
|
-
* @param option `可选` 更多的配置
|
|
21
|
-
*/
|
|
22
|
-
constructor(ServiceClass: new () => S & {
|
|
23
|
-
entityClass: new () => E;
|
|
24
|
-
}, props: IJson, option?: O);
|
|
25
|
-
/**
|
|
26
|
-
* ### 查询详情方法
|
|
27
|
-
*/
|
|
28
|
-
getDetail(): Promise<void>;
|
|
29
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Entity } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { DetailController } from './DetailController';
|
|
4
|
-
/**
|
|
5
|
-
* # 编辑器控制器
|
|
6
|
-
*
|
|
7
|
-
* @author Hamm.cn
|
|
8
|
-
*/
|
|
9
|
-
export declare class EditorController<E extends Entity, S extends AbstractWebService<E>> extends DetailController<E, S> {
|
|
10
|
-
getDetail(): Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Entity, QuerySort, Page, QueryPageRequest, QueryPageResponse } from '@airpower/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { AbstractWebService } from '../../service';
|
|
4
|
-
import { ITableControllerOption } from '../interface';
|
|
5
|
-
/**
|
|
6
|
-
* # 表格控制器基类
|
|
7
|
-
*
|
|
8
|
-
* @author Hamm.cn
|
|
9
|
-
*/
|
|
10
|
-
export declare class BaseTableController<E extends Entity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> {
|
|
11
|
-
request: Ref<QueryPageRequest<E>>;
|
|
12
|
-
response: Ref<QueryPageResponse<E>>;
|
|
13
|
-
list: Ref<E[]>;
|
|
14
|
-
selectList: Ref<E[]>;
|
|
15
|
-
isLoading: Ref<boolean, boolean>;
|
|
16
|
-
protected service: S;
|
|
17
|
-
protected option: O;
|
|
18
|
-
/**
|
|
19
|
-
* ### 创建表格控制器
|
|
20
|
-
* @param ServiceClass 服务类
|
|
21
|
-
*/
|
|
22
|
-
constructor(ServiceClass: new () => S & {
|
|
23
|
-
entityClass: new () => E;
|
|
24
|
-
});
|
|
25
|
-
/**
|
|
26
|
-
* ### 设置配置
|
|
27
|
-
* @param option 更多配置
|
|
28
|
-
*/
|
|
29
|
-
setOption(option: O): this;
|
|
30
|
-
/**
|
|
31
|
-
* ### 查询列表事件
|
|
32
|
-
*/
|
|
33
|
-
getList(): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* ### 搜索
|
|
36
|
-
* @param req 请求对象
|
|
37
|
-
*/
|
|
38
|
-
search(req: QueryPageRequest<E>): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* ### 重新加载数据
|
|
41
|
-
* 会自动返回第一页
|
|
42
|
-
*/
|
|
43
|
-
reload(): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* ### 添加事件
|
|
46
|
-
*/
|
|
47
|
-
add(): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* ### 点击表格行详情事件
|
|
50
|
-
* @param row 行数据
|
|
51
|
-
*/
|
|
52
|
-
detail(row: E): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* ### 排序变更事件
|
|
55
|
-
* @param sort 排序对象
|
|
56
|
-
*/
|
|
57
|
-
sortChanged(sort?: QuerySort): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* ### 选择变更事件
|
|
60
|
-
* @param list 选择列表
|
|
61
|
-
*/
|
|
62
|
-
selectChanged(list: E[]): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* ### 分页变更事件
|
|
65
|
-
* @param page 分页对象
|
|
66
|
-
*/
|
|
67
|
-
pageChanged(page: Page): Promise<void>;
|
|
68
|
-
}
|