refactor(接口管理): 调整执行结果样式
This commit is contained in:
parent
9b0a28ac9f
commit
83fedebb8a
|
@ -492,5 +492,5 @@ export function getReportById(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCaseReportDetail(reportId: string, stepId: string) {
|
export function getCaseReportDetail(reportId: string, stepId: string) {
|
||||||
return MSR.get<ApiCaseReportDetail>({ url: `${GetCaseReportDetailUrl + reportId}/${stepId}` });
|
return MSR.get<ApiCaseReportDetail[]>({ url: `${GetCaseReportDetailUrl + reportId}/${stepId}` });
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,22 @@
|
||||||
width: 960px;
|
width: 960px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-modal-response {
|
||||||
|
.arco-modal {
|
||||||
|
width: 800px;
|
||||||
|
height: 467px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-modal-response-body{
|
||||||
|
.arco-modal .arco-modal-body{
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.ms-modal-small {
|
.ms-modal-small {
|
||||||
.arco-modal {
|
.arco-modal {
|
||||||
width: 480px;
|
width: 480px;
|
||||||
|
|
|
@ -115,7 +115,10 @@
|
||||||
</a-popover> -->
|
</a-popover> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a-spin :loading="props.loading" class="h-[calc(100%-35px)] w-full px-[18px] pb-[18px]">
|
<a-spin
|
||||||
|
:loading="props.loading"
|
||||||
|
:class="[isResponseModel ? 'h-[326px] w-full' : 'h-[calc(100%-35px)] w-full px-[18px] pb-[18px]']"
|
||||||
|
>
|
||||||
<edit
|
<edit
|
||||||
v-if="props.isEdit && activeResponseType === 'content' && innerResponseDefinition"
|
v-if="props.isEdit && activeResponseType === 'content' && innerResponseDefinition"
|
||||||
v-model:response-definition="innerResponseDefinition"
|
v-model:response-definition="innerResponseDefinition"
|
||||||
|
@ -164,6 +167,7 @@
|
||||||
isEdit?: boolean; // 是否可编辑
|
isEdit?: boolean; // 是否可编辑
|
||||||
uploadTempFileApi?: (...args) => Promise<any>; // 上传临时文件接口
|
uploadTempFileApi?: (...args) => Promise<any>; // 上传临时文件接口
|
||||||
isDefinition?: boolean;
|
isDefinition?: boolean;
|
||||||
|
isResponseModel?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
activeLayout: 'vertical',
|
activeLayout: 'vertical',
|
||||||
|
|
|
@ -74,20 +74,30 @@
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</ms-base-table>
|
</ms-base-table>
|
||||||
<a-modal v-model:visible="showResponse" class="ms-modal-form ms-modal-small" title-align="start">
|
<a-modal
|
||||||
|
v-model:visible="showResponse"
|
||||||
|
class="ms-modal-form ms-modal-response ms-modal-response-body"
|
||||||
|
title-align="start"
|
||||||
|
:footer="false"
|
||||||
|
>
|
||||||
|
<template #title> {{ t('caseManagement.featureCase.tableColumnExecutionResult') }} </template>
|
||||||
<response
|
<response
|
||||||
v-show="showResponse"
|
v-show="showResponse"
|
||||||
|
:hide-layout-switch="true"
|
||||||
:is-expanded="true"
|
:is-expanded="true"
|
||||||
:is-http-protocol="props.protocol === 'HTTP'"
|
:is-http-protocol="props.protocol === 'HTTP'"
|
||||||
:is-priority-local-exec="false"
|
:is-priority-local-exec="false"
|
||||||
:active-tab="ResponseComposition.BODY"
|
:active-tab="ResponseComposition.BODY"
|
||||||
:request-task-result="responseContent"
|
:request-task-result="responseContent"
|
||||||
|
:is-definition="true"
|
||||||
|
:is-response-model="true"
|
||||||
></response>
|
></response>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||||
|
@ -101,11 +111,13 @@
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
|
|
||||||
import { ApiCaseReportDetail, RequestTaskResult } from '@/models/apiTest/common';
|
import { ApiCaseReportDetail, RequestResult, RequestTaskResult } from '@/models/apiTest/common';
|
||||||
import { ApiCaseExecuteHistoryItem } from '@/models/apiTest/management';
|
import { ApiCaseExecuteHistoryItem } from '@/models/apiTest/management';
|
||||||
import { ExecuteStatusFilters, ResponseComposition } from '@/enums/apiEnum';
|
import { ExecuteStatusFilters, ResponseComposition } from '@/enums/apiEnum';
|
||||||
import { TriggerModeLabel } from '@/enums/reportEnum';
|
import { TriggerModeLabel } from '@/enums/reportEnum';
|
||||||
|
|
||||||
|
import { defaultResponse } from '@/views/api-test/components/config';
|
||||||
|
|
||||||
const triggerModeListFilters = ref<string[]>(Object.keys(TriggerModeLabel));
|
const triggerModeListFilters = ref<string[]>(Object.keys(TriggerModeLabel));
|
||||||
const triggerModeFilterVisible = ref(false);
|
const triggerModeFilterVisible = ref(false);
|
||||||
const statusFilterVisible = ref(false);
|
const statusFilterVisible = ref(false);
|
||||||
|
@ -216,10 +228,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadedReportDetail(detail: ApiCaseReportDetail) {
|
function loadedReportDetail(detail: ApiCaseReportDetail[]) {
|
||||||
if (detail.id) {
|
responseContent.value = cloneDeep(defaultResponse);
|
||||||
responseContent.value?.requestResults.push(detail.content);
|
const apiCaseReportDetailElement = detail[0];
|
||||||
showResponse.value = true;
|
if (apiCaseReportDetailElement.id) {
|
||||||
|
responseContent.value.requestResults[0] = apiCaseReportDetailElement.content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +240,8 @@
|
||||||
if (detail.id) {
|
if (detail.id) {
|
||||||
if (detail.children && detail.children.length > 0) {
|
if (detail.children && detail.children.length > 0) {
|
||||||
try {
|
try {
|
||||||
const caseReportDetail = getCaseReportDetail(detail.id, detail.children[0].stepId);
|
const caseReportDetail = await getCaseReportDetail(detail.id, detail.children[0].stepId);
|
||||||
loadedReportDetail(await caseReportDetail);
|
loadedReportDetail(caseReportDetail);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -238,6 +251,7 @@
|
||||||
|
|
||||||
async function showResult(record: ApiCaseExecuteHistoryItem) {
|
async function showResult(record: ApiCaseExecuteHistoryItem) {
|
||||||
try {
|
try {
|
||||||
|
showResponse.value = true;
|
||||||
const result = await getReportById(record.id);
|
const result = await getReportById(record.id);
|
||||||
await loadedReport(result);
|
await loadedReport(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue