tableConfig.tsx 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import WidthEllipsis from "@/components/widthEllipsis"
  2. import LookRoleDetails from "@/pages/gameDataStatistics/player/role/lookRoleDetails"
  3. import { Space, Statistic } from "antd"
  4. import React from "react"
  5. function columns12(assignHandle: (data: any) => void): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {
  6. return [
  7. {
  8. label: '基本信息',
  9. data: [
  10. {
  11. title: '角色名称', dataIndex: 'roleName', label: '基本信息', align: 'center', width: 85, default: 1,
  12. render: (a: string) => (<WidthEllipsis value={a} />)
  13. },
  14. {
  15. title: '角色ID', dataIndex: 'roleId', label: '基本信息', align: 'center', width: 85,
  16. render: (a: string) => (<WidthEllipsis value={a} />)
  17. },
  18. {
  19. title: '玩家名称', dataIndex: 'userName', label: '基本信息', align: 'center', width: 90, default: 2,
  20. render: (a: string) => (<WidthEllipsis value={a} />)
  21. },
  22. {
  23. title: '玩家ID', dataIndex: 'userId', label: '基本信息', align: 'center', width: 85,
  24. render: (a: string) => (<WidthEllipsis value={a} />)
  25. },
  26. {
  27. title: '游戏名称', dataIndex: 'gameName', label: '基本信息', align: 'center', width: 85, default: 3,
  28. render: (a: string) => (<WidthEllipsis value={a} />)
  29. },
  30. {
  31. title: '游戏ID', dataIndex: 'gameId', label: '基本信息', align: 'center', width: 85,
  32. render: (a: string) => (<WidthEllipsis value={a} />)
  33. },
  34. {
  35. title: '区服名称', dataIndex: 'serverName', label: '基本信息', align: 'center', width: 80, default: 4,
  36. render: (a: string) => (<WidthEllipsis value={a} />)
  37. },
  38. {
  39. title: '区服ID', dataIndex: 'serverId', label: '基本信息', align: 'center', width: 80,
  40. render: (a: string) => (<WidthEllipsis value={a} />)
  41. },
  42. {
  43. title: '角色创建时间', dataIndex: 'createTime', label: '基本信息', align: 'center', width: 125, default: 5, sorter: true,
  44. render: (a: string, b: any) => (<WidthEllipsis value={a} />)
  45. },
  46. {
  47. title: '角色等级', dataIndex: 'roleLevel', label: '基本信息', align: 'center', width: 60, sorter: true, default: 6,
  48. render: (a: string) => <Statistic value={a || 0} />
  49. },
  50. {
  51. title: '等级上报时间', dataIndex: 'levelTime', label: '基本信息', align: 'center', width: 120, default: 7, sorter: true,
  52. render: (a: string) => (<WidthEllipsis value={a} />)
  53. },
  54. {
  55. title: '等级上报时间距今', dataIndex: 'levelTimeDiff', label: '角色游戏数据', align: 'center', width: 100, default: 8,
  56. render: (_: any, b: any) => {
  57. if (b?.createTime) {
  58. let a = (new Date().getTime() / 1000) - (new Date(b?.levelTime).getTime() / 1000)
  59. function secondsToDhms(seconds: any) {
  60. const days = Math.floor(seconds / (3600 * 24));
  61. const hours = Math.floor((seconds % (3600 * 24)) / 3600);
  62. const minutes = Math.floor((seconds % 3600) / 60);
  63. const remainingSeconds = seconds % 60;
  64. return <span style={{ fontSize: 12, color: (hours + (days * 24)) > 1 ? 'red' : '#000' }}>{`${days ? days + "天" : ''}${hours ? hours + "小时" : ''}${minutes ? minutes + "分" : ''}${remainingSeconds ? remainingSeconds.toFixed(0) + "秒" : ''}`}</span>
  65. }
  66. return a ? secondsToDhms(a) : '--'
  67. } else {
  68. return '--'
  69. }
  70. }
  71. },
  72. {
  73. title: '创角时间至今', dataIndex: 'createTimeDiff', label: '角色游戏数据', align: 'center', width: 100, default: 9,
  74. render: (_: any, b: any) => {
  75. if (b?.createTime) {
  76. let a = (new Date().getTime() / 1000) - (new Date(b?.createTime).getTime() / 1000)
  77. function secondsToDhms(seconds: any) {
  78. const days = Math.floor(seconds / (3600 * 24));
  79. const hours = Math.floor((seconds % (3600 * 24)) / 3600);
  80. const minutes = Math.floor((seconds % 3600) / 60);
  81. const remainingSeconds = seconds % 60;
  82. return <span style={{ fontSize: 12, color: days > 5 ? 'red' : '#000' }}>{`${days ? days + "天" : ''}${hours ? hours + "小时" : ''}${minutes ? minutes + "分" : ''}${remainingSeconds ? remainingSeconds.toFixed(0) + "秒" : ''}`}</span>
  83. }
  84. return a ? secondsToDhms(a) : '--'
  85. } else {
  86. return '--'
  87. }
  88. }
  89. }
  90. ]
  91. },
  92. {
  93. label: '客户管理操作',
  94. data: [
  95. { title: 'GS', dataIndex: 'gsName', label: '客户管理操作', align: 'center', width: 80, default: 10, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  96. { title: '客服', dataIndex: 'customerServiceName', label: '客户管理操作', align: 'center', width: 80, default: 11, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  97. { title: '运营', dataIndex: 'operUserName', label: '客户管理操作', align: 'center', width: 80, default: 12, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
  98. { title: '投手', dataIndex: 'putUserName', label: '客户管理操作', align: 'center', width: 80, default: 13, render: (a: string, b: any) => (<WidthEllipsis value={a} />) }
  99. ]
  100. },
  101. {
  102. label: '操作',
  103. data: [
  104. {
  105. title: '操作',
  106. dataIndex: 'cz',
  107. align: 'center',
  108. width: 60,
  109. label: '操作',
  110. default: 14,
  111. render: (_: any, b: any) => {
  112. return <Space>
  113. <LookRoleDetails userId={b.userId} />
  114. <a style={{ fontSize: 12 }} onClick={() => { assignHandle([b]) }}>指派</a>
  115. </Space>
  116. }
  117. }
  118. ]
  119. }
  120. ]
  121. }
  122. export default columns12