useUserManageTable.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import useTable, { ModelType, MultipleResponseType } from '@/hooks/useTable'
  2. import type { EpTableColumn } from 'global-type'
  3. const useUserManageTable = (model?: ModelType<'getUserList'>) => {
  4. const { data, ...other } = useTable('getUserList', model, { pageSize: 20 })
  5. const columns: EpTableColumn<MultipleResponseType<'getUserList'>>[] = [
  6. { type: 'selection', width: 60 },
  7. { label: 'ID', prop: 'id', minWidth: 50 },
  8. { label: '姓名', prop: 'name', minWidth: 100 },
  9. { label: '登录名', prop: 'loginName', minWidth: 100 },
  10. { label: '单位', prop: 'employer', minWidth: 100 },
  11. { label: '角色', prop: 'roleName', minWidth: 80 },
  12. {
  13. label: '状态',
  14. prop: 'enable',
  15. minWidth: 50,
  16. formatter(row) {
  17. return row.enable ? '启用' : '禁用'
  18. },
  19. },
  20. { label: '更新人', prop: 'updaterName', minWidth: 100 },
  21. { label: '更新时间', prop: 'updateTime', minWidth: 130 },
  22. { label: '操作', slotName: 'operation', showOverflowTooltip: false, minWidth: 180 },
  23. ]
  24. return {
  25. ...other,
  26. columns,
  27. data,
  28. }
  29. }
  30. export default useUserManageTable