@jiangood/admin-spring-boot-starter 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/dist/config.js +45 -0
- package/config/dist/index.js +19 -0
- package/config/dist/plugins/form-plugin.js +51 -0
- package/config/dist/plugins/route-plugin.js +72 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +9 -0
- 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.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 +49 -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 +60 -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.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- 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 +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -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/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -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/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +15 -0
- package/src/framework/pages/LoginPage.jsx +132 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +35 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/MessageUtils.tsx +145 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +412 -0
- package/src/framework/utils/TreeUtils.ts +251 -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 +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -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/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +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 +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +153 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/flowable/design/contextPad.js +50 -0
- 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.css +7 -0
- package/src/pages/flowable/design/index.jsx +171 -0
- 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 +87 -0
- 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 +98 -0
- package/src/pages/flowable/task/form.jsx +186 -0
- package/src/pages/flowable/task/index.jsx +184 -0
- package/src/pages/flowable/task/instance/view.jsx +85 -0
- package/src/pages/flowable/test/index.jsx +57 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- 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 +136 -0
- package/src/pages/system/dict/Dict.jsx +72 -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 +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +22 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,123 @@
|
|
|
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 {DateUtils, PageUtils, StorageUtils} from "../../../../utils";
|
|
9
|
+
|
|
10
|
+
export default class Toolbar extends React.Component {
|
|
11
|
+
|
|
12
|
+
state = {
|
|
13
|
+
// 查询历史的模态框
|
|
14
|
+
historyOpen: false
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render = () => {
|
|
18
|
+
const {
|
|
19
|
+
onRefresh,
|
|
20
|
+
toolBarRender,
|
|
21
|
+
loading,
|
|
22
|
+
showSearch
|
|
23
|
+
} = this.props;
|
|
24
|
+
|
|
25
|
+
return <div className='pro-table-toolbar'>
|
|
26
|
+
|
|
27
|
+
<div className='pro-table-toolbar-left'>
|
|
28
|
+
{showSearch && <Input.Search placeholder='搜索...'
|
|
29
|
+
allowClear
|
|
30
|
+
onChange={(e) => {
|
|
31
|
+
this.props.onSearch({searchText: e.target.value})
|
|
32
|
+
}}
|
|
33
|
+
/>}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div className='pro-table-toolbar-option'>
|
|
37
|
+
{toolBarRender}
|
|
38
|
+
<Button title='刷新' size='small' icon={<ReloadOutlined/>} onClick={onRefresh} loading={loading}/>
|
|
39
|
+
<Button title='查询历史' size='small' icon={<HistoryOutlined/>} onClick={this.onClickHistory}/>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{this.renderHistory()}
|
|
43
|
+
</div>
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
renderHistory() {
|
|
48
|
+
const {params} = this.props
|
|
49
|
+
const list = StorageUtils.get(this.getParamKey()) || []
|
|
50
|
+
|
|
51
|
+
const dataSource = [{params, time: '当前'}, ...list]
|
|
52
|
+
|
|
53
|
+
return <Modal title='查询方案'
|
|
54
|
+
width={800}
|
|
55
|
+
open={this.state.historyOpen}
|
|
56
|
+
onCancel={() => this.setState({historyOpen: false})}
|
|
57
|
+
footer={null}
|
|
58
|
+
destroyOnHidden
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
<Table
|
|
62
|
+
dataSource={dataSource}
|
|
63
|
+
pagination={false}
|
|
64
|
+
rowKey='time'
|
|
65
|
+
columns={[
|
|
66
|
+
{
|
|
67
|
+
dataIndex: 'time', title: '时间'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
dataIndex: 'params', title: '参数',
|
|
71
|
+
render(v) {
|
|
72
|
+
return JSON.stringify(v)
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
dataIndex: 'option', title: '-',
|
|
76
|
+
render: (v, record) => {
|
|
77
|
+
if (record.time === '当前') {
|
|
78
|
+
return <Button onClick={this.onSaveHistory}>保存</Button>
|
|
79
|
+
} else {
|
|
80
|
+
return <Button type='primary' onClick={() => this.onApply(record.params)}>使用</Button>
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]}></Table>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</Modal>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onClickHistory = () => {
|
|
91
|
+
|
|
92
|
+
this.setState({historyOpen: true})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getParamKey() {
|
|
96
|
+
return 'query-params-' + PageUtils.currentPathname();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onSaveHistory = () => {
|
|
100
|
+
const {params} = this.props
|
|
101
|
+
const keys = Object.keys(params)
|
|
102
|
+
if (keys.length === 0) {
|
|
103
|
+
message.error('查询参数为空,无法保存')
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
const list = StorageUtils.get(this.getParamKey()) || []
|
|
107
|
+
let data = {time: DateUtils.now(), params};
|
|
108
|
+
list.unshift(data)
|
|
109
|
+
if (list.length > 5) {
|
|
110
|
+
list.pop()
|
|
111
|
+
}
|
|
112
|
+
StorageUtils.set(this.getParamKey(), list)
|
|
113
|
+
message.success('保存成功')
|
|
114
|
+
this.setState({historyOpen: false})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onApply = (params) => {
|
|
118
|
+
this.props.changeFormValues(params)
|
|
119
|
+
this.setState({historyOpen: false})
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
@@ -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,42 @@
|
|
|
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
|
+
* 请求函数
|
|
9
|
+
*/
|
|
10
|
+
request: (params:any)=>{};
|
|
11
|
+
|
|
12
|
+
rowKey?: string,
|
|
13
|
+
|
|
14
|
+
// 选择行,通ant table
|
|
15
|
+
rowSelection?: any,
|
|
16
|
+
|
|
17
|
+
toolBarRender?: (params:any, {selectedRows:[],selectedRowKeys:[]})=>{},
|
|
18
|
+
bordered?:boolean,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 默认每页数量
|
|
22
|
+
*/
|
|
23
|
+
defaultPageSize?:number,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 查询表单的引用
|
|
27
|
+
*/
|
|
28
|
+
formRef?: React.Ref<any>,
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
showToolbarSearch?:boolean
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 垂直滚动条, true自动计算, 也可指定高度
|
|
37
|
+
*/
|
|
38
|
+
scrollY?: boolean | number
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export class ProTable extends React.Component<ProTableProps, any> {
|
|
42
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
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 {StringUtils} from "../../utils";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class ProTable extends React.Component {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
state = {
|
|
13
|
+
selectedRowKeys: [],
|
|
14
|
+
selectedRows: [],
|
|
15
|
+
|
|
16
|
+
tableSize: 'small',
|
|
17
|
+
|
|
18
|
+
loading: true,
|
|
19
|
+
params: {},
|
|
20
|
+
dataSource: [],
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
total: 0,
|
|
24
|
+
current: 1, // 当前页
|
|
25
|
+
pageSize: 10,
|
|
26
|
+
|
|
27
|
+
sorter: {
|
|
28
|
+
field: undefined, // 字段
|
|
29
|
+
order: undefined, // 排序 ascend, descend
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
// 服务端返回的一些额外数据
|
|
33
|
+
extData: {
|
|
34
|
+
// 总结栏
|
|
35
|
+
summary: null,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
scrollY: null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
constructor(props) {
|
|
43
|
+
super(props);
|
|
44
|
+
if (props.defaultPageSize) {
|
|
45
|
+
this.state.pageSize = props.defaultPageSize
|
|
46
|
+
}
|
|
47
|
+
this.id = StringUtils.random(32)
|
|
48
|
+
this.showToolbarSearch = this.props.showToolbarSearch
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
formRef = React.createRef()
|
|
52
|
+
|
|
53
|
+
componentDidMount() {
|
|
54
|
+
this.loadData()
|
|
55
|
+
if (this.props.actionRef) {
|
|
56
|
+
this.props.actionRef.current = {
|
|
57
|
+
reload: () => this.loadData()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let scrollY = this.props.scrollY;
|
|
62
|
+
if (scrollY) {
|
|
63
|
+
this.setState({scrollY: scrollY})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
loadData = () => {
|
|
68
|
+
const {request} = this.props
|
|
69
|
+
const params = {...this.state.params}
|
|
70
|
+
params.size = this.state.pageSize
|
|
71
|
+
params.page = this.state.current
|
|
72
|
+
|
|
73
|
+
const {sorter} = this.state
|
|
74
|
+
|
|
75
|
+
const {field, order} = sorter
|
|
76
|
+
if (field) {
|
|
77
|
+
params.sort = field + "," + (order === 'ascend' ? 'asc' : 'desc')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
this.setState({loading: true})
|
|
82
|
+
request(params).then(rs => {
|
|
83
|
+
const {content, totalElements, extData} = rs;
|
|
84
|
+
|
|
85
|
+
this.setState({dataSource: content, total: parseInt(totalElements)})
|
|
86
|
+
if (extData) {
|
|
87
|
+
this.setState({extData})
|
|
88
|
+
}
|
|
89
|
+
this.updateSelectedRows(content)
|
|
90
|
+
|
|
91
|
+
}).finally(() => {
|
|
92
|
+
this.setState({loading: false})
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// 数据重新加载后,更新toolbar需要的已选择数据行
|
|
98
|
+
updateSelectedRows = list => {
|
|
99
|
+
const {rowKey = "id"} = this.props
|
|
100
|
+
const {selectedRows} = this.state
|
|
101
|
+
for (let i = 0; i < selectedRows.length; i++) {
|
|
102
|
+
for (let newItem of list) {
|
|
103
|
+
let oldItem = selectedRows[i];
|
|
104
|
+
if (oldItem[rowKey] === newItem[rowKey]) {
|
|
105
|
+
selectedRows[i] = newItem;
|
|
106
|
+
break
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.setState({selectedRows: [...selectedRows]})
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
render() {
|
|
116
|
+
const {
|
|
117
|
+
actionRef,
|
|
118
|
+
toolBarRender,
|
|
119
|
+
columns,
|
|
120
|
+
rowSelection,
|
|
121
|
+
rowKey = "id",
|
|
122
|
+
toolbarOptions,
|
|
123
|
+
} = this.props
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
return <div className={'tmgg-pro-table '} id={this.id}>
|
|
127
|
+
{this.renderForm()}
|
|
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: '80px'}}
|
|
194
|
+
wrapperCol={{flex: '200px'}}
|
|
195
|
+
className='search-form'
|
|
196
|
+
>
|
|
197
|
+
|
|
198
|
+
{this.props.children}
|
|
199
|
+
<div style={{marginLeft: '16px'}}>
|
|
200
|
+
<Button type='primary' htmlType="submit" icon={<SearchOutlined/>}> 查询
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
</Form>
|
|
205
|
+
</div>;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
getToolBarRenderNode(toolBarRender) {
|
|
209
|
+
if (!toolBarRender) {
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
let {selectedRows, selectedRowKeys, params} = this.state;
|
|
213
|
+
return toolBarRender(params, {
|
|
214
|
+
selectedRows: selectedRows,
|
|
215
|
+
selectedRowKeys: selectedRowKeys,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
getRowSelectionProps = rowSelection => {
|
|
220
|
+
if (rowSelection == null || rowSelection === false) {
|
|
221
|
+
return null
|
|
222
|
+
}
|
|
223
|
+
if (rowSelection === true) {
|
|
224
|
+
rowSelection = {}
|
|
225
|
+
}
|
|
226
|
+
let {type, onChange: inputOnChange} = rowSelection
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
type,
|
|
231
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
232
|
+
this.setState({selectedRowKeys, selectedRows})
|
|
233
|
+
if (inputOnChange) {
|
|
234
|
+
inputOnChange(selectedRowKeys, selectedRows)
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
selectedRowKeys: this.state.selectedRowKeys
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
onSearch = (values) => {
|
|
242
|
+
this.setState({params: values, current: 1}, this.loadData)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
changeFormValues = (values) => {
|
|
246
|
+
if (this.formRef.current) {
|
|
247
|
+
this.formRef.current.resetFields()
|
|
248
|
+
this.formRef.current.setFieldsValue(values)
|
|
249
|
+
this.formRef.current.submit()
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
@@ -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,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,27 @@
|
|
|
1
|
+
|
|
2
|
+
import {ViewImage, ViewText} from "../view";
|
|
3
|
+
import {ViewPassword,ViewBoolean} from "../../view-components";
|
|
4
|
+
import {FieldDictSelect, FieldRemoteSelect} from "../../field-components";
|
|
5
|
+
import {Input} from "antd";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const fieldRegistry = {
|
|
9
|
+
'text':Input,
|
|
10
|
+
|
|
11
|
+
'dict':FieldDictSelect,
|
|
12
|
+
'password':Input.Password,
|
|
13
|
+
|
|
14
|
+
select: FieldRemoteSelect
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const viewRegistry = {
|
|
18
|
+
text: ViewText,
|
|
19
|
+
password: ViewPassword,
|
|
20
|
+
boolean: ViewBoolean,
|
|
21
|
+
imageBase64: ViewImage,
|
|
22
|
+
image:ViewImage
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './ProModal'
|
|
2
|
+
export * from './Ellipsis'
|
|
3
|
+
|
|
4
|
+
export * from './system'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export * from './PageLoading'
|
|
8
|
+
|
|
9
|
+
export * from './ProTable'
|
|
10
|
+
export * from './DownloadFileButton'
|
|
11
|
+
|
|
12
|
+
export * from './NamedIcon'
|
|
13
|
+
export * from './view'
|
|
14
|
+
export * from './LinkButton'
|
|
15
|
+
export * from './Gap'
|
|
16
|
+
export * from './Page'
|
|
17
|
+
export * from './ValueType'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Space} from 'antd';
|
|
3
|
+
import {PermUtils} from "../../utils";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 带权限的按钮列表
|
|
8
|
+
* @param maxNum: 显示子节点的个数, 超过的为收缩起来
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export class ButtonList extends React.Component {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
let {children} = this.props;
|
|
16
|
+
const menus = [];
|
|
17
|
+
|
|
18
|
+
// 判断是否数组
|
|
19
|
+
if (Array.isArray(children)) {
|
|
20
|
+
for (let child of children) {
|
|
21
|
+
if (child === null || child === undefined) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (child.props == null || child.props.perm == null || PermUtils.hasPermission(child.props.perm)) {
|
|
25
|
+
menus.push(child);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
menus.push(children)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return <Space>{menus}</Space>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
import {PermUtils} from "../../utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 使用该组件,可以判断权限
|
|
6
|
+
*/
|
|
7
|
+
export function HasPerm(props: { code: string, children: ReactNode }) {
|
|
8
|
+
let {code} = props;
|
|
9
|
+
|
|
10
|
+
if (PermUtils.hasPermission(code)) {
|
|
11
|
+
return props.children;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|