199 lines
5.2 KiB
TypeScript
199 lines
5.2 KiB
TypeScript
import httpFetch from "@/api/fetch"
|
|
import { Project, ProjectDetail, ReviewUsers } from "./typing"
|
|
import { BASE_LABEL_API } from "../const"
|
|
|
|
// 获取项目列表
|
|
export const getProjectList = (data: Project.ListRequest) => {
|
|
return httpFetch<Project.ListResponse>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/list",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 获取项目详情
|
|
export const getProjectDetailById = (id: number) => {
|
|
return httpFetch<ProjectDetail.DataProps>({
|
|
url: BASE_LABEL_API + `/api/v1/label_server/project/detail/${id}`,
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 校验项目源数据
|
|
export const checkLabelDataSource = (data: Project.CheckRequest) => {
|
|
return httpFetch<Project.CheckResponse>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/check_data",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 创建项目
|
|
export const projectAdd = (data: Project.CreateProps) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/add",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 审核项目
|
|
export const projectReview = (data: Project.CreateProps) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/review",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 配置项目
|
|
export const projectConfig = (data: Project.ConfigProps) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/config",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 编辑项目
|
|
export const projectEditById = (data: any, id: number) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + `/api/v1/label_server/project/edit/${id}`,
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 审核试标项目
|
|
export const projectPreLabelReview = (data: Project.PreLabelProps) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/prototype_review",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 提交验收
|
|
export const projectDeliver = (data: { project_id: number }) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/deliver",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 完成项目
|
|
export const projectAccept = (data: { project_id: number; pass: boolean }) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/accept",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 收藏项目
|
|
export const projectCollect = (data: {
|
|
project_id: number
|
|
is_collect: boolean
|
|
}) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/collect",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 获取项目抽检比例
|
|
export const getReviewScaleList = (params: { project_id: number }) => {
|
|
return httpFetch<any[]>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/review_scale/list",
|
|
method: "GET",
|
|
data: params,
|
|
})
|
|
}
|
|
|
|
// 保存抽检比例
|
|
export const saveUserReviewScale = (data: Project.ReviewScaleProps) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/review_scale/save",
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
export const getProjectDetail = (id: number) => {
|
|
return httpFetch<Project.DetailResponse>({
|
|
url: BASE_LABEL_API + `/api/v1/label_server/project/detail/${id}`,
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 重新生成Embedding
|
|
export const regenerateProjectEmbedding = (data: { project_id: number }) => {
|
|
return httpFetch({
|
|
url: BASE_LABEL_API + `/api/v1/label_server/project/regenerate_embedding`,
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
})
|
|
}
|
|
|
|
// 获取个人参与项目
|
|
export const getPersonProjectDashBoard = () => {
|
|
return httpFetch<Array<Project.PersonProjectDashboardResponseItem>>({
|
|
url:
|
|
BASE_LABEL_API + `/api/v1/label_server/data_statistics/personal_project`,
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 获取个人看板数据
|
|
export const getCurrentPersonData = (params: { date: string }) => {
|
|
return httpFetch<{
|
|
label_data_size: number
|
|
label_work_time: number
|
|
review1_data_size: number
|
|
review1_work_time: number
|
|
review2_data_size: number
|
|
review2_work_time: number
|
|
}>({
|
|
url:
|
|
BASE_LABEL_API +
|
|
"/api/v1/label_server/data_statistics/personal_dashboard",
|
|
method: "GET",
|
|
data: params,
|
|
})
|
|
}
|
|
|
|
/* ****************************** Options ****************************** */
|
|
// 获取项目所属业务列表
|
|
export const getProjectTypeList = () => {
|
|
return httpFetch<string[]>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/type_list",
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 获取项目管理员列表
|
|
export const getProjectAdminList = () => {
|
|
return httpFetch<Array<{ label: string; value: number }>>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/admin_list",
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 获取项目审核员
|
|
export const getProjectReviewers = () => {
|
|
return httpFetch<ReviewUsers>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/reviewer_map",
|
|
method: "GET",
|
|
})
|
|
}
|
|
|
|
// 获取用户有权限的项目
|
|
export const getSelfProjectList = () => {
|
|
return httpFetch<Array<{ label: string; value: number }>>({
|
|
url: BASE_LABEL_API + "/api/v1/label_server/project/self",
|
|
method: "GET",
|
|
})
|
|
}
|