@jiangood/springboot-admin-starter 0.0.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/config/config.js +10 -0
- package/config/config.local.js +10 -0
- package/config/defaultConfig.js +35 -0
- package/config/plugins/forms.js +44 -0
- package/config/plugins/routes.js +82 -0
- package/package.json +41 -0
- package/src/.npmignore +6 -0
- package/src/app.js +0 -0
- package/src/asserts/login_bg.jpg +0 -0
- package/src/asserts/welcome.png +0 -0
- package/src/components/InstanceInfo.jsx +138 -0
- package/src/components/InstanceStatusInfo.jsx +79 -0
- package/src/components/StreamLog.jsx +27 -0
- package/src/components/flow/BpmnUtils.js +85 -0
- package/src/components/flow/customTranslate/customTranslate.js +19 -0
- package/src/components/flow/customTranslate/translations.js +79 -0
- package/src/components/flow/design/contextPad.js +50 -0
- package/src/components/flow/design/form/ConditionForm.jsx +316 -0
- package/src/components/flow/design/form/ServiceTaskForm.jsx +55 -0
- package/src/components/flow/design/form/TimerEventDefinitionForm.jsx +62 -0
- package/src/components/flow/design/form/UserTaskForm.jsx +211 -0
- package/src/components/flow/design/palette.js +39 -0
- package/src/components/monitor/AllDefinition.jsx +46 -0
- package/src/components/monitor/AllInstance.jsx +76 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/ButtonList.d.ts +9 -0
- package/src/framework/components/ButtonList.jsx +91 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Echarts/index.d.ts +10 -0
- package/src/framework/components/Echarts/index.jsx +49 -0
- package/src/framework/components/EditTable/index.d.ts +11 -0
- package/src/framework/components/EditTable/index.jsx +85 -0
- package/src/framework/components/EditTable/index.less +29 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/FieldRemoteTree.jsx +20 -0
- package/src/framework/components/Gap/index.d.ts +10 -0
- package/src/framework/components/Gap/index.jsx +15 -0
- package/src/framework/components/Gap/index.less +3 -0
- package/src/framework/components/HasPerm.jsx +18 -0
- package/src/framework/components/ImageView.d.ts +12 -0
- package/src/framework/components/ImageView.jsx +64 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +13 -0
- package/src/framework/components/MsgBox.jsx +180 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/OrgTree.jsx +60 -0
- package/src/framework/components/Page/index.d.ts +10 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.jsx +31 -0
- package/src/framework/components/Panel/index.d.ts +11 -0
- package/src/framework/components/Panel/index.jsx +24 -0
- package/src/framework/components/Panel/index.less +0 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +124 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +38 -0
- package/src/framework/components/ProTable/index.jsx +258 -0
- package/src/framework/components/ProTable/index.less +3 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/RoleTree.jsx +53 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +38 -0
- package/src/framework/components/field/FieldAutoTime/index.tsx +46 -0
- package/src/framework/components/field/FieldBoolean/index.tsx +92 -0
- package/src/framework/components/field/FieldEditTable/index.d.ts +13 -0
- package/src/framework/components/field/FieldEditTable/index.jsx +103 -0
- package/src/framework/components/field/FieldEditTable/index.less +29 -0
- package/src/framework/components/field/FieldEditor.jsx +48 -0
- package/src/framework/components/field/FieldFileBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldFileBase64/index.jsx +23 -0
- package/src/framework/components/field/FieldImageBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldImageBase64/index.jsx +22 -0
- package/src/framework/components/field/FieldInput.jsx +13 -0
- package/src/framework/components/field/FieldOrgTree/index.tsx +45 -0
- package/src/framework/components/field/FieldPassword.jsx +11 -0
- package/src/framework/components/field/FieldProps.ts +19 -0
- package/src/framework/components/field/FieldRemoteTreeCascader.jsx +75 -0
- package/src/framework/components/field/FieldRemoteTreeCheckable.jsx +81 -0
- package/src/framework/components/field/FieldRemoteTreeMultipleSelect.jsx +100 -0
- package/src/framework/components/field/FieldRemoteTreeSelect.jsx +82 -0
- package/src/framework/components/field/FieldSelectPosition/index.tsx +85 -0
- package/src/framework/components/field/FieldTree.jsx +45 -0
- package/src/framework/components/field/dict/index.tsx +110 -0
- package/src/framework/components/field/flat-multiple-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-multiple-select/index.jsx +116 -0
- package/src/framework/components/field/flat-multiple-select/index.less +12 -0
- package/src/framework/components/field/flat-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-select/index.jsx +107 -0
- package/src/framework/components/field/flat-select/index.less +12 -0
- package/src/framework/components/field/index.js +33 -0
- package/src/framework/components/field/input-number-percent/index.d.ts +11 -0
- package/src/framework/components/field/input-number-percent/index.jsx +28 -0
- package/src/framework/components/field/select/FieldSelect/index.d.ts +39 -0
- package/src/framework/components/field/select/FieldSelect/index.jsx +156 -0
- package/src/framework/components/field/select/FieldTableSelect/index.d.ts +29 -0
- package/src/framework/components/field/select/FieldTableSelect/index.jsx +155 -0
- package/src/framework/components/field/select/index.jsx +2 -0
- package/src/framework/components/field/switch-y-n/index.d.ts +11 -0
- package/src/framework/components/field/switch-y-n/index.jsx +31 -0
- package/src/framework/components/field/text/index.tsx +7 -0
- package/src/framework/components/field/time/DatePickerString.tsx +37 -0
- package/src/framework/components/field/time/DateTimePickerString.tsx +42 -0
- package/src/framework/components/field/time/FieldDateRange.d.ts +9 -0
- package/src/framework/components/field/time/FieldDateRange.jsx +49 -0
- package/src/framework/components/field/time/HHmmPickerString.tsx +42 -0
- package/src/framework/components/field/time/MonthPickerString.tsx +45 -0
- package/src/framework/components/field/time/TimePickerTool.ts +14 -0
- package/src/framework/components/field/time/YearPickerString.tsx +41 -0
- package/src/framework/components/field/time/YearQuarterString.tsx +38 -0
- package/src/framework/components/field/time/index.tsx +7 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.d.ts +22 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.jsx +11 -0
- package/src/framework/components/field/upload/FieldUploadFile.d.ts +35 -0
- package/src/framework/components/field/upload/FieldUploadFile.jsx +145 -0
- package/src/framework/components/field/upload/FieldUploadImage.d.ts +7 -0
- package/src/framework/components/field/upload/FieldUploadImage.jsx +16 -0
- package/src/framework/components/field/upload/index.jsx +3 -0
- package/src/framework/components/index.js +25 -0
- package/src/framework/components/system.jsx +29 -0
- package/src/framework/components/view/ViewBoolean.jsx +15 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.jsx +16 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +50 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +61 -0
- package/src/framework/components/view/ViewPassword.jsx +24 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.jsx +9 -0
- package/src/framework/components/view/index.js +12 -0
- package/src/framework/index.js +3 -0
- package/src/framework/system/FormRegistry.js +58 -0
- package/src/framework/system/dict.js +88 -0
- package/src/framework/system/http.jsx +290 -0
- package/src/framework/system/index.js +13 -0
- package/src/framework/system/page.js +109 -0
- package/src/framework/system/permission.js +44 -0
- package/src/framework/system/sys.js +60 -0
- package/src/framework/system/theme.js +17 -0
- package/src/framework/utils/arr.js +118 -0
- package/src/framework/utils/browser.js +24 -0
- package/src/framework/utils/color.js +269 -0
- package/src/framework/utils/date.js +173 -0
- package/src/framework/utils/debounce.js +33 -0
- package/src/framework/utils/dom.js +16 -0
- package/src/framework/utils/eventBus.js +70 -0
- package/src/framework/utils/html.js +13 -0
- package/src/framework/utils/index.js +17 -0
- package/src/framework/utils/obj.js +72 -0
- package/src/framework/utils/storage.js +37 -0
- package/src/framework/utils/str.js +297 -0
- package/src/framework/utils/tree.js +175 -0
- package/src/framework/utils/uid.js +76 -0
- package/src/framework/utils/url.js +84 -0
- package/src/framework/utils/validate.js +9 -0
- package/src/index.js +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +174 -0
- package/src/layouts/admin/index.less +64 -0
- package/src/layouts/index.jsx +163 -0
- package/src/layouts/index.less +45 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/api/accessLog/index.jsx +108 -0
- package/src/pages/api/accountResource/index.jsx +149 -0
- package/src/pages/api/doc.jsx +135 -0
- package/src/pages/api/index.jsx +163 -0
- package/src/pages/api/resource.jsx +18 -0
- package/src/pages/flowable/design/index.css +7 -0
- package/src/pages/flowable/design/index.jsx +297 -0
- package/src/pages/flowable/index.jsx +128 -0
- package/src/pages/flowable/instance/view.jsx +13 -0
- package/src/pages/flowable/monitor.jsx +106 -0
- package/src/pages/flowable/task/form.jsx +99 -0
- package/src/pages/flowable/task/index.jsx +200 -0
- package/src/pages/flowable/test/form.jsx +31 -0
- package/src/pages/flowable/test/index.jsx +54 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/job/index.jsx +239 -0
- package/src/pages/job/logList.jsx +100 -0
- package/src/pages/job/status.jsx +84 -0
- package/src/pages/login.jsx +144 -0
- package/src/pages/login.less +53 -0
- package/src/pages/system/config/index.jsx +136 -0
- package/src/pages/system/dict/Dict.jsx +73 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +152 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +263 -0
- package/src/pages/system/role/index.jsx +314 -0
- package/src/pages/system/role/perm.jsx +111 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +132 -0
- package/src/pages/system/user/index.jsx +261 -0
- package/src/pages/test.jsx +16 -0
- package/src/pages/ureport/index.jsx +43 -0
- package/src/pages/userCenter/ChangePassword.jsx +64 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +63 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工具栏
|
|
3
|
+
*/
|
|
4
|
+
import {HistoryOutlined, ReloadOutlined} from '@ant-design/icons';
|
|
5
|
+
import {Button, Input, message, Modal, Table} from 'antd';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import './index.less';
|
|
8
|
+
import {PageUtil} from "../../../../system";
|
|
9
|
+
import {DateUtil, StorageUtil} from "../../../../utils";
|
|
10
|
+
|
|
11
|
+
export default class Toolbar extends React.Component {
|
|
12
|
+
|
|
13
|
+
state = {
|
|
14
|
+
// 查询历史的模态框
|
|
15
|
+
historyOpen: false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render = () => {
|
|
19
|
+
const {
|
|
20
|
+
onRefresh,
|
|
21
|
+
toolBarRender,
|
|
22
|
+
loading,
|
|
23
|
+
showSearch
|
|
24
|
+
} = this.props;
|
|
25
|
+
|
|
26
|
+
return <div className='pro-table-toolbar'>
|
|
27
|
+
|
|
28
|
+
<div className='pro-table-toolbar-left'>
|
|
29
|
+
{showSearch && <Input.Search placeholder='搜索...'
|
|
30
|
+
allowClear
|
|
31
|
+
onChange={(e) => {
|
|
32
|
+
this.props.onSearch({searchText: e.target.value})
|
|
33
|
+
}}
|
|
34
|
+
/>}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div className='pro-table-toolbar-option'>
|
|
38
|
+
{toolBarRender}
|
|
39
|
+
<Button title='刷新' size='small' icon={<ReloadOutlined/>} onClick={onRefresh} loading={loading}/>
|
|
40
|
+
<Button title='查询历史' size='small' icon={<HistoryOutlined/>} onClick={this.onClickHistory}/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{this.renderHistory()}
|
|
44
|
+
</div>
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
renderHistory() {
|
|
49
|
+
const {params} = this.props
|
|
50
|
+
const list = StorageUtil.get(this.getParamKey()) || []
|
|
51
|
+
|
|
52
|
+
const dataSource = [{params, time: '当前'}, ...list]
|
|
53
|
+
|
|
54
|
+
return <Modal title='查询方案'
|
|
55
|
+
width={800}
|
|
56
|
+
open={this.state.historyOpen}
|
|
57
|
+
onCancel={() => this.setState({historyOpen: false})}
|
|
58
|
+
footer={null}
|
|
59
|
+
destroyOnHidden
|
|
60
|
+
>
|
|
61
|
+
|
|
62
|
+
<Table
|
|
63
|
+
dataSource={dataSource}
|
|
64
|
+
pagination={false}
|
|
65
|
+
rowKey='time'
|
|
66
|
+
columns={[
|
|
67
|
+
{
|
|
68
|
+
dataIndex: 'time', title: '时间'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
dataIndex: 'params', title: '参数',
|
|
72
|
+
render(v) {
|
|
73
|
+
return JSON.stringify(v)
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
dataIndex: 'option', title: '-',
|
|
77
|
+
render: (v, record) => {
|
|
78
|
+
if (record.time === '当前') {
|
|
79
|
+
return <Button onClick={this.onSaveHistory}>保存</Button>
|
|
80
|
+
} else {
|
|
81
|
+
return <Button type='primary' onClick={() => this.onApply(record.params)}>使用</Button>
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]}></Table>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
</Modal>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
onClickHistory = () => {
|
|
92
|
+
|
|
93
|
+
this.setState({historyOpen: true})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getParamKey() {
|
|
97
|
+
return 'query-params-' + PageUtil.currentPathname();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
onSaveHistory = () => {
|
|
101
|
+
const {params} = this.props
|
|
102
|
+
const keys = Object.keys(params)
|
|
103
|
+
if (keys.length === 0) {
|
|
104
|
+
message.error('查询参数为空,无法保存')
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
const list = StorageUtil.get(this.getParamKey()) || []
|
|
108
|
+
let data = {time: DateUtil.now(), params};
|
|
109
|
+
list.unshift(data)
|
|
110
|
+
if (list.length > 5) {
|
|
111
|
+
list.pop()
|
|
112
|
+
}
|
|
113
|
+
StorageUtil.set(this.getParamKey(), list)
|
|
114
|
+
message.success('保存成功')
|
|
115
|
+
this.setState({historyOpen: false})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
onApply = (params) => {
|
|
119
|
+
this.props.changeFormValues(params)
|
|
120
|
+
this.setState({historyOpen: false})
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.pro-table-toolbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
margin-bottom: 8px;
|
|
6
|
+
/*
|
|
7
|
+
border: 1px solid #ddd;
|
|
8
|
+
border-radius: 5px;
|
|
9
|
+
background: #F8F9FA;
|
|
10
|
+
padding: 8px;
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
&-option {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: flex-end;
|
|
17
|
+
gap: 12px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.btn {
|
|
21
|
+
padding: 0;
|
|
22
|
+
background: #f8f8f8;
|
|
23
|
+
border:none;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
user-select: none;
|
|
28
|
+
img {
|
|
29
|
+
width: 20px;
|
|
30
|
+
height: 20px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (max-width: 575px) {
|
|
36
|
+
.pro-table-toolbar {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
height: auto;
|
|
41
|
+
margin-bottom: 16px;
|
|
42
|
+
margin-left: 16px;
|
|
43
|
+
padding: 16px 8px 8px;
|
|
44
|
+
line-height: normal;
|
|
45
|
+
|
|
46
|
+
&-option {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {ColumnsType} from "antd/es/table";
|
|
4
|
+
|
|
5
|
+
declare type ProTableProps = {
|
|
6
|
+
columns: ColumnsType,
|
|
7
|
+
// 请求数据,注意:需处理下载
|
|
8
|
+
request: (params:any)=>{};
|
|
9
|
+
|
|
10
|
+
// 选择行,通ant table
|
|
11
|
+
rowSelection?: any,
|
|
12
|
+
|
|
13
|
+
toolBarRender?: (params:any, {selectedRows:[],selectedRowKeys:[]})=>{},
|
|
14
|
+
bordered?:boolean,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 默认每页数量
|
|
18
|
+
*/
|
|
19
|
+
defaultPageSize?:number,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 查询表单的引用
|
|
23
|
+
*/
|
|
24
|
+
formRef?: React.Ref<any>,
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
showToolbarSearch?:boolean
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 垂直滚动条, true自动计算, 也可指定高度
|
|
33
|
+
*/
|
|
34
|
+
scrollY?: boolean | number
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class ProTable extends React.Component<ProTableProps, any> {
|
|
38
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {Button, Form, Table} from 'antd';
|
|
2
|
+
import Toolbar from './components/ToolBar';
|
|
3
|
+
import React from "react";
|
|
4
|
+
import './index.less'
|
|
5
|
+
import {SearchOutlined} from "@ant-design/icons";
|
|
6
|
+
import {StrUtil} from "../../utils";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class ProTable extends React.Component {
|
|
10
|
+
state = {
|
|
11
|
+
selectedRowKeys: [],
|
|
12
|
+
selectedRows: [],
|
|
13
|
+
|
|
14
|
+
tableSize: 'small',
|
|
15
|
+
|
|
16
|
+
loading: true,
|
|
17
|
+
params: {},
|
|
18
|
+
dataSource: [],
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
total: 0,
|
|
22
|
+
current: 1, // 当前页
|
|
23
|
+
pageSize: 10,
|
|
24
|
+
|
|
25
|
+
sorter: {
|
|
26
|
+
field: undefined, // 字段
|
|
27
|
+
order: undefined, // 排序 ascend, descend
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// 服务端返回的一些额外数据
|
|
31
|
+
extData: {
|
|
32
|
+
// 总结栏
|
|
33
|
+
summary: null,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
scrollY: null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
constructor(props) {
|
|
41
|
+
super(props);
|
|
42
|
+
if (props.defaultPageSize) {
|
|
43
|
+
this.state.pageSize = props.defaultPageSize
|
|
44
|
+
}
|
|
45
|
+
this.id = StrUtil.random(32)
|
|
46
|
+
this.showToolbarSearch = this.props.showToolbarSearch
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
formRef = React.createRef()
|
|
50
|
+
|
|
51
|
+
componentDidMount() {
|
|
52
|
+
this.loadData()
|
|
53
|
+
if (this.props.actionRef) {
|
|
54
|
+
this.props.actionRef.current = {
|
|
55
|
+
reload: () => this.loadData()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let scrollY = this.props.scrollY;
|
|
60
|
+
if (scrollY) {
|
|
61
|
+
this.setState({scrollY: scrollY})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
loadData = () => {
|
|
66
|
+
const {request} = this.props
|
|
67
|
+
const params = {...this.state.params}
|
|
68
|
+
params.size = this.state.pageSize
|
|
69
|
+
params.page = this.state.current
|
|
70
|
+
|
|
71
|
+
const {sorter} = this.state
|
|
72
|
+
|
|
73
|
+
const {field, order} = sorter
|
|
74
|
+
if (field) {
|
|
75
|
+
params.sort = field + "," + (order === 'ascend' ? 'asc' : 'desc')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
this.setState({loading: true})
|
|
80
|
+
request(params).then(rs => {
|
|
81
|
+
const {content, totalElements, extData} = rs;
|
|
82
|
+
|
|
83
|
+
this.setState({dataSource: content, total: parseInt(totalElements)})
|
|
84
|
+
if (extData) {
|
|
85
|
+
this.setState({extData})
|
|
86
|
+
}
|
|
87
|
+
this.updateSelectedRows(content)
|
|
88
|
+
|
|
89
|
+
}).finally(() => {
|
|
90
|
+
this.setState({loading: false})
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 数据重新加载后,更新toolbar需要的已选择数据行
|
|
95
|
+
updateSelectedRows = list => {
|
|
96
|
+
const {rowKey = "id"} = this.props
|
|
97
|
+
const {selectedRows} = this.state
|
|
98
|
+
for (let i = 0; i < selectedRows.length; i++) {
|
|
99
|
+
for (let newItem of list) {
|
|
100
|
+
let oldItem = selectedRows[i];
|
|
101
|
+
if (oldItem[rowKey] === newItem[rowKey]) {
|
|
102
|
+
selectedRows[i] = newItem;
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.setState({selectedRows: [...selectedRows]})
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
render() {
|
|
113
|
+
const {
|
|
114
|
+
actionRef,
|
|
115
|
+
toolBarRender,
|
|
116
|
+
columns,
|
|
117
|
+
rowSelection,
|
|
118
|
+
rowKey = "id",
|
|
119
|
+
toolbarOptions,
|
|
120
|
+
} = this.props
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
return <div className={'tmgg-pro-table '} id={this.id}>
|
|
124
|
+
|
|
125
|
+
{this.renderForm()}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
{toolbarOptions !== false && <Toolbar
|
|
129
|
+
actionRef={actionRef}
|
|
130
|
+
toolBarRender={this.getToolBarRenderNode(toolBarRender)}
|
|
131
|
+
|
|
132
|
+
onRefresh={() => this.loadData()}
|
|
133
|
+
onSearch={this.onSearch}
|
|
134
|
+
loading={this.state.loading}
|
|
135
|
+
params={this.state.params}
|
|
136
|
+
showSearch={this.showToolbarSearch}
|
|
137
|
+
changeFormValues={this.changeFormValues}
|
|
138
|
+
/>}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<Table
|
|
142
|
+
loading={this.state.loading}
|
|
143
|
+
columns={columns}
|
|
144
|
+
dataSource={this.state.dataSource}
|
|
145
|
+
rowKey={rowKey}
|
|
146
|
+
size={this.state.tableSize}
|
|
147
|
+
rowSelection={this.getRowSelectionProps(rowSelection)}
|
|
148
|
+
scroll={{x: 'max-content', y: this.state.scrollY}}
|
|
149
|
+
pagination={{
|
|
150
|
+
showSizeChanger: true,
|
|
151
|
+
total: this.state.total,
|
|
152
|
+
pageSize: this.state.pageSize,
|
|
153
|
+
current: this.state.current,
|
|
154
|
+
pageSizeOptions: [10, 20, 50, 100, 500, 1000, 5000],
|
|
155
|
+
showTotal: (total) => `共 ${total} 条`
|
|
156
|
+
}}
|
|
157
|
+
|
|
158
|
+
onChange={(pagination, filters, sorter, extra) => {
|
|
159
|
+
this.setState({
|
|
160
|
+
current: pagination.current,
|
|
161
|
+
pageSize: pagination.pageSize,
|
|
162
|
+
sorter
|
|
163
|
+
}, this.loadData)
|
|
164
|
+
}}
|
|
165
|
+
|
|
166
|
+
footer={this.state.extData.summary ? () => this.state.extData.summary : null}
|
|
167
|
+
bordered={this.props.bordered}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
renderForm = () => {
|
|
175
|
+
if (!this.props.children) {
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
if (this.props.searchFormItemsRender) {
|
|
179
|
+
throw new Error('不再支持 searchFormItemsRender,请直接放到ProTable的子节点')
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return <div style={{marginBottom: '16px'}}>
|
|
183
|
+
<Form
|
|
184
|
+
layout="inline"
|
|
185
|
+
onFinish={(values) => this.onSearch(values)}
|
|
186
|
+
ref={(instance) => {
|
|
187
|
+
this.formRef.current = instance;
|
|
188
|
+
if (this.props.formRef != null) {
|
|
189
|
+
this.props.formRef.current = instance;
|
|
190
|
+
}
|
|
191
|
+
}}
|
|
192
|
+
style={{gap: '8px 0px'}}
|
|
193
|
+
labelCol={{flex: '70px'}}
|
|
194
|
+
>
|
|
195
|
+
|
|
196
|
+
{this.props.children}
|
|
197
|
+
|
|
198
|
+
<Form.Item style={{marginLeft: this.props.children.length > 2 ? 'auto' : 'inherit'}}>
|
|
199
|
+
<Button type='primary' htmlType="submit" icon={<SearchOutlined/>}> 查询
|
|
200
|
+
</Button>
|
|
201
|
+
</Form.Item>
|
|
202
|
+
</Form>
|
|
203
|
+
</div>;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
getToolBarRenderNode(toolBarRender) {
|
|
207
|
+
if (!toolBarRender) {
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
let {selectedRows, selectedRowKeys, params} = this.state;
|
|
211
|
+
return toolBarRender(params, {
|
|
212
|
+
selectedRows: selectedRows,
|
|
213
|
+
selectedRowKeys: selectedRowKeys,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
getRowSelectionProps = rowSelection => {
|
|
218
|
+
if (rowSelection == null || rowSelection === false) {
|
|
219
|
+
return null
|
|
220
|
+
}
|
|
221
|
+
if (rowSelection === true) {
|
|
222
|
+
rowSelection = {}
|
|
223
|
+
}
|
|
224
|
+
let {type, onChange: inputOnChange} = rowSelection
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
type,
|
|
229
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
230
|
+
this.setState({selectedRowKeys, selectedRows})
|
|
231
|
+
if (inputOnChange) {
|
|
232
|
+
inputOnChange(selectedRowKeys, selectedRows)
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
selectedRowKeys: this.state.selectedRowKeys
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
onSearch = (values) => {
|
|
240
|
+
this.setState({params: values, current: 1}, this.loadData)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
changeFormValues = (values) => {
|
|
244
|
+
if (this.formRef.current) {
|
|
245
|
+
this.formRef.current.resetFields()
|
|
246
|
+
this.formRef.current.setFieldsValue(values)
|
|
247
|
+
this.formRef.current.submit()
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取用户的 action 信息
|
|
3
|
+
*
|
|
4
|
+
* @param actionRef
|
|
5
|
+
* @param counter
|
|
6
|
+
* @param onCleanSelected
|
|
7
|
+
*/
|
|
8
|
+
export function useActionType(
|
|
9
|
+
ref,
|
|
10
|
+
action,
|
|
11
|
+
props,
|
|
12
|
+
) {
|
|
13
|
+
/** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
|
|
14
|
+
const userAction = {
|
|
15
|
+
pageInfo: action.pageInfo,
|
|
16
|
+
reload: async (resetPageIndex) => {
|
|
17
|
+
// 如果为 true,回到第一页
|
|
18
|
+
if (resetPageIndex) {
|
|
19
|
+
await action.setPageInfo({
|
|
20
|
+
current: 1,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
action?.reload();
|
|
24
|
+
},
|
|
25
|
+
reloadAndRest: async () => {
|
|
26
|
+
// reload 之后大概率会切换数据,清空一下选择。
|
|
27
|
+
props.onCleanSelected();
|
|
28
|
+
await action.setPageInfo({
|
|
29
|
+
current: 1,
|
|
30
|
+
});
|
|
31
|
+
await action?.reload();
|
|
32
|
+
},
|
|
33
|
+
reset: async () => {
|
|
34
|
+
await props.resetAll();
|
|
35
|
+
await action?.reset?.();
|
|
36
|
+
await action?.reload();
|
|
37
|
+
},
|
|
38
|
+
clearSelected: () => props.onCleanSelected(),
|
|
39
|
+
setPageInfo: (rest) => action.setPageInfo(rest),
|
|
40
|
+
};
|
|
41
|
+
// eslint-disable-next-line no-param-reassign
|
|
42
|
+
ref.current = userAction;
|
|
43
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {Skeleton, Tree} from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {HttpUtil} from "../system";
|
|
4
|
+
import {SolutionOutlined} from '@ant-design/icons';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export class RoleTree extends React.Component {
|
|
8
|
+
|
|
9
|
+
state = {
|
|
10
|
+
treeDataLoading: true,
|
|
11
|
+
treeData: [],
|
|
12
|
+
|
|
13
|
+
currentOrgId: null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
componentDidMount() {
|
|
18
|
+
HttpUtil.get('admin/sysRole/bizTree').then(tree => {
|
|
19
|
+
this.setState({treeData: tree,treeDataLoading: false})
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onSelect = keys => {
|
|
24
|
+
let orgId = keys[0] || null;
|
|
25
|
+
this.props.onSelect(orgId)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
let {treeData, treeDataLoading} = this.state
|
|
31
|
+
if (treeDataLoading) {
|
|
32
|
+
return <Skeleton title='加载中...'/>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
return <Tree
|
|
37
|
+
treeData={treeData}
|
|
38
|
+
defaultExpandAll
|
|
39
|
+
onSelect={this.onSelect}
|
|
40
|
+
showIcon
|
|
41
|
+
blockNode
|
|
42
|
+
icon={item=>{
|
|
43
|
+
return <SolutionOutlined />
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
</Tree>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {fieldRegistry, viewRegistry} from "./registry";
|
|
3
|
+
import {Input} from "antd";
|
|
4
|
+
import {ViewText} from "../view";
|
|
5
|
+
|
|
6
|
+
function getComponent(registry, type) {
|
|
7
|
+
if (!type) {
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
for (let key in registry) {
|
|
11
|
+
if (key.toLowerCase() === type.toLowerCase()) {
|
|
12
|
+
return registry[key]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function renderField(type, props = {}) {
|
|
18
|
+
const componentClass = getComponent(fieldRegistry, type) || Input
|
|
19
|
+
return React.createElement(componentClass, props)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function renderView(type, props = {}) {
|
|
23
|
+
const componentClass = getComponent(viewRegistry, type) || ViewText
|
|
24
|
+
|
|
25
|
+
return React.createElement(componentClass, props)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ValueType = {
|
|
29
|
+
renderView,
|
|
30
|
+
renderField
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FieldDateTimePickerString,
|
|
3
|
+
FieldDictRadio,
|
|
4
|
+
FieldImageBase64,
|
|
5
|
+
FieldInput,
|
|
6
|
+
FieldPassword,
|
|
7
|
+
FieldRadioBoolean,
|
|
8
|
+
FieldSelect,
|
|
9
|
+
FieldUploadImage
|
|
10
|
+
} from "../field";
|
|
11
|
+
import {ViewBoolean, ViewImage, ViewPassword, ViewText} from "../view";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export const fieldRegistry = {
|
|
15
|
+
'text':FieldInput,
|
|
16
|
+
|
|
17
|
+
'dict':FieldDictRadio,
|
|
18
|
+
'dictRadio':FieldDictRadio,
|
|
19
|
+
'password':FieldPassword,
|
|
20
|
+
'datetime':FieldDateTimePickerString,
|
|
21
|
+
'boolean':FieldRadioBoolean,
|
|
22
|
+
imageBase64:FieldImageBase64,
|
|
23
|
+
image:FieldUploadImage,
|
|
24
|
+
|
|
25
|
+
select: FieldSelect
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const viewRegistry = {
|
|
29
|
+
text: ViewText,
|
|
30
|
+
password: ViewPassword,
|
|
31
|
+
boolean: ViewBoolean,
|
|
32
|
+
imageBase64: ViewImage,
|
|
33
|
+
image:ViewImage
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根据时间类型自动渲染时间选择组件
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {FieldMonthPickerString, FieldYearPickerString, FieldYearQuarterString} from "../time";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type TypeEum = 'YEAR' | 'YEAR_MONTH' | 'YEAR_QUARTER';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
type: TypeEum; // 枚举
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class FieldAutoTime extends React.Component<Props, any> {
|
|
15
|
+
|
|
16
|
+
render() {
|
|
17
|
+
let {type,...props} = this.props;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case 'YEAR':
|
|
20
|
+
return <FieldYearPickerString {...props}/>;
|
|
21
|
+
case 'YEAR_MONTH':
|
|
22
|
+
return <FieldMonthPickerString {...props}/>;
|
|
23
|
+
case 'YEAR_QUARTER':
|
|
24
|
+
return <FieldYearQuarterString {...props}/>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return <div>未知组件 {type}</div>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getDefaultValue(type:TypeEum) {
|
|
31
|
+
let year = dayjs().format("YYYY");
|
|
32
|
+
let month = dayjs().format("YYYY-MM");
|
|
33
|
+
let quarter = dayjs().format("YYYY-QQ");
|
|
34
|
+
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'YEAR':
|
|
37
|
+
return year;
|
|
38
|
+
case 'YEAR_MONTH':
|
|
39
|
+
return month;
|
|
40
|
+
case 'YEAR_QUARTER':
|
|
41
|
+
return quarter;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|