refactor: API类型声明优化调整

Former-commit-id: 0ae696c2e872fa90feba0c5df9a92391c02d3e0b
This commit is contained in:
haoxr
2022-11-08 22:53:42 +08:00
parent 94b93f02a1
commit b39ff7b1f6
38 changed files with 468 additions and 513 deletions

77
src/api/dept/index.ts Normal file
View File

@@ -0,0 +1,77 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeptForm, DeptQuery, Dept } from './types';
/**
* 部门树形表格
*
* @param queryParams
*/
export function listDepartments(queryParams?: DeptQuery): AxiosPromise<Dept[]> {
return request({
url: '/api/v1/dept',
method: 'get',
params: queryParams
});
}
/**
* 部门下拉列表
*/
export function listDeptOptions(): AxiosPromise<OptionType[]> {
return request({
url: '/api/v1/dept/options',
method: 'get'
});
}
/**
* 获取部门详情
*
* @param id
*/
export function getDeptForm(id: string): AxiosPromise<DeptForm> {
return request({
url: '/api/v1/dept/' + id + '/form',
method: 'get'
});
}
/**
* 新增部门
*
* @param data
*/
export function addDept(data: DeptForm) {
return request({
url: '/api/v1/dept',
method: 'post',
data: data
});
}
/**
* 修改部门
*
* @param id
* @param data
*/
export function updateDept(id: string, data: DeptForm) {
return request({
url: '/api/v1/dept/' + id,
method: 'put',
data: data
});
}
/**
* 删除部门
*
* @param ids
*/
export function deleteDept(ids: string) {
return request({
url: '/api/v1/dept/' + ids,
method: 'delete'
});
}