C4file.ts 793 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. export type C4tableType = {
  2. createTime: string
  3. creatorId: number
  4. creatorName: string
  5. fileName: string
  6. filePath: string
  7. fileSize: string
  8. id: number
  9. joinName: string
  10. joinNum: string
  11. moduleId: number
  12. moduleName: string
  13. parentId: number
  14. thumb: string
  15. type: string
  16. updateTime: string
  17. }
  18. // 初始化状态
  19. const initState = {
  20. // 列表数据
  21. tableInfo: {
  22. list: [] as C4tableType[],
  23. total: 0
  24. }
  25. }
  26. // 定义 action 类型
  27. type Props = {
  28. type: 'C4/getList'
  29. payload: { list: C4tableType[]; total: number }
  30. }
  31. // reducer
  32. export default function Reducer(state = initState, action: Props) {
  33. switch (action.type) {
  34. // 获取列表数据
  35. case 'C4/getList':
  36. return { ...state, tableInfo: action.payload }
  37. default:
  38. return state
  39. }
  40. }