@jiangood/springboot-admin-starter 0.0.3 → 0.0.5
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/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- 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 +5 -0
- package/src/framework/pages/LoginPage.d.ts +11 -0
- package/src/framework/pages/LoginPage.jsx +136 -0
- package/src/{pages/login.less → framework/pages/LoginPage.less} +1 -1
- package/src/framework/pages/index.ts +1 -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 +4 -129
- 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.d.ts +0 -13
- package/src/framework/components/field/FieldEditTable/index.jsx +0 -103
- 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
|
@@ -2,9 +2,8 @@ import React from "react";
|
|
|
2
2
|
import ImgCrop from "antd-img-crop";
|
|
3
3
|
import {Modal, Upload} from "antd";
|
|
4
4
|
import UploadOutlined from "@ant-design/icons/lib/icons/UploadOutlined";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {ObjUtil} from "../../../utils";
|
|
5
|
+
import {ViewFile} from "../components";
|
|
6
|
+
import {ObjectUtils} from "../utils";
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
export class FieldUploadFile extends React.Component {
|
|
@@ -13,7 +12,6 @@ export class FieldUploadFile extends React.Component {
|
|
|
13
12
|
// 传入的参数
|
|
14
13
|
maxCount: 1,
|
|
15
14
|
cropImage: false,
|
|
16
|
-
accept: ".jpg,.png",
|
|
17
15
|
|
|
18
16
|
// 内部参数
|
|
19
17
|
fileList: [],
|
|
@@ -22,7 +20,7 @@ export class FieldUploadFile extends React.Component {
|
|
|
22
20
|
|
|
23
21
|
constructor(props) {
|
|
24
22
|
super(props);
|
|
25
|
-
|
|
23
|
+
ObjectUtils.copyPropertyIfPresent(props, this.state)
|
|
26
24
|
this.state.fileList = this.convertInputToComponentValue(this.state.value);
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -31,7 +29,7 @@ export class FieldUploadFile extends React.Component {
|
|
|
31
29
|
if (value && value.length > 0) {
|
|
32
30
|
const arr = value.split(",")
|
|
33
31
|
for (const id of arr) {
|
|
34
|
-
const url =
|
|
32
|
+
const url = 'admin/sysFile/preview/' + id
|
|
35
33
|
let file = {id, url, uid: id, name: id, status: 'done', fileName: id};
|
|
36
34
|
list.push(file);
|
|
37
35
|
}
|
|
@@ -93,7 +91,6 @@ export class FieldUploadFile extends React.Component {
|
|
|
93
91
|
|
|
94
92
|
|
|
95
93
|
handlePreview = (file) => {
|
|
96
|
-
debugger
|
|
97
94
|
Modal.info({
|
|
98
95
|
title: '文件预览',
|
|
99
96
|
width: '80vw',
|
|
@@ -116,11 +113,10 @@ export class FieldUploadFile extends React.Component {
|
|
|
116
113
|
const {accept, fileList, maxCount} = this.state;
|
|
117
114
|
|
|
118
115
|
return <Upload
|
|
119
|
-
action={
|
|
116
|
+
action={'admin/sysFile/upload'}
|
|
120
117
|
listType={this.props.listType || 'picture-card'}
|
|
121
118
|
fileList={fileList}
|
|
122
119
|
onChange={this.handleChange}
|
|
123
|
-
headers={SysUtil.getHeaders()}
|
|
124
120
|
multiple={false}
|
|
125
121
|
accept={accept}
|
|
126
122
|
maxCount={maxCount}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// 表单组件,主要属性: value onChange
|
|
2
|
+
export * from './FieldRemoteSelect';
|
|
3
|
+
export * from './FieldRemoteSelectMultiple';
|
|
4
|
+
export * from './FieldRemoteSelectMultipleInline';
|
|
5
|
+
export * from './FieldRemoteTree';
|
|
6
|
+
export * from './FieldDictSelect';
|
|
7
|
+
export * from './FieldEditor'
|
|
8
|
+
export * from './FieldRemoteTreeCascader'
|
|
9
|
+
export * from './FieldRemoteTreeSelect'
|
|
10
|
+
export * from './FieldRemoteTreeSelectMultiple'
|
|
11
|
+
export * from './FieldBoolean';
|
|
12
|
+
export * from './FieldDate';
|
|
13
|
+
export * from './FieldDateRange';
|
|
14
|
+
export * from './FieldTable'
|
|
15
|
+
export * from './FieldTableSelect'
|
|
16
|
+
export * from './FieldSysOrgTreeSelect'
|
|
17
|
+
export * from './FieldSysOrgTree'
|
|
18
|
+
export * from './FieldPercent'
|
|
19
|
+
export * from './FieldUploadFile';
|
|
20
|
+
export * from './system';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {Alert, Skeleton, Tree} from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {HttpUtil} from "../system";
|
|
4
3
|
import * as Icons from '@ant-design/icons';
|
|
4
|
+
import {HttpUtils} from "../../utils";
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
export class OrgTree extends React.Component {
|
|
7
|
+
export class OrgTree extends React.Component<any, any> {
|
|
8
8
|
|
|
9
9
|
state = {
|
|
10
10
|
treeDataLoading: true,
|
|
@@ -15,11 +15,12 @@ export class OrgTree extends React.Component {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
componentDidMount() {
|
|
18
|
-
|
|
18
|
+
HttpUtils.get('admin/sysOrg/unitTree').then(tree => {
|
|
19
19
|
this.setState({treeData: tree,treeDataLoading: false})
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
onSelectOrg = orgIds => {
|
|
24
25
|
let orgId = orgIds[0] || null;
|
|
25
26
|
this.props.onChange(orgId)
|
|
@@ -44,10 +45,10 @@ export class OrgTree extends React.Component {
|
|
|
44
45
|
showIcon
|
|
45
46
|
blockNode
|
|
46
47
|
icon={item=>{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const icon = Icons[item.iconName]
|
|
49
|
+
if(icon){
|
|
50
|
+
return React.createElement(icon)
|
|
51
|
+
}
|
|
51
52
|
}}
|
|
52
53
|
>
|
|
53
54
|
</Tree>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {Skeleton, Tree} from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {HttpUtil} from "../system";
|
|
4
3
|
import {SolutionOutlined} from '@ant-design/icons';
|
|
4
|
+
import {HttpUtils} from "../../utils";
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
export class RoleTree extends React.Component {
|
|
7
|
+
export class RoleTree extends React.Component<any, any> {
|
|
8
8
|
|
|
9
9
|
state = {
|
|
10
10
|
treeDataLoading: true,
|
|
@@ -15,7 +15,7 @@ export class RoleTree extends React.Component {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
componentDidMount() {
|
|
18
|
-
|
|
18
|
+
HttpUtils.get('admin/sysRole/bizTree').then(tree => {
|
|
19
19
|
this.setState({treeData: tree,treeDataLoading: false})
|
|
20
20
|
})
|
|
21
21
|
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Button, Form, Input, message, Space} from 'antd';
|
|
3
|
+
import {LockOutlined, SafetyCertificateOutlined, UserOutlined, WarningOutlined} from '@ant-design/icons';
|
|
4
|
+
import "./LoginPage.less"
|
|
5
|
+
import {history} from 'umi';
|
|
6
|
+
import {HttpUtils, MessageUtils, PageUtils, SysUtils} from "../utils";
|
|
7
|
+
import {JSEncrypt} from "jsencrypt";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export class LoginPage extends React.Component {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
state = {
|
|
14
|
+
logging: false,
|
|
15
|
+
|
|
16
|
+
siteInfo: {},
|
|
17
|
+
random: Math.random()
|
|
18
|
+
}
|
|
19
|
+
redirect = '/';
|
|
20
|
+
|
|
21
|
+
async componentDidMount() {
|
|
22
|
+
console.log('渲染登录页面')
|
|
23
|
+
const redirect = PageUtils.currentParams()['redirect']
|
|
24
|
+
if (redirect) {
|
|
25
|
+
console.log('重定向参数', redirect)
|
|
26
|
+
this.redirect = decodeURIComponent(redirect)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (localStorage.length === 0) {
|
|
30
|
+
MessageUtils.alert('站点数据缺失,刷新当前页面...')
|
|
31
|
+
window.location.reload()
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const siteInfo = SysUtils.getSiteInfo()
|
|
36
|
+
this.setState({siteInfo})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
submit = values => {
|
|
41
|
+
this.setState({logging: true})
|
|
42
|
+
|
|
43
|
+
const pubkey = this.state.siteInfo.rsaPublicKey;
|
|
44
|
+
if (!pubkey) {
|
|
45
|
+
message.error("未获取密钥,请刷新浏览器再试")
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
// 对密码加密
|
|
49
|
+
const crypt = new JSEncrypt();
|
|
50
|
+
crypt.setPublicKey(pubkey);
|
|
51
|
+
values.password = crypt.encrypt(values.password)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
HttpUtils.postForm('/admin/auth/login', values).then(rs => {
|
|
55
|
+
console.log('登录结果', rs)
|
|
56
|
+
history.push(this.redirect)
|
|
57
|
+
}).catch(e => {
|
|
58
|
+
console.log('登录错误', e)
|
|
59
|
+
})
|
|
60
|
+
.finally(() => {
|
|
61
|
+
this.setState({logging: false})
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
render() {
|
|
67
|
+
const {siteInfo} = this.state
|
|
68
|
+
|
|
69
|
+
const pageStyle = {}
|
|
70
|
+
if (siteInfo.loginBackground) {
|
|
71
|
+
let url = 'admin/sysFile/preview/' + siteInfo.loginBackground;
|
|
72
|
+
pageStyle.backgroundImage = 'url("' + url + '")'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<section className='login-page' style={pageStyle}>
|
|
77
|
+
<div className="login-content">
|
|
78
|
+
<h1>{siteInfo.title}</h1>
|
|
79
|
+
<Form
|
|
80
|
+
name="normal_login"
|
|
81
|
+
className="login-form"
|
|
82
|
+
initialValues={{remember: true}}
|
|
83
|
+
onFinish={this.submit}
|
|
84
|
+
requiredMark={false}
|
|
85
|
+
colon={false}
|
|
86
|
+
>
|
|
87
|
+
|
|
88
|
+
<Form.Item name="username" rules={[{required: true, message: '请输入用户名!'}]}>
|
|
89
|
+
<Input size='large' prefix={<UserOutlined/>} placeholder="用户名" autoComplete="off"/>
|
|
90
|
+
</Form.Item>
|
|
91
|
+
<Form.Item name="password" rules={[{required: true, message: '请输入密码!'}]}>
|
|
92
|
+
<Input autoComplete="off" prefix={<LockOutlined/>} type="password" placeholder="密码"
|
|
93
|
+
size='large'
|
|
94
|
+
/>
|
|
95
|
+
</Form.Item>
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
{siteInfo.captcha && <Form.Item name='captchaCode' rules={[{required: true}]}>
|
|
99
|
+
<Space style={{alignItems: 'center'}}>
|
|
100
|
+
<Input size='large' placeholder='验证码' prefix={<SafetyCertificateOutlined/>}/>
|
|
101
|
+
<img height={36}
|
|
102
|
+
width={100}
|
|
103
|
+
src={"/admin/auth/captchaImage?_random=" + this.state.random}
|
|
104
|
+
onClick={() => {
|
|
105
|
+
this.setState({random: Math.random()})
|
|
106
|
+
}}></img>
|
|
107
|
+
</Space>
|
|
108
|
+
</Form.Item>}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
<Form.Item style={{marginTop: 10}}>
|
|
112
|
+
<Button loading={this.state.logging} type="primary" htmlType="submit"
|
|
113
|
+
block size='large'>
|
|
114
|
+
登录
|
|
115
|
+
</Button>
|
|
116
|
+
</Form.Item>
|
|
117
|
+
</Form>
|
|
118
|
+
|
|
119
|
+
{this.renderFormBottom()}
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
</section>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
renderFormBottom() {
|
|
128
|
+
let siteInfo = this.state.siteInfo;
|
|
129
|
+
if (siteInfo.loginBoxBottomTip) {
|
|
130
|
+
return <div style={{color: 'white', marginTop: 50, fontSize: '14px', textAlign: 'center'}}>
|
|
131
|
+
<WarningOutlined/> {siteInfo.loginBoxBottomTip}
|
|
132
|
+
</div>
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoginPage'
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数组工具类
|
|
3
|
+
* 提供了一系列对数组进行操作的静态方法。
|
|
4
|
+
*/
|
|
5
|
+
export class ArrUtils {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 检查数组是否包含某个元素。
|
|
9
|
+
* @param arr 目标数组。
|
|
10
|
+
* @param item 要检查的元素。
|
|
11
|
+
* @returns 如果包含则返回 true,否则返回 false。
|
|
12
|
+
*/
|
|
13
|
+
static contains<T>(arr: T[], item: T): boolean {
|
|
14
|
+
return arr.indexOf(item) !== -1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 检查数组是否包含至少一个指定的元素。
|
|
19
|
+
* 注意:原始实现中的 this.contains(item) 逻辑错误,已修正为检查 arr 是否包含 item。
|
|
20
|
+
*
|
|
21
|
+
* @param arr 目标数组。
|
|
22
|
+
* @param items 要检查的一个或多个元素。
|
|
23
|
+
* @returns 如果包含任意一个元素则返回 true,否则返回 false。
|
|
24
|
+
*/
|
|
25
|
+
static containsAny<T>(arr: T[], ...items: T[]): boolean {
|
|
26
|
+
for (const item of items) {
|
|
27
|
+
// 这里调用自身的静态方法
|
|
28
|
+
if (ArrUtils.contains(arr, item)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 在数组末尾添加一个元素。
|
|
37
|
+
* @param arr 目标数组。
|
|
38
|
+
* @param item 要添加的元素。
|
|
39
|
+
*/
|
|
40
|
+
static add<T>(arr: T[], item: T): void {
|
|
41
|
+
arr.push(item);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 在数组的指定索引处添加一个元素。
|
|
46
|
+
* @param arr 目标数组。
|
|
47
|
+
* @param index 插入位置的索引。
|
|
48
|
+
* @param item 要添加的元素。
|
|
49
|
+
*/
|
|
50
|
+
static addAt<T>(arr: T[], index: number, item: T): void {
|
|
51
|
+
arr.splice(index, 0, item);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 将另一个数组的所有元素追加到目标数组的尾部。
|
|
56
|
+
* @param arr 目标数组。
|
|
57
|
+
* @param items 要追加的元素数组。
|
|
58
|
+
*/
|
|
59
|
+
static addAll<T>(arr: T[], items: T[]): void {
|
|
60
|
+
// 使用 ES6 的 spread 运算符或 push.apply 效率更高
|
|
61
|
+
arr.push(...items);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 移除数组指定索引处的元素。
|
|
66
|
+
* @param arr 目标数组。
|
|
67
|
+
* @param index 要移除元素的索引。
|
|
68
|
+
*/
|
|
69
|
+
static removeAt<T>(arr: T[], index: number): void {
|
|
70
|
+
if (index >= 0 && index < arr.length) {
|
|
71
|
+
arr.splice(index, 1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 移除数组中第一个匹配的元素。
|
|
77
|
+
* @param arr 目标数组。
|
|
78
|
+
* @param item 要移除的元素。
|
|
79
|
+
*/
|
|
80
|
+
static remove<T>(arr: T[], item: T): void {
|
|
81
|
+
const index = arr.indexOf(item);
|
|
82
|
+
if (index !== -1) {
|
|
83
|
+
// 这里调用自身的静态方法
|
|
84
|
+
ArrUtils.removeAt(arr, index);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 清空数组。
|
|
90
|
+
* @param arr 目标数组。
|
|
91
|
+
*/
|
|
92
|
+
static clear<T>(arr: T[]): void {
|
|
93
|
+
arr.length = 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 截取数组的一个子集。
|
|
98
|
+
* @param arr 目标数组。
|
|
99
|
+
* @param fromIndex 开始索引(包含)。
|
|
100
|
+
* @param toIndex 结束索引(不包含)。
|
|
101
|
+
* @returns 截取后的新数组。
|
|
102
|
+
*/
|
|
103
|
+
static sub<T>(arr: T[], fromIndex?: number, toIndex?: number): T[] {
|
|
104
|
+
return arr.slice(fromIndex, toIndex);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 交换数组中两个元素的位置。
|
|
109
|
+
* @param arr 目标数组。
|
|
110
|
+
* @param item1 元素1。
|
|
111
|
+
* @param item2 元素2。
|
|
112
|
+
*/
|
|
113
|
+
static swap<T>(arr: T[], item1: T, item2: T): void {
|
|
114
|
+
const index1 = arr.indexOf(item1);
|
|
115
|
+
const index2 = arr.indexOf(item2);
|
|
116
|
+
|
|
117
|
+
if (index1 !== -1 && index2 !== -1) {
|
|
118
|
+
// 使用解构赋值进行交换,更简洁
|
|
119
|
+
[arr[index1], arr[index2]] = [arr[index2], arr[index1]];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 在数组的指定索引处插入一个元素(与 addAt 相同,保留以兼容原 API)。
|
|
125
|
+
* @param arr 目标数组。
|
|
126
|
+
* @param index 插入位置的索引。
|
|
127
|
+
* @param item 要插入的元素。
|
|
128
|
+
*/
|
|
129
|
+
static insert<T>(arr: T[], index: number, item: T): void {
|
|
130
|
+
ArrUtils.addAt(arr, index, item);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 如果元素不存在于数组中,则将其添加到数组末尾。
|
|
135
|
+
* @param arr 目标数组。
|
|
136
|
+
* @param item 要添加的元素。
|
|
137
|
+
*/
|
|
138
|
+
static pushIfNotExist<T>(arr: T[], item: T): void {
|
|
139
|
+
if (!ArrUtils.contains(arr, item)) {
|
|
140
|
+
arr.push(item);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 将新数组中的所有元素添加到目标数组的末尾。
|
|
146
|
+
* @param arr 目标数组。
|
|
147
|
+
* @param newArr 要添加的元素数组。
|
|
148
|
+
*/
|
|
149
|
+
static pushAll<T>(arr: T[], newArr: T[]): void {
|
|
150
|
+
ArrUtils.addAll(arr, newArr);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 获取对象数组中某一属性值最大的对象。
|
|
155
|
+
* 使用泛型 K 约束 key 必须是 T 的属性,并确保属性值可以进行数值比较。
|
|
156
|
+
*
|
|
157
|
+
* @param arr 对象数组。
|
|
158
|
+
* @param key 用于比较的属性名。
|
|
159
|
+
* @returns 属性值最大的对象,如果数组为空则返回 undefined。
|
|
160
|
+
*/
|
|
161
|
+
static maxBy<T extends Record<K, any>, K extends keyof T>(
|
|
162
|
+
arr: T[],
|
|
163
|
+
key: K
|
|
164
|
+
): T | undefined {
|
|
165
|
+
if (arr == null || arr.length === 0) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let maxElement: T | undefined = undefined;
|
|
170
|
+
let maxValue: number = -Infinity;
|
|
171
|
+
|
|
172
|
+
for (const element of arr) {
|
|
173
|
+
// 运行时类型检查(虽然 TS 层面已约束 K,但值可能不是数字)
|
|
174
|
+
const value = element[key];
|
|
175
|
+
|
|
176
|
+
// 确保比较的是数字类型
|
|
177
|
+
if (typeof value === 'number' && value > maxValue) {
|
|
178
|
+
maxValue = value;
|
|
179
|
+
maxElement = element;
|
|
180
|
+
} else if (typeof value !== 'number') {
|
|
181
|
+
// 可选:如果遇到非数字,可以跳过或根据需求抛出错误/记录警告
|
|
182
|
+
// console.warn(`Element with key ${String(key)} has non-numeric value: ${value}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return maxElement;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 对数组进行去重。
|
|
191
|
+
* @param arr 目标数组。
|
|
192
|
+
* @returns 去重后的新数组。
|
|
193
|
+
*/
|
|
194
|
+
static unique<T>(arr: T[]): T[] {
|
|
195
|
+
return [...new Set(arr)];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 示例用法(可选)
|
|
200
|
+
/*
|
|
201
|
+
interface User {
|
|
202
|
+
id: number;
|
|
203
|
+
score: number;
|
|
204
|
+
name: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const users: User[] = [
|
|
208
|
+
{ id: 1, score: 90, name: 'Alice' },
|
|
209
|
+
{ id: 2, score: 95, name: 'Bob' },
|
|
210
|
+
{ id: 3, score: 88, name: 'Charlie' },
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
const maxUser = ArrUtil.maxBy(users, 'score');
|
|
214
|
+
console.log(maxUser); // { id: 2, score: 95, name: 'Bob' }
|
|
215
|
+
|
|
216
|
+
const numbers = [1, 2, 2, 3, 4, 1];
|
|
217
|
+
const uniqueNumbers = ArrUtil.unique(numbers);
|
|
218
|
+
console.log(uniqueNumbers); // [1, 2, 3, 4]
|
|
219
|
+
|
|
220
|
+
let list = [10, 20];
|
|
221
|
+
ArrUtil.register(list, 30);
|
|
222
|
+
console.log(list); // [10, 20, 30]
|
|
223
|
+
|
|
224
|
+
ArrUtil.remove(list, 20);
|
|
225
|
+
console.log(list); // [10, 30]
|
|
226
|
+
|
|
227
|
+
ArrUtil.addAll(list, [40, 50]);
|
|
228
|
+
console.log(list); // [10, 30, 40, 50]
|
|
229
|
+
*/
|