-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
451c754
commit 03b398a
Showing
21 changed files
with
332 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#请求的环境 | ||
VITE_HTTP_ENV=DEV | ||
#请求地址 | ||
VITE_HTTP_URL=http://192.168.100.43:8201 | ||
VITE_HTTP_URL=https://test.aisuit.com.cn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** 数据字典 */ | ||
export interface Dictionary { | ||
/** 字典名字 */ | ||
label: string; | ||
/** 要素名字(一级指标) */ | ||
charactorLabel: string; | ||
/** 要素下的指标key(二级指标) */ | ||
indicatorKey: string; | ||
/** 要素下的指标名字(二级指标) */ | ||
indicatorLabel: string; | ||
/** 备注 */ | ||
remark: string; | ||
/** 指标公式 */ | ||
formula: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './auth'; | ||
export * from './demo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** 数据字典 */ | ||
export interface ResponseDictionary { | ||
/** 字典名字 */ | ||
modelName: string; | ||
/** 要素名字(一级指标) */ | ||
modelCharactorName: string; | ||
/** 要素下的指标key(二级指标) */ | ||
modelIndicator: string; | ||
/** 要素下的指标名字(二级指标) */ | ||
modelIndicatorName: string; | ||
/** 备注 */ | ||
remarks: string; | ||
/** 指标公式 */ | ||
formula: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './system'; | ||
export * from './route'; | ||
export * from './service'; | ||
export * from './api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* 请求服务的错误类型: | ||
* - axios: axios错误:网络错误, 请求超时, 默认的兜底错误 | ||
* - http: 请求成功,响应的状态码非200的错误 | ||
* - backend: 请求成功,响应的状态码为200,由后端定义的业务错误 | ||
*/ | ||
export type RequestServiceErrorType = 'axios' | 'http' | 'backend'; | ||
|
||
/** 请求服务的错误 */ | ||
export interface RequestServiceError { | ||
/** 请求服务的错误类型 */ | ||
type: RequestServiceErrorType; | ||
/** 错误码 */ | ||
code: string | number; | ||
/** 错误信息 */ | ||
msg: string; | ||
} | ||
|
||
/** 后端接口返回的类型结构 */ | ||
export interface BackendServiceResult { | ||
/** 状态码 */ | ||
code: number; | ||
/** 接口数据 */ | ||
data: any; | ||
/** 接口消息 */ | ||
message: string; | ||
} | ||
|
||
/** 自定义的请求成功结果 */ | ||
export interface CustomSuccessRequestResult<ResponseData> { | ||
/** 请求错误 */ | ||
error: null; | ||
/** 请求数据 */ | ||
data: ResponseData; | ||
/** 网络状态 */ | ||
networkStatus: boolean; | ||
} | ||
|
||
/** 自定义的请求失败结果 */ | ||
export interface CustomFailRequestResult { | ||
/** 请求错误 */ | ||
error: RequestServiceError; | ||
/** 请求数据 */ | ||
data: null; | ||
/** 网络状态 */ | ||
networkStatus: boolean; | ||
} | ||
|
||
/** 自定义的请求结果 */ | ||
export type CustomRequestResult<ResponseData> = CustomSuccessRequestResult<ResponseData> | CustomFailRequestResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +0,0 @@ | ||
import { request } from '../request'; | ||
|
||
/** | ||
* 获取数据字典 | ||
*/ | ||
export async function fetchDictionary(keyword: string) { | ||
await request.post('/ehe/model/getByIndicator', { indiCatorName: keyword }); | ||
} | ||
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { ResponseDictionary, Dictionary } from '@/interface'; | ||
import { request, resultMiddleware } from '../request'; | ||
import { fecthDictionaryMiddleware } from '../middleware'; | ||
|
||
// 接口示例 | ||
|
||
/** | ||
* 获取数据字典(不加middleware处理) | ||
* @param keyword - 关键词 | ||
*/ | ||
export function fetchDictionary(keyword: string) { | ||
return request.post<ResponseDictionary[]>('/emoss-entropy/ehe/model/getByIndicator', { | ||
indiCatorName: keyword | ||
}); | ||
} | ||
|
||
/** | ||
* 获取数据字典(加middleware处理) | ||
* @param keyword - 关键词 | ||
*/ | ||
export async function fetchDictionaryWithMiddleware(keyword: string) { | ||
const res = await request.post<ResponseDictionary[]>('/emoss-entropy/ehe/model/getByIndicator', { | ||
indiCatorName: keyword | ||
}); | ||
|
||
return resultMiddleware<Dictionary[]>(fecthDictionaryMiddleware, [res]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './auth'; | ||
export * from './demo'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ResponseDictionary, Dictionary } from '@/interface'; | ||
|
||
export function fecthDictionaryMiddleware(data: ResponseDictionary[]): Dictionary[] { | ||
return data.map(item => { | ||
const { | ||
modelName: label, | ||
modelCharactorName: charactorLabel, | ||
modelIndicator: indicatorKey, | ||
modelIndicatorName: indicatorLabel, | ||
remarks: remark, | ||
formula | ||
} = item; | ||
|
||
return { | ||
label, | ||
charactorLabel, | ||
indicatorKey, | ||
indicatorLabel, | ||
remark, | ||
formula | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './auth'; | ||
export * from './demo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
03b398a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: