suspectedUser.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. import { useAjax } from '@/Hook/useAjax';
  2. import { getSuspectedRoleDetailListApi } from '@/services/gsData';
  3. import { Modal, Table } from 'antd';
  4. import React, { useEffect, useState } from 'react';
  5. /**
  6. * 疑似同玩家
  7. * @param param0
  8. * @returns
  9. */
  10. const SuspectedUser: React.FC<{ roleId: string, icon?: React.ReactNode }> = ({ roleId, icon }) => {
  11. /*********************************/
  12. const [visible, setVisible] = useState<boolean>(false)
  13. const getSuspectedRoleDetailList = useAjax((params) => getSuspectedRoleDetailListApi(params))
  14. /*********************************/
  15. useEffect(() => {
  16. if (visible) {
  17. const params = { roleId }
  18. getSuspectedRoleDetailList.run(params)
  19. }
  20. }, [roleId, visible])
  21. return <>
  22. <a onClick={() => setVisible(true)}>{icon}</a>
  23. {visible && <Modal
  24. title={<strong>疑似同玩家(角色ID:{roleId})</strong>}
  25. visible={visible}
  26. onCancel={() => setVisible(false)}
  27. footer={null}
  28. width={1000}
  29. >
  30. <Table
  31. columns={[
  32. {
  33. title: '角色名称',
  34. dataIndex: 'roleName',
  35. key: 'roleName',
  36. ellipsis: true,
  37. width: 90
  38. },
  39. {
  40. title: '角色ID',
  41. dataIndex: 'roleId',
  42. key: 'roleId',
  43. align: 'center',
  44. ellipsis: true,
  45. width: 80
  46. },
  47. {
  48. title: '玩家角色战力',
  49. dataIndex: 'combatNum',
  50. key: 'combatNum',
  51. align: 'center',
  52. width: 90
  53. },
  54. {
  55. title: '角色充值金额',
  56. dataIndex: 'roleTotalAmount',
  57. key: 'roleTotalAmount',
  58. align: 'center',
  59. width: 80
  60. },
  61. {
  62. title: '角色等级',
  63. dataIndex: 'roleLevel',
  64. key: 'roleLevel',
  65. align: 'center',
  66. width: 80
  67. },
  68. {
  69. title: '游戏名称',
  70. dataIndex: 'gameName',
  71. key: 'gameName',
  72. align: 'center',
  73. ellipsis: true,
  74. width: 100
  75. },
  76. {
  77. title: '区服名称',
  78. dataIndex: 'serverName',
  79. key: 'serverName',
  80. align: 'center',
  81. ellipsis: true,
  82. width: 100
  83. },
  84. {
  85. title: '区服ID',
  86. dataIndex: 'serverId',
  87. key: 'serverId',
  88. ellipsis: true,
  89. align: 'center',
  90. width: 70
  91. },
  92. {
  93. title: '系统',
  94. dataIndex: 'os',
  95. key: 'os',
  96. align: 'center',
  97. width: 70,
  98. render(value) {
  99. return value || '--'
  100. },
  101. },
  102. {
  103. title: '创建时间',
  104. dataIndex: 'createTime',
  105. key: 'createTime',
  106. align: 'center',
  107. width: 140,
  108. ellipsis: true,
  109. render(value) {
  110. return value || '--'
  111. },
  112. },
  113. {
  114. title: '更新时间',
  115. dataIndex: 'updateTime',
  116. key: 'updateTime',
  117. align: 'center',
  118. width: 140,
  119. ellipsis: true,
  120. render(value) {
  121. return value || '--'
  122. },
  123. },
  124. {
  125. title: '最近登录时间',
  126. dataIndex: 'lastLoginTime',
  127. key: 'lastLoginTime',
  128. align: 'center',
  129. width: 140,
  130. ellipsis: true,
  131. render(value) {
  132. return value || '--'
  133. },
  134. },
  135. {
  136. title: '最近充值时间',
  137. dataIndex: 'lastRechargeTime',
  138. key: 'lastRechargeTime',
  139. align: 'center',
  140. width: 140,
  141. ellipsis: true,
  142. render(value) {
  143. return value || '--'
  144. },
  145. },
  146. ]}
  147. rowKey={(record) => {
  148. return record.roleId + '_' + record.gameId + '_' + record.userId
  149. }}
  150. scroll={{ x: 1000 }}
  151. dataSource={getSuspectedRoleDetailList?.data}
  152. loading={getSuspectedRoleDetailList?.loading}
  153. size="small"
  154. bordered
  155. />
  156. </Modal>}
  157. </>
  158. };
  159. export default SuspectedUser;