diff --git a/frontend/src/api/modules/api-test/management.ts b/frontend/src/api/modules/api-test/management.ts index e906462da9..57954f205d 100644 --- a/frontend/src/api/modules/api-test/management.ts +++ b/frontend/src/api/modules/api-test/management.ts @@ -55,6 +55,7 @@ import { SortCaseUrl, SortDefinitionUrl, SwitchDefinitionScheduleUrl, + ToggleFollowCaseUrl, ToggleFollowDefinitionUrl, TransferFileCaseUrl, TransferFileModuleOptionCaseUrl, @@ -401,6 +402,11 @@ export function getCaseDetail(id: string) { return MSR.get({ url: GetCaseDetailUrl, params: id }); } +// 关注/取消关注接口用例 +export function toggleFollowCase(id: string | number) { + return MSR.get({ url: ToggleFollowCaseUrl, params: id }); +} + /** * 接口用例回收站 */ diff --git a/frontend/src/api/requrls/api-test/management.ts b/frontend/src/api/requrls/api-test/management.ts index ffc7231699..596a7c8447 100644 --- a/frontend/src/api/requrls/api-test/management.ts +++ b/frontend/src/api/requrls/api-test/management.ts @@ -73,6 +73,7 @@ export const ExecuteCaseUrl = '/api/case/run/'; // 单独执行接口用例 export const GetExecuteHistoryUrl = 'api/case/execute/page'; // 获取用的执行历史 export const GetDependencyUrl = '/api/case/get-reference'; // 获取用例的依赖关系 export const GetChangeHistoryUrl = '/api/case/operation-history/page'; // 获取用例的依赖关系 +export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口定义-关注/取消关注 /** * 接口用例回收站 diff --git a/frontend/src/models/apiTest/common.ts b/frontend/src/models/apiTest/common.ts index c46590c373..06989f461c 100644 --- a/frontend/src/models/apiTest/common.ts +++ b/frontend/src/models/apiTest/common.ts @@ -373,7 +373,7 @@ export interface ExecutePluginRequestParams { // 执行接口调试入参 export interface ExecuteRequestParams { id?: string; - reportId: string; + reportId?: string; environmentId: string; uploadFileIds: string[]; linkFileIds: string[]; diff --git a/frontend/src/models/apiTest/management.ts b/frontend/src/models/apiTest/management.ts index 8bbec7c8bf..eb2e402e49 100644 --- a/frontend/src/models/apiTest/management.ts +++ b/frontend/src/models/apiTest/management.ts @@ -343,8 +343,10 @@ export interface AddApiCaseParams extends ExecuteRequestParams { name: string; priority: string; status: string; - apiDefinitionId: string | number; + apiDefinitionId?: string | number; tags: string[]; + deleteFileIds?: string[]; + unLinkFileIds?: string[]; } export interface ApiRunModeRequest { diff --git a/frontend/src/views/api-test/components/requestComposition/index.vue b/frontend/src/views/api-test/components/requestComposition/index.vue index f9f03f06b8..9f0284770a 100644 --- a/frontend/src/views/api-test/components/requestComposition/index.vue +++ b/frontend/src/views/api-test/components/requestComposition/index.vue @@ -139,7 +139,7 @@ -
+
(); @@ -409,6 +410,12 @@ } } + watchEffect(() => { + if (!props.isCase) return; + // case编辑后需要刷新数据 + previewDetail.value = cloneDeep(props.detail); // props.detail是嵌套的引用类型,防止不必要的修改来源影响props.detail的数据 + }); + watch( () => props.detail.id, () => { diff --git a/frontend/src/views/api-test/management/components/management/api/preview/index.vue b/frontend/src/views/api-test/management/components/management/api/preview/index.vue index d6e407bfa0..900e1a32dd 100644 --- a/frontend/src/views/api-test/management/components/management/api/preview/index.vue +++ b/frontend/src/views/api-test/management/components/management/api/preview/index.vue @@ -2,19 +2,6 @@
- - - - (); const emit = defineEmits(['updateFollow']); @@ -113,7 +97,6 @@ () => props.detail.id, () => { previewDetail.value = cloneDeep(props.detail); // props.detail是嵌套的引用类型,防止不必要的修改来源影响props.detail的数据 - if (props.isCaseDetail) return; const tableParam = getValidRequestTableParams(previewDetail.value); // 在编辑props.detail时,参数表格会多出一行默认数据,需要去除 previewDetail.value = { ...previewDetail.value, @@ -137,66 +120,49 @@ } ); - const description = computed(() => { - const commonDescription = [ - { - key: 'type', - locale: 'apiTestManagement.apiType', - value: previewDetail.value.method, - }, - { - key: 'path', - locale: 'apiTestManagement.path', - value: previewDetail.value.url || previewDetail.value.path, - }, - { - key: 'tags', - locale: 'common.tag', - value: previewDetail.value.tags, - }, - ]; - if (!props.isCaseDetail) { - return [ - ...commonDescription, - ...[ - { - key: 'description', - locale: 'common.desc', - value: previewDetail.value.description, - width: '100%', - }, - { - key: 'belongModule', - locale: 'apiTestManagement.belongModule', - value: findNodeByKey(props.moduleTree, previewDetail.value.moduleId, 'id')?.path, - }, - { - key: 'creator', - locale: 'common.creator', - value: previewDetail.value.createUserName, - }, - { - key: 'createTime', - locale: 'apiTestManagement.createTime', - value: dayjs(previewDetail.value.createTime).format('YYYY-MM-DD HH:mm:ss'), - }, - { - key: 'updateTime', - locale: 'apiTestManagement.updateTime', - value: dayjs(previewDetail.value.updateTime).format('YYYY-MM-DD HH:mm:ss'), - }, - ], - ]; - } - // 处理用例详情的 - const caseDescription = commonDescription.slice(); - caseDescription.splice(1, 0, { - key: 'priority', - locale: 'case.caseLevel', - value: previewDetail.value.priority, - }); - return caseDescription; - }); + const description = computed(() => [ + { + key: 'type', + locale: 'apiTestManagement.apiType', + value: previewDetail.value.method, + }, + { + key: 'path', + locale: 'apiTestManagement.path', + value: previewDetail.value.url || previewDetail.value.path, + }, + { + key: 'tags', + locale: 'common.tag', + value: previewDetail.value.tags, + }, + { + key: 'description', + locale: 'common.desc', + value: previewDetail.value.description, + width: '100%', + }, + { + key: 'belongModule', + locale: 'apiTestManagement.belongModule', + value: findNodeByKey(props.moduleTree, previewDetail.value.moduleId, 'id')?.path, + }, + { + key: 'creator', + locale: 'common.creator', + value: previewDetail.value.createUserName, + }, + { + key: 'createTime', + locale: 'apiTestManagement.createTime', + value: dayjs(previewDetail.value.createTime).format('YYYY-MM-DD HH:mm:ss'), + }, + { + key: 'updateTime', + locale: 'apiTestManagement.updateTime', + value: dayjs(previewDetail.value.updateTime).format('YYYY-MM-DD HH:mm:ss'), + }, + ]); const followLoading = ref(false); async function toggleFollowReview() { diff --git a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue index 9dc185a579..1c120a81ca 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue @@ -1,33 +1,126 @@ + + diff --git a/frontend/src/views/api-test/management/components/management/case/caseDetailDrawer.vue b/frontend/src/views/api-test/management/components/management/case/caseDetailDrawer.vue new file mode 100644 index 0000000000..162adb29f5 --- /dev/null +++ b/frontend/src/views/api-test/management/components/management/case/caseDetailDrawer.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/frontend/src/views/api-test/management/components/management/case/caseTable.vue b/frontend/src/views/api-test/management/components/management/case/caseTable.vue index 18e2702a26..227ea635c2 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseTable.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseTable.vue @@ -1,6 +1,6 @@