|
@@ -9,28 +9,24 @@ import React, { useEffect, useState } from 'react';
|
|
|
* @param param0
|
|
|
* @returns
|
|
|
*/
|
|
|
-const RegIpRoleDetails: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode }> = ({ ip, userId, icon }) => {
|
|
|
+const RegIpRoleDetails: React.FC<{ roleId: string, excludeUserType: 0 | 1, icon?: React.ReactNode }> = ({ roleId, excludeUserType, icon }) => {
|
|
|
|
|
|
/*********************************/
|
|
|
- const [queryForm, setQueryForm] = useState<{ pageSize: number, pageNum: number }>({ pageNum: 1, pageSize: 10 })
|
|
|
const [visible, setVisible] = useState<boolean>(false)
|
|
|
const getRoleDetailList = useAjax((params) => getRoleDetailListApi(params))
|
|
|
/*********************************/
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (visible) {
|
|
|
- const params: { regIp: string, excludeUserId?: any } = { regIp: ip, ...queryForm }
|
|
|
- if (userId) {
|
|
|
- params.excludeUserId = userId
|
|
|
- }
|
|
|
+ const params = { roleId, excludeUserType }
|
|
|
getRoleDetailList.run(params)
|
|
|
}
|
|
|
- }, [ip, userId, visible, queryForm])
|
|
|
+ }, [roleId, excludeUserType, visible])
|
|
|
|
|
|
return <>
|
|
|
<a onClick={() => setVisible(true)}>{icon}</a>
|
|
|
{visible && <Modal
|
|
|
- title={<strong>同IP下角色列表{userId ? '(排除同玩家)' : ''}({ip})</strong>}
|
|
|
+ title={<strong>同IP下角色列表{excludeUserType ? '(排除同玩家)' : ''}(角色ID:{roleId})</strong>}
|
|
|
visible={visible}
|
|
|
onCancel={() => setVisible(false)}
|
|
|
footer={null}
|
|
@@ -94,23 +90,13 @@ const RegIpRoleDetails: React.FC<{ ip: any, userId?: any, icon?: React.ReactNode
|
|
|
ellipsis: true
|
|
|
}
|
|
|
]}
|
|
|
- rowKey={'roleId'}
|
|
|
- dataSource={getRoleDetailList?.data?.records}
|
|
|
+ rowKey={(record) => {
|
|
|
+ return record.roleId + '_' + record.gameId + '_' + record.userId
|
|
|
+ }}
|
|
|
+ dataSource={getRoleDetailList?.data}
|
|
|
loading={getRoleDetailList?.loading}
|
|
|
size="small"
|
|
|
bordered
|
|
|
- pagination={{
|
|
|
- total: getRoleDetailList?.data?.total,
|
|
|
- pageSize: getRoleDetailList?.data?.size,
|
|
|
- current: getRoleDetailList?.data?.current
|
|
|
- }}
|
|
|
- onChange={(pagination) => {
|
|
|
- let { current, pageSize } = pagination
|
|
|
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
|
|
|
- newQueryForm.pageNum = current || newQueryForm.pageNum
|
|
|
- newQueryForm.pageSize = pageSize || newQueryForm.pageSize
|
|
|
- setQueryForm({ ...newQueryForm })
|
|
|
- }}
|
|
|
/>
|
|
|
</Modal>}
|
|
|
</>
|