Merge pull request '更新 Web/src/stores/userInfo.ts' (#43) from 362270511/Admin.NET.Pro:main into main

Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/43
This commit is contained in:
zuohuaijun 2024-07-12 00:18:37 +08:00
commit 6614392375

View File

@ -132,14 +132,17 @@ export const useUserInfo = defineStore('userInfo', {
// 根据字典类型和代码取字典项 // 根据字典类型和代码取字典项
getDictItemByCode(typePCode: string, val: string) { getDictItemByCode(typePCode: string, val: string) {
val = val.toString(); if(val!=undefined)
if (val) { {
const _val = val.toString(); val = val.toString();
const ds = this.getDictDatasByCode(typePCode); if (val) {
for (let index = 0; index < ds.length; index++) { const _val = val.toString();
const element = ds[index]; const ds = this.getDictDatasByCode(typePCode);
if (element.code == _val) { for (let index = 0; index < ds.length; index++) {
return element; const element = ds[index];
if (element.code == _val) {
return element;
}
} }
} }
} }