@jiangood/springboot-admin-starter 0.0.2 → 0.0.4
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/config/dist/config.js +32 -0
- package/config/dist/index.js +0 -1
- package/config/dist/plugins/form-plugin.js +2 -2
- package/package.json +12 -10
- package/src/forms/demoForm.jsx +5 -5
- package/src/framework/components/DownloadFileButton.jsx +2 -2
- package/src/framework/components/Ellipsis.jsx +2 -2
- package/src/framework/components/LinkButton.d.ts +4 -4
- package/src/framework/components/LinkButton.jsx +6 -9
- package/src/framework/components/Page/index.jsx +2 -2
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +6 -7
- package/src/framework/components/ProTable/index.d.ts +5 -1
- package/src/framework/components/ProTable/index.jsx +4 -6
- package/src/framework/components/ProTable/index.less +0 -1
- package/src/framework/components/ValueType/registry.jsx +9 -20
- package/src/framework/components/{index.js → index.ts} +2 -10
- package/src/framework/components/system/ButtonList.jsx +35 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
- package/src/framework/components/view/ViewEllipsis.jsx +2 -2
- package/src/framework/components/view/ViewFile.jsx +1 -2
- package/src/framework/components/view/ViewImage.jsx +2 -3
- package/src/framework/components/view/ViewText.tsx +16 -0
- package/src/framework/components/view/{index.js → index.ts} +0 -2
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +25 -0
- package/src/framework/field-components/FieldDate.jsx +109 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +101 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +68 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/{components/field/FieldEditTable/index.d.ts → field-components/FieldTable.d.ts} +5 -2
- package/src/framework/{components/field/FieldEditTable/index.jsx → field-components/FieldTable.jsx} +29 -21
- package/src/framework/{components/field/select/FieldTableSelect/index.d.ts → field-components/FieldTableSelect.d.ts} +4 -14
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/{components/field/upload → field-components}/FieldUploadFile.d.ts +0 -1
- package/src/framework/{components/field/upload → field-components}/FieldUploadFile.jsx +5 -9
- package/src/framework/field-components/index.ts +20 -0
- package/src/framework/{components/OrgTree.jsx → field-components/system/OrgTree.tsx} +8 -7
- package/src/framework/{components/RoleTree.jsx → field-components/system/RoleTree.tsx} +3 -3
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +4 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/{date.js → DateUtils.ts} +69 -69
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +143 -0
- package/src/framework/utils/MessageUtils.tsx +182 -0
- package/src/framework/utils/ObjectUtils.ts +113 -0
- package/src/framework/utils/StorageUtils.ts +67 -0
- package/src/framework/utils/StringUtils.ts +410 -0
- package/src/framework/utils/TreeUtils.ts +248 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +246 -0
- package/src/framework/utils/system/PageUtils.ts +153 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewBoolean.jsx +4 -0
- package/src/framework/view-components/index.js +3 -0
- package/src/layouts/PageRender.jsx +2 -2
- package/src/layouts/admin/HeaderRight.jsx +9 -9
- package/src/layouts/admin/TabPageRender.jsx +2 -2
- package/src/layouts/admin/index.jsx +27 -40
- package/src/layouts/admin/index.less +2 -1
- package/src/layouts/index.jsx +30 -38
- package/src/layouts/index.less +0 -21
- package/src/loading.jsx +2 -2
- package/src/{components → pages/flowable}/InstanceInfo.jsx +5 -4
- package/src/pages/flowable/design/customTranslate/customTranslate.js +16 -0
- package/src/pages/flowable/design/customTranslate/translations-properties-panel.js +10 -0
- package/src/pages/flowable/design/customTranslate/translations.js +144 -0
- package/src/pages/flowable/design/descriptors/flowable.json +1109 -0
- package/src/pages/flowable/design/index.jsx +61 -234
- package/src/pages/flowable/design/provider/FlowablePropertiesProvider.js +75 -0
- package/src/pages/flowable/design/provider/index.js +6 -0
- package/src/pages/flowable/design/provider/properties/ConditionDesign.jsx +175 -0
- package/src/pages/flowable/design/provider/properties/ConditionProps.jsx +76 -0
- package/src/pages/flowable/design/provider/properties/DelegateExpressionProps.js +54 -0
- package/src/pages/flowable/design/provider/properties/FormProps.js +55 -0
- package/src/pages/flowable/design/provider/properties/MultiInstanceProps.js +100 -0
- package/src/pages/flowable/design/provider/properties/UserTaskForm.jsx +48 -0
- package/src/pages/flowable/design/provider/properties/utils.jsx +35 -0
- package/src/pages/flowable/index.jsx +28 -69
- package/src/pages/flowable/monitor/definition.jsx +87 -0
- package/src/pages/flowable/monitor/instance/index.jsx +177 -0
- package/src/pages/flowable/monitor/instance/view.jsx +102 -0
- package/src/pages/flowable/monitor/task.jsx +93 -0
- package/src/pages/flowable/task/form.jsx +5 -5
- package/src/pages/flowable/task/index.jsx +5 -5
- package/src/pages/flowable/test/index.jsx +13 -10
- package/src/pages/index.jsx +8 -13
- package/src/pages/login.jsx +8 -8
- package/src/pages/{api/doc.jsx → system/api/ApiDoc.jsx} +56 -47
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/config/index.jsx +3 -3
- package/src/pages/system/dict/Dict.jsx +2 -3
- package/src/pages/system/dict/DictItem.jsx +5 -5
- package/src/pages/system/file/index.jsx +13 -5
- package/src/pages/{job → system/job}/index.jsx +124 -39
- package/src/pages/system/log/index.jsx +3 -3
- package/src/pages/system/org/index.jsx +11 -12
- package/src/pages/system/role/index.jsx +11 -11
- package/src/pages/system/role/perm.jsx +8 -8
- package/src/pages/system/sysManual/index.jsx +6 -6
- package/src/pages/system/user/UserPerm.jsx +7 -42
- package/src/pages/system/user/index.jsx +13 -17
- package/src/pages/test.jsx +188 -3
- package/src/pages/ureport/index.jsx +4 -4
- package/src/pages/userCenter/ChangePassword.jsx +3 -4
- package/src/pages/userCenter/index.jsx +2 -2
- package/src/pages/userCenter/manual.jsx +3 -7
- package/src/pages/userCenter/message.jsx +5 -5
- package/config/dist/config.local.js +0 -23
- package/src/components/InstanceStatusInfo.jsx +0 -79
- package/src/components/StreamLog.jsx +0 -27
- package/src/components/flow/BpmnUtils.js +0 -85
- package/src/components/flow/customTranslate/customTranslate.js +0 -19
- package/src/components/flow/customTranslate/translations.js +0 -79
- package/src/components/flow/design/form/ConditionForm.jsx +0 -316
- package/src/components/flow/design/form/ServiceTaskForm.jsx +0 -55
- package/src/components/flow/design/form/TimerEventDefinitionForm.jsx +0 -62
- package/src/components/flow/design/form/UserTaskForm.jsx +0 -211
- package/src/components/flow/design/palette.js +0 -39
- package/src/components/monitor/AllDefinition.jsx +0 -46
- package/src/components/monitor/AllInstance.jsx +0 -76
- package/src/forms/driverForm.jsx +0 -18
- package/src/framework/components/ButtonList.jsx +0 -91
- package/src/framework/components/Echarts/index.d.ts +0 -10
- package/src/framework/components/Echarts/index.jsx +0 -49
- package/src/framework/components/EditTable/index.d.ts +0 -11
- package/src/framework/components/EditTable/index.jsx +0 -85
- package/src/framework/components/FieldRemoteTree.jsx +0 -20
- package/src/framework/components/HasPerm.jsx +0 -18
- package/src/framework/components/ImageView.d.ts +0 -12
- package/src/framework/components/ImageView.jsx +0 -64
- package/src/framework/components/MsgBox.jsx +0 -180
- package/src/framework/components/PageLoading.jsx +0 -31
- package/src/framework/components/Panel/index.d.ts +0 -11
- package/src/framework/components/Panel/index.jsx +0 -24
- package/src/framework/components/Panel/index.less +0 -0
- package/src/framework/components/field/FieldAutoTime/index.tsx +0 -46
- package/src/framework/components/field/FieldBoolean/index.tsx +0 -92
- package/src/framework/components/field/FieldEditTable/index.less +0 -29
- package/src/framework/components/field/FieldEditor.jsx +0 -48
- package/src/framework/components/field/FieldFileBase64/index.d.ts +0 -15
- package/src/framework/components/field/FieldFileBase64/index.jsx +0 -23
- package/src/framework/components/field/FieldImageBase64/index.d.ts +0 -15
- package/src/framework/components/field/FieldImageBase64/index.jsx +0 -22
- package/src/framework/components/field/FieldInput.jsx +0 -13
- package/src/framework/components/field/FieldOrgTree/index.tsx +0 -45
- package/src/framework/components/field/FieldPassword.jsx +0 -11
- package/src/framework/components/field/FieldProps.ts +0 -19
- package/src/framework/components/field/FieldRemoteTreeCascader.jsx +0 -75
- package/src/framework/components/field/FieldRemoteTreeCheckable.jsx +0 -81
- package/src/framework/components/field/FieldRemoteTreeMultipleSelect.jsx +0 -100
- package/src/framework/components/field/FieldRemoteTreeSelect.jsx +0 -82
- package/src/framework/components/field/FieldSelectPosition/index.tsx +0 -85
- package/src/framework/components/field/FieldTree.jsx +0 -45
- package/src/framework/components/field/dict/index.tsx +0 -110
- package/src/framework/components/field/flat-multiple-select/index.d.ts +0 -4
- package/src/framework/components/field/flat-multiple-select/index.jsx +0 -116
- package/src/framework/components/field/flat-multiple-select/index.less +0 -12
- package/src/framework/components/field/flat-select/index.d.ts +0 -4
- package/src/framework/components/field/flat-select/index.jsx +0 -107
- package/src/framework/components/field/flat-select/index.less +0 -12
- package/src/framework/components/field/index.js +0 -33
- package/src/framework/components/field/input-number-percent/index.d.ts +0 -11
- package/src/framework/components/field/input-number-percent/index.jsx +0 -28
- package/src/framework/components/field/select/FieldSelect/index.d.ts +0 -39
- package/src/framework/components/field/select/FieldSelect/index.jsx +0 -156
- package/src/framework/components/field/select/FieldTableSelect/index.jsx +0 -155
- package/src/framework/components/field/select/index.jsx +0 -2
- package/src/framework/components/field/switch-y-n/index.d.ts +0 -11
- package/src/framework/components/field/switch-y-n/index.jsx +0 -31
- package/src/framework/components/field/text/index.tsx +0 -7
- package/src/framework/components/field/time/DatePickerString.tsx +0 -37
- package/src/framework/components/field/time/DateTimePickerString.tsx +0 -42
- package/src/framework/components/field/time/FieldDateRange.d.ts +0 -9
- package/src/framework/components/field/time/FieldDateRange.jsx +0 -49
- package/src/framework/components/field/time/HHmmPickerString.tsx +0 -42
- package/src/framework/components/field/time/MonthPickerString.tsx +0 -45
- package/src/framework/components/field/time/TimePickerTool.ts +0 -14
- package/src/framework/components/field/time/YearPickerString.tsx +0 -41
- package/src/framework/components/field/time/YearQuarterString.tsx +0 -38
- package/src/framework/components/field/time/index.tsx +0 -7
- package/src/framework/components/field/upload/FieldUploadCropImage/index.d.ts +0 -22
- package/src/framework/components/field/upload/FieldUploadCropImage/index.jsx +0 -11
- package/src/framework/components/field/upload/FieldUploadImage.d.ts +0 -7
- package/src/framework/components/field/upload/FieldUploadImage.jsx +0 -16
- package/src/framework/components/field/upload/index.jsx +0 -3
- package/src/framework/components/system.jsx +0 -29
- package/src/framework/components/view/ViewBoolean.jsx +0 -15
- package/src/framework/components/view/ViewBooleanEnableDisable.jsx +0 -16
- package/src/framework/components/view/ViewText.jsx +0 -9
- package/src/framework/index.js +0 -3
- package/src/framework/system/dict.js +0 -88
- package/src/framework/system/formRegistry.js +0 -58
- package/src/framework/system/http.jsx +0 -290
- package/src/framework/system/index.js +0 -13
- package/src/framework/system/page.js +0 -109
- package/src/framework/system/permission.js +0 -44
- package/src/framework/system/sys.js +0 -60
- package/src/framework/system/theme.js +0 -17
- package/src/framework/utils/arr.js +0 -118
- package/src/framework/utils/browser.js +0 -24
- package/src/framework/utils/color.js +0 -269
- package/src/framework/utils/debounce.js +0 -33
- package/src/framework/utils/dom.js +0 -16
- package/src/framework/utils/eventBus.js +0 -70
- package/src/framework/utils/html.js +0 -13
- package/src/framework/utils/index.js +0 -17
- package/src/framework/utils/obj.js +0 -72
- package/src/framework/utils/storage.js +0 -37
- package/src/framework/utils/str.js +0 -297
- package/src/framework/utils/tree.js +0 -175
- package/src/framework/utils/uid.js +0 -76
- package/src/framework/utils/url.js +0 -84
- package/src/framework/utils/validate.js +0 -9
- package/src/pages/api/accessLog/index.jsx +0 -108
- package/src/pages/api/accountResource/index.jsx +0 -149
- package/src/pages/api/index.jsx +0 -163
- package/src/pages/api/resource.jsx +0 -18
- package/src/pages/flowable/instance/view.jsx +0 -13
- package/src/pages/flowable/monitor.jsx +0 -106
- package/src/pages/flowable/test/form.jsx +0 -31
- package/src/pages/job/logList.jsx +0 -100
- package/src/pages/job/status.jsx +0 -84
- /package/src/framework/components/{ButtonList.d.ts → system/ButtonList.d.ts} +0 -0
- /package/src/framework/{components/EditTable/index.less → field-components/FieldTable.less} +0 -0
- /package/src/framework/{components/view → view-components}/ViewPassword.jsx +0 -0
- /package/src/{index.js → index.ts} +0 -0
- /package/src/{components/flow → pages/flowable}/design/contextPad.js +0 -0
package/src/framework/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/***
|
|
2
|
-
*
|
|
3
|
-
* @param code
|
|
4
|
-
*/
|
|
5
|
-
import {Tag} from 'antd';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import {SysUtil} from "./sys";
|
|
8
|
-
import {StrUtil} from "../utils";
|
|
9
|
-
|
|
10
|
-
// 根据字典类型code返回字典数据列表, code 支持 驼峰或下划线(都转为下划线比较)
|
|
11
|
-
export function dictList(code) {
|
|
12
|
-
const dictTypeTree = SysUtil.getDictInfo()
|
|
13
|
-
if (dictTypeTree === undefined) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let filtered = dictTypeTree.filter((item) => {
|
|
18
|
-
return item.code === code || StrUtil.toUnderlineCase(item.code) === StrUtil.toUnderlineCase(code);
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
if (filtered.length === 0) {
|
|
23
|
-
console.log('字典' + code + '不存在,请刷新或在后台添加字典');
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
const tree = filtered[0].children;
|
|
27
|
-
if (tree === undefined) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
return tree;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function dictMap(typeCode) {
|
|
34
|
-
const list = dictList(typeCode);
|
|
35
|
-
|
|
36
|
-
if (list == null) {
|
|
37
|
-
console.log('未找到数据字典, code=' + typeCode);
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
const map = {};
|
|
41
|
-
list.forEach((i) => {
|
|
42
|
-
const code = i.code;
|
|
43
|
-
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
map[code] = i;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return map;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function dictValue(typeCode, code) {
|
|
52
|
-
const item = dictData(typeCode, code);
|
|
53
|
-
if (item) {
|
|
54
|
-
return item.name;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function dictValueTag(typeCode, dataCode) {
|
|
59
|
-
if (dataCode == null) {
|
|
60
|
-
return '';
|
|
61
|
-
}
|
|
62
|
-
const data = dictData(typeCode, dataCode);
|
|
63
|
-
if (data != null) {
|
|
64
|
-
const {name, color} = data;
|
|
65
|
-
|
|
66
|
-
if (color == null) {
|
|
67
|
-
return name;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// js 方式创建 ,等同于 <Tag color={color}>{name}</Tag>
|
|
71
|
-
return React.createElement(Tag, {color: color}, name);
|
|
72
|
-
}
|
|
73
|
-
return '';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function dictData(typeCode, code) {
|
|
77
|
-
if (code == null) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
const map = dictMap(typeCode);
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
let item = map[code];
|
|
83
|
-
if (item == null) {
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
item = map[code + ''];
|
|
86
|
-
}
|
|
87
|
-
return item;
|
|
88
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
class ReactFormRegistry {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.forms = new Map(); // 存储 React 表单组件,key: 表单标识(如 'leave'),value: React 组件
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 注册 React 表单组件
|
|
8
|
-
* @param {string} formKey - 表单唯一标识(如 'leave'、'expense')
|
|
9
|
-
* @param {React.Component} formComponent - React 表单组件
|
|
10
|
-
*/
|
|
11
|
-
register(formKey, formComponent) {
|
|
12
|
-
if (!formKey || !formComponent) {
|
|
13
|
-
throw new Error("表单 Key 和组件不能为空!");
|
|
14
|
-
}
|
|
15
|
-
if (this.forms.has(formKey)) {
|
|
16
|
-
console.warn(`⚠️ 表单 "${formKey}" 已存在,将被覆盖!`);
|
|
17
|
-
}
|
|
18
|
-
this.forms.set(formKey, formComponent);
|
|
19
|
-
console.log(`✅ React 表单 "${formKey}" 注册成功`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 获取 React 表单组件
|
|
24
|
-
* @param {string} formKey - 表单唯一标识
|
|
25
|
-
* @returns {React.Component|null} React 表单组件,如果不存在则返回 null
|
|
26
|
-
*/
|
|
27
|
-
get(formKey) {
|
|
28
|
-
const formComponent = this.forms.get(formKey);
|
|
29
|
-
if (!formComponent) {
|
|
30
|
-
console.warn(`⚠️ React 表单 "${formKey}" 未注册!`);
|
|
31
|
-
}
|
|
32
|
-
return formComponent || null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 检查表单是否已注册
|
|
37
|
-
* @param {string} formKey
|
|
38
|
-
* @returns {boolean}
|
|
39
|
-
*/
|
|
40
|
-
has(formKey) {
|
|
41
|
-
return this.forms.has(formKey);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 获取所有已注册的表单 Key
|
|
46
|
-
* @returns {string[]}
|
|
47
|
-
*/
|
|
48
|
-
getAllKeys() {
|
|
49
|
-
return Array.from(this.forms.keys());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// 创建全局单例(推荐)
|
|
54
|
-
const formRegistry = new ReactFormRegistry();
|
|
55
|
-
|
|
56
|
-
// 导出单例(项目里直接 import { reactFormRegistry } 使用)
|
|
57
|
-
export { formRegistry };
|
|
58
|
-
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import {message as messageUtil, Modal} from "antd";
|
|
3
|
-
import {SysUtil} from "./sys";
|
|
4
|
-
import qs from 'qs'
|
|
5
|
-
import {MsgBox} from "../components";
|
|
6
|
-
import {PageUtil} from "./page";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const HttpUtil = {
|
|
10
|
-
|
|
11
|
-
create() {
|
|
12
|
-
return new Util();
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
get(url, params = null) {
|
|
17
|
-
const util = new Util();
|
|
18
|
-
util.enableShowMessage()
|
|
19
|
-
util.enableTransformData()
|
|
20
|
-
return util.get(url, params)
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
post(url, data = null, params = null) {
|
|
24
|
-
const util = new Util();
|
|
25
|
-
util.enableShowMessage()
|
|
26
|
-
util.enableTransformData()
|
|
27
|
-
|
|
28
|
-
return util.post(url, data, params)
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
postForm(url, data) {
|
|
33
|
-
console.warn('不推荐调用本方法,设计urlEncode等,对于特殊字符可能会有问题')
|
|
34
|
-
const util = new Util();
|
|
35
|
-
util.enableShowMessage()
|
|
36
|
-
util.enableTransformData()
|
|
37
|
-
|
|
38
|
-
let config = {
|
|
39
|
-
url,
|
|
40
|
-
method: 'POST',
|
|
41
|
-
data,
|
|
42
|
-
headers: {
|
|
43
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return util.request(config)
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 分页请求, 为antd的ProTable
|
|
52
|
-
*/
|
|
53
|
-
pageData(url, params) {
|
|
54
|
-
const { _exportType, ...data} = params || {};
|
|
55
|
-
|
|
56
|
-
if (_exportType) {
|
|
57
|
-
return this.downloadFileGet(url, data, {'X-Export-Type': _exportType})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return this.get(url, data)
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* 下载
|
|
64
|
-
* @deprecated
|
|
65
|
-
*/
|
|
66
|
-
downloadFile(url, params, method = 'GET') {
|
|
67
|
-
const util = new Util();
|
|
68
|
-
util.enableShowMessage()
|
|
69
|
-
|
|
70
|
-
const get = method === 'GET';
|
|
71
|
-
if (get) {
|
|
72
|
-
return this.downloadFileGet(url, params)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return this.downloadFilePost(url, params)
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
downloadFilePost(url, data, params, headers) {
|
|
79
|
-
const util = new Util();
|
|
80
|
-
util.enableShowMessage()
|
|
81
|
-
return util.downloadFile(url, data, params, 'POST', headers)
|
|
82
|
-
},
|
|
83
|
-
downloadFileGet(url, params,headers) {
|
|
84
|
-
const util = new Util();
|
|
85
|
-
util.enableShowMessage()
|
|
86
|
-
return util.downloadFile(url, null, params, 'GET',headers)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
class Util {
|
|
91
|
-
_showLoading = false
|
|
92
|
-
|
|
93
|
-
// 请求成功结果,返回data那一层(忽略 success,code )
|
|
94
|
-
_transformData = false
|
|
95
|
-
|
|
96
|
-
// 自动显示成功消息(message)、失败消息(modal)
|
|
97
|
-
_showMessage = false
|
|
98
|
-
|
|
99
|
-
request = config => {
|
|
100
|
-
const defaultConfig = {
|
|
101
|
-
withCredentials: true, // 带cookie
|
|
102
|
-
baseURL: SysUtil.getServerUrl(),
|
|
103
|
-
headers: {
|
|
104
|
-
'Content-Type': 'application/json'
|
|
105
|
-
},
|
|
106
|
-
paramsSerializer: params => {
|
|
107
|
-
return qs.stringify(params, { indices: false })
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
let finalConfig = Object.assign({}, defaultConfig, config);
|
|
113
|
-
|
|
114
|
-
const {...axiosConfig} = finalConfig
|
|
115
|
-
|
|
116
|
-
if (axiosConfig.url.startsWith("//")) {
|
|
117
|
-
axiosConfig.url = axiosConfig.url.substring(1)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return new Promise((resolve, reject) => {
|
|
122
|
-
let hideLoading = null
|
|
123
|
-
if (this._showLoading) {
|
|
124
|
-
hideLoading = messageUtil.loading('处理中...', 0)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
axios(axiosConfig).then(response => {
|
|
128
|
-
const body = response.data;
|
|
129
|
-
const {success, message, data, code} = body;
|
|
130
|
-
|
|
131
|
-
if (this._showMessage && success != null && message) { // 有可能是下载
|
|
132
|
-
if (success) {
|
|
133
|
-
messageUtil.success(message)
|
|
134
|
-
} else {
|
|
135
|
-
messageUtil.error(message)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (!this._transformData) {
|
|
140
|
-
resolve(response);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (success == null) { // 返回结果没有success标志,则原样
|
|
146
|
-
resolve(body);
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (success) {
|
|
151
|
-
resolve(data)
|
|
152
|
-
} else {
|
|
153
|
-
reject(message)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}).catch(e => {
|
|
158
|
-
if (!this._showMessage) {
|
|
159
|
-
reject(e)
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
let title = "请求异常";
|
|
163
|
-
let msg = '操作失败';
|
|
164
|
-
|
|
165
|
-
if(e.status === 401){
|
|
166
|
-
MsgBox.confirm('登录已过期,请重新登录').then(rs=>{
|
|
167
|
-
PageUtil.redirectToLogin()
|
|
168
|
-
})
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if(e.status === 504){
|
|
173
|
-
msg = '504 请求后端服务失败'
|
|
174
|
-
}else {
|
|
175
|
-
if (e.response && e.response.data) {
|
|
176
|
-
const rs = e.response.data
|
|
177
|
-
msg = rs.message
|
|
178
|
-
}
|
|
179
|
-
if (msg == null && e.message) {
|
|
180
|
-
msg = e.message
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
messageUtil.error(msg)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
reject(e)
|
|
188
|
-
}).finally(() => {
|
|
189
|
-
if (hideLoading) {
|
|
190
|
-
hideLoading()
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
get(url, params = null) {
|
|
200
|
-
let config = {
|
|
201
|
-
url,
|
|
202
|
-
method: 'GET',
|
|
203
|
-
params,
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
return this.request(config)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
post(url, data, params = null) {
|
|
210
|
-
let config = {
|
|
211
|
-
url,
|
|
212
|
-
method: 'POST',
|
|
213
|
-
params,
|
|
214
|
-
data,
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
return this.request(config)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
downloadFile(url, data, params, method = 'GET', headers = {}) {
|
|
221
|
-
let config = {
|
|
222
|
-
url,
|
|
223
|
-
params,
|
|
224
|
-
method,
|
|
225
|
-
responseType: 'blob',
|
|
226
|
-
data,
|
|
227
|
-
headers
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return this.request(config).then(res => {
|
|
232
|
-
const {data: blob, headers} = res
|
|
233
|
-
if (blob.type === 'application/json') {// 可能是错误了,否则不应该返回json
|
|
234
|
-
const reader = new FileReader();
|
|
235
|
-
reader.readAsText(blob, 'utf-8');
|
|
236
|
-
reader.onload = function (e) {
|
|
237
|
-
let rs = JSON.parse(reader.result);
|
|
238
|
-
Modal.error({
|
|
239
|
-
title: '下载文件失败',
|
|
240
|
-
content: rs.message || '不支持下载'
|
|
241
|
-
})
|
|
242
|
-
}
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// 获取文件名称
|
|
247
|
-
const contentDisposition = headers.get('content-disposition');
|
|
248
|
-
if (contentDisposition == null) {
|
|
249
|
-
Modal.error({
|
|
250
|
-
title: '获取文件名称失败',
|
|
251
|
-
content: "缺少content-disposition响应头"
|
|
252
|
-
})
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
let regExp = new RegExp('filename=(.*)');
|
|
258
|
-
const result = regExp.exec(contentDisposition);
|
|
259
|
-
let filename = result[1];
|
|
260
|
-
|
|
261
|
-
filename = decodeURIComponent(filename);
|
|
262
|
-
filename = filename.replaceAll('"', '');
|
|
263
|
-
filename = filename.replace(/^["](.*)["]$/g, '$1')
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const url = window.URL.createObjectURL(new Blob([blob]));
|
|
267
|
-
const link = document.createElement('a');
|
|
268
|
-
link.style.display = 'none';
|
|
269
|
-
|
|
270
|
-
link.href = url;
|
|
271
|
-
link.download = decodeURI(filename); // 下载后文件名
|
|
272
|
-
|
|
273
|
-
document.body.appendChild(link);
|
|
274
|
-
link.click();
|
|
275
|
-
|
|
276
|
-
document.body.removeChild(link); // 下载完成移除元素
|
|
277
|
-
window.URL.revokeObjectURL(url);
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
enableShowMessage() {
|
|
282
|
-
this._showMessage = true
|
|
283
|
-
return this
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
enableTransformData() {
|
|
287
|
-
this._transformData = true
|
|
288
|
-
return this
|
|
289
|
-
}
|
|
290
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {history} from "umi";
|
|
2
|
-
import {StrUtil, UrlUtil} from "../utils";
|
|
3
|
-
|
|
4
|
-
export class PageUtil {
|
|
5
|
-
|
|
6
|
-
static redirectToLogin(){
|
|
7
|
-
let url = PageUtil.currentUrl();
|
|
8
|
-
url =encodeURIComponent(url)
|
|
9
|
-
history.push('/login?redirect='+ url)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
* @returns {{}}
|
|
15
|
-
*/
|
|
16
|
-
static currentLocationQuery() {
|
|
17
|
-
return this.currentParams()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static currentParams(){
|
|
21
|
-
let url = window.location.href
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let hasQuery = url.indexOf('?') > 0
|
|
25
|
-
if (!hasQuery) {
|
|
26
|
-
return {}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const search = url.substring(url.indexOf('?') + 1);
|
|
30
|
-
const kvs = search.split('&')
|
|
31
|
-
|
|
32
|
-
const rs = {}
|
|
33
|
-
for (let kv of kvs) {
|
|
34
|
-
const kvArr = kv.split('=')
|
|
35
|
-
const k = kvArr[0];
|
|
36
|
-
let v = kvArr[1];
|
|
37
|
-
if(v){
|
|
38
|
-
v = decodeURI(v)
|
|
39
|
-
}
|
|
40
|
-
rs[k] = v;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return rs
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//"http://localhost:8000/#/login?id=1"
|
|
47
|
-
// 返回不带参的路径
|
|
48
|
-
static currentPathname() {
|
|
49
|
-
let path = window.location.hash.substring(1);
|
|
50
|
-
return StrUtil.subBefore(path, '?')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated
|
|
55
|
-
* @returns {{}}
|
|
56
|
-
*/
|
|
57
|
-
static currentPath() {
|
|
58
|
-
let path = window.location.hash.substring(1);
|
|
59
|
-
return path
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* hash后的路径
|
|
64
|
-
* @returns {string}
|
|
65
|
-
*/
|
|
66
|
-
static currentUrl() {
|
|
67
|
-
let path = window.location.hash.substring(1);
|
|
68
|
-
return path
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 当前路由的最后一个斜杠后面的单词, 通常用于基于路径的路由
|
|
73
|
-
* @returns {string|null}
|
|
74
|
-
*/
|
|
75
|
-
static currentPathnameLastPart() {
|
|
76
|
-
const path = this.currentPathname()
|
|
77
|
-
return StrUtil.subAfterLast(path, '/')
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
static open(path,label) {
|
|
81
|
-
if(label) {
|
|
82
|
-
path = UrlUtil.setParam(path,'_label', label)
|
|
83
|
-
}
|
|
84
|
-
history.push(path)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* 打开一个不带菜单,header的页面
|
|
89
|
-
* @param path
|
|
90
|
-
*/
|
|
91
|
-
static openNoLayout(path) {
|
|
92
|
-
path = UrlUtil.setParam(path,'_noLayout', true)
|
|
93
|
-
|
|
94
|
-
history.push(path)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
static currentLabel(){
|
|
99
|
-
return this.currentParams()['_label']
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
static closeCurrent(){
|
|
103
|
-
const event = new CustomEvent('close-page-event', {
|
|
104
|
-
detail: { url: PageUtil.currentUrl() }
|
|
105
|
-
});
|
|
106
|
-
document.dispatchEvent(event)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 控制按钮是否显示
|
|
3
|
-
*/
|
|
4
|
-
import {SysUtil} from "./sys";
|
|
5
|
-
import {ArrUtil} from "../utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const PermUtil = {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 是否拥有权限
|
|
12
|
-
* @param perm 权限码
|
|
13
|
-
*/
|
|
14
|
-
hasPermission(perm) {
|
|
15
|
-
if (perm === null || perm === '') {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const info = SysUtil.getLoginInfo();
|
|
20
|
-
const { permissions } = info;
|
|
21
|
-
if(permissions == null || permissions.length === 0){
|
|
22
|
-
return false
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (ArrUtil.contains(permissions,"*")) {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return permissions.indexOf(perm) > -1;
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 是否授权, 同 hasPermission
|
|
34
|
-
* @param p
|
|
35
|
-
* @returns {boolean}
|
|
36
|
-
*/
|
|
37
|
-
isPermitted(p){
|
|
38
|
-
return PermUtil.hasPermission(p)
|
|
39
|
-
},
|
|
40
|
-
notPermitted(p){
|
|
41
|
-
!PermUtil.isPermitted(p)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {StorageUtil, UrlUtil} from "../utils";
|
|
2
|
-
|
|
3
|
-
const SITE_INFO_KEY = "siteInfo"
|
|
4
|
-
const LOGIN_INFO_KEY = "loginInfo"
|
|
5
|
-
const DICT_INFO_KEY = "dictInfo"
|
|
6
|
-
export const SysUtil = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 服务器端的地址, 以 /结尾
|
|
12
|
-
* @returns {string}
|
|
13
|
-
*/
|
|
14
|
-
getServerUrl() {
|
|
15
|
-
return "/"
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 将服务url加载最前
|
|
20
|
-
* @param url
|
|
21
|
-
* @returns {*}
|
|
22
|
-
*/
|
|
23
|
-
wrapServerUrl(url) {
|
|
24
|
-
const serverUrl = SysUtil.getServerUrl()
|
|
25
|
-
return UrlUtil.join(serverUrl, url)
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
getHeaders() {
|
|
30
|
-
const headers = {}
|
|
31
|
-
return headers;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
setSiteInfo(data) {
|
|
35
|
-
return StorageUtil.set(SITE_INFO_KEY, data)
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
getSiteInfo() {
|
|
39
|
-
return StorageUtil.get(SITE_INFO_KEY) || {}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
setLoginInfo(data) {
|
|
43
|
-
return StorageUtil.set(LOGIN_INFO_KEY, data)
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
getLoginInfo() {
|
|
47
|
-
return StorageUtil.get(LOGIN_INFO_KEY) || {}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
setDictInfo(data) {
|
|
52
|
-
return StorageUtil.set(DICT_INFO_KEY, data)
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
getDictInfo() {
|
|
56
|
-
return StorageUtil.get(DICT_INFO_KEY)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const theme = {
|
|
2
|
-
"primary-color": "#1961AC",
|
|
3
|
-
"success-color": "#52c41a",
|
|
4
|
-
"warning-color": "#faad14",
|
|
5
|
-
"error-color": "#ff4d4f",
|
|
6
|
-
"background-color":"#f5f5f5",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"primary-color-hover":"#4990CD",
|
|
10
|
-
"primary-color-click":"#124B93"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|