From 6e9673f7dd981e13bd4cb8f3e3de2a83d683d35a Mon Sep 17 00:00:00 2001 From: qiaoxinjiu Date: Mon, 11 May 2026 14:27:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(plan):=20=E8=AE=A1=E5=88=92=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E6=89=A7=E8=A1=8C=E3=80=81=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=8E=E9=89=B4=E6=9D=83=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 automationApi、PlanAutomationRun、PlanAutomationExecutionList - 计划构建/列表/执行/进度等接入自动化与路由 - request 与 authToken 处理 token 刷新与错误码 Co-authored-by: Cursor --- src/api/automationApi.js | 55 ++ src/api/planApi.js | 6 +- src/components/Home.vue | 1 + .../Plan/PlanAutomationExecutionList.vue | 379 ++++++++ .../TestPlatform/Plan/PlanAutomationRun.vue | 842 ++++++++++++++++++ .../TestPlatform/Plan/PlanBuilder.vue | 27 +- .../TestPlatform/Plan/PlanCaseAdd.vue | 25 +- .../TestPlatform/Plan/PlanExecute.vue | 9 +- src/components/TestPlatform/Plan/PlanList.vue | 87 +- .../TestPlatform/Plan/PlanProgress.vue | 9 +- src/components/User/Login.vue | 6 + src/router/index.js | 14 + src/utils/authToken.js | 58 ++ src/utils/request.js | 117 ++- 14 files changed, 1587 insertions(+), 48 deletions(-) create mode 100644 src/api/automationApi.js create mode 100644 src/components/TestPlatform/Plan/PlanAutomationExecutionList.vue create mode 100644 src/components/TestPlatform/Plan/PlanAutomationRun.vue create mode 100644 src/utils/authToken.js diff --git a/src/api/automationApi.js b/src/api/automationApi.js new file mode 100644 index 0000000..b76c818 --- /dev/null +++ b/src/api/automationApi.js @@ -0,0 +1,55 @@ +import request from '@/utils/request' + +/** POST /automation/plan/run — 文档字段为 camelCase */ +export function runAutomationPlan(data) { + return request({ + url: '/automation/plan/run', + method: 'post', + data: data || {} + }) +} + +/** POST /automation/case/run */ +export function runAutomationCase(data) { + return request({ + url: '/automation/case/run', + method: 'post', + data: data || {} + }) +} + +/** GET /automation/execution/list */ +export function getAutomationExecutionList(params) { + return request({ + url: '/automation/execution/list', + method: 'get', + params: params || {} + }) +} + +/** GET /automation/execution/detail */ +export function getAutomationExecutionDetail(executionId) { + return request({ + url: '/automation/execution/detail', + method: 'get', + params: { executionId } + }) +} + +/** GET /automation/execution/case/list */ +export function getAutomationExecutionCaseList(params) { + return request({ + url: '/automation/execution/case/list', + method: 'get', + params: params || {} + }) +} + +/** POST /automation/execution/poll — body 可选 { executionId },不传则轮询所有待执行任务 */ +export function postAutomationExecutionPoll(data) { + return request({ + url: '/automation/execution/poll', + method: 'post', + data: data || {} + }) +} diff --git a/src/api/planApi.js b/src/api/planApi.js index 4db8b5e..0169f1c 100644 --- a/src/api/planApi.js +++ b/src/api/planApi.js @@ -24,13 +24,13 @@ export function updatePlan(projectId, planId, data) { }) } -export function deletePlan(projectId, planId) { +/** POST /plan/delete,body 传 planId */ +export function deletePlan(planId) { return request({ url: '/plan/delete', method: 'post', data: { - project_id: projectId, - id: planId + planId } }) } diff --git a/src/components/Home.vue b/src/components/Home.vue index 7392b08..daa1ad0 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -264,6 +264,7 @@ export default { if (command === 'logout') { localStorage.removeItem('authUser') localStorage.removeItem('accessToken') + localStorage.removeItem('refreshToken') localStorage.removeItem('userMenus') this.$store.commit('ClearCurrentUser') this.$message.success('已退出登录') diff --git a/src/components/TestPlatform/Plan/PlanAutomationExecutionList.vue b/src/components/TestPlatform/Plan/PlanAutomationExecutionList.vue new file mode 100644 index 0000000..369c71a --- /dev/null +++ b/src/components/TestPlatform/Plan/PlanAutomationExecutionList.vue @@ -0,0 +1,379 @@ + + + + + diff --git a/src/components/TestPlatform/Plan/PlanAutomationRun.vue b/src/components/TestPlatform/Plan/PlanAutomationRun.vue new file mode 100644 index 0000000..3894071 --- /dev/null +++ b/src/components/TestPlatform/Plan/PlanAutomationRun.vue @@ -0,0 +1,842 @@ + + + + + diff --git a/src/components/TestPlatform/Plan/PlanBuilder.vue b/src/components/TestPlatform/Plan/PlanBuilder.vue index 385e132..9473a92 100644 --- a/src/components/TestPlatform/Plan/PlanBuilder.vue +++ b/src/components/TestPlatform/Plan/PlanBuilder.vue @@ -1,7 +1,7 @@