tableConfig.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import TargetingTooltip from "@/pages/launchSystemV3/components/TargetingTooltip";
  2. import { QuestionCircleFilled } from "@ant-design/icons";
  3. import { Button, Popover, Space, Typography } from "antd";
  4. import { ColumnsType } from "antd/es/table";
  5. import React from "react";
  6. export function TableConfig(geoLocationList: any, modelList: any, editHandle: (data: any, isCopy?: boolean) => void): ColumnsType<any> {
  7. let arr: ColumnsType<any> = [
  8. {
  9. title: '定向模板名称',
  10. dataIndex: 'targetingName',
  11. key: 'targetingName',
  12. width: 300,
  13. fixed: 'left',
  14. render(value, records) {
  15. return <div style={{ width: '100%', display: 'flex', alignItems: 'center' }}>
  16. <div style={{ width: 'calc(100% - 20px)' }}><Typography.Text ellipsis={{ tooltip: true }}>{value}</Typography.Text></div>
  17. <Popover
  18. placement="right"
  19. overlayInnerStyle={{ maxWidth: 350, maxHeight: 350, overflow: 'hidden', overflowY: 'auto' }}
  20. mouseEnterDelay={0.5}
  21. content={<TargetingTooltip
  22. data={records?.targeting}
  23. geoLocationList={geoLocationList}
  24. modelList={modelList}
  25. taskType={records?.taskType}
  26. />}
  27. >
  28. <QuestionCircleFilled />
  29. </Popover>
  30. </div>
  31. }
  32. },
  33. {
  34. title: '关联账户',
  35. dataIndex: 'accountId',
  36. key: 'accountId',
  37. align: 'center',
  38. width: 80,
  39. ellipsis: true,
  40. render(value) {
  41. return value || '不限'
  42. },
  43. },
  44. {
  45. title: '定向模板描述',
  46. dataIndex: 'description',
  47. key: 'description',
  48. width: 150,
  49. ellipsis: true,
  50. render(value) {
  51. return value || '--'
  52. }
  53. },
  54. {
  55. title: '创建人',
  56. dataIndex: 'createByName',
  57. key: 'createByName',
  58. align: 'center',
  59. width: 100,
  60. ellipsis: true,
  61. render(value) {
  62. return value || '--'
  63. }
  64. },
  65. {
  66. title: '创建时间',
  67. dataIndex: 'createTime',
  68. key: 'createTime',
  69. align: 'center',
  70. width: 140,
  71. ellipsis: true,
  72. },
  73. {
  74. title: '操作',
  75. dataIndex: 'cz',
  76. key: 'cz',
  77. align: 'center',
  78. fixed: 'right',
  79. width: 120,
  80. render: (a: any, b: any) => {
  81. return <Space wrap>
  82. <Button type="link" style={{ padding: 0, fontSize: 12 }} onClick={() => { editHandle(b) }} >编辑</Button>
  83. <Button type="link" style={{ padding: 0, fontSize: 12 }} onClick={() => { editHandle(b, true) }} >复制</Button>
  84. </Space>
  85. }
  86. },
  87. ]
  88. return arr
  89. }