tableConfig.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import { ProColumns } from "@ant-design/pro-components";
  2. export const columns = (enumList:any): ProColumns<any>[] => {
  3. let arr: any =enumList?.CHANGE_TYPE.values
  4. return [
  5. {
  6. title: "ID",
  7. dataIndex: 'id',
  8. hideInSearch: true,
  9. align: "center",
  10. key: "id"
  11. },
  12. {
  13. title: "用户ID",
  14. dataIndex: 'userId',
  15. key: "userId",
  16. align: "center",
  17. hideInSearch: true,
  18. },
  19. {
  20. title: "小说名称",
  21. dataIndex: 'bookInfo',
  22. key: "bookInfo",
  23. align: "center",
  24. hideInSearch: true,
  25. render: (a, b) => {
  26. return b?.bookInfo?.bookName || b?.bookInfo?.bookName
  27. },
  28. },
  29. {
  30. title: "章节/段落名称",
  31. dataIndex: 'longBookChapterName',
  32. key: "longBookChapterName",
  33. align: "center",
  34. hideInSearch: true,
  35. render: (a, b) => {
  36. return b?.paragraphId || b?.chapterInfo?.chapterName
  37. },
  38. },
  39. {
  40. title: "书币变更数量",
  41. tooltip: "(负数:消费、正数:充值)",
  42. dataIndex: 'coinChangeNum',
  43. key: "coinChangeNum",
  44. hideInSearch: true,
  45. align: "center",
  46. },
  47. {
  48. title: "书币变更后剩余书币",
  49. dataIndex: 'coinRemainingNum',
  50. key: "coinRemainingNum",
  51. hideInSearch: true,
  52. align: "center",
  53. },
  54. {
  55. title: "充值金额",
  56. dataIndex: 'rechargeMoney',
  57. key: "rechargeMoney",
  58. hideInSearch: true,
  59. align: "center",
  60. },
  61. {
  62. title: "书币变更类型",
  63. dataIndex: 'changeType',
  64. key: "changeType",
  65. hideInSearch: true,
  66. align: "center",
  67. render: (a: any) => {
  68. return new Map(arr?.map((item: { value: any; description: any; })=>[item.value,item.description])).get(a)
  69. }
  70. },
  71. {
  72. title: "使用时间",
  73. dataIndex: 'createTime',
  74. key: "createTime",
  75. hideInSearch: true,
  76. align: "center",
  77. },
  78. // 搜索条件
  79. {
  80. hideInTable: true,
  81. dataIndex: 'changeType',
  82. title:"书币变更类型",
  83. valueType:'select',
  84. valueEnum:new Map(arr?.map((item: { value: any; description: any; })=>[item.value,item.description]))
  85. },
  86. {
  87. title: "开始时间",
  88. dataIndex: 'startTime',
  89. valueType: 'dateTime',
  90. hideInTable: true
  91. },
  92. {
  93. title: "结束时间",
  94. dataIndex: 'endTime',
  95. valueType: 'dateTime',
  96. hideInTable: true
  97. },
  98. ];
  99. }