feat(报告): 报告列表增加导出按钮
This commit is contained in:
parent
98e046db5a
commit
8c1136eb86
|
@ -19,6 +19,7 @@ import {
|
|||
BatchRecoverApiUrl,
|
||||
BatchRecoverCaseUrl,
|
||||
BatchUpdateDefinitionUrl,
|
||||
CaseBatchExportLogUrl,
|
||||
CaseExportLogUrl,
|
||||
CasePageUrl,
|
||||
caseTableBatchSyncUrl,
|
||||
|
@ -620,6 +621,11 @@ export function exportApiDefinition(data: ApiDefinitionBatchExportParams, type:
|
|||
}
|
||||
|
||||
// 接口用例导出报告日志记录
|
||||
export function logCaseExport(reportId: string) {
|
||||
return MSR.get({ url: `${CaseExportLogUrl}/${reportId}` });
|
||||
export function logCaseReportExport(reportId: string) {
|
||||
return MSR.post({ url: `${CaseExportLogUrl}/${reportId}` });
|
||||
}
|
||||
|
||||
// 接口用例导出报告日志记录
|
||||
export function logCaseReportBatchExport(data: BatchApiParams) {
|
||||
return MSR.post({ url: `${CaseBatchExportLogUrl}`, data });
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import {
|
|||
MoveModuleUrl,
|
||||
RecoverScenarioUrl,
|
||||
RecycleScenarioUrl,
|
||||
ScenarioBatchExportLogUrl,
|
||||
ScenarioExportLogUrl,
|
||||
ScenarioHistoryUrl,
|
||||
ScenarioPageUrl,
|
||||
|
@ -69,6 +70,7 @@ import {
|
|||
} from '@/models/apiTest/scenario';
|
||||
import {
|
||||
AddModuleParams,
|
||||
type BatchApiParams,
|
||||
CommonList,
|
||||
DragSortParams,
|
||||
ModuleTreeNode,
|
||||
|
@ -307,6 +309,11 @@ export function getStepProjectInfo(id: string, type: ScenarioStepType) {
|
|||
}
|
||||
|
||||
// 场景导出报告日志记录
|
||||
export function logScenarioExport(reportId: string) {
|
||||
return MSR.get({ url: `${ScenarioExportLogUrl}/${reportId}` });
|
||||
export function logScenarioReportExport(reportId: string) {
|
||||
return MSR.post({ url: `${ScenarioExportLogUrl}/${reportId}` });
|
||||
}
|
||||
|
||||
// 场景导出报告日志记录
|
||||
export function logScenarioReportBatchExport(data: BatchApiParams) {
|
||||
return MSR.post({ url: `${ScenarioBatchExportLogUrl}`, data });
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as reportUrl from '@/api/requrls/test-plan/report';
|
|||
|
||||
import type { GetShareId } from '@/models/apiTest/report';
|
||||
import { ReportDetail, ReportStepDetail } from '@/models/apiTest/report';
|
||||
import { CommonList, TableQueryParams } from '@/models/common';
|
||||
import { type BatchApiParams, CommonList, TableQueryParams } from '@/models/common';
|
||||
import {
|
||||
ApiOrScenarioCaseItem,
|
||||
FeatureCaseItem,
|
||||
|
@ -173,4 +173,12 @@ export function getReportLayout(reportId: string, shareId?: string) {
|
|||
return MSR.get({ url: `${reportUrl.getReportLayoutUrl}/${reportId}` });
|
||||
}
|
||||
|
||||
export default {};
|
||||
// 导出报告日志
|
||||
export function logTestPlanReportExport(reportId: string) {
|
||||
return MSR.post({ url: `${reportUrl.TestPlanReportExportUrl}/${reportId}` });
|
||||
}
|
||||
|
||||
// 批量导出报告日志
|
||||
export function logTestPlanReportBatchExport(data: BatchApiParams) {
|
||||
return MSR.post({ url: reportUrl.TestPlanBatchReportExportUrl, data });
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ export const RunCaseUrl = '/api/case/run'; // 执行接口用例
|
|||
export const GetCaseReportByIdUrl = '/api/report/case/get/'; // 接口用例报告获取
|
||||
export const GetCaseReportDetailUrl = '/api/report/case/get/detail/'; // 接口用例报告获取
|
||||
export const CaseExportLogUrl = '/api/report/case/export'; // 接口用例导出报告日志记录
|
||||
export const CaseBatchExportLogUrl = '/api/report/case/batch-export'; // 接口用例批量导出报告日志记录
|
||||
|
||||
/**
|
||||
* 接口用例回收站
|
||||
|
|
|
@ -42,3 +42,4 @@ export const BatchDeleteScenarioUrl = '/api/scenario/batch-operation/delete';
|
|||
export const ExecuteHistoryUrl = '/api/scenario/execute/page'; // 场景执行历史
|
||||
export const ScenarioHistoryUrl = '/api/scenario/operation-history/page'; // 场景变更历史
|
||||
export const ScenarioExportLogUrl = '/api/report/scenario/export'; // 场景导出报告日志记录
|
||||
export const ScenarioBatchExportLogUrl = '/api/report/scenario/batch-export'; // 场景批量导出报告日志记录
|
||||
|
|
|
@ -68,3 +68,7 @@ export const ManualReportGenUrl = '/test-plan/report/manual-gen';
|
|||
export const getReportLayoutUrl = '/test-plan/report/get-layout';
|
||||
// 测试计划-报告-详情-获取报告布局-分享
|
||||
export const getReportShareLayoutUrl = '/test-plan/report/share/get-layout';
|
||||
// 测试计划-报告-导出日志
|
||||
export const TestPlanReportExportUrl = '/test-plan/report/export';
|
||||
// 测试计划-报告-批量导出日志
|
||||
export const TestPlanBatchReportExportUrl = '/test-plan/report/batch-export';
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
class="mr-4 !rounded-[var(--border-radius-small)]"
|
||||
@click="exportHandler"
|
||||
>
|
||||
<MsIcon type="icon-icon_bottom-align_outlined" class="mr-2 font-[16px]" />
|
||||
<MsIcon type="icon-icon_into-item_outlined" class="mr-2 font-[16px]" />
|
||||
{{ t('common.export') }}
|
||||
</MsButton>
|
||||
</div>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
class="mr-4 !rounded-[var(--border-radius-small)]"
|
||||
@click="exportHandler"
|
||||
>
|
||||
<MsIcon type="icon-icon_bottom-align_outlined" class="mr-2 font-[16px]" />
|
||||
<MsIcon type="icon-icon_into-item_outlined" class="mr-2 font-[16px]" />
|
||||
{{ t('common.export') }}
|
||||
</MsButton>
|
||||
</div>
|
||||
|
|
|
@ -71,12 +71,12 @@
|
|||
<span>{{ dayjs(record.operationTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template #operation="{ record }">
|
||||
<MsButton
|
||||
v-permission="['PROJECT_API_REPORT:READ+DELETE']"
|
||||
class="!mr-0"
|
||||
@click="handleDelete(record.id, record.name)"
|
||||
>{{ t('ms.comment.delete') }}</MsButton
|
||||
>
|
||||
<MsButton v-permission="['PROJECT_API_REPORT:READ+DELETE']" @click="handleDelete(record.id, record.name)">
|
||||
{{ t('ms.comment.delete') }}
|
||||
</MsButton>
|
||||
<MsButton v-permission="['PROJECT_API_REPORT:READ+EXPORT']" @click="() => exportPdf(record, record.integrated)">
|
||||
{{ t('common.export') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
</ms-base-table>
|
||||
<ReportDetailDrawer
|
||||
|
@ -126,6 +126,7 @@
|
|||
} from '@/api/modules/api-test/report';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import { useTableStore } from '@/store';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { characterLimit } from '@/utils';
|
||||
|
@ -134,6 +135,7 @@
|
|||
import { BatchApiParams } from '@/models/common';
|
||||
import { ReportExecStatus } from '@/enums/apiEnum';
|
||||
import { ReportEnum, ReportStatus, TriggerModeLabel } from '@/enums/reportEnum';
|
||||
import { FullPageEnum } from '@/enums/routeEnum';
|
||||
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
|
||||
|
@ -144,6 +146,7 @@
|
|||
const appStore = useAppStore();
|
||||
const tableStore = useTableStore();
|
||||
const route = useRoute();
|
||||
const { openNewPage } = useOpenNewPage();
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps<{
|
||||
|
@ -487,6 +490,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
function exportPdf(record: any, type: boolean) {
|
||||
openNewPage(
|
||||
props.moduleType === ReportEnum.API_SCENARIO_REPORT
|
||||
? FullPageEnum.FULL_PAGE_SCENARIO_EXPORT_PDF
|
||||
: FullPageEnum.FULL_PAGE_API_CASE_EXPORT_PDF,
|
||||
{
|
||||
id: record.id,
|
||||
type: type ? 'GROUP' : 'TEST_PLAN',
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
showDetail();
|
||||
getTime();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
import CaseReportCom from './component/caseReportCom.vue';
|
||||
|
||||
import { logCaseExport } from '@/api/modules/api-test/management';
|
||||
import { logCaseReportExport } from '@/api/modules/api-test/management';
|
||||
import { reportCaseDetail } from '@/api/modules/api-test/report';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import exportPDF from '@/utils/exportPdf';
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
async function logExport() {
|
||||
try {
|
||||
await logCaseExport(route.query.id as string);
|
||||
await logCaseReportExport(route.query.id as string);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
import ScenarioCom from './component/scenarioCom.vue';
|
||||
|
||||
import { reportScenarioDetail } from '@/api/modules/api-test/report';
|
||||
import { logScenarioExport } from '@/api/modules/api-test/scenario';
|
||||
import { logScenarioReportExport } from '@/api/modules/api-test/scenario';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import exportPDF from '@/utils/exportPdf';
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
async function logExport() {
|
||||
try {
|
||||
await logScenarioExport(route.query.id as string);
|
||||
await logScenarioReportExport(route.query.id as string);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
|
|
@ -80,20 +80,22 @@
|
|||
<span>{{ dayjs(record.operationTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template #operation="{ record }">
|
||||
<MsButton
|
||||
v-permission="['PROJECT_TEST_PLAN_REPORT:READ+DELETE']"
|
||||
class="!mr-0"
|
||||
@click="handleDelete(record.id, record.name)"
|
||||
>
|
||||
<MsButton v-permission="['PROJECT_TEST_PLAN_REPORT:READ+DELETE']" @click="handleDelete(record.id, record.name)">
|
||||
{{ t('ms.comment.delete') }}
|
||||
</MsButton>
|
||||
<MsButton
|
||||
v-permission="['PROJECT_TEST_PLAN_REPORT:READ+EXPORT']"
|
||||
class="!mr-0"
|
||||
@click="() => exportPdf(record, record.integrated)"
|
||||
>
|
||||
{{ t('common.export') }}
|
||||
</MsButton>
|
||||
</template>
|
||||
</ms-base-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
@ -109,6 +111,7 @@
|
|||
import { reportBathDelete, reportDelete, reportList, reportRename } from '@/api/modules/test-plan/report';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import { useTableStore } from '@/store';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useCacheStore from '@/store/modules/cache/cache';
|
||||
|
@ -118,7 +121,7 @@
|
|||
import { BatchApiParams } from '@/models/common';
|
||||
import { ReportExecStatus } from '@/enums/apiEnum';
|
||||
import { PlanReportStatus, TriggerModeLabel } from '@/enums/reportEnum';
|
||||
import { TestPlanRouteEnum } from '@/enums/routeEnum';
|
||||
import { FullPageEnum, TestPlanRouteEnum } from '@/enums/routeEnum';
|
||||
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
|
||||
|
@ -132,6 +135,7 @@
|
|||
const keyword = ref<string>('');
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { openNewPage } = useOpenNewPage();
|
||||
|
||||
type ReportShowType = 'All' | 'INDEPENDENT' | 'INTEGRATED';
|
||||
const showType = ref<ReportShowType>('All');
|
||||
|
@ -439,6 +443,14 @@
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
function exportPdf(record: any, type: boolean) {
|
||||
openNewPage(FullPageEnum.FULL_PAGE_TEST_PLAN_EXPORT_PDF, {
|
||||
id: record.id,
|
||||
type: type ? 'GROUP' : 'TEST_PLAN',
|
||||
});
|
||||
}
|
||||
|
||||
const isActivated = computed(() => cacheStore.cacheViews.includes(TestPlanRouteEnum.TEST_PLAN_REPORT));
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
class="ml-4 !rounded-[var(--border-radius-small)]"
|
||||
@click="exportPdf"
|
||||
>
|
||||
<MsIcon type="icon-icon_into-item_outlined" class="mr-2 font-[16px]" />
|
||||
{{ t('report.detail.exportPdf') }}
|
||||
</MsButton>
|
||||
</div>
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
getReportShareBugList,
|
||||
getReportShareFeatureCaseList,
|
||||
getScenarioPage,
|
||||
logTestPlanReportExport,
|
||||
} from '@/api/modules/test-plan/report';
|
||||
import {
|
||||
commonConfig,
|
||||
|
@ -769,8 +770,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
async function logExport() {
|
||||
await logTestPlanReportExport(route.query.id as string);
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
getDetail();
|
||||
logExport();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue