Ver Fonte

chore: 代码优化

喵你个旺呀 há 1 ano atrás
pai
commit
2565134a4f
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      Web/src/stores/userInfo.ts

+ 3 - 3
Web/src/stores/userInfo.ts

@@ -44,7 +44,7 @@ export const useUserInfo = defineStore('userInfo', {
 			this.dictList = await getAPI(SysDictTypeApi).apiSysDictTypeAllDictListGet().then(res => res.data.result ?? {});
 			this.dictList = await getAPI(SysDictTypeApi).apiSysDictTypeAllDictListGet().then(res => res.data.result ?? {});
 			for (const key in this.dictList) {
 			for (const key in this.dictList) {
 				// 处理字典国际化
 				// 处理字典国际化
-				this.dictList[key].forEach((e: any) => setDictLangMessage(key, e));
+				this.dictList[key].forEach((e: any) => setDictLangMessage(e));
 				if (key.endsWith("Enum")) {
 				if (key.endsWith("Enum")) {
 					this.dictList[key].forEach((e: any) => e.code = Number(e.code));
 					this.dictList[key].forEach((e: any) => e.code = Number(e.code));
 				}
 				}
@@ -125,8 +125,8 @@ export const useUserInfo = defineStore('userInfo', {
 });
 });
 
 
 // 处理字典国际化, 默认显示字典中的value值
 // 处理字典国际化, 默认显示字典中的value值
-const setDictLangMessage = (dictType: string, dict: any) => {
-	dict.langMessage = `message.system.dictType.${dictType}.${dict.code}`;
+const setDictLangMessage = (dict: any) => {
+	dict.langMessage = `message.system.dictType.${dict.typeCode}.${dict.code}`;
 	const value = t(dict.langMessage);
 	const value = t(dict.langMessage);
 	dict.value = value !== dict.langMessage ? value : dict.value;
 	dict.value = value !== dict.langMessage ? value : dict.value;
 }
 }