diff --git a/src/api/project.ts b/src/api/project.ts index 0dc06cf..6bc61e0 100644 --- a/src/api/project.ts +++ b/src/api/project.ts @@ -17,6 +17,7 @@ export type ProjectItem = { projectType?: string; managerId?: number; managerName?: string; + managerAvatar?: string; planStartDate?: string; planEndDate?: string; progress?: number; @@ -60,6 +61,60 @@ export const deleteProject = (id: string) => { return http.request>("delete", `/api/v1/project/${id}`); }; +// ==================== 项目管理 API ==================== + +/** 项目实体 - 根据 OpenAPI 定义(用于编辑) */ +export type Project = { + id?: string; + projectCode?: string; + projectName?: string; + projectType?: string; + description?: string; + objectives?: string; + managerId?: string; + sponsorId?: string; + planStartDate?: string; + planEndDate?: string; + actualStartDate?: string; + actualEndDate?: string; + budget?: number; + cost?: number; + currency?: string; + progress?: number; + status?: string; // draft-草稿, planning-规划中, ongoing-进行中, paused-暂停, completed-已完成, cancelled-已取消 + priority?: string; // critical-关键, high-高, medium-中, low-低 + riskLevel?: string; // high-高, medium-中, low-低 + visibility?: number; // 1-公开, 2-部门内, 3-项目成员 + tags?: string[]; + extraData?: Record; +}; + +/** 修改项目 */ +export const updateProject = (data: Project) => { + return http.request>("put", "/api/v1/project", { data }); +}; + +/** 更新项目状态 */ +export const updateProjectStatus = (id: string, status: string) => { + return http.request>("put", `/api/v1/project/${id}/status`, { + params: { status } + }); +}; + +/** 更新项目进度 */ +export const updateProjectProgress = (id: string, progress: number) => { + return http.request>("put", `/api/v1/project/${id}/progress`, { + params: { progress } + }); +}; + +/** 更新项目经理 */ +export const updateProjectManager = (id: string, managerName: string) => { + return http.request>("put", `/api/v1/project/${id}/manager`, { + params: { managerName } + }); +}; + // ==================== 项目统计 ==================== /** 项目统计数据 - 根据 OpenAPI 定义 */ diff --git a/src/api/项目管理.openapi.json b/src/api/项目管理.openapi.json new file mode 100644 index 0000000..42a362c --- /dev/null +++ b/src/api/项目管理.openapi.json @@ -0,0 +1,396 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "默认模块", + "description": "", + "version": "1.0.0" + }, + "tags": [], + "paths": { + "/api/v1/project": { + "put": { + "summary": "修改项目", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "Authorization", + "in": "header", + "description": "", + "example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95", + "schema": { + "type": "string", + "default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Project", + "description": "" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BaseResponseVoid" + } + } + } + } + }, + "security": [] + } + }, + "/api/v1/project/{id}": { + "delete": { + "summary": "删除项目", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "Authorization", + "in": "header", + "description": "", + "example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95", + "schema": { + "type": "string", + "default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BaseResponseVoid" + } + } + } + } + }, + "security": [] + } + }, + "/api/v1/project/{id}/status": { + "put": { + "summary": "更新项目状态", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "status", + "in": "query", + "description": "", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "Authorization", + "in": "header", + "description": "", + "example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95", + "schema": { + "type": "string", + "default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BaseResponseVoid" + } + } + } + } + }, + "security": [] + } + }, + "/api/v1/project/{id}/progress": { + "put": { + "summary": "更新项目进度", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "progress", + "in": "query", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "Authorization", + "in": "header", + "description": "", + "example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95", + "schema": { + "type": "string", + "default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BaseResponseVoid" + } + } + } + } + }, + "security": [] + } + }, + "/api/v1/project/{id}/manager": { + "put": { + "summary": "更新项目经理", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "managerId", + "in": "query", + "description": "", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "Authorization", + "in": "header", + "description": "", + "example": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95", + "schema": { + "type": "string", + "default": "Bearer b35c6f5b-bc0b-4652-bef2-eca04a5cdd95" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BaseResponseVoid" + } + } + } + } + }, + "security": [] + } + } + }, + "components": { + "schemas": { + "Project": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "", + "format": "int64" + }, + "projectCode": { + "type": "string", + "description": "项目编号" + }, + "projectName": { + "type": "string", + "description": "项目名称" + }, + "projectType": { + "type": "string", + "description": "项目类型" + }, + "description": { + "type": "string", + "description": "项目描述" + }, + "objectives": { + "type": "string", + "description": "项目目标" + }, + "managerId": { + "type": "integer", + "description": "项目经理ID", + "format": "int64" + }, + "sponsorId": { + "type": "integer", + "description": "项目发起人ID", + "format": "int64" + }, + "planStartDate": { + "type": "string", + "description": "计划开始日期" + }, + "planEndDate": { + "type": "string", + "description": "计划结束日期" + }, + "actualStartDate": { + "type": "string", + "description": "实际开始日期" + }, + "actualEndDate": { + "type": "string", + "description": "实际结束日期" + }, + "budget": { + "type": "number", + "description": "项目预算" + }, + "cost": { + "type": "number", + "description": "已花费金额" + }, + "currency": { + "type": "string", + "description": "币种" + }, + "progress": { + "type": "integer", + "description": "进度百分比" + }, + "status": { + "type": "string", + "description": "状态: draft-草稿, planning-规划中, ongoing-进行中, paused-暂停, completed-已完成, cancelled-已取消" + }, + "priority": { + "type": "string", + "description": "优先级: critical-关键, high-高, medium-中, low-低" + }, + "riskLevel": { + "type": "string", + "description": "风险等级: high-高, medium-中, low-低" + }, + "visibility": { + "type": "integer", + "description": "可见性: 1-公开, 2-部门内, 3-项目成员" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "标签列表" + }, + "extraData": { + "type": "object", + "properties": {}, + "description": "扩展数据" + }, + "createBy": { + "type": "integer", + "description": "创建人", + "format": "int64" + }, + "createTime": { + "type": "string", + "description": "创建时间" + }, + "updateBy": { + "type": "integer", + "description": "更新人", + "format": "int64" + }, + "updateTime": { + "type": "string", + "description": "更新时间" + }, + "deleted": { + "type": "integer", + "description": "删除标记" + } + } + }, + "BaseResponseVoid": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "description": "" + }, + "data": { + "description": "", + "type": "null" + }, + "message": { + "type": "string", + "description": "" + } + } + } + }, + "responses": {}, + "securitySchemes": {} + }, + "servers": [], + "security": [] +} diff --git a/src/views/project/index.vue b/src/views/project/index.vue index eb8db97..fba059e 100644 --- a/src/views/project/index.vue +++ b/src/views/project/index.vue @@ -1,8 +1,17 @@