From 01d874746808094013f19fcd2fc9fd3dc4ce4874 Mon Sep 17 00:00:00 2001 From: RubyLiu Date: Mon, 5 Feb 2024 22:25:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/bug-management/index.ts | 29 +- frontend/src/api/requrls/bug-management.ts | 13 + .../components/bug-detail-drawer.vue | 30 +- .../bug-management/components/bugCaseTab.vue | 338 ++++++++---- .../components/bugDetailTab.vue | 511 +++++++++++++++--- .../views/bug-management/createSuccess.vue | 24 +- frontend/src/views/bug-management/edit.vue | 16 +- 7 files changed, 771 insertions(+), 190 deletions(-) diff --git a/frontend/src/api/modules/bug-management/index.ts b/frontend/src/api/modules/bug-management/index.ts index 150c0697ae..810db6ae33 100644 --- a/frontend/src/api/modules/bug-management/index.ts +++ b/frontend/src/api/modules/bug-management/index.ts @@ -4,7 +4,7 @@ import MSR from '@/api/http/index'; import * as bugURL from '@/api/requrls/bug-management'; import { BugEditFormObject, BugExportParams, BugListItem } from '@/models/bug-management'; -import { AssociatedList, OperationFile } from '@/models/caseManagement/featureCase'; +import { AssociatedList, CreateOrUpdateDemand, DemandItem, OperationFile } from '@/models/caseManagement/featureCase'; import { CommonList, TableQueryParams, TemplateOption } from '@/models/common'; /** @@ -181,3 +181,30 @@ export function deleteSingleByRecycle(id: string) { export function deleteBatchByRecycle(data: TableQueryParams) { return MSR.post({ url: bugURL.getBatchDeleteUrl, data }); } + +// ----------------------关联需求 + +// 已关联需求列表 +export function getAssociatedList(data: TableQueryParams) { + return MSR.post>({ url: bugURL.getDemandListUrl, data }); +} + +// 缺陷管理-关联用例-未关联用例-列表分页 +export function getUnAssociatedList(data: TableQueryParams) { + return MSR.post({ url: bugURL.getUnrelatedDemandListUrl, data }); +} + +// 未关联用例-模块树 +export function getModuleTree(data: TableQueryParams) { + return MSR.post({ url: `${bugURL.getUnrelatedModuleTreeUrl}`, data }); +} + +// 批量关联需求 +export function batchAssociation(data: TableQueryParams) { + return MSR.post({ url: bugURL.postAddDemandUrl, data }); +} + +// 取消关联 +export function cancelAssociation(id: string) { + return MSR.get({ url: `${bugURL.getCancelDemandUrl}/${id}` }); +} diff --git a/frontend/src/api/requrls/bug-management.ts b/frontend/src/api/requrls/bug-management.ts index 5bf02bafd4..aa20b9d847 100644 --- a/frontend/src/api/requrls/bug-management.ts +++ b/frontend/src/api/requrls/bug-management.ts @@ -51,3 +51,16 @@ export const getBatchRecoverUrl = '/bug/trash/batch-recover'; export const getDeleteSingleUrl = '/bug/trash/delete/'; // 批量删除 export const getBatchDeleteUrl = '/bug/trash/batch-delete'; + +// 获取关联的需求列表 +export const getDemandListUrl = '/bug/case/page'; +// 批量添加关联 +export const postAddDemandUrl = '/bug/case/relate'; +// 单个取消关联 +export const getCancelDemandUrl = '/bug/case/un-relate/'; +// 未关联的用例列表 +export const getUnrelatedDemandListUrl = '/bug/case/un-relate/page'; +// 未关联的模块树 +export const getUnrelatedModuleTreeUrl = '/bug/case/un-relate/module/tree'; +// 未关联的模块树 数量 +export const getUnrelatedModuleTreeCountUrl = '/bug/case/un-relate/module/count'; diff --git a/frontend/src/views/bug-management/components/bug-detail-drawer.vue b/frontend/src/views/bug-management/components/bug-detail-drawer.vue index 9a41b87589..7d3554255c 100644 --- a/frontend/src/views/bug-management/components/bug-detail-drawer.vue +++ b/frontend/src/views/bug-management/components/bug-detail-drawer.vue @@ -88,20 +88,19 @@ - + - + - + @@ -119,6 +118,7 @@ :form-rule="formRules" class="w-full" :option="options" + @change="handleOK" />
@@ -175,6 +175,7 @@ followBug, getBugDetail, getTemplateById, + updateBug, } from '@/api/modules/bug-management/index'; import useFullScreen from '@/hooks/useFullScreen'; import { useI18n } from '@/hooks/useI18n'; @@ -214,7 +215,7 @@ const activeTab = ref('detail'); - const detailInfo = ref>({}); // 存储当前详情信息,通过loadBug 获取 + const detailInfo = ref>({ match: [] }); // 存储当前详情信息,通过loadBug 获取 const tags = ref([]); // 处理表单格式 @@ -332,6 +333,25 @@ }); } + const handleOK = async () => { + const values = await fApi.value.validate(); + if (values) { + const params = { + id: detailInfo.value.id, + projectId: currentProjectId.value, + ...values, + }; + try { + await updateBug(params); + Message.success(t('common.editSuccess')); + detailDrawerRef.value?.initDetail(); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } + } + }; + // 表单配置项 const options = { resetBtn: false, // 不展示默认配置的重置和提交 diff --git a/frontend/src/views/bug-management/components/bugCaseTab.vue b/frontend/src/views/bug-management/components/bugCaseTab.vue index 24d1ba47c0..50d7686a7d 100644 --- a/frontend/src/views/bug-management/components/bugCaseTab.vue +++ b/frontend/src/views/bug-management/components/bugCaseTab.vue @@ -1,148 +1,286 @@