cfel-base-components 2.5.2 → 2.5.4
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/package.json +1 -1
- package/src/components/layout/index.tsx +1 -1
- package/src/components/universal-pages/cpcAccountInfo/api.ts +16 -25
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +304 -269
- package/src/components/universal-pages/cpcRoleInfo/api.ts +24 -24
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +455 -360
|
@@ -1,17 +1,27 @@
|
|
|
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
|
|
7
|
-
import {
|
|
7
|
+
import useTableHooks from "../../../hooks/useTableHooks"
|
|
8
|
+
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
9
|
+
|
|
10
|
+
import { get } from 'lodash'
|
|
11
|
+
import {
|
|
12
|
+
Modal,
|
|
13
|
+
Button,
|
|
14
|
+
Divider,
|
|
15
|
+
Descriptions,
|
|
16
|
+
Space,
|
|
17
|
+
message,
|
|
18
|
+
Avatar,
|
|
8
19
|
Spin,
|
|
9
20
|
Tabs,
|
|
10
|
-
Table
|
|
11
|
-
|
|
21
|
+
Table
|
|
22
|
+
} from 'antd'
|
|
23
|
+
import { UserOutlined } from '@ant-design/icons'
|
|
12
24
|
import EditAccountDrawer from './EditAccountDrawer/index'
|
|
13
|
-
import useTableHooks from "../../../hooks/useTableHooks"
|
|
14
|
-
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
15
25
|
import {
|
|
16
26
|
getAccount,
|
|
17
27
|
pageBoundRoles,
|
|
@@ -19,387 +29,389 @@ import {
|
|
|
19
29
|
rolelistRole,
|
|
20
30
|
accountBoundRoles,
|
|
21
31
|
accountUnboundRoles,
|
|
22
|
-
|
|
23
|
-
accountAuthorizePage,
|
|
32
|
+
accountAuthorizePage
|
|
24
33
|
} from './api'
|
|
25
|
-
import
|
|
26
|
-
import { InteractionOutlined } from
|
|
27
|
-
import dayjs from
|
|
28
|
-
|
|
34
|
+
import './index.scss'
|
|
35
|
+
import { InteractionOutlined } from '@ant-design/icons'
|
|
36
|
+
import dayjs from 'dayjs'
|
|
29
37
|
|
|
30
38
|
export interface RoleInfoProps {
|
|
31
39
|
isShowTab: {
|
|
32
|
-
main: boolean
|
|
33
|
-
tableResource: boolean
|
|
34
|
-
tableEmpower: boolean
|
|
35
|
-
tableData: boolean
|
|
36
|
-
}
|
|
37
|
-
getAuthTree?: any
|
|
40
|
+
main: boolean
|
|
41
|
+
tableResource: boolean
|
|
42
|
+
tableEmpower: boolean
|
|
43
|
+
tableData: boolean
|
|
44
|
+
}
|
|
45
|
+
getAuthTree?: any
|
|
46
|
+
getAccountAuthTree?: any
|
|
38
47
|
}
|
|
39
|
-
export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
40
|
-
const [accountInfo, setAccountInfoInfo]: any = useState({})
|
|
41
|
-
const [pageId, setPageId] = useState(getUrlParams(
|
|
42
|
-
const [rolelistRoleData, setRolelistRoleData]: any = useState([])
|
|
43
|
-
const [roleCheckData, setRoleCheckData]: any = useState([])
|
|
44
|
-
const [editAccountOpen, setEditAccountOpen] = useState(false)
|
|
48
|
+
export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree }: RoleInfoProps) {
|
|
49
|
+
const [accountInfo, setAccountInfoInfo]: any = useState({})
|
|
50
|
+
const [pageId, setPageId] = useState(getUrlParams('id'))
|
|
51
|
+
const [rolelistRoleData, setRolelistRoleData]: any = useState([]) // 角色总数据
|
|
52
|
+
const [roleCheckData, setRoleCheckData]: any = useState([]) //当前选中的角色list
|
|
53
|
+
const [editAccountOpen, setEditAccountOpen] = useState(false)
|
|
54
|
+
|
|
55
|
+
const [loading, setLoading] = useState(false)
|
|
56
|
+
const [tabCheck, setTabCheck] = useState('main')
|
|
57
|
+
const [ResourceTableData, setResourceTableData]: any = useState([]) //关联资源
|
|
58
|
+
const [isTableLoading, setisTableLoading] = useState(false)
|
|
59
|
+
const [selectedRowKeys, setselectedRowKeys]: any = useState([])
|
|
60
|
+
const [defaultExpandedRowKeys, setdefaultExpandedRowKeys]: any = useState([])
|
|
61
|
+
const [isTableByDataLoading, setisTableByDataLoading] = useState(false) //数据权限使用
|
|
62
|
+
const [selectedDataRowKeys, setselectedDataRowKeys]: any = useState([]) //数据权限使用
|
|
63
|
+
const [defaultExpandedDataRowKeys, setdefaultExpandedDataRowKeys]: any = useState([]) //数据权限使用
|
|
64
|
+
const [ResourceData, setResourceData]: any = useState([]) //数据权限使用
|
|
45
65
|
|
|
46
|
-
const [loading, setLoading] = useState(false);
|
|
47
|
-
const [tabCheck, setTabCheck] = useState("main");
|
|
48
|
-
const [ResourceTableData, setResourceTableData]: any = useState([]); //关联资源
|
|
49
|
-
const [isTableLoading, setisTableLoading] = useState(false);
|
|
50
|
-
const [selectedRowKeys, setselectedRowKeys]: any = useState([]);
|
|
51
|
-
const [defaultExpandedRowKeys, setdefaultExpandedRowKeys]: any = useState([]);
|
|
52
66
|
const [TableItemData, setTableItemData]: any = useState([
|
|
53
67
|
{
|
|
54
|
-
key:
|
|
68
|
+
key: 'main',
|
|
55
69
|
label: `关联角色`,
|
|
56
|
-
icon: <InteractionOutlined
|
|
57
|
-
}
|
|
58
|
-
])
|
|
70
|
+
icon: <InteractionOutlined />
|
|
71
|
+
}
|
|
72
|
+
]) //tab 数据
|
|
59
73
|
const TableResource: any = [
|
|
60
74
|
{
|
|
61
|
-
title:
|
|
62
|
-
dataIndex:
|
|
63
|
-
key:
|
|
64
|
-
}
|
|
65
|
-
]
|
|
75
|
+
title: '菜单名称',
|
|
76
|
+
dataIndex: 'name',
|
|
77
|
+
key: 'name'
|
|
78
|
+
}
|
|
79
|
+
]
|
|
66
80
|
const columns: any = [
|
|
67
81
|
{
|
|
68
|
-
title:
|
|
69
|
-
dataIndex:
|
|
70
|
-
key:
|
|
82
|
+
title: '角色名称',
|
|
83
|
+
dataIndex: 'roleName',
|
|
84
|
+
key: 'roleName'
|
|
71
85
|
},
|
|
72
86
|
{
|
|
73
|
-
title:
|
|
74
|
-
dataIndex:
|
|
75
|
-
key:
|
|
76
|
-
width: 300
|
|
87
|
+
title: '角色编码',
|
|
88
|
+
dataIndex: 'roleCode',
|
|
89
|
+
key: 'roleCode',
|
|
90
|
+
width: 300
|
|
77
91
|
},
|
|
78
92
|
{
|
|
79
|
-
title:
|
|
80
|
-
dataIndex:
|
|
81
|
-
key:
|
|
93
|
+
title: '来源',
|
|
94
|
+
dataIndex: 'source',
|
|
95
|
+
key: 'source',
|
|
82
96
|
render: (cell: any) => {
|
|
83
|
-
if (cell
|
|
84
|
-
return
|
|
85
|
-
} else if (cell
|
|
86
|
-
return
|
|
87
|
-
} else
|
|
88
|
-
return
|
|
97
|
+
if (cell === 'system') {
|
|
98
|
+
return '系统创建'
|
|
99
|
+
} else if (cell === 'user') {
|
|
100
|
+
return '用户自建'
|
|
101
|
+
} else {
|
|
102
|
+
return '未知'
|
|
89
103
|
}
|
|
90
|
-
}
|
|
104
|
+
}
|
|
91
105
|
},
|
|
92
106
|
{
|
|
93
|
-
title:
|
|
94
|
-
dataIndex:
|
|
95
|
-
key:
|
|
107
|
+
title: '描述',
|
|
108
|
+
dataIndex: 'description',
|
|
109
|
+
key: 'description'
|
|
96
110
|
},
|
|
97
111
|
{
|
|
98
|
-
title:
|
|
99
|
-
dataIndex:
|
|
100
|
-
key:
|
|
112
|
+
title: '创建时间',
|
|
113
|
+
dataIndex: 'gmtCreate',
|
|
114
|
+
key: 'gmtCreate',
|
|
101
115
|
render: (cell: any) => {
|
|
102
|
-
return timeFormatter(cell)
|
|
103
|
-
}
|
|
116
|
+
return timeFormatter(cell)
|
|
117
|
+
}
|
|
104
118
|
},
|
|
105
119
|
{
|
|
106
|
-
title:
|
|
107
|
-
dataIndex:
|
|
108
|
-
key:
|
|
120
|
+
title: '修改时间',
|
|
121
|
+
dataIndex: 'gmtModified',
|
|
122
|
+
key: 'gmtModified',
|
|
109
123
|
render: (cell: any) => {
|
|
110
|
-
return timeFormatter(cell)
|
|
111
|
-
}
|
|
124
|
+
return timeFormatter(cell)
|
|
125
|
+
}
|
|
112
126
|
},
|
|
113
127
|
{
|
|
114
|
-
title:
|
|
128
|
+
title: '操作',
|
|
115
129
|
width: 80,
|
|
116
|
-
fixed:
|
|
130
|
+
fixed: 'right',
|
|
117
131
|
render: (rowdata: any) => (
|
|
118
132
|
<Space>
|
|
119
133
|
<a
|
|
120
134
|
onClick={() => {
|
|
121
135
|
Modal.confirm({
|
|
122
|
-
title:
|
|
123
|
-
content:
|
|
136
|
+
title: '确认解绑吗?',
|
|
137
|
+
content: '',
|
|
124
138
|
onOk: () => {
|
|
125
|
-
isBoundRolesFunc(false, { roleCodes: [rowdata.roleCode] })
|
|
126
|
-
}
|
|
127
|
-
})
|
|
139
|
+
isBoundRolesFunc(false, { roleCodes: [rowdata.roleCode] })
|
|
140
|
+
}
|
|
141
|
+
})
|
|
128
142
|
}}
|
|
129
143
|
>
|
|
130
144
|
解绑
|
|
131
145
|
</a>
|
|
132
146
|
</Space>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
]
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
]
|
|
136
150
|
const TablePolicy: any = [
|
|
137
151
|
{
|
|
138
|
-
title:
|
|
139
|
-
dataIndex:
|
|
140
|
-
key:
|
|
152
|
+
title: '授权主体',
|
|
153
|
+
dataIndex: 'subject',
|
|
154
|
+
key: 'subject'
|
|
141
155
|
},
|
|
142
156
|
{
|
|
143
|
-
title:
|
|
144
|
-
dataIndex:
|
|
145
|
-
key:
|
|
157
|
+
title: '权限策略',
|
|
158
|
+
dataIndex: 'policy',
|
|
159
|
+
key: 'policy'
|
|
146
160
|
},
|
|
147
161
|
{
|
|
148
|
-
title:
|
|
149
|
-
dataIndex:
|
|
150
|
-
key:
|
|
162
|
+
title: '资源组',
|
|
163
|
+
dataIndex: 'group',
|
|
164
|
+
key: 'group'
|
|
151
165
|
},
|
|
152
166
|
{
|
|
153
|
-
title:
|
|
154
|
-
dataIndex:
|
|
155
|
-
key:
|
|
167
|
+
title: '授权时间',
|
|
168
|
+
dataIndex: 'gmtModified',
|
|
169
|
+
key: 'gmtModified',
|
|
156
170
|
render: (text: any, data: any) => {
|
|
157
|
-
return dayjs(text).format(
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
]
|
|
171
|
+
return dayjs(text).format('YYYY-MM-DD HH:mm:ss') || '数据格式错误'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
161
175
|
useEffect(() => {
|
|
162
|
-
init()
|
|
163
|
-
getAccountFunc({ id: pageId })
|
|
164
|
-
}, [])
|
|
176
|
+
init()
|
|
177
|
+
getAccountFunc({ id: pageId })
|
|
178
|
+
}, [])
|
|
165
179
|
const init = () => {
|
|
166
|
-
let data: any = []
|
|
180
|
+
let data: any = []
|
|
167
181
|
if (isShowTab?.tableResource) {
|
|
168
182
|
data.push({
|
|
169
|
-
label:
|
|
170
|
-
key:
|
|
171
|
-
icon: <InteractionOutlined
|
|
172
|
-
})
|
|
183
|
+
label: '关联菜单',
|
|
184
|
+
key: 'tableResource',
|
|
185
|
+
icon: <InteractionOutlined />
|
|
186
|
+
})
|
|
173
187
|
}
|
|
174
188
|
if (isShowTab?.tableEmpower) {
|
|
175
189
|
data.push({
|
|
176
|
-
label:
|
|
177
|
-
key:
|
|
178
|
-
icon: <InteractionOutlined
|
|
179
|
-
})
|
|
190
|
+
label: '关联授权',
|
|
191
|
+
key: 'tableEmpower',
|
|
192
|
+
icon: <InteractionOutlined />
|
|
193
|
+
})
|
|
180
194
|
}
|
|
181
195
|
if (isShowTab?.tableData) {
|
|
182
196
|
data.push({
|
|
183
|
-
label:
|
|
184
|
-
key:
|
|
185
|
-
icon: <InteractionOutlined
|
|
186
|
-
})
|
|
197
|
+
label: '关联数权',
|
|
198
|
+
key: 'tableData',
|
|
199
|
+
icon: <InteractionOutlined />
|
|
200
|
+
})
|
|
187
201
|
}
|
|
188
|
-
setTableItemData([...TableItemData, ...data])
|
|
189
|
-
}
|
|
202
|
+
setTableItemData([...TableItemData, ...data])
|
|
203
|
+
}
|
|
190
204
|
|
|
191
205
|
const tabCheckFunc = () => {
|
|
192
|
-
if (tabCheck
|
|
206
|
+
if (tabCheck === 'tableEmpower') {
|
|
193
207
|
policy?.execute({
|
|
194
|
-
accountId: pageId
|
|
195
|
-
})
|
|
196
|
-
} else if (tabCheck
|
|
197
|
-
getAuthTreeFunc()
|
|
208
|
+
accountId: pageId
|
|
209
|
+
}) // 获取授权策略
|
|
210
|
+
} else if (tabCheck === 'tableResource') {
|
|
211
|
+
getAuthTreeFunc() // 获取关联资源
|
|
212
|
+
} else if (tabCheck === 'tableData') {
|
|
213
|
+
getAccountAuthTreeFunc() // 获取关联数权
|
|
198
214
|
} else {
|
|
199
|
-
execute({ accountId: pageId })
|
|
215
|
+
execute({ accountId: pageId })
|
|
200
216
|
}
|
|
201
|
-
}
|
|
217
|
+
}
|
|
202
218
|
|
|
203
219
|
useEffect(() => {
|
|
204
|
-
if(!tabCheck) return
|
|
205
|
-
tabCheckFunc()
|
|
206
|
-
}, [tabCheck])
|
|
220
|
+
if (!tabCheck) return
|
|
221
|
+
tabCheckFunc()
|
|
222
|
+
}, [tabCheck])
|
|
207
223
|
|
|
208
224
|
const getAccountFunc = (data: any) => {
|
|
209
|
-
setAccountInfoInfo({})
|
|
210
|
-
setLoading(true)
|
|
225
|
+
setAccountInfoInfo({})
|
|
226
|
+
setLoading(true)
|
|
211
227
|
getAccount({
|
|
212
|
-
...data
|
|
228
|
+
...data
|
|
213
229
|
}).then((res: any) => {
|
|
214
|
-
setLoading(false)
|
|
215
|
-
setAccountInfoInfo(res || {})
|
|
216
|
-
tabCheckFunc()
|
|
217
|
-
})
|
|
218
|
-
}
|
|
230
|
+
setLoading(false)
|
|
231
|
+
setAccountInfoInfo(res || {})
|
|
232
|
+
tabCheckFunc()
|
|
233
|
+
})
|
|
234
|
+
}
|
|
219
235
|
|
|
220
236
|
//获取关联资源
|
|
221
237
|
const getAuthTreeFunc = () => {
|
|
222
|
-
setisTableLoading(true)
|
|
223
|
-
getAuthTree
|
|
224
|
-
getAuthTree({
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
let
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
+
setisTableLoading(true)
|
|
239
|
+
if (getAuthTree) {
|
|
240
|
+
getAuthTree().then((res: any) => {
|
|
241
|
+
let listId: Array<[]> = []
|
|
242
|
+
let defaultRowKeys: Array<[]> = []
|
|
243
|
+
let { data, list, drkey }: any = resourceAction(res, listId, defaultRowKeys)
|
|
244
|
+
setselectedRowKeys(list)
|
|
245
|
+
setdefaultExpandedRowKeys(drkey)
|
|
246
|
+
setResourceTableData(data)
|
|
247
|
+
setisTableLoading(false)
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
//获取关联数权
|
|
252
|
+
const getAccountAuthTreeFunc = () => {
|
|
253
|
+
setisTableByDataLoading(true)
|
|
254
|
+
if (getAccountAuthTree) {
|
|
255
|
+
getAccountAuthTree().then((res: any) => {
|
|
256
|
+
let listId: Array<[]> = []
|
|
257
|
+
let defaultRowKeys: Array<[]> = []
|
|
258
|
+
let { data, list, drkey }: any = resourceAction(res, listId, defaultRowKeys)
|
|
259
|
+
setselectedDataRowKeys(list)
|
|
260
|
+
setdefaultExpandedDataRowKeys(drkey)
|
|
261
|
+
setResourceData(data)
|
|
262
|
+
setisTableByDataLoading(false)
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const resourceAction: any = (data: any, list: any, drkey: any) => {
|
|
267
|
+
if (Object.prototype.toString.call(data) === '[object Array]') {
|
|
238
268
|
data.map((item: any) => {
|
|
239
|
-
return resourceAction(item,list,drkey)
|
|
240
|
-
})
|
|
269
|
+
return resourceAction(item, list, drkey)
|
|
270
|
+
})
|
|
241
271
|
return {
|
|
242
272
|
data,
|
|
243
273
|
list,
|
|
244
274
|
drkey
|
|
245
275
|
}
|
|
246
|
-
} else if (Object.prototype.toString.call(data) ===
|
|
247
|
-
if(data.checked)list.push(data.id)
|
|
276
|
+
} else if (Object.prototype.toString.call(data) === '[object Object]') {
|
|
277
|
+
if (data.checked) list.push(data.id || data.bizId)
|
|
248
278
|
if (data.children && data.children.length !== 0) {
|
|
249
|
-
drkey.push(data.id)
|
|
250
|
-
return resourceAction(data.children,list,drkey)
|
|
279
|
+
drkey.push(data.id || data.bizId)
|
|
280
|
+
return resourceAction(data.children, list, drkey)
|
|
251
281
|
} else {
|
|
252
|
-
delete data.children
|
|
253
|
-
drkey.push(data.id)
|
|
254
|
-
return data
|
|
282
|
+
delete data.children
|
|
283
|
+
drkey.push(data.id || data.bizId)
|
|
284
|
+
return data
|
|
255
285
|
}
|
|
256
286
|
}
|
|
257
|
-
}
|
|
258
|
-
const readDataList = ({
|
|
259
|
-
innerPageNo,
|
|
260
|
-
innerPageSize,
|
|
261
|
-
...otherOptions
|
|
262
|
-
}: any) => {
|
|
287
|
+
}
|
|
288
|
+
const readDataList = ({ innerPageNo, innerPageSize, ...otherOptions }: any) => {
|
|
263
289
|
return pageBoundRoles({
|
|
264
290
|
currentPage: innerPageNo,
|
|
265
291
|
pageSize: innerPageSize,
|
|
266
|
-
...otherOptions
|
|
292
|
+
...otherOptions
|
|
267
293
|
}).then((res: any) => {
|
|
268
|
-
let records = get(res,
|
|
269
|
-
let total = get(res,
|
|
294
|
+
let records = get(res, 'records', [])
|
|
295
|
+
let total = get(res, 'total', 0)
|
|
270
296
|
return {
|
|
297
|
+
...res,
|
|
271
298
|
dataList: records,
|
|
272
|
-
totalCount: total
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
}
|
|
299
|
+
totalCount: total
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
}
|
|
276
303
|
const { execute, dataList, isLoading, pagination } = useTableHooks({
|
|
277
|
-
asyncFunction: readDataList
|
|
278
|
-
})
|
|
304
|
+
asyncFunction: readDataList
|
|
305
|
+
})
|
|
279
306
|
|
|
280
307
|
const getQueryBoundRolesFunc = () => {
|
|
281
|
-
Promise.all([queryBoundRoles({ accountId: pageId }), rolelistRole()]).then(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (repeat) {
|
|
296
|
-
result.push(item.roleCode);
|
|
308
|
+
Promise.all([queryBoundRoles({ accountId: pageId }), rolelistRole()]).then(res => {
|
|
309
|
+
let boundRoles: any = res[0]
|
|
310
|
+
let roleList: any = res[1]
|
|
311
|
+
let result: any = []
|
|
312
|
+
for (let i = 0; i < roleList.length; i++) {
|
|
313
|
+
let item = roleList[i]
|
|
314
|
+
let repeat = false
|
|
315
|
+
for (let j = 0; j < boundRoles.length; j++) {
|
|
316
|
+
if (item.roleCode === boundRoles[j].roleCode) {
|
|
317
|
+
repeat = true
|
|
318
|
+
break
|
|
297
319
|
}
|
|
298
320
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
321
|
+
if (repeat) {
|
|
322
|
+
result.push(item.roleCode)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
setRolelistRoleData(roleList)
|
|
326
|
+
setRoleCheckData(result)
|
|
327
|
+
setEditAccountOpen(true)
|
|
328
|
+
})
|
|
329
|
+
}
|
|
305
330
|
const isBoundRolesFunc = (type: any, { roleCodes }: any) => {
|
|
306
331
|
return (type ? accountBoundRoles : accountUnboundRoles)({
|
|
307
332
|
accountId: pageId,
|
|
308
|
-
roleCodes: roleCodes
|
|
333
|
+
roleCodes: roleCodes
|
|
309
334
|
}).then(() => {
|
|
310
|
-
message.success(`${type ?
|
|
311
|
-
execute({ accountId: pageId })
|
|
312
|
-
setEditAccountOpen(false)
|
|
313
|
-
})
|
|
314
|
-
}
|
|
335
|
+
message.success(`${type ? '绑定' : '解绑'}成功`)
|
|
336
|
+
execute({ accountId: pageId })
|
|
337
|
+
setEditAccountOpen(false)
|
|
338
|
+
})
|
|
339
|
+
}
|
|
315
340
|
|
|
316
|
-
const accountAuthorizePageFunc = ({
|
|
317
|
-
innerPageNo,
|
|
318
|
-
innerPageSize,
|
|
319
|
-
...otherOptions
|
|
320
|
-
}: any) => {
|
|
341
|
+
const accountAuthorizePageFunc = ({ innerPageNo, innerPageSize, ...otherOptions }: any) => {
|
|
321
342
|
return accountAuthorizePage({
|
|
322
343
|
currentPage: innerPageNo,
|
|
323
344
|
pageSize: innerPageSize,
|
|
324
|
-
...otherOptions
|
|
345
|
+
...otherOptions
|
|
325
346
|
}).then((res: any) => {
|
|
326
|
-
let records = get(res,
|
|
327
|
-
let total = get(res,
|
|
347
|
+
let records = get(res, 'records', [])
|
|
348
|
+
let total = get(res, 'total', 0)
|
|
328
349
|
return {
|
|
350
|
+
...res,
|
|
329
351
|
dataList: records,
|
|
330
|
-
totalCount: total
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
}
|
|
352
|
+
totalCount: total
|
|
353
|
+
}
|
|
354
|
+
})
|
|
355
|
+
}
|
|
334
356
|
let policy = useTableHooks({
|
|
335
|
-
asyncFunction: accountAuthorizePageFunc
|
|
336
|
-
})
|
|
357
|
+
asyncFunction: accountAuthorizePageFunc
|
|
358
|
+
})
|
|
337
359
|
return (
|
|
338
360
|
<PageContainer>
|
|
339
361
|
<Spin spinning={loading}>
|
|
340
|
-
<div className=
|
|
341
|
-
<div className=
|
|
342
|
-
<Divider orientation=
|
|
362
|
+
<div className='deviceTopTitle'>
|
|
363
|
+
<div className='deviceTopDivider'>
|
|
364
|
+
<Divider orientation='left'>
|
|
343
365
|
<Avatar
|
|
344
|
-
style={{ backgroundColor:
|
|
366
|
+
style={{ backgroundColor: '#1677ff', marginRight: '8px' }}
|
|
345
367
|
draggable={false}
|
|
346
368
|
icon={<UserOutlined />}
|
|
347
369
|
src={!!accountInfo.avatar ? accountInfo.avatar : undefined}
|
|
348
370
|
/>
|
|
349
|
-
{accountInfo?.name ||
|
|
371
|
+
{accountInfo?.name || ''}
|
|
350
372
|
</Divider>
|
|
351
373
|
</div>
|
|
352
374
|
<Button
|
|
353
|
-
className=
|
|
375
|
+
className='deviceTopButton'
|
|
354
376
|
onClick={() => {
|
|
355
|
-
getAccountFunc({ id: pageId })
|
|
377
|
+
getAccountFunc({ id: pageId })
|
|
356
378
|
}}
|
|
357
379
|
>
|
|
358
380
|
刷新
|
|
359
381
|
</Button>
|
|
360
382
|
</div>
|
|
361
|
-
<Descriptions className=
|
|
362
|
-
<Descriptions.Item label=
|
|
363
|
-
|
|
364
|
-
</Descriptions.Item>
|
|
365
|
-
<Descriptions.Item label=
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
{accountInfo?.name || ""}
|
|
383
|
+
<Descriptions className='basicInfoWrap'>
|
|
384
|
+
<Descriptions.Item label='账号'>{accountInfo?.account || ''}</Descriptions.Item>
|
|
385
|
+
<Descriptions.Item label='员工工号'>{accountInfo?.jobNumber || ''}</Descriptions.Item>
|
|
386
|
+
<Descriptions.Item label='名称'>{accountInfo?.name || ''}</Descriptions.Item>
|
|
387
|
+
<Descriptions.Item label='手机号'>{accountInfo?.mobile || ''}</Descriptions.Item>
|
|
388
|
+
<Descriptions.Item label='邮箱'>{accountInfo?.email || ''}</Descriptions.Item>
|
|
389
|
+
<Descriptions.Item label='是否企业管理员'>
|
|
390
|
+
{accountInfo?.isAdmin ? '是' : '否'}
|
|
370
391
|
</Descriptions.Item>
|
|
371
|
-
<Descriptions.Item label=
|
|
372
|
-
{accountInfo?.mobile || ""}
|
|
373
|
-
</Descriptions.Item>
|
|
374
|
-
<Descriptions.Item label="邮箱">
|
|
375
|
-
{accountInfo?.email || ""}
|
|
376
|
-
</Descriptions.Item>
|
|
377
|
-
<Descriptions.Item label="是否企业管理员">
|
|
378
|
-
{accountInfo?.isAdmin ? "是" : "否"}
|
|
379
|
-
</Descriptions.Item>
|
|
380
|
-
<Descriptions.Item label="创建时间">
|
|
392
|
+
<Descriptions.Item label='创建时间'>
|
|
381
393
|
{timeFormatter(accountInfo?.gmtCreate)}
|
|
382
394
|
</Descriptions.Item>
|
|
383
|
-
<Descriptions.Item label=
|
|
395
|
+
<Descriptions.Item label='修改时间'>
|
|
384
396
|
{timeFormatter(accountInfo?.gmtModified)}
|
|
385
397
|
</Descriptions.Item>
|
|
386
398
|
</Descriptions>
|
|
387
399
|
<div>
|
|
388
|
-
<Divider orientation=
|
|
389
|
-
<div className=
|
|
400
|
+
<Divider orientation='left'>当前账号关联内容</Divider>
|
|
401
|
+
<div className='jsonWarp'>
|
|
390
402
|
<Tabs
|
|
391
|
-
onChange={
|
|
392
|
-
setTabCheck(e)
|
|
403
|
+
onChange={e => {
|
|
404
|
+
setTabCheck(e)
|
|
393
405
|
}}
|
|
394
406
|
items={TableItemData}
|
|
395
407
|
/>
|
|
396
|
-
{tabCheck
|
|
408
|
+
{tabCheck === 'main' && (
|
|
397
409
|
<>
|
|
398
|
-
<div className=
|
|
410
|
+
<div className='tableActionWarp'>
|
|
399
411
|
<Button
|
|
400
|
-
type=
|
|
412
|
+
type='primary'
|
|
401
413
|
onClick={() => {
|
|
402
|
-
getQueryBoundRolesFunc()
|
|
414
|
+
getQueryBoundRolesFunc()
|
|
403
415
|
}}
|
|
404
416
|
>
|
|
405
417
|
绑定
|
|
@@ -407,10 +419,10 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
407
419
|
</div>
|
|
408
420
|
<Table
|
|
409
421
|
scroll={{
|
|
410
|
-
x: 1200
|
|
422
|
+
x: 1200
|
|
411
423
|
}}
|
|
412
|
-
size=
|
|
413
|
-
rowKey=
|
|
424
|
+
size='small'
|
|
425
|
+
rowKey='id'
|
|
414
426
|
dataSource={dataList}
|
|
415
427
|
loading={isLoading}
|
|
416
428
|
columns={columns}
|
|
@@ -422,43 +434,43 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
422
434
|
execute({
|
|
423
435
|
innerPageNo,
|
|
424
436
|
innerPageSize,
|
|
425
|
-
accountId: pageId
|
|
426
|
-
})
|
|
437
|
+
accountId: pageId
|
|
438
|
+
})
|
|
427
439
|
}}
|
|
428
440
|
/>
|
|
429
441
|
</>
|
|
430
442
|
)}
|
|
431
|
-
{tabCheck
|
|
443
|
+
{tabCheck === 'tableResource' && (
|
|
432
444
|
<>
|
|
433
445
|
<Table
|
|
434
|
-
style={{ width:
|
|
435
|
-
size=
|
|
436
|
-
rowKey=
|
|
446
|
+
style={{ width: '100%' }}
|
|
447
|
+
size='small'
|
|
448
|
+
rowKey='id'
|
|
437
449
|
loading={isTableLoading}
|
|
438
450
|
pagination={false}
|
|
439
451
|
columns={TableResource}
|
|
440
452
|
dataSource={ResourceTableData || []}
|
|
441
453
|
rowSelection={{
|
|
442
|
-
selectedRowKeys:selectedRowKeys,
|
|
454
|
+
selectedRowKeys: selectedRowKeys,
|
|
443
455
|
getCheckboxProps: (record: any) => {
|
|
444
456
|
return {
|
|
445
457
|
disabled: true
|
|
446
|
-
}
|
|
458
|
+
}
|
|
447
459
|
}
|
|
448
460
|
}}
|
|
449
461
|
expandable={{
|
|
450
|
-
expandedRowKeys:defaultExpandedRowKeys
|
|
462
|
+
expandedRowKeys: defaultExpandedRowKeys //defaultExpandAllRows 不走,不是初始化tab
|
|
451
463
|
}}
|
|
452
464
|
/>
|
|
453
465
|
</>
|
|
454
466
|
)}
|
|
455
467
|
|
|
456
|
-
{tabCheck
|
|
468
|
+
{tabCheck === 'tableEmpower' && (
|
|
457
469
|
<>
|
|
458
470
|
<Table
|
|
459
|
-
style={{ width:
|
|
460
|
-
size=
|
|
461
|
-
rowKey=
|
|
471
|
+
style={{ width: '100%' }}
|
|
472
|
+
size='small'
|
|
473
|
+
rowKey='id'
|
|
462
474
|
dataSource={policy?.dataList}
|
|
463
475
|
loading={policy?.isLoading}
|
|
464
476
|
columns={TablePolicy}
|
|
@@ -470,13 +482,36 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
470
482
|
policy?.execute({
|
|
471
483
|
innerPageNo,
|
|
472
484
|
innerPageSize,
|
|
473
|
-
accountId: pageId
|
|
474
|
-
})
|
|
485
|
+
accountId: pageId
|
|
486
|
+
})
|
|
487
|
+
}}
|
|
488
|
+
/>
|
|
489
|
+
</>
|
|
490
|
+
)}
|
|
491
|
+
{tabCheck === 'tableData' && (
|
|
492
|
+
<>
|
|
493
|
+
<Table
|
|
494
|
+
style={{ width: '100%' }}
|
|
495
|
+
size='small'
|
|
496
|
+
rowKey='bizId'
|
|
497
|
+
loading={isTableByDataLoading}
|
|
498
|
+
pagination={false}
|
|
499
|
+
columns={TableResource}
|
|
500
|
+
dataSource={ResourceData || []}
|
|
501
|
+
rowSelection={{
|
|
502
|
+
selectedRowKeys: selectedDataRowKeys,
|
|
503
|
+
getCheckboxProps: (record: any) => {
|
|
504
|
+
return {
|
|
505
|
+
disabled: true
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}}
|
|
509
|
+
expandable={{
|
|
510
|
+
expandedRowKeys: defaultExpandedDataRowKeys //defaultExpandAllRows 不走,不是初始化tab
|
|
475
511
|
}}
|
|
476
512
|
/>
|
|
477
513
|
</>
|
|
478
514
|
)}
|
|
479
|
-
{tabCheck == "tableData" && <></>}
|
|
480
515
|
</div>
|
|
481
516
|
</div>
|
|
482
517
|
{/* */}
|
|
@@ -489,5 +524,5 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
489
524
|
isBoundRolesFunc={isBoundRolesFunc}
|
|
490
525
|
></EditAccountDrawer>
|
|
491
526
|
</PageContainer>
|
|
492
|
-
)
|
|
527
|
+
)
|
|
493
528
|
}
|