tableConfig.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import { Row, Col, Popconfirm } from "antd"
  2. import WidthEllipsis from "@/components/widthEllipsis"
  3. import React from "react"
  4. function columnsPos(toCode: (data: any) => void, editPack: (data: any) => void, del: (id: number) => void, handle: (data: any, type: string) => void) {
  5. let newArr: any = [
  6. {
  7. title: '游戏',
  8. dataIndex: 'gameName',
  9. key: 'gameName',
  10. align: 'center',
  11. width: 90,
  12. render: (a: string) => (<WidthEllipsis value={a} />)
  13. },
  14. {
  15. title: '礼包类型',
  16. dataIndex: 'codeTypeName',
  17. key: 'codeTypeName',
  18. align: 'center',
  19. width: 90,
  20. render: (a: string) => (<WidthEllipsis value={a} />)
  21. },
  22. {
  23. title: '礼包链接',
  24. dataIndex: 'codeLink',
  25. key: 'codeLink',
  26. width: 230,
  27. render: (a: string) => (<WidthEllipsis value={a} isCopy />)
  28. },
  29. {
  30. title: '付费区间(元)',
  31. dataIndex: 'pay',
  32. key: 'pay',
  33. width: 100,
  34. align: 'center',
  35. render: (_: any, b: any) => (b?.conditionDTO?.pay?.min !== null ? <WidthEllipsis value={b?.conditionDTO?.pay?.min + '~' + b?.conditionDTO?.pay?.max} /> : '--')
  36. },
  37. {
  38. title: '注册时间(分钟)',
  39. dataIndex: 'regTime',
  40. key: 'regTime',
  41. width: 100,
  42. align: 'center',
  43. render: (_: any, b: any) => (b?.conditionDTO?.regTime?.min !== null ? <WidthEllipsis value={b?.conditionDTO?.regTime?.min + '~' + b?.conditionDTO?.regTime?.max} /> : '--')
  44. },
  45. {
  46. title: '未登录时间(分钟)',
  47. dataIndex: 'unLogin',
  48. key: 'unLogin',
  49. width: 100,
  50. align: 'center',
  51. render: (_: any, b: any) => (b?.conditionDTO?.unLogin?.min !== null ? <WidthEllipsis value={b?.conditionDTO?.unLogin?.min + '~' + b?.conditionDTO?.unLogin?.max} /> : '--')
  52. },
  53. {
  54. title: '创建人',
  55. dataIndex: 'createByName',
  56. key: 'createByName',
  57. align: 'center',
  58. width: 100,
  59. render: (a: string) => (<WidthEllipsis value={a} />)
  60. },
  61. {
  62. title: '创建时间',
  63. dataIndex: 'createTime',
  64. key: 'createTime',
  65. align: 'center',
  66. width: 135,
  67. render: (a: string) => (<WidthEllipsis value={a} />)
  68. },
  69. {
  70. title: '更新人',
  71. dataIndex: 'updateByName',
  72. key: 'updateByName',
  73. align: 'center',
  74. width: 100,
  75. render: (a: string) => (<WidthEllipsis value={a} />)
  76. },
  77. {
  78. title: '更新时间',
  79. dataIndex: 'updateTime',
  80. key: 'updateTime',
  81. align: 'center',
  82. width: 135,
  83. render: (a: string) => (<WidthEllipsis value={a} />)
  84. },
  85. {
  86. title: '操作',
  87. dataIndex: 'cz',
  88. key: 'cz',
  89. width: 220,
  90. fixed: 'right',
  91. render: (a: string, b: any) => (
  92. <Row justify='center' gutter={[10, 0]}>
  93. <Col><a style={{ fontSize: "12px" }} onClick={() => { toCode(b) }}>礼包码</a></Col>
  94. <Col><a style={{ fontSize: "12px" }} onClick={() => { handle(b, 'log') }}>访问记录</a></Col>
  95. <Col><a style={{ fontSize: "12px" }} onClick={() => { handle(b, 'lq') }}>领取记录</a></Col>
  96. <Col><a style={{ fontSize: "12px" }} onClick={() => { editPack(b) }}>修改</a></Col>
  97. <Col>
  98. <Popconfirm
  99. title="确定删除?"
  100. onConfirm={() => { del(b.id) }}
  101. okText="是"
  102. cancelText="否"
  103. >
  104. <a style={{ fontSize: "12px", color: 'red' }}>删除</a>
  105. </Popconfirm>
  106. </Col>
  107. </Row>
  108. )
  109. }
  110. ]
  111. return newArr
  112. }
  113. export default columnsPos