getters.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. userName: 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. role: state => (state.ibps.user.info ? state.ibps.user.info.role : []), // 用户信息
  16. position: state =>
  17. state.ibps.user.info && state.ibps.user.info.employee
  18. ? state.ibps.user.info.employee.positions
  19. : '', // 用户部门信息
  20. mainPosition: state =>
  21. state.ibps.user.info && state.ibps.user.info.employee
  22. ? state.ibps.user.info.mainPosition
  23. : {}, // 用户部门信息
  24. isSuper: state =>
  25. state.ibps.user.info && state.ibps.user.info.user
  26. ? state.ibps.user.info.user.isSuper === 'Y'
  27. : false, // 是否超级管理员
  28. account: state =>
  29. state.ibps.user.info && state.ibps.user.info.user
  30. ? state.ibps.user.info.user.account
  31. : '', // 用户名
  32. regOpen: state => state.ibps.user.regOpen, // 注册状态
  33. userInfo: state => state.ibps.user.info, // 用户信息
  34. hasDataChange: state => state.ibps.app.hasDataChange, // 是否有数据修改
  35. // ============ 表单
  36. form: state => state.ibps.form,
  37. single: state => state.ibps.api.single, // 单体应用
  38. baseApi: state => state.ibps.api.base, // baseAPI地址
  39. websocket: state => state.ibps.api.websocket, // websocket地址
  40. // 获取所有角色信息
  41. roleList: state =>
  42. state.ibps.param && state.ibps.param.roleList
  43. ? state.ibps.param.roleList
  44. : [],
  45. // 获取所有用户信息
  46. userList: state =>
  47. state.ibps.param && state.ibps.param.userList
  48. ? state.ibps.param.userList
  49. : [],
  50. // 获取所有部门信息
  51. deptList: state =>
  52. state.ibps.param && state.ibps.param.deptList
  53. ? state.ibps.param.deptList
  54. : [],
  55. // 获取所有流程信息
  56. flowList: state =>
  57. state.ibps.param && state.ibps.param.flowList
  58. ? state.ibps.param.flowList
  59. : [],
  60. // 获取用户最高层级
  61. level: state =>
  62. state.ibps.param && state.ibps.param.level ? state.ibps.param.level : [],
  63. // 获取配置信息
  64. setting: (state) =>
  65. state.ibps.param && state.ibps.param.setting ? state.ibps.param.setting : {}
  66. }