tableConfig.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import { Popconfirm, Tag } from "antd"
  2. import React from "react"
  3. function columnsPos(handle: (data: any) => void) {
  4. let newArr: any = [
  5. {
  6. title: 'ID',
  7. dataIndex: 'id',
  8. key: 'id',
  9. align: 'center',
  10. width: 60
  11. },
  12. {
  13. title: '玩家ID',
  14. dataIndex: 'userId',
  15. key: 'userId',
  16. align: 'center',
  17. ellipsis: true,
  18. width: 120
  19. },
  20. {
  21. title: '玩家账号',
  22. dataIndex: 'userName',
  23. key: 'userName',
  24. align: 'center',
  25. width: 150,
  26. ellipsis: true,
  27. },
  28. {
  29. title: '玩家昵称',
  30. dataIndex: 'userNickName',
  31. key: 'userNickName',
  32. align: 'center',
  33. width: 120,
  34. ellipsis: true,
  35. },
  36. {
  37. title: '玩家注册时间',
  38. dataIndex: 'regTime',
  39. key: 'regTime',
  40. align: 'center',
  41. width: 120,
  42. ellipsis: true,
  43. },
  44. {
  45. title: '封禁时间',
  46. dataIndex: 'banTime',
  47. key: 'banTime',
  48. align: 'center',
  49. width: 120,
  50. ellipsis: true,
  51. },
  52. {
  53. title: '更新时间',
  54. dataIndex: 'updateTime',
  55. key: 'updateTime',
  56. align: 'center',
  57. width: 120,
  58. ellipsis: true,
  59. },
  60. {
  61. title: '当前封禁状态',
  62. dataIndex: 'status',
  63. key: 'status',
  64. align: 'center',
  65. width: 120,
  66. render: (a: number) => {
  67. if (a === 1) {
  68. return <Tag color="#f50">封禁</Tag>
  69. }
  70. return <Tag color="#108ee9">已解封</Tag>
  71. }
  72. },
  73. {
  74. title: '操作',
  75. dataIndex: 'cz',
  76. key: 'cz',
  77. align: 'center',
  78. width: 80,
  79. fixed: 'right',
  80. render: (a: string, b: any) => (
  81. <Popconfirm
  82. title={b?.status === 1 ? '确定解封?' : '确定封禁?'}
  83. onConfirm={() => { handle && handle(b) }}
  84. okText="是"
  85. cancelText="否"
  86. >
  87. <a style={{ fontSize: "12px", color: b?.status === 1 ? '#108ee9' : '#f50' }}> {b?.status === 1 ? '解封' : '封禁'}</a>
  88. </Popconfirm>
  89. )
  90. }
  91. ]
  92. return newArr
  93. }
  94. export default columnsPos