logTableConfig.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { copy } from "@/utils/utils";
  2. import { DownOutlined } from "@ant-design/icons";
  3. import { Badge, Button, Dropdown, Menu, Space } from "antd"
  4. import React from "react"
  5. function tableConfig(copyCreative: (data: any) => void): any {
  6. return [
  7. {
  8. title: 'ID',
  9. dataIndex: 'id',
  10. key: 'id',
  11. align: 'center',
  12. width: 45,
  13. },
  14. {
  15. title: '媒体账户',
  16. dataIndex: 'accountId',
  17. key: 'accountId',
  18. align: 'center',
  19. width: 80,
  20. render: (a: any, b: any) => {
  21. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  22. }
  23. },
  24. {
  25. title: '商品ID',
  26. dataIndex: 'productId',
  27. key: 'productId',
  28. width: 150,
  29. ellipsis: true,
  30. render: (a: any, b: any) => {
  31. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  32. }
  33. },
  34. {
  35. title: '品牌形象',
  36. dataIndex: 'promotedObjectId',
  37. key: 'promotedObjectId',
  38. width: 140,
  39. align: 'center',
  40. ellipsis: true,
  41. render: (a: any, b: any) => {
  42. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  43. }
  44. },
  45. {
  46. title: '创建状态',
  47. dataIndex: 'createStatus',
  48. key: 'createStatus',
  49. align: 'center',
  50. width: 90,
  51. render: (a: any, b: any) => {
  52. if (a) {
  53. return a === 0 ? <Badge status="warning" text={<span style={{ fontSize: "12px" }}>创建中</span>} /> : a === 100 ? <Badge status="success" text={<span style={{ fontSize: "12px" }}>创建成功</span>} /> : <Badge status="error" text={<span style={{ fontSize: "12px" }}>创建失败</span>} />
  54. } else {
  55. return <span>--</span>
  56. }
  57. }
  58. },
  59. {
  60. title: '创建时间',
  61. dataIndex: 'createTime',
  62. key: 'createTime',
  63. align: 'center',
  64. width: 150,
  65. ellipsis: true,
  66. render: (a: any, b: any) => {
  67. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  68. }
  69. },
  70. {
  71. title: <span style={{ padding: '0 8px' }}>失败原因</span>,
  72. dataIndex: 'failMsg',
  73. key: 'failMsg',
  74. align: 'left',
  75. ellipsis: true,
  76. render: (a: any, b: any) => {
  77. return <a style={{ fontSize: "12px" }} onClick={() => copy(a)}>{a || '--'}</a>
  78. }
  79. },
  80. // {
  81. // title: '操作',
  82. // dataIndex: 'cz',
  83. // key: 'cz',
  84. // width: 100,
  85. // align: 'center',
  86. // render: (a: any, b: any) => {
  87. // return <Dropdown trigger={['click']} overlay={<Menu items={[
  88. // {
  89. // key: '1',
  90. // label: (<Button size="small" type="link" onClick={() => { copyCreative(b) }}>批量复制</Button>)
  91. // }
  92. // ]} />}>
  93. // <a onClick={e => e.preventDefault()} style={{ fontSize: 12 }}>
  94. // <Space>
  95. // 操作
  96. // <DownOutlined />
  97. // </Space>
  98. // </a>
  99. // </Dropdown>
  100. // }
  101. // }
  102. ]
  103. }
  104. export default tableConfig