tableConfig.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { copy } from "@/utils/utils"
  2. import { Space, Popconfirm, TableProps } from "antd"
  3. import React from "react"
  4. const columns = (del: (id: number) => void, edit: (data: any) => void): TableProps<any>['columns'] => {
  5. const data: TableProps<any>['columns'] = [
  6. {
  7. title: '操作',
  8. dataIndex: 'cz',
  9. key: 'cz',
  10. align: 'center',
  11. width: 90,
  12. render: (_, b) => {
  13. return <Space>
  14. <Popconfirm
  15. title="确定删除?"
  16. onConfirm={() => del(b.id)}
  17. okText="是"
  18. cancelText="否"
  19. >
  20. <a style={{ color: 'red', fontSize: 12 }}>删除</a>
  21. </Popconfirm>
  22. <a style={{ fontSize: 12 }} onClick={() => edit(b)}>修改</a>
  23. </Space>
  24. }
  25. },
  26. {
  27. title: '微信小程序名称',
  28. dataIndex: 'appletName',
  29. key: 'appletName',
  30. width: 160,
  31. ellipsis: true,
  32. render: (a) => {
  33. return <span style={{ fontSize: "12px" }}>{a}</span>
  34. }
  35. },
  36. {
  37. title: '微信小程序原始ID',
  38. dataIndex: 'appletId',
  39. key: 'appletId',
  40. width: 180,
  41. ellipsis: true,
  42. render: (a) => {
  43. return <a style={{ fontSize: "12px" }} onClick={() => copy(a)}>{a}</a>
  44. }
  45. },
  46. {
  47. title: '微信小程序路径',
  48. dataIndex: 'appletLink',
  49. key: 'appletLink',
  50. width: 380,
  51. ellipsis: true,
  52. render: (a) => {
  53. return <a style={{ fontSize: "12px" }} onClick={() => copy(a)}>{a}</a>
  54. }
  55. },
  56. {
  57. title: '详细描述',
  58. dataIndex: 'description',
  59. key: 'description',
  60. ellipsis: true,
  61. render: (a) => {
  62. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  63. }
  64. },
  65. {
  66. title: '创建人',
  67. dataIndex: 'createByName',
  68. key: 'createByName',
  69. align: 'center',
  70. width: 75,
  71. ellipsis: true,
  72. render: (a) => {
  73. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  74. }
  75. },
  76. {
  77. title: '更新人',
  78. dataIndex: 'createByName',
  79. key: 'createByName',
  80. align: 'center',
  81. width: 75,
  82. ellipsis: true,
  83. render: (a) => {
  84. return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
  85. }
  86. },
  87. {
  88. title: '创建时间',
  89. dataIndex: 'createTime',
  90. key: 'createTime',
  91. align: 'center',
  92. width: 140,
  93. ellipsis: true,
  94. render: (a) => {
  95. return <span style={{ fontSize: "12px" }}>{a}</span>
  96. }
  97. }
  98. ]
  99. return data
  100. }
  101. export default columns