52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import type * as T from './type'
|
|
import http from '@/utils/http'
|
|
|
|
export type * from './type'
|
|
|
|
const BASE_URL = '/project'
|
|
|
|
/** @desc 查询项目列表 */
|
|
export function listProject(query: T.ProjectPageQuery) {
|
|
return http.get<PageRes<T.ProjectResp[]>>(`${BASE_URL}/list`, query)
|
|
}
|
|
|
|
/** @desc 获取项目详情 */
|
|
export function getProject(id: string | number) {
|
|
return http.get<T.ProjectResp>(`${BASE_URL}/${id}`)
|
|
}
|
|
|
|
/** @desc 新增项目 */
|
|
export function addProject(data: any) {
|
|
return http.post(`${BASE_URL}`, data)
|
|
}
|
|
|
|
/** @desc 修改项目 */
|
|
export function updateProject(data: any, id: string | number) {
|
|
return http.put(`${BASE_URL}/${id}`, data)
|
|
}
|
|
|
|
/** @desc 修改项目状态 */
|
|
export function updateProjectStatus(data: any, id: string | number) {
|
|
return http.patch(`${BASE_URL}/${id}/status`, data)
|
|
}
|
|
|
|
/** @desc 删除项目 */
|
|
export function deleteProject(id: string | number) {
|
|
return http.del(`${BASE_URL}/${id}`)
|
|
}
|
|
|
|
/** @desc 导入项目 */
|
|
export function importProject(file: File) {
|
|
const formData = new FormData()
|
|
formData.append('file', file)
|
|
return http.post(`${BASE_URL}/import`, formData, {
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
})
|
|
}
|
|
|
|
/** @desc 导出项目 */
|
|
export function exportProject(query: T.ProjectQuery) {
|
|
return http.download(`${BASE_URL}/export`, query)
|
|
}
|