feat(projects): 新增项目、执行、任务等功能
This commit is contained in:
450
src/typings/api/project.d.ts
vendored
Normal file
450
src/typings/api/project.d.ts
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
declare namespace Api {
|
||||
/**
|
||||
* namespace Project
|
||||
*
|
||||
* backend api module: "project/project"
|
||||
*/
|
||||
namespace Project {
|
||||
/** 项目状态编码 */
|
||||
type ProjectStatusCode = 'pending' | 'active' | 'paused' | 'completed' | 'cancelled' | 'archived';
|
||||
|
||||
/** 项目状态动作编码 */
|
||||
type ProjectStatusActionCode = 'auto_start' | 'pause' | 'resume' | 'complete' | 'cancel' | 'reopen' | 'archive';
|
||||
|
||||
/** 项目设置基础信息 */
|
||||
interface ProjectSettingBaseInfo {
|
||||
/** 项目 ID */
|
||||
id: string;
|
||||
/** 项目编码 */
|
||||
projectCode: string;
|
||||
/** 项目名称 */
|
||||
projectName: string;
|
||||
/** 项目方向字典值 */
|
||||
directionCode: string;
|
||||
/** 项目类型字典值 */
|
||||
projectType: string;
|
||||
/** 所属产品 ID */
|
||||
productId: string | null;
|
||||
/** 所属产品名称 */
|
||||
productName: string | null;
|
||||
/** 项目负责人用户昵称 */
|
||||
managerUserNickname: string | null;
|
||||
/** 项目负责人用户 ID */
|
||||
managerUserId: string | null;
|
||||
/** 项目状态编码 */
|
||||
statusCode: ProjectStatusCode;
|
||||
/** 计划开始日期 */
|
||||
plannedStartDate: string | null;
|
||||
/** 计划结束日期 */
|
||||
plannedEndDate: string | null;
|
||||
/** 实际开始日期 */
|
||||
actualStartDate: string | null;
|
||||
/** 实际结束日期 */
|
||||
actualEndDate: string | null;
|
||||
/** 项目说明 */
|
||||
projectDesc: string | null;
|
||||
/** 最近一次状态动作原因 */
|
||||
lastStatusReason: string | null;
|
||||
}
|
||||
|
||||
/** 项目生命周期动作 */
|
||||
interface ProjectLifecycleAction {
|
||||
actionCode: Exclude<ProjectStatusActionCode, 'auto_start'>;
|
||||
actionName: string;
|
||||
needReason: boolean;
|
||||
}
|
||||
|
||||
/** 项目生命周期信息 */
|
||||
interface ProjectLifecycleInfo {
|
||||
statusCode: ProjectStatusCode;
|
||||
lastStatusReason: string | null;
|
||||
availableActions: ProjectLifecycleAction[];
|
||||
}
|
||||
|
||||
/** 执行状态编码 */
|
||||
type ProjectExecutionStatusCode = 'pending' | 'active' | 'paused' | 'completed' | 'cancelled';
|
||||
|
||||
/** 执行动作编码 */
|
||||
type ProjectExecutionActionCode = 'start' | 'pause' | 'resume' | 'cancel';
|
||||
|
||||
/** 任务状态编码 */
|
||||
type ProjectTaskStatusCode = 'pending' | 'active' | 'blocked' | 'completed' | 'cancelled';
|
||||
|
||||
/** 任务动作编码 */
|
||||
type ProjectTaskActionCode = 'start' | 'block' | 'resume' | 'complete' | 'cancel';
|
||||
|
||||
interface LifecycleAction<ActionCode extends string = string> {
|
||||
actionCode: ActionCode;
|
||||
actionName: string;
|
||||
needReason: boolean;
|
||||
}
|
||||
|
||||
interface StatusBoardItem {
|
||||
statusCode: string;
|
||||
statusName: string;
|
||||
count: number;
|
||||
sort: number;
|
||||
terminal?: boolean;
|
||||
}
|
||||
|
||||
interface StatusBoard {
|
||||
total: number;
|
||||
items: StatusBoardItem[];
|
||||
}
|
||||
|
||||
interface ProjectExecution {
|
||||
id: string;
|
||||
projectId: string;
|
||||
projectRequirementId: string | null;
|
||||
executionName: string;
|
||||
executionType: string | null;
|
||||
ownerId: string;
|
||||
ownerNickname?: string | null;
|
||||
statusCode: ProjectExecutionStatusCode;
|
||||
statusName: string | null;
|
||||
terminal: boolean;
|
||||
allowEdit: boolean;
|
||||
availableActions: LifecycleAction<ProjectExecutionActionCode>[];
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
actualStartDate: string | null;
|
||||
actualEndDate: string | null;
|
||||
progressRate: number;
|
||||
executionDesc: string | null;
|
||||
lastStatusReason: string | null;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
interface ExecutionMember {
|
||||
id: string;
|
||||
executionId: string;
|
||||
userId: string;
|
||||
userNickname?: string | null;
|
||||
joinedAt: string | null;
|
||||
removedAt: string | null;
|
||||
removedReason: string | null;
|
||||
}
|
||||
|
||||
/** 执行成员变更事件类型 */
|
||||
type ExecutionMemberActionType = 'join' | 'inactive' | 'owner_transfer_in' | 'owner_transfer_out';
|
||||
|
||||
/** 执行成员变更历史 */
|
||||
interface ExecutionMemberLog {
|
||||
id: string;
|
||||
executionId: string;
|
||||
actionType: ExecutionMemberActionType;
|
||||
userId: string;
|
||||
userNicknameSnapshot: string | null;
|
||||
operatorUserId: string;
|
||||
operatorNicknameSnapshot: string | null;
|
||||
actionTime: string;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
type ExecutionMemberLogSearchParams = CommonType.RecordNullable<
|
||||
Pick<PageParams, 'pageNo' | 'pageSize'> & {
|
||||
actionTypes: ExecutionMemberActionType[];
|
||||
userId: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
}
|
||||
>;
|
||||
|
||||
interface ProjectTask {
|
||||
id: string;
|
||||
projectId: string;
|
||||
executionId: string;
|
||||
parentTaskId: string | null;
|
||||
taskTitle: string;
|
||||
ownerId: string;
|
||||
ownerNickname?: string | null;
|
||||
statusCode: ProjectTaskStatusCode;
|
||||
statusName: string | null;
|
||||
terminal: boolean;
|
||||
allowEdit: boolean;
|
||||
availableActions: LifecycleAction<ProjectTaskActionCode>[];
|
||||
progressRate: number;
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
actualStartDate: string | null;
|
||||
actualEndDate: string | null;
|
||||
taskDesc: string | null;
|
||||
lastStatusReason: string | null;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
type ProjectExecutionSearchParams = CommonType.RecordNullable<
|
||||
Pick<PageParams, 'pageNo' | 'pageSize'> & {
|
||||
keyword: string;
|
||||
executionType: string;
|
||||
ownerId: string;
|
||||
statusCode: string;
|
||||
updateTime: string[];
|
||||
}
|
||||
>;
|
||||
|
||||
type ProjectExecutionStatusBoardParams = CommonType.RecordNullable<{
|
||||
keyword: string;
|
||||
executionType: string;
|
||||
ownerId: string;
|
||||
updateTime: string[];
|
||||
}>;
|
||||
|
||||
interface SaveProjectExecutionParams {
|
||||
executionName: string;
|
||||
executionType: string;
|
||||
ownerId: string;
|
||||
projectRequirementId: string | null;
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
executionDesc: string | null;
|
||||
memberUserIds?: string[];
|
||||
}
|
||||
|
||||
interface ChangeExecutionOwnerParams {
|
||||
newOwnerId: string;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
interface ChangeExecutionStatusParams {
|
||||
actionCode: ProjectExecutionActionCode;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
interface CreateExecutionMemberParams {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
interface InactiveExecutionMemberParams {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
type ProjectTaskSearchParams = CommonType.RecordNullable<
|
||||
Pick<PageParams, 'pageNo' | 'pageSize'> & {
|
||||
keyword: string;
|
||||
parentTaskId: string;
|
||||
ownerId: string;
|
||||
statusCode: string;
|
||||
updateTime: string[];
|
||||
}
|
||||
>;
|
||||
|
||||
type ProjectTaskStatusBoardParams = CommonType.RecordNullable<{
|
||||
keyword: string;
|
||||
parentTaskId: string;
|
||||
ownerId: string;
|
||||
updateTime: string[];
|
||||
}>;
|
||||
|
||||
interface SaveProjectTaskParams {
|
||||
parentTaskId: string | null;
|
||||
taskTitle: string;
|
||||
ownerId: string | null;
|
||||
progressRate?: number;
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
taskDesc: string | null;
|
||||
/** 仅创建任务时生效,编辑接口静默忽略;userId 必须是当前有效执行成员且不能等于 ownerId */
|
||||
assigneeUserIds?: string[];
|
||||
}
|
||||
|
||||
interface ChangeTaskStatusParams {
|
||||
actionCode: ProjectTaskActionCode;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
/** 项目设置参数 */
|
||||
interface ProjectSettings {
|
||||
baseInfo: ProjectSettingBaseInfo;
|
||||
lifecycle: ProjectLifecycleInfo;
|
||||
}
|
||||
|
||||
/** 项目设置基础信息参数 */
|
||||
interface UpdateProjectSettingBaseInfoParams {
|
||||
projectName: string;
|
||||
directionCode: string;
|
||||
projectType: string;
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
projectDesc: string | null;
|
||||
}
|
||||
|
||||
/** 项目成员状态 */
|
||||
type ProjectMemberStatus = 0 | 1;
|
||||
|
||||
interface PageParams {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
interface PageResult<T = any> {
|
||||
total: number;
|
||||
list: T[];
|
||||
}
|
||||
|
||||
/** 项目入口页概览统计 */
|
||||
interface ProjectOverviewSummary {
|
||||
/** 项目状态数量映射,key 为后端状态编码 */
|
||||
statusCounts: Record<string, number>;
|
||||
}
|
||||
|
||||
interface Project {
|
||||
/** 项目 ID */
|
||||
id: string;
|
||||
/** 项目编码 */
|
||||
projectCode: string;
|
||||
/** 项目名称 */
|
||||
projectName: string;
|
||||
/** 项目方向字典值 */
|
||||
directionCode: string;
|
||||
/** 项目类型字典值 */
|
||||
projectType: string;
|
||||
/** 所属产品 ID */
|
||||
productId: string | null;
|
||||
/** 所属产品名称 */
|
||||
productName?: string | null;
|
||||
/** 项目负责人用户 ID */
|
||||
managerUserId: string;
|
||||
/** 项目负责人用户昵称 */
|
||||
managerUserNickname?: string | null;
|
||||
/** 项目状态编码 */
|
||||
statusCode: ProjectStatusCode;
|
||||
/** 计划开始日期 */
|
||||
plannedStartDate: string | null;
|
||||
/** 计划结束日期 */
|
||||
plannedEndDate: string | null;
|
||||
/** 实际开始日期 */
|
||||
actualStartDate: string | null;
|
||||
/** 实际结束日期 */
|
||||
actualEndDate: string | null;
|
||||
/** 进度百分比 */
|
||||
progressRate: number;
|
||||
/** 项目说明 */
|
||||
projectDesc: string | null;
|
||||
/** 最近一次状态动作原因 */
|
||||
lastStatusReason: string | null;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
interface ProjectContext {
|
||||
currentProject: {
|
||||
id: string;
|
||||
projectCode: string;
|
||||
projectName: string;
|
||||
projectType: string;
|
||||
productId: string | null;
|
||||
managerUserId: string;
|
||||
statusCode: ProjectStatusCode;
|
||||
};
|
||||
currentRole: {
|
||||
roleId: string | null;
|
||||
roleCode: string | null;
|
||||
roleName: string | null;
|
||||
guestFlag: boolean;
|
||||
};
|
||||
navs: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
path: string;
|
||||
icon: string;
|
||||
sort: number;
|
||||
}>;
|
||||
buttons: string[];
|
||||
}
|
||||
|
||||
interface ProjectMember {
|
||||
/** 成员关系 ID */
|
||||
id: string;
|
||||
/** 用户 ID */
|
||||
userId: string;
|
||||
/** 用户昵称 */
|
||||
userNickname: string;
|
||||
/** 角色 ID */
|
||||
roleId: string;
|
||||
/** 角色名称 */
|
||||
roleName: string;
|
||||
/** 角色编码 */
|
||||
roleCode: string;
|
||||
/** 是否项目负责人 */
|
||||
managerFlag: boolean;
|
||||
/** 成员状态 */
|
||||
status: ProjectMemberStatus;
|
||||
/** 加入时间 */
|
||||
joinedTime: string;
|
||||
/** 退出时间 */
|
||||
leftTime: string | null;
|
||||
/** 备注 */
|
||||
remark: string | null;
|
||||
}
|
||||
|
||||
/** 项目搜索参数 */
|
||||
type ProjectSearchParams = CommonType.RecordNullable<
|
||||
Pick<PageParams, 'pageNo' | 'pageSize'> & {
|
||||
keyword: string;
|
||||
directionCode: string;
|
||||
projectType: string;
|
||||
productId: string;
|
||||
managerUserId: string;
|
||||
statusCode: ProjectStatusCode;
|
||||
updateTime: string[];
|
||||
}
|
||||
>;
|
||||
|
||||
/** 创建/保存项目参数 */
|
||||
type SaveProjectParams = Pick<Project, 'projectName' | 'directionCode' | 'projectType' | 'projectDesc'> & {
|
||||
projectCode: string | null;
|
||||
productId: string | null;
|
||||
managerUserId: string;
|
||||
plannedStartDate: string | null;
|
||||
plannedEndDate: string | null;
|
||||
actualStartDate?: string | null;
|
||||
actualEndDate?: string | null;
|
||||
};
|
||||
|
||||
/** 更新项目参数 */
|
||||
type UpdateProjectParams = { id: string } & SaveProjectParams;
|
||||
|
||||
/** 变更项目状态参数 */
|
||||
interface ChangeProjectStatusParams {
|
||||
id: string;
|
||||
actionCode: ProjectStatusActionCode;
|
||||
reason: string | null;
|
||||
}
|
||||
|
||||
/** 删除项目参数 */
|
||||
interface DeleteProjectParams {
|
||||
id: string;
|
||||
projectName: string;
|
||||
confirmText: string;
|
||||
reason: string;
|
||||
}
|
||||
|
||||
/** 创建项目成员参数 */
|
||||
interface CreateProjectMemberParams {
|
||||
userId: string;
|
||||
roleId: string;
|
||||
remark: string | null;
|
||||
previousManagerUserId?: string | null;
|
||||
previousManagerRoleId?: string | null;
|
||||
}
|
||||
|
||||
/** 更新项目成员参数 */
|
||||
interface UpdateProjectMemberParams {
|
||||
roleId: string;
|
||||
reason: string | null;
|
||||
remark: string | null;
|
||||
previousManagerUserId?: string | null;
|
||||
previousManagerRoleId?: string | null;
|
||||
}
|
||||
|
||||
/** 移出项目成员参数 */
|
||||
interface InactiveProjectMemberParams {
|
||||
reason: string | null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user