feat(报告): 报告导出日志&权限

This commit is contained in:
baiqi 2024-09-11 17:00:50 +08:00 committed by Craftsman
parent 8ab2aa8c29
commit dfd4b7ecbc
10 changed files with 46 additions and 6 deletions

View File

@ -19,6 +19,7 @@ import {
BatchRecoverApiUrl,
BatchRecoverCaseUrl,
BatchUpdateDefinitionUrl,
CaseExportLogUrl,
CasePageUrl,
caseTableBatchSyncUrl,
CheckDefinitionScheduleUrl,
@ -95,8 +96,6 @@ import {
UploadTempFileUrl,
UploadTempMockFileUrl,
} from '@/api/requrls/api-test/management';
import { StopCaseExportUrl } from '@/api/requrls/case-management/featureCase';
import { BatchDownloadFileUrl } from '@/api/requrls/project-management/fileManagement';
import { ApiCaseReportDetail, ExecuteRequestParams } from '@/models/apiTest/common';
import {
@ -619,3 +618,8 @@ export function getCaseReportDetail(reportId: string, stepId: string) {
export function exportApiDefinition(data: ApiDefinitionBatchExportParams, type: string) {
return MSR.post({ url: `${ExportDefinitionUrl}/${type}`, data });
}
// 接口用例导出报告日志记录
export function logCaseExport(reportId: string) {
return MSR.get({ url: `${CaseExportLogUrl}/${reportId}` });
}

View File

@ -29,6 +29,7 @@ import {
MoveModuleUrl,
RecoverScenarioUrl,
RecycleScenarioUrl,
ScenarioExportLogUrl,
ScenarioHistoryUrl,
ScenarioPageUrl,
ScenarioScheduleConfigDeleteUrl,
@ -304,3 +305,8 @@ export function updateScenarioPro(id: string | number, priority: CaseLevel | und
export function getStepProjectInfo(id: string, type: ScenarioStepType) {
return MSR.get<ScenarioStepResourceInfo>({ url: `${GetStepProjectInfoUrl}/${id}`, params: { resourceType: type } });
}
// 场景导出报告日志记录
export function logScenarioExport(reportId: string) {
return MSR.get({ url: `${ScenarioExportLogUrl}/${reportId}` });
}

View File

@ -96,6 +96,7 @@ export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口定义-关注/
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'; // 接口用例导出报告日志记录
/**
*

View File

@ -41,3 +41,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'; // 场景导出报告日志记录

View File

@ -29,7 +29,7 @@
</template>
</a-dropdown>
<MsButton
v-permission="['PROJECT_API_REPORT:READ+SHARE']"
v-permission="['PROJECT_API_REPORT:READ+EXPORT']"
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)] text-[var(--color-text-1)]"

View File

@ -38,7 +38,7 @@
</template>
</a-dropdown>
<MsButton
v-permission="['PROJECT_API_REPORT:READ+SHARE']"
v-permission="['PROJECT_API_REPORT:READ+EXPORT']"
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"

View File

@ -30,7 +30,7 @@
{{ t('common.share') }}
</MsButton>
<MsButton
v-permission="['PROJECT_API_REPORT:READ+SHARE']"
v-permission="['PROJECT_API_REPORT:READ+EXPORT']"
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"

View File

@ -13,6 +13,7 @@
import CaseReportCom from './component/caseReportCom.vue';
import { logCaseExport } from '@/api/modules/api-test/management';
import { reportCaseDetail } from '@/api/modules/api-test/report';
import { useI18n } from '@/hooks/useI18n';
import exportPDF from '@/utils/exportPdf';
@ -42,9 +43,19 @@
}
}
async function logExport() {
try {
await logCaseExport(route.query.id as string);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
onBeforeMount(() => {
if (route.query.id) {
initReportDetail();
logExport();
}
});
</script>

View File

@ -14,6 +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 { useI18n } from '@/hooks/useI18n';
import exportPDF from '@/utils/exportPdf';
@ -42,9 +43,19 @@
}
}
async function logExport() {
try {
await logScenarioExport(route.query.id as string);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
onBeforeMount(() => {
if (route.query.id) {
initReportDetail();
logExport();
}
});
</script>

View File

@ -27,7 +27,13 @@
<MsIcon type="icon-icon_share1" class="mr-2 font-[16px]" />
{{ t('common.share') }}
</MsButton>
<MsButton type="icon" status="secondary" class="ml-4 !rounded-[var(--border-radius-small)]" @click="exportPdf">
<MsButton
v-permission="['PROJECT_TEST_PLAN_REPORT:READ+EXPORT']"
type="icon"
status="secondary"
class="ml-4 !rounded-[var(--border-radius-small)]"
@click="exportPdf"
>
{{ t('report.detail.exportPdf') }}
</MsButton>
</div>