getters.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. export default {
  2. // =========== 用户相关
  3. userId: (state) =>
  4. state.ibps.user.info && state.ibps.user.info.user
  5. ? state.ibps.user.info.user.id
  6. : '', // 用户ID
  7. name: (state) =>
  8. state.ibps.user.info && state.ibps.user.info.employee
  9. ? state.ibps.user.info.employee.name
  10. : '', // 姓名
  11. status: (state) =>
  12. state.ibps.user.info && state.ibps.user.info.employee
  13. ? state.ibps.user.info.employee.status
  14. : '', // 用户状态
  15. org: (state) => (state.ibps.user.info ? state.ibps.user.info.org : {}), // 用户部门信息
  16. role: (state) => (state.ibps.user.info ? state.ibps.user.info.role : []), // 用户角色信息
  17. position: (state) =>
  18. state.ibps.user.info && state.ibps.user.info.employee
  19. ? state.ibps.user.info.employee.positions
  20. : '', // 用户部门信息
  21. mainPosition: (state) =>
  22. state.ibps.user.info && state.ibps.user.info.employee
  23. ? state.ibps.user.info.mainPosition
  24. : {}, // 用户部门信息
  25. isSuper: (state) =>
  26. state.ibps.user.info && state.ibps.user.info.user
  27. ? state.ibps.user.info.user.isSuper === 'Y'
  28. : false, // 是否超级管理员
  29. account: (state) =>
  30. state.ibps.user.info && state.ibps.user.info.user
  31. ? state.ibps.user.info.user.account
  32. : '', // 用户名
  33. regOpen: (state) => state.ibps.user.regOpen, // 注册状态
  34. userInfo: (state) => state.ibps.user.info, // 用户信息
  35. // =========== 租户
  36. tenant: (state) =>
  37. state.ibps.user.info && state.ibps.user.info.mainTenant
  38. ? state.ibps.user.info.mainTenant || {}
  39. : {}, // 当前租户
  40. tenants: (state) =>
  41. state.ibps.user.info && state.ibps.user.info.tenants
  42. ? state.ibps.user.info.tenants || []
  43. : [], // 当前拥有的租户
  44. tenantid: (state) =>
  45. state.ibps.user.info && state.ibps.user.info.tenantId
  46. ? state.ibps.user.info.tenantId || ''
  47. : '', // 租户id
  48. isTenantAdmin: (state) =>
  49. state.ibps.user.info && state.ibps.user.info.isTenantAdmin
  50. ? state.ibps.user.info.isTenantAdmin || false
  51. : false, // 是否租户管理员
  52. single: (state) => state.ibps.api.single, // 单体应用
  53. baseApi: (state) => state.ibps.api.base, // baseAPI地址
  54. websocket: (state) => state.ibps.api.websocket, // websocket地址
  55. isTenantOpen: (state) =>
  56. state.ibps.sass ? state.ibps.sass.tenantOpen : false, // 是否租户模式
  57. designTenantid: (state) =>
  58. state.ibps.user && state.ibps.user.designTenantid
  59. ? state.ibps.user.designTenantid || ''
  60. : '',
  61. // =========== 菜单
  62. menus: (state) => state.ibps.menu.menus, // 菜单
  63. routers: (state) => state.ibps.menu.routers, // 新增的路由表
  64. // =========== 子系统
  65. system: (state) => state.ibps.system.system, // 子系统
  66. activeHeader: (state) => state.ibps.menu.activeHeader,
  67. systemid: (state) =>
  68. state.ibps.system.system ? state.ibps.system.system.id : '', // 子系统id
  69. permissions: (state) => state.ibps.menu.permissions, // 拥有的权限
  70. myform: (state) => (state.ibps.myform ? state.ibps.myform : ''),
  71. // 获取所有用户信息
  72. userList: (state) =>
  73. state.ibps.param && state.ibps.param.userList
  74. ? state.ibps.param.userList
  75. : [],
  76. // 获取所有部门信息
  77. deptList: (state) =>
  78. state.ibps.param && state.ibps.param.deptList
  79. ? state.ibps.param.deptList
  80. : [],
  81. deptListAll: (state) =>
  82. state.ibps.param && state.ibps.param.deptListAll
  83. ? state.ibps.param.deptListAll
  84. : [],
  85. // 获取用户最高层级
  86. level: (state) =>
  87. state.ibps.param && state.ibps.param.level ? state.ibps.param.level : [],
  88. // 获取认证信息
  89. licence: (state) => (state.ibps.licence ? state.ibps.licence.licJson : {}),
  90. // 获取配置信息
  91. setting: (state) =>
  92. state.ibps.param && state.ibps.param.setting ? state.ibps.param.setting : {},
  93. // 获取示例列表
  94. exampleList: (state) =>
  95. state.ibps.page && state.ibps.page.exampleList ? state.ibps.page.exampleList : []
  96. }