6 changed files with 30 additions and 9 deletions
@ -0,0 +1,15 @@ |
|||||
|
import useUserStore from '@/store/modules/user'; |
||||
|
|
||||
|
export function getNameById(id) { |
||||
|
const userStore = useUserStore(); |
||||
|
const list = userStore.dsSysList || []; |
||||
|
const item = list.find(x => x.id === id); |
||||
|
return item ? item.name : ''; |
||||
|
} |
||||
|
|
||||
|
export function getIdByName(name) { |
||||
|
const userStore = useUserStore(); |
||||
|
const list = userStore.dsSysList || []; |
||||
|
const item = list.find(x => x.name === name); |
||||
|
return item ? item.id : null; |
||||
|
} |
Loading…
Reference in new issue