123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import {useUserStore} from "@/pinia/user-store";
- const userRoles = useUserStore().userInfo.roles
- export function getGreatestRole() {
- if (userRoles) {
- if (userRoles.indexOf(1) > -1 || userRoles.indexOf('1') > -1) {
- return 1
- }
- if (userRoles.indexOf(2) > -1 || userRoles.indexOf('2') > -1) {
- return 2
- }
- if (userRoles.indexOf(3) > -1 || userRoles.indexOf('3') > -1) {
- return 3
- }
- if (userRoles.indexOf(5) > -1 || userRoles.indexOf('5') > -1) {
- return 5
- }
- if (userRoles.indexOf(8) > -1 || userRoles.indexOf('8') > -1) {
- return 8
- }
- return 99
- }
- }
- export function allWardsVisible() {
- if (userRoles) {
- return userRoles.indexOf(1) > -1 || userRoles.indexOf(2) > -1 || userRoles.indexOf(8) > -1
- }
- return false
- }
- export function isInpatientStaff() {
- if (userRoles) {
- return userRoles.indexOf(3) > -1 || userRoles.indexOf(4) > -1
- }
- return false
- }
- export function recoveryTradePermission() {
- if (userRoles) {
- return userRoles.indexOf(41) > -1
- }
- return false
- }
|