tableConfig.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { Badge } from "antd"
  2. import React from "react"
  3. let type = {
  4. 0: { text: '导入excel成功', color: 'cyan' },
  5. 1: { text: '创建中', color: 'processing' },
  6. 2: { text: '部分成功', color: 'warning' },
  7. 3: { text: '全部成功', color: 'success' },
  8. '-1': { text: '创建失败', color: 'error' },
  9. '-2': { text: '全部失败', color: 'error' },
  10. }
  11. function columns(platformName: string, see: (props:any) => void) {
  12. return [
  13. // {
  14. // title: 'ID',
  15. // dataIndex: 'id',
  16. // key: 'id',
  17. // align: 'center',
  18. // },
  19. {
  20. title: '创建人',
  21. dataIndex: 'createUser',
  22. key: 'createUser',
  23. align: 'center',
  24. render: (a: any) => {
  25. return a?.nickName
  26. }
  27. },
  28. {
  29. title: '创建时间',
  30. dataIndex: 'autoLinkReocrds',
  31. key: 'autoLinkReocrds',
  32. align: 'center',
  33. render: (a: any) => {
  34. return a[0]?.createTime
  35. }
  36. },
  37. {
  38. title: '导入的文件名',
  39. dataIndex: 'fileName',
  40. key: 'fileName',
  41. align: 'center',
  42. },
  43. {
  44. title: '创建状态',
  45. dataIndex: 'createStatus',
  46. key: 'createStatus',
  47. align: 'center',
  48. render: (a: any) => {
  49. return <><Badge text={type[a]?.text} status={type[a]?.color} /></>
  50. }
  51. },
  52. {
  53. title: '导入的记录总数',
  54. dataIndex: 'recordCount',
  55. key: 'recordCount',
  56. align: 'center',
  57. },
  58. {
  59. title: '链接创建成功数',
  60. dataIndex: 'successCount',
  61. key: 'successCount',
  62. align: 'center',
  63. render: (a: any, b: any) => {
  64. return <span style={b?.recordCount !== a ? { color: 'red' } : {}}>{a}</span>
  65. }
  66. },
  67. {
  68. title: '操作',
  69. dataIndex: 'cz',
  70. key: 'cz',
  71. align: 'center',
  72. render: (a:any,data:any) => {
  73. return <>
  74. <a onClick={()=>{see(data)}}>查看详情</a>
  75. </>
  76. }
  77. }
  78. // {
  79. // title: '请求ID',
  80. // dataIndex: 'requestId',
  81. // key: 'requestId',
  82. // align: 'center',
  83. // },
  84. ]
  85. }
  86. export default columns