cfel-base-components 2.5.12 → 2.5.13
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/.vscode/settings.json +3 -0
- package/demo/src/index.html +4 -3
- package/package.json +1 -1
- package/src/.umi/core/helmet.ts +10 -0
- package/src/.umi/core/helmetContext.ts +4 -0
- package/src/components/layout/index.tsx +14 -4
- package/src/components/layout/user-card/index.scss +31 -8
- package/src/components/layout/user-card/index.tsx +79 -91
- package/src/components/universal-pages/cpcAccount/AddModal/index.tsx +263 -124
- package/src/components/universal-pages/cpcAccount/ResetModal/index.tsx +232 -0
- package/src/components/universal-pages/cpcAccount/api.ts +31 -15
- package/src/components/universal-pages/cpcAccount/index.tsx +132 -97
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +3 -1
- package/src/components/universal-pages/cpcRole/AddModal/index.tsx +1 -1
- package/src/components/universal-pages/cpcRole/index.tsx +101 -99
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +16 -29
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
|
|
2
3
|
import PageContainer from '../../base-component/PageContainer';
|
|
3
4
|
import QueryFilter from '../../base-component/QueryFilter';
|
|
4
5
|
import ProTable from '../../base-component/ProTable';
|
|
5
6
|
import Pagination from '../../base-component/Pagination';
|
|
6
|
-
import { ProFormText, } from '@ant-design/pro-components';
|
|
7
|
-
import { Space, Button, message,Modal } from 'antd';
|
|
8
|
-
import { get } from 'lodash';
|
|
9
|
-
import { timeFormatter } from '../../../utils';
|
|
10
7
|
import useTableHooks from "../../../hooks/useTableHooks"
|
|
8
|
+
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
9
|
+
|
|
10
|
+
import { ProFormText } from '@ant-design/pro-components'
|
|
11
|
+
import { Space, Button, message, Modal } from 'antd'
|
|
12
|
+
import { get } from 'lodash'
|
|
13
|
+
|
|
14
|
+
import { FormOutlined } from '@ant-design/icons'
|
|
11
15
|
import {
|
|
12
|
-
accountPage,
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
accountPage,
|
|
17
|
+
accountCreateAccount,
|
|
18
|
+
accountUpdateAccount,
|
|
19
|
+
accountDeleteAccount,
|
|
20
|
+
accountGetAccount,
|
|
21
|
+
accountGetAccountPassword,
|
|
22
|
+
accountResetPw
|
|
23
|
+
} from './api'
|
|
15
24
|
import AddModal from './AddModal'
|
|
16
|
-
import
|
|
25
|
+
import ResetModal from './ResetModal'
|
|
26
|
+
|
|
27
|
+
import './index.scss'
|
|
17
28
|
|
|
18
29
|
export interface AccountProps {
|
|
19
|
-
historyAction: any
|
|
30
|
+
historyAction: any
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
export default function Account({
|
|
23
|
-
historyAction
|
|
24
|
-
}: AccountProps) {
|
|
33
|
+
export default function Account({ historyAction }: AccountProps) {
|
|
25
34
|
const searchFormRef: any = useRef()
|
|
26
35
|
|
|
27
36
|
const [ModalOpen, setModalOpen] = useState(false)
|
|
28
|
-
const [
|
|
37
|
+
const [id, setId] = useState(null)
|
|
38
|
+
const [editingData, setEditingData]: any = useState(null) //编辑数据
|
|
39
|
+
|
|
40
|
+
const [resetModalOpen, setResetModalOpen] = useState(false)
|
|
41
|
+
const [resetEditingData, setResetEditingData]: any = useState(null) //编辑数据
|
|
29
42
|
|
|
30
43
|
useEffect(() => {
|
|
31
44
|
execute()
|
|
@@ -38,41 +51,29 @@ export default function Account({
|
|
|
38
51
|
key: 'name',
|
|
39
52
|
render: (text: any, data: any) => {
|
|
40
53
|
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
<>
|
|
55
|
+
<span
|
|
56
|
+
style={{ cursor: 'pointer', color: '#1677ff' }}
|
|
57
|
+
onClick={() => {
|
|
58
|
+
historyAction?.push({
|
|
59
|
+
pathname: `/account-info`,
|
|
60
|
+
search: `?id=${data.id}`
|
|
61
|
+
})
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{data?.name}
|
|
65
|
+
<FormOutlined />
|
|
66
|
+
</span>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
54
70
|
},
|
|
55
71
|
{
|
|
56
72
|
title: '账号',
|
|
57
73
|
dataIndex: 'account',
|
|
58
|
-
key: 'account'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: '工号',
|
|
62
|
-
dataIndex: 'jobNumber',
|
|
63
|
-
key: 'jobNumber',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
title: '手机号',
|
|
67
|
-
dataIndex: 'mobile',
|
|
68
|
-
key: 'mobile',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
title: '邮箱',
|
|
72
|
-
dataIndex: 'email',
|
|
73
|
-
key: 'email',
|
|
74
|
-
ellipsis: true,
|
|
74
|
+
key: 'account'
|
|
75
75
|
},
|
|
76
|
+
|
|
76
77
|
{
|
|
77
78
|
title: '是否主账号',
|
|
78
79
|
dataIndex: 'isAdmin',
|
|
@@ -107,39 +108,48 @@ export default function Account({
|
|
|
107
108
|
fixed: 'right',
|
|
108
109
|
width: 150,
|
|
109
110
|
render: (rowdata: any) => (
|
|
110
|
-
|
|
111
111
|
<Space>
|
|
112
|
-
<a
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
<a
|
|
113
|
+
onClick={() => {
|
|
114
|
+
setResetEditingData(rowdata)
|
|
115
|
+
setResetModalOpen(true)
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
重置密码
|
|
119
|
+
</a>
|
|
116
120
|
<a
|
|
117
121
|
onClick={() => {
|
|
118
122
|
historyAction?.push({
|
|
119
123
|
pathname: `/account-info`,
|
|
120
|
-
search: `?id=${rowdata.id}
|
|
121
|
-
})
|
|
124
|
+
search: `?id=${rowdata.id}`
|
|
125
|
+
})
|
|
122
126
|
}}
|
|
123
127
|
>
|
|
124
128
|
配置
|
|
125
129
|
</a>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
{rowdata.isAdmin ? null : (
|
|
131
|
+
<a
|
|
132
|
+
onClick={() => {
|
|
133
|
+
Modal.confirm({
|
|
134
|
+
title: `确认删除${rowdata?.name}吗?`,
|
|
135
|
+
onOk: () => {
|
|
136
|
+
DeleteFunc(rowdata?.id)
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
删除
|
|
142
|
+
</a>
|
|
143
|
+
)}
|
|
134
144
|
</Space>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
]
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
]
|
|
138
148
|
|
|
139
149
|
const handleOnReset: any = async (values: any) => {
|
|
140
150
|
searchFormRef.current = { ...values }
|
|
141
151
|
execute({
|
|
142
|
-
innerPageNo: 1
|
|
152
|
+
innerPageNo: 1
|
|
143
153
|
})
|
|
144
154
|
}
|
|
145
155
|
|
|
@@ -148,17 +158,14 @@ export default function Account({
|
|
|
148
158
|
execute()
|
|
149
159
|
}
|
|
150
160
|
|
|
151
|
-
const readDataList = ({
|
|
152
|
-
innerPageNo,
|
|
153
|
-
innerPageSize,
|
|
154
|
-
}: any) => {
|
|
161
|
+
const readDataList = ({ innerPageNo, innerPageSize }: any) => {
|
|
155
162
|
return accountPage({
|
|
156
163
|
currentPage: innerPageNo,
|
|
157
164
|
pageSize: innerPageSize,
|
|
158
|
-
...searchFormRef.current
|
|
165
|
+
...searchFormRef.current
|
|
159
166
|
}).then((res: any) => {
|
|
160
|
-
let records = get(res,
|
|
161
|
-
let total = get(res,
|
|
167
|
+
let records = get(res, 'records', [])
|
|
168
|
+
let total = get(res, 'total', 0)
|
|
162
169
|
return {
|
|
163
170
|
...res,
|
|
164
171
|
dataList: records,
|
|
@@ -177,65 +184,93 @@ export default function Account({
|
|
|
177
184
|
const setModalOpenFunc = (type: boolean) => {
|
|
178
185
|
setModalOpen(type)
|
|
179
186
|
setEditingData(null)
|
|
187
|
+
setId(null)
|
|
180
188
|
}
|
|
181
189
|
const actionFunc = (data: any, type: string) => {
|
|
182
|
-
return
|
|
183
|
-
message.success(
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
return accountCreateAccount({ ...data }).then((res: any) => {
|
|
191
|
+
message.success(`新增成功`)
|
|
192
|
+
setId(res)
|
|
193
|
+
accountGetAccountFunc(res)
|
|
186
194
|
execute()
|
|
187
195
|
})
|
|
188
196
|
}
|
|
189
|
-
const
|
|
197
|
+
const accountGetAccountFunc = (id: any) => {
|
|
198
|
+
accountGetAccount({
|
|
199
|
+
id
|
|
200
|
+
}).then((res: any) => {
|
|
201
|
+
setEditingData(res)
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
const DeleteFunc = (id: any) => {
|
|
190
205
|
accountDeleteAccount({
|
|
191
|
-
|
|
206
|
+
id
|
|
192
207
|
}).then((res: any) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
208
|
+
message.success('删除成功')
|
|
209
|
+
execute()
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
const accountGetAccountPasswordFunc = (data: any) => {
|
|
213
|
+
return accountGetAccountPassword(data)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const actionResetFunc = (data: any) => {
|
|
217
|
+
return accountResetPw({ ...data }).then((res: any) => {
|
|
218
|
+
message.success(`重置成功`)
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
const setResetModalOpenFunc = (type: boolean) => {
|
|
222
|
+
setResetModalOpen(type)
|
|
223
|
+
setResetEditingData(null)
|
|
224
|
+
}
|
|
197
225
|
return (
|
|
198
226
|
<PageContainer>
|
|
199
|
-
<QueryFilter
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
>
|
|
203
|
-
<ProFormText name="name" label="名称" />
|
|
204
|
-
<ProFormText name="account" label="账号" />
|
|
227
|
+
<QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
228
|
+
<ProFormText name='name' label='名称' />
|
|
229
|
+
<ProFormText name='account' label='账号' />
|
|
205
230
|
</QueryFilter>
|
|
206
231
|
<ProTable
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
232
|
+
columnsState={{
|
|
233
|
+
persistenceKey: 'base_cpcAccount',
|
|
234
|
+
persistenceType: 'localStorage'
|
|
235
|
+
}}
|
|
211
236
|
toolBarRender={() => {
|
|
212
237
|
return [
|
|
213
238
|
<Button
|
|
214
|
-
|
|
239
|
+
key='add'
|
|
240
|
+
type='primary'
|
|
215
241
|
onClick={() => {
|
|
216
242
|
setModalOpen(true)
|
|
217
243
|
}}
|
|
218
244
|
>
|
|
219
245
|
新增账号
|
|
220
|
-
</Button
|
|
221
|
-
]
|
|
246
|
+
</Button>
|
|
247
|
+
]
|
|
222
248
|
}}
|
|
223
|
-
headerTitle={
|
|
249
|
+
headerTitle={'账号列表'}
|
|
224
250
|
dataSource={dataList}
|
|
225
251
|
loading={isLoading}
|
|
226
252
|
columns={columns}
|
|
227
|
-
rowKey=
|
|
253
|
+
rowKey='id'
|
|
228
254
|
options={{
|
|
229
255
|
reload: handleRoload
|
|
230
256
|
}}
|
|
231
257
|
/>
|
|
258
|
+
|
|
259
|
+
<Pagination {...pagination} />
|
|
260
|
+
<ResetModal
|
|
261
|
+
ModalOpen={resetModalOpen} //弹框状态
|
|
262
|
+
editOpenStatus={setResetModalOpenFunc} //关闭弹框
|
|
263
|
+
editingData={resetEditingData} //编辑数据
|
|
264
|
+
actionFunc={actionResetFunc} //新增事件
|
|
265
|
+
accountGetAccountPasswordFunc={accountGetAccountPasswordFunc}
|
|
266
|
+
/>
|
|
232
267
|
<AddModal
|
|
233
268
|
ModalOpen={ModalOpen}
|
|
234
269
|
editOpenStatus={setModalOpenFunc} //修改状态事件
|
|
235
270
|
editingData={editingData} //当前数据
|
|
236
|
-
actionFunc={actionFunc}//事件
|
|
271
|
+
actionFunc={actionFunc} //事件
|
|
272
|
+
accountGetAccountPasswordFunc={accountGetAccountPasswordFunc}
|
|
237
273
|
/>
|
|
238
|
-
<Pagination {...pagination} />
|
|
239
274
|
</PageContainer>
|
|
240
275
|
)
|
|
241
276
|
}
|
|
@@ -130,6 +130,7 @@ export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree
|
|
|
130
130
|
fixed: 'right',
|
|
131
131
|
render: (rowdata: any) => (
|
|
132
132
|
<Space>
|
|
133
|
+
{accountInfo?.isAdmin && rowdata.roleCode === 'admin' ? null : (
|
|
133
134
|
<a
|
|
134
135
|
onClick={() => {
|
|
135
136
|
Modal.confirm({
|
|
@@ -143,7 +144,8 @@ export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree
|
|
|
143
144
|
>
|
|
144
145
|
解绑
|
|
145
146
|
</a>
|
|
146
|
-
|
|
147
|
+
)}
|
|
148
|
+
</Space>
|
|
147
149
|
)
|
|
148
150
|
}
|
|
149
151
|
]
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import useTableHooks from "../../../hooks/useTableHooks"
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
3
2
|
|
|
4
3
|
import PageContainer from '../../base-component/PageContainer';
|
|
5
4
|
import QueryFilter from '../../base-component/QueryFilter';
|
|
6
5
|
import ProTable from '../../base-component/ProTable';
|
|
7
6
|
import Pagination from '../../base-component/Pagination';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import useTableHooks from "../../../hooks/useTableHooks"
|
|
8
|
+
|
|
9
|
+
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
10
|
+
import { get } from 'lodash'
|
|
11
|
+
import { Space, Button, message, Modal, Popover } from 'antd'
|
|
12
|
+
import { pageRequest, create, remove, update } from './api'
|
|
13
|
+
|
|
14
|
+
import { ProFormText } from '@ant-design/pro-components'
|
|
15
15
|
|
|
16
|
-
import { ProFormText, } from '@ant-design/pro-components';
|
|
17
|
-
import { timeFormatter } from '../../../utils';
|
|
18
16
|
import AddModal from './AddModal'
|
|
19
|
-
import
|
|
17
|
+
import './index.scss'
|
|
20
18
|
export interface RoleProps {
|
|
21
|
-
historyAction: any
|
|
19
|
+
historyAction: any
|
|
22
20
|
}
|
|
23
|
-
export default function Role({
|
|
24
|
-
historyAction
|
|
25
|
-
}: RoleProps) {
|
|
21
|
+
export default function Role({ historyAction }: RoleProps) {
|
|
26
22
|
const searchFormRef: any = useRef()
|
|
27
23
|
|
|
28
24
|
const [ModalOpen, setModalOpen] = useState(false)
|
|
29
|
-
const [editingData, setEditingData] = useState(null)
|
|
25
|
+
const [editingData, setEditingData] = useState(null) //编辑数据
|
|
30
26
|
useEffect(() => {
|
|
31
27
|
init()
|
|
32
28
|
execute()
|
|
33
29
|
}, [])
|
|
34
30
|
|
|
35
|
-
const init = () => {
|
|
36
|
-
}
|
|
31
|
+
const init = () => {}
|
|
37
32
|
|
|
38
33
|
const columns: any = [
|
|
39
34
|
{
|
|
@@ -43,37 +38,37 @@ export default function Role({
|
|
|
43
38
|
render: (text: any, data: any) => {
|
|
44
39
|
return (
|
|
45
40
|
<span
|
|
46
|
-
style={{ cursor:
|
|
41
|
+
style={{ cursor: 'pointer', color: '#1677ff' }}
|
|
47
42
|
onClick={() => {
|
|
48
43
|
historyAction?.push({
|
|
49
44
|
pathname: `/role-info`,
|
|
50
|
-
search: `?roleCode=${data.roleCode}
|
|
51
|
-
})
|
|
45
|
+
search: `?roleCode=${data.roleCode}`
|
|
46
|
+
})
|
|
52
47
|
}}
|
|
53
48
|
>
|
|
54
49
|
{data?.roleName}
|
|
55
50
|
</span>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
58
53
|
},
|
|
59
54
|
{
|
|
60
55
|
title: '角色编码',
|
|
61
56
|
dataIndex: 'roleCode',
|
|
62
|
-
key: 'roleCode'
|
|
57
|
+
key: 'roleCode'
|
|
63
58
|
},
|
|
64
59
|
{
|
|
65
|
-
title:
|
|
66
|
-
dataIndex:
|
|
67
|
-
key:
|
|
60
|
+
title: '来源',
|
|
61
|
+
dataIndex: 'source',
|
|
62
|
+
key: 'source',
|
|
68
63
|
render: (cell: any) => {
|
|
69
|
-
if (cell
|
|
70
|
-
return
|
|
71
|
-
} else if (cell
|
|
72
|
-
return
|
|
73
|
-
} else{
|
|
74
|
-
return
|
|
64
|
+
if (cell === 'system') {
|
|
65
|
+
return '系统创建'
|
|
66
|
+
} else if (cell === 'user') {
|
|
67
|
+
return '用户自建'
|
|
68
|
+
} else {
|
|
69
|
+
return '未知'
|
|
75
70
|
}
|
|
76
|
-
}
|
|
71
|
+
}
|
|
77
72
|
},
|
|
78
73
|
{
|
|
79
74
|
title: '角色描述',
|
|
@@ -115,41 +110,53 @@ export default function Role({
|
|
|
115
110
|
{
|
|
116
111
|
title: '操作',
|
|
117
112
|
width: 180,
|
|
118
|
-
fixed:
|
|
119
|
-
render: (rowdata: any
|
|
120
|
-
|
|
121
|
-
rowdata.source !==
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
113
|
+
fixed: 'right',
|
|
114
|
+
render: (rowdata: any) => (
|
|
115
|
+
<Space>
|
|
116
|
+
{rowdata.source !== 'system' && (
|
|
117
|
+
<a
|
|
118
|
+
onClick={() => {
|
|
119
|
+
setEditingData(rowdata)
|
|
120
|
+
setModalOpen(true)
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
编辑
|
|
124
|
+
</a>
|
|
125
|
+
)}
|
|
126
|
+
<a
|
|
127
|
+
onClick={() => {
|
|
128
|
+
historyAction?.push({
|
|
129
|
+
pathname: `/role-info`,
|
|
130
|
+
search: `?roleCode=${rowdata.roleCode}`
|
|
131
|
+
})
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
配置
|
|
135
|
+
</a>
|
|
136
|
+
{rowdata.source !== 'system' && (
|
|
137
|
+
<a
|
|
138
|
+
onClick={() => {
|
|
139
|
+
Modal.confirm({
|
|
140
|
+
title: `确认删除${rowdata?.roleName}吗?`,
|
|
141
|
+
content: '',
|
|
142
|
+
onOk: () => {
|
|
143
|
+
DeleteFunc(rowdata?.roleCode)
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
删除
|
|
149
|
+
</a>
|
|
150
|
+
)}
|
|
151
|
+
</Space>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
]
|
|
148
155
|
|
|
149
156
|
const handleOnReset: any = async (values: any) => {
|
|
150
157
|
searchFormRef.current = { ...values }
|
|
151
158
|
execute({
|
|
152
|
-
innerPageNo: 1
|
|
159
|
+
innerPageNo: 1
|
|
153
160
|
})
|
|
154
161
|
}
|
|
155
162
|
|
|
@@ -158,17 +165,14 @@ export default function Role({
|
|
|
158
165
|
execute()
|
|
159
166
|
}
|
|
160
167
|
|
|
161
|
-
const readDataList = ({
|
|
162
|
-
innerPageNo,
|
|
163
|
-
innerPageSize,
|
|
164
|
-
}: any) => {
|
|
168
|
+
const readDataList = ({ innerPageNo, innerPageSize }: any) => {
|
|
165
169
|
return pageRequest({
|
|
166
170
|
currentPage: innerPageNo,
|
|
167
171
|
pageSize: innerPageSize,
|
|
168
172
|
...searchFormRef.current
|
|
169
173
|
}).then((res: any) => {
|
|
170
|
-
let records = get(res,
|
|
171
|
-
let total = get(res,
|
|
174
|
+
let records = get(res, 'records', [])
|
|
175
|
+
let total = get(res, 'total', 0)
|
|
172
176
|
return {
|
|
173
177
|
...res,
|
|
174
178
|
dataList: records,
|
|
@@ -191,63 +195,61 @@ export default function Role({
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
const actionFunc = (data: any, type: string) => {
|
|
194
|
-
return
|
|
195
|
-
message.success(`${type
|
|
198
|
+
return (type === 'add' ? create : update)({ ...data }).then((res: any) => {
|
|
199
|
+
message.success(`${type === 'add' ? '新增' : '更新'}成功`)
|
|
196
200
|
setModalOpen(false)
|
|
197
201
|
setEditingData(null)
|
|
198
202
|
execute()
|
|
199
203
|
})
|
|
200
204
|
}
|
|
201
|
-
const DeleteFunc = (roleCode:any)=>{
|
|
205
|
+
const DeleteFunc = (roleCode: any) => {
|
|
202
206
|
remove({
|
|
203
|
-
roleCode
|
|
207
|
+
roleCode
|
|
204
208
|
}).then((res: any) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
+
message.success('删除成功')
|
|
210
|
+
execute()
|
|
211
|
+
})
|
|
212
|
+
}
|
|
209
213
|
return (
|
|
210
|
-
<PageContainer
|
|
211
|
-
<QueryFilter
|
|
212
|
-
|
|
213
|
-
onFinish={handleOnFinish}
|
|
214
|
-
>
|
|
215
|
-
<ProFormText name="roleName" label="角色名称" />
|
|
214
|
+
<PageContainer>
|
|
215
|
+
<QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
216
|
+
<ProFormText name='roleName' label='角色名称' />
|
|
216
217
|
</QueryFilter>
|
|
217
218
|
|
|
218
219
|
<ProTable
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
columnsState={{
|
|
221
|
+
persistenceKey: 'base_cpcRole',
|
|
222
|
+
persistenceType: 'localStorage'
|
|
223
|
+
}}
|
|
223
224
|
toolBarRender={() => {
|
|
224
225
|
return [
|
|
225
226
|
<Button
|
|
226
|
-
|
|
227
|
+
key='add'
|
|
228
|
+
type='primary'
|
|
227
229
|
onClick={() => {
|
|
228
230
|
setModalOpen(true)
|
|
229
231
|
}}
|
|
230
232
|
>
|
|
231
233
|
新增角色
|
|
232
|
-
</Button
|
|
233
|
-
]
|
|
234
|
+
</Button>
|
|
235
|
+
]
|
|
234
236
|
}}
|
|
235
|
-
headerTitle={
|
|
237
|
+
headerTitle={'角色列表'}
|
|
236
238
|
dataSource={dataList}
|
|
237
239
|
loading={isLoading}
|
|
238
240
|
columns={columns}
|
|
239
|
-
rowKey=
|
|
241
|
+
rowKey='id'
|
|
240
242
|
options={{
|
|
241
243
|
reload: handleRoload
|
|
242
244
|
}}
|
|
243
245
|
/>
|
|
244
|
-
<Pagination
|
|
246
|
+
<Pagination {...pagination} />
|
|
245
247
|
<AddModal
|
|
246
248
|
ModalOpen={ModalOpen}
|
|
247
249
|
editOpenStatus={setModalOpenFunc} //修改状态事件
|
|
248
250
|
editingData={editingData} //当前数据
|
|
249
|
-
actionFunc={actionFunc}//事件
|
|
251
|
+
actionFunc={actionFunc} //事件
|
|
250
252
|
/>
|
|
251
|
-
</PageContainer
|
|
253
|
+
</PageContainer>
|
|
252
254
|
)
|
|
253
|
-
}
|
|
255
|
+
}
|