소스 검색

适配新的对象结构

Signed-off-by: skywolf627 <skywolf627@qq.com>
skywolf627 2 년 전
부모
커밋
457ec0c511
1개의 변경된 파일4개의 추가작업 그리고 16개의 파일을 삭제
  1. 4 16
      Web/src/utils/constHelper.ts

+ 4 - 16
Web/src/utils/constHelper.ts

@@ -1,6 +1,5 @@
 import type { App } from 'vue';
 import { useUserInfo } from '/@/stores/userInfo';
-import request from '/@/utils/request';
 
 export function setupConstFilter(app: App) {
 	// 全局过滤器  在vue文件中调用  $filters.codeToName(code,type)
@@ -15,12 +14,8 @@ export function setupConstFilter(app: App) {
 export function codeToName(code: any, type: any) {
 	const userStore = useUserInfo();
 	try {
-		const name = userStore.constList
-			.filter((x: any) => x.code === type)
-			.map((x: any) => x.data)
-			.map((x: any) => x.filter((y: any) => y.code === code))
-			.map((x: any) => x[0].name);
-		return name[0];
+		const name = userStore.constList.find((x: any) => x.code === type).data.result.find((x: any) => x.code === code)?.name;
+		return name;
 	} catch (error) {
 		return code;
 	}
@@ -28,13 +23,6 @@ export function codeToName(code: any, type: any) {
 
 export function getConstType(type: any) {
 	const userStore = useUserInfo();
-	const constType = userStore.constList.filter((x: any) => x.code === type)[0].data;
+	const constType = userStore.constList.filter((x: any) => x.code === type)[0].data.result;
 	return constType;
-}
-
-export function getConstSelectorList(typeName: string) {
-	return request({
-		url: `/api/sysConst/data/${typeName}`,
-		method: 'get',
-	});
-}
+}