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