feat(projects): 1、执行、任务、工作日志开发调试;2、增加富文本、附件等支撑

This commit is contained in:
2026-05-12 21:41:39 +08:00
parent 28c47b14a3
commit 5615399a68
59 changed files with 8046 additions and 919 deletions

View File

@@ -8,19 +8,25 @@ import {
safeJsonRequestConfig
} from './shared';
import {
type ExecutionMemberLogResponse,
type ExecutionMemberResponse,
type ExecutionAssigneeLogResponse,
type ExecutionAssigneeResponse,
type ProjectExecutionResponse,
type ProjectLocalDateValue,
type ProjectMemberResponse,
type ProjectTaskResponse,
type TaskAssigneeFromApiResponse,
type TaskAssigneeLogResponse,
type TaskWorklogResponse,
getProjectLifecycleActions,
normalizeExecutionMember,
normalizeExecutionMemberLog,
normalizeExecutionAssignee,
normalizeExecutionAssigneeLog,
normalizeProjectExecution,
normalizeProjectLocalDate,
normalizeProjectMember,
normalizeProjectTask
normalizeProjectTask,
normalizeTaskAssignee,
normalizeTaskAssigneeLog,
normalizeTaskWorklog
} from './project-shared';
const PROJECT_PREFIX = `${WEB_SERVICE_PREFIX}/project/project`;
@@ -159,6 +165,18 @@ export async function fetchCreateProject(data: Api.Project.SaveProjectParams) {
return mapServiceResult(result as ServiceRequestResult<string | number>, normalizeStringId);
}
/** 创建项目(含初始团队,原子接口) */
export async function fetchCreateProjectWithTeam(data: Api.Project.CreateProjectWithTeamParams) {
const result = await request<string | number>({
...safeJsonRequestConfig,
url: `${PROJECT_PREFIX}/create-with-team`,
method: 'post',
data
});
return mapServiceResult(result as ServiceRequestResult<string | number>, normalizeStringId);
}
/** 更新项目 */
export function fetchUpdateProject(data: Api.Project.UpdateProjectParams) {
return request<boolean>({
@@ -340,7 +358,7 @@ export async function fetchGetProjectExecution(projectId: string, executionId: s
}
/** 创建项目执行 */
export async function fetchCreateProjectExecution(projectId: string, data: Api.Project.SaveProjectExecutionParams) {
export async function fetchCreateProjectExecution(projectId: string, data: Api.Project.CreateProjectExecutionParams) {
const result = await request<string | number>({
...safeJsonRequestConfig,
url: getExecutionPrefix(projectId),
@@ -355,7 +373,7 @@ export async function fetchCreateProjectExecution(projectId: string, data: Api.P
export function fetchUpdateProjectExecution(
projectId: string,
executionId: string,
data: Api.Project.SaveProjectExecutionParams
data: Api.Project.UpdateProjectExecutionParams
) {
return request<boolean>({
...safeJsonRequestConfig,
@@ -379,6 +397,20 @@ export function fetchChangeProjectExecutionOwner(
});
}
/** 删除项目执行 */
export function fetchDeleteProjectExecution(
projectId: string,
executionId: string,
data: Api.Project.DeleteProjectExecutionParams
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getExecutionPrefix(projectId)}/${executionId}`,
method: 'delete',
data
});
}
/** 变更项目执行状态 */
export function fetchChangeProjectExecutionStatus(
projectId: string,
@@ -393,28 +425,28 @@ export function fetchChangeProjectExecutionStatus(
});
}
/** 获取项目执行成员 */
export async function fetchGetProjectExecutionMembers(projectId: string, executionId: string) {
const result = await request<ExecutionMemberResponse[]>({
/** 获取项目执行协办人 */
export async function fetchGetProjectExecutionAssignees(projectId: string, executionId: string) {
const result = await request<ExecutionAssigneeResponse[]>({
...safeJsonRequestConfig,
url: `${getExecutionPrefix(projectId)}/${executionId}/members`,
url: `${getExecutionPrefix(projectId)}/${executionId}/assignees`,
method: 'get'
});
return mapServiceResult(result as ServiceRequestResult<ExecutionMemberResponse[]>, data =>
data.map(normalizeExecutionMember)
return mapServiceResult(result as ServiceRequestResult<ExecutionAssigneeResponse[]>, data =>
data.map(normalizeExecutionAssignee)
);
}
/** 创建项目执行成员 */
export async function fetchCreateProjectExecutionMember(
/** 创建项目执行协办人 */
export async function fetchCreateProjectExecutionAssignee(
projectId: string,
executionId: string,
data: Api.Project.CreateExecutionMemberParams
data: Api.Project.CreateExecutionAssigneeParams
) {
const result = await request<string | number>({
...safeJsonRequestConfig,
url: `${getExecutionPrefix(projectId)}/${executionId}/members`,
url: `${getExecutionPrefix(projectId)}/${executionId}/assignees`,
method: 'post',
data
});
@@ -422,37 +454,40 @@ export async function fetchCreateProjectExecutionMember(
return mapServiceResult(result as ServiceRequestResult<string | number>, normalizeStringId);
}
/** 移除项目执行成员 */
export function fetchInactiveProjectExecutionMember(
/** 移除项目执行协办人 */
export function fetchInactiveProjectExecutionAssignee(
projectId: string,
executionId: string,
payload: { memberId: string; data: Api.Project.InactiveExecutionMemberParams }
payload: { assigneeId: string; data: Api.Project.InactiveExecutionAssigneeParams }
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getExecutionPrefix(projectId)}/${executionId}/members/${payload.memberId}/inactive`,
url: `${getExecutionPrefix(projectId)}/${executionId}/assignees/${payload.assigneeId}/inactive`,
method: 'post',
data: payload.data
});
}
/** 获取项目执行成员变更历史分页 */
export async function fetchGetProjectExecutionMemberLogPage(
/** 获取项目执行协办人变更历史分页 */
export async function fetchGetProjectExecutionAssigneeLogPage(
projectId: string,
executionId: string,
params?: Api.Project.ExecutionMemberLogSearchParams
params?: Api.Project.ExecutionAssigneeLogSearchParams
) {
const result = await request<Api.Project.PageResult<ExecutionMemberLogResponse>>({
const result = await request<Api.Project.PageResult<ExecutionAssigneeLogResponse>>({
...safeJsonRequestConfig,
url: `${getExecutionPrefix(projectId)}/${executionId}/member-logs`,
url: `${getExecutionPrefix(projectId)}/${executionId}/assignee-logs`,
method: 'get',
params
});
return mapServiceResult(result as ServiceRequestResult<Api.Project.PageResult<ExecutionMemberLogResponse>>, data => ({
...data,
list: data.list.map(normalizeExecutionMemberLog)
}));
return mapServiceResult(
result as ServiceRequestResult<Api.Project.PageResult<ExecutionAssigneeLogResponse>>,
data => ({
...data,
list: data.list.map(normalizeExecutionAssigneeLog)
})
);
}
/** 获取项目任务分页 */
@@ -529,6 +564,22 @@ export function fetchUpdateProjectTask(
});
}
/** 删除项目任务 */
// eslint-disable-next-line max-params
export function fetchDeleteProjectTask(
projectId: string,
executionId: string,
taskId: string,
data: Api.Project.DeleteProjectTaskParams
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getTaskPrefix(projectId, executionId)}/${taskId}`,
method: 'delete',
data
});
}
/** 变更项目任务状态 */
export function fetchChangeProjectTaskStatus(
projectId: string,
@@ -542,3 +593,148 @@ export function fetchChangeProjectTaskStatus(
data: payload.data
});
}
type TaskWorklogPageResponse = Api.Project.PageResult<TaskWorklogResponse>;
function getWorklogPrefix(projectId: string, executionId: string, taskId: string) {
return `${getTaskPrefix(projectId, executionId)}/${taskId}/worklogs`;
}
/** 获取任务工时分页 */
// eslint-disable-next-line max-params
export async function fetchGetProjectTaskWorklogPage(
projectId: string,
executionId: string,
taskId: string,
params?: Api.Project.TaskWorklogSearchParams
) {
const result = await request<TaskWorklogPageResponse>({
...safeJsonRequestConfig,
url: getWorklogPrefix(projectId, executionId, taskId),
method: 'get',
params
});
return mapServiceResult(result as ServiceRequestResult<TaskWorklogPageResponse>, data => ({
...data,
list: data.list.map(normalizeTaskWorklog)
}));
}
/** 新增任务工时 */
// eslint-disable-next-line max-params
export async function fetchCreateProjectTaskWorklog(
projectId: string,
executionId: string,
taskId: string,
data: Api.Project.SaveTaskWorklogParams
) {
const result = await request<string | number>({
...safeJsonRequestConfig,
url: getWorklogPrefix(projectId, executionId, taskId),
method: 'post',
data
});
return mapServiceResult(result as ServiceRequestResult<string | number>, normalizeStringId);
}
/** 修改任务工时 */
// eslint-disable-next-line max-params
export function fetchUpdateProjectTaskWorklog(
projectId: string,
executionId: string,
taskId: string,
payload: { worklogId: string; data: Api.Project.SaveTaskWorklogParams }
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getWorklogPrefix(projectId, executionId, taskId)}/${payload.worklogId}`,
method: 'put',
data: payload.data
});
}
/** 删除任务工时 */
// eslint-disable-next-line max-params
export function fetchDeleteProjectTaskWorklog(
projectId: string,
executionId: string,
taskId: string,
worklogId: string
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getWorklogPrefix(projectId, executionId, taskId)}/${worklogId}`,
method: 'delete'
});
}
/** 5.6 获取任务协办人列表(仅当前活跃) */
export async function fetchGetProjectTaskAssignees(projectId: string, executionId: string, taskId: string) {
const result = await request<TaskAssigneeFromApiResponse[]>({
...safeJsonRequestConfig,
url: `${getTaskPrefix(projectId, executionId)}/${taskId}/assignees`,
method: 'get'
});
return mapServiceResult(result as ServiceRequestResult<TaskAssigneeFromApiResponse[]>, data =>
data.map(normalizeTaskAssignee)
);
}
/** 5.7 加入任务协办人 */
// eslint-disable-next-line max-params
export async function fetchCreateProjectTaskAssignee(
projectId: string,
executionId: string,
taskId: string,
data: Api.Project.CreateTaskAssigneeParams
) {
const result = await request<string | number>({
...safeJsonRequestConfig,
url: `${getTaskPrefix(projectId, executionId)}/${taskId}/assignees`,
method: 'post',
data
});
return mapServiceResult(result as ServiceRequestResult<string | number>, normalizeStringId);
}
/** 5.8 退出任务协办人 */
// eslint-disable-next-line max-params
export function fetchInactiveProjectTaskAssignee(
projectId: string,
executionId: string,
taskId: string,
assigneeId: string,
data: Api.Project.InactiveTaskAssigneeParams
) {
return request<boolean>({
...safeJsonRequestConfig,
url: `${getTaskPrefix(projectId, executionId)}/${taskId}/assignees/${assigneeId}/inactive`,
method: 'post',
data
});
}
/** 5.9 任务协办人变更历史分页 */
// eslint-disable-next-line max-params
export async function fetchGetProjectTaskAssigneeLogPage(
projectId: string,
executionId: string,
taskId: string,
params?: Api.Project.TaskAssigneeLogSearchParams
) {
const result = await request<Api.Project.PageResult<TaskAssigneeLogResponse>>({
...safeJsonRequestConfig,
url: `${getTaskPrefix(projectId, executionId)}/${taskId}/assignee-logs`,
method: 'get',
params
});
return mapServiceResult(result as ServiceRequestResult<Api.Project.PageResult<TaskAssigneeLogResponse>>, data => ({
...data,
list: data.list.map(normalizeTaskAssigneeLog)
}));
}