useUserManageTable.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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)
  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: 'roleName', minWidth: 80 },
  11. {
  12. label: '状态',
  13. prop: 'enable',
  14. minWidth: 50,
  15. formatter(row) {
  16. return row.enable ? '启用' : '禁用'
  17. },
  18. },
  19. { label: '更新人', prop: 'updaterName', minWidth: 100 },
  20. { label: '更新时间', prop: 'updateTime', minWidth: 130 },
  21. { label: '操作', slotName: 'operation', showOverflowTooltip: false, minWidth: 180 },
  22. ]
  23. return {
  24. ...other,
  25. columns,
  26. data,
  27. }
  28. }
  29. export default useUserManageTable