-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from suyuan32/refactor-interface
Refactor: optimize interface
- Loading branch information
Showing
79 changed files
with
2,030 additions
and
1,119 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,71 @@ | ||
import { defHttp } from '/@/utils/http/axios'; | ||
import { ErrorMessageMode } from '/#/axios'; | ||
import { BaseDataResp, BaseIdReq, BaseListReq, BaseResp } from '/@/api/model/baseModel'; | ||
import { BaseDataResp, BaseListReq, BaseResp, BaseIDsReq, BaseIDReq } from '/@/api/model/baseModel'; | ||
import { ApiInfo, ApiListResp } from './model/apiModel'; | ||
|
||
enum Api { | ||
CreateApi = '/sys-api/api/create', | ||
UpdateApi = '/sys-api/api/update', | ||
GetApiList = '/sys-api/api/list', | ||
CreateOrUpdateApi = '/sys-api/api/create_or_update', | ||
DeleteApi = '/sys-api/api/delete', | ||
GetApiById = '/sys-api/api', | ||
} | ||
|
||
/** | ||
* @description: Get api list | ||
*/ | ||
|
||
export const getApiList = (params: BaseListReq) => { | ||
return defHttp.post<BaseDataResp<ApiListResp>>({ url: Api.GetApiList, params }); | ||
export const getApiList = (params: BaseListReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseDataResp<ApiListResp>>( | ||
{ url: Api.GetApiList, params }, | ||
{ errorMessageMode: mode }, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: Create a new api | ||
*/ | ||
export const createApi = (params: ApiInfo, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.CreateApi, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* author: ryan | ||
* @description: create a new api | ||
* @description: Update the api | ||
*/ | ||
export const createOrUpdateApi = (params: ApiInfo, mode: ErrorMessageMode = 'modal') => { | ||
export const updateApi = (params: ApiInfo, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.CreateOrUpdateApi, params: params }, | ||
{ url: Api.UpdateApi, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* author: Ryan Su | ||
* @description: delete api | ||
* @description: Delete apis | ||
*/ | ||
export const deleteApi = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => { | ||
export const deleteApi = (params: BaseIDsReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.DeleteApi, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: Get api By ID | ||
*/ | ||
export const getApiById = (params: BaseIDReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseDataResp<ApiInfo>>( | ||
{ url: Api.GetApiById, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,71 @@ | ||
import { defHttp } from '/@/utils/http/axios'; | ||
import { ErrorMessageMode } from '/#/axios'; | ||
import { BaseDataResp, BaseListReq, BaseResp, BaseIdsReq, BaseIdReq } from '/@/api/model/baseModel'; | ||
import { BaseDataResp, BaseListReq, BaseResp, BaseIDsReq, BaseIDReq } from '/@/api/model/baseModel'; | ||
import { DepartmentInfo, DepartmentListResp } from './model/departmentModel'; | ||
|
||
enum Api { | ||
CreateOrUpdateDepartment = '/sys-api/department/create_or_update', | ||
CreateDepartment = '/sys-api/department/create', | ||
UpdateDepartment = '/sys-api/department/update', | ||
GetDepartmentList = '/sys-api/department/list', | ||
DeleteDepartment = '/sys-api/department/delete', | ||
BatchDeleteDepartment = '/sys-api/department/batch_delete', | ||
SetDepartmentStatus = '/sys-api/department/status', | ||
GetDepartmentById = '/sys-api/department', | ||
} | ||
|
||
/** | ||
* @description: Get department list | ||
*/ | ||
|
||
export const getDepartmentList = (params: BaseListReq) => { | ||
return defHttp.post<BaseDataResp<DepartmentListResp>>({ url: Api.GetDepartmentList, params }); | ||
export const getDepartmentList = (params: BaseListReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseDataResp<DepartmentListResp>>( | ||
{ url: Api.GetDepartmentList, params }, | ||
{ errorMessageMode: mode }, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: create a new department | ||
* @description: Create a new department | ||
*/ | ||
export const createOrUpdateDepartment = ( | ||
params: DepartmentInfo, | ||
mode: ErrorMessageMode = 'modal', | ||
) => { | ||
export const createDepartment = (params: DepartmentInfo, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.CreateOrUpdateDepartment, params: params }, | ||
{ url: Api.CreateDepartment, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: delete department | ||
* @description: Update the department | ||
*/ | ||
export const deleteDepartment = (params: BaseIdReq, mode: ErrorMessageMode = 'modal') => { | ||
export const updateDepartment = (params: DepartmentInfo, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.DeleteDepartment, params: params }, | ||
{ url: Api.UpdateDepartment, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: batch delete departments | ||
* @description: Delete departments | ||
*/ | ||
export const batchDeleteDepartment = (params: BaseIdsReq, mode: ErrorMessageMode = 'modal') => { | ||
export const deleteDepartment = (params: BaseIDsReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseResp>( | ||
{ url: Api.BatchDeleteDepartment, params: params }, | ||
{ url: Api.DeleteDepartment, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; | ||
|
||
/** | ||
* @description: set the department status | ||
* @description: Get department By ID | ||
*/ | ||
export const setDepartmentStatus = (id: string, status: number) => | ||
defHttp.post({ url: Api.SetDepartmentStatus, params: { id, status } }); | ||
export const getDepartmentById = (params: BaseIDReq, mode: ErrorMessageMode = 'message') => { | ||
return defHttp.post<BaseDataResp<DepartmentInfo>>( | ||
{ url: Api.GetDepartmentById, params: params }, | ||
{ | ||
errorMessageMode: mode, | ||
}, | ||
); | ||
}; |
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.