mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
fix(测试计划): 修复测试计划报告接口用例&场景用例切换数据问题&测试计划执行
This commit is contained in:
parent
b869df8428
commit
a9b35ccdcb
@ -87,17 +87,23 @@ export function getShareValidity(id: string) {
|
||||
}
|
||||
// 测试计划-独立报告-接口用例
|
||||
export function getApiPage(data: TableQueryParams) {
|
||||
if (data.shareId) {
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportShareApiUrl, data });
|
||||
}
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportIndependentApiUrl, data });
|
||||
}
|
||||
// 测试计划-报告-获取分享链接时效
|
||||
export function getScenarioPage(data: TableQueryParams) {
|
||||
if (data.shareId) {
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportShareScenarioUrl, data });
|
||||
}
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportIndependentScenarioUrl, data });
|
||||
}
|
||||
// 测试计划-独立报告-接口用例
|
||||
export function getShareApiPage(data: TableQueryParams) {
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportShareApiUrl, data });
|
||||
}
|
||||
// 测试计划-报告-获取分享链接时效
|
||||
// 测试计划-报告-场景用例
|
||||
export function getShareScenarioPage(data: TableQueryParams) {
|
||||
return MSR.post<CommonList<ApiOrScenarioCaseItem>>({ url: reportUrl.ReportShareScenarioUrl, data });
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
:disabled="!contentEditAble"
|
||||
:placeholder="t('editor.placeholder')"
|
||||
:upload-image="handleUploadImage"
|
||||
:auto-height="false"
|
||||
:preview-url="EditorPreviewFileUrl"
|
||||
/>
|
||||
<div v-else v-dompurify-html="form?.description || '-'" class="markdown-body"></div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<MsBaseTable v-bind="propsRes" v-on="propsEvent">
|
||||
<MsBaseTable v-bind="currentCaseTable.propsRes.value" v-on="currentCaseTable.propsEvent.value">
|
||||
<template #num="{ record }">
|
||||
<MsButton type="text" @click="showReport(record)">{{ record.num }}</MsButton>
|
||||
</template>
|
||||
@ -32,7 +32,7 @@
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" async>
|
||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
||||
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||
@ -41,7 +41,7 @@
|
||||
import ExecuteResult from '@/components/business/ms-case-associate/executeResult.vue';
|
||||
import CaseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
|
||||
|
||||
import { getApiPage, getScenarioPage, getShareApiPage, getShareScenarioPage } from '@/api/modules/test-plan/report';
|
||||
import { getApiPage, getScenarioPage } from '@/api/modules/test-plan/report';
|
||||
|
||||
import { ApiOrScenarioCaseItem } from '@/models/testPlan/report';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
@ -117,32 +117,36 @@
|
||||
showDrag: true,
|
||||
},
|
||||
];
|
||||
const reportApiList = () => {
|
||||
if (props.activeTab === 'scenarioCase') {
|
||||
return !props.shareId ? getScenarioPage : getShareScenarioPage;
|
||||
|
||||
const getReportApiList = () => {
|
||||
if (props.activeTab === 'apiCase') {
|
||||
return getApiPage;
|
||||
}
|
||||
return !props.shareId ? getApiPage : getShareApiPage;
|
||||
return getScenarioPage;
|
||||
};
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetFilterParams, resetPagination } = useTable(
|
||||
reportApiList(),
|
||||
{
|
||||
scroll: { x: '100%' },
|
||||
columns,
|
||||
showSelectorAll: false,
|
||||
}
|
||||
);
|
||||
|
||||
const useApiTable = useTable(getApiPage, {
|
||||
scroll: { x: '100%' },
|
||||
columns,
|
||||
showSelectorAll: false,
|
||||
showSetting: false,
|
||||
});
|
||||
const useScenarioTable = useTable(getScenarioPage, {
|
||||
scroll: { x: '100%' },
|
||||
columns,
|
||||
showSelectorAll: false,
|
||||
showSetting: false,
|
||||
});
|
||||
|
||||
const currentCaseTable = computed(() => {
|
||||
return props.activeTab === 'apiCase' ? useApiTable : useScenarioTable;
|
||||
});
|
||||
|
||||
async function loadCaseList() {
|
||||
setLoadListParams({ reportId: props.reportId, shareId: props.shareId ?? undefined });
|
||||
loadList();
|
||||
currentCaseTable.value.setLoadListParams({ reportId: props.reportId, shareId: props.shareId ?? undefined });
|
||||
currentCaseTable.value.loadList();
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.reportId) {
|
||||
loadCaseList();
|
||||
}
|
||||
});
|
||||
|
||||
// 显示执行报告
|
||||
const reportVisible = ref(false);
|
||||
|
||||
@ -156,9 +160,24 @@
|
||||
watch(
|
||||
() => props.activeTab,
|
||||
() => {
|
||||
resetFilterParams();
|
||||
resetPagination();
|
||||
currentCaseTable.value.resetFilterParams();
|
||||
currentCaseTable.value.resetPagination();
|
||||
loadCaseList();
|
||||
}
|
||||
);
|
||||
|
||||
// onBeforeMount(() => {
|
||||
// if (props.reportId) {
|
||||
// loadCaseList();
|
||||
// }
|
||||
// });
|
||||
|
||||
watch(
|
||||
() => props.reportId,
|
||||
(val) => {
|
||||
if (val) {
|
||||
loadCaseList();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
@ -239,27 +239,10 @@
|
||||
|
||||
<template #operation="{ record }">
|
||||
<div class="flex items-center">
|
||||
<!-- TODO 测试计划组手动生成报告 -->
|
||||
<!-- <MsButton class="mr-2" @click="handleGenerateReport(record.id)">生成报告</MsButton> -->
|
||||
<MsButton
|
||||
v-if="
|
||||
getFunctionalCount(record.id) > 0 &&
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE']) &&
|
||||
record.status !== 'ARCHIVED'
|
||||
"
|
||||
class="!mx-0"
|
||||
@click="executePlan(record)"
|
||||
>{{ t('testPlan.testPlanIndex.execution') }}</MsButton
|
||||
>
|
||||
<a-divider
|
||||
v-if="
|
||||
getFunctionalCount(record.id) > 0 &&
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE']) &&
|
||||
record.status !== 'ARCHIVED'
|
||||
"
|
||||
direction="vertical"
|
||||
:margin="8"
|
||||
></a-divider>
|
||||
<MsButton v-if="isShowExecuteButton(record)" class="!mx-0" @click="executePlan(record)">{{
|
||||
t('testPlan.testPlanIndex.execution')
|
||||
}}</MsButton>
|
||||
<a-divider v-if="isShowExecuteButton(record)" direction="vertical" :margin="8"></a-divider>
|
||||
|
||||
<MsButton
|
||||
v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && record.status !== 'ARCHIVED'"
|
||||
@ -273,25 +256,10 @@
|
||||
:margin="8"
|
||||
></a-divider>
|
||||
|
||||
<MsButton
|
||||
v-if="
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) &&
|
||||
getFunctionalCount(record.id) < 1 &&
|
||||
record.status !== 'ARCHIVED'
|
||||
"
|
||||
class="!mx-0"
|
||||
@click="copyTestPlanOrGroup(record.id)"
|
||||
>{{ t('common.copy') }}</MsButton
|
||||
>
|
||||
<a-divider
|
||||
v-if="
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) &&
|
||||
getFunctionalCount(record.id) < 1 &&
|
||||
record.status !== 'ARCHIVED'
|
||||
"
|
||||
direction="vertical"
|
||||
:margin="8"
|
||||
></a-divider>
|
||||
<MsButton v-if="!isShowExecuteButton(record)" class="!mx-0" @click="copyTestPlanOrGroup(record.id)">{{
|
||||
t('common.copy')
|
||||
}}</MsButton>
|
||||
<a-divider v-if="!isShowExecuteButton(record)" direction="vertical" :margin="8"></a-divider>
|
||||
<MsTableMoreAction :list="getMoreActions(record)" @select="handleMoreActionSelect($event, record)" />
|
||||
</div>
|
||||
</template>
|
||||
@ -727,13 +695,20 @@
|
||||
return defaultCountDetailMap.value[id].scheduleConfig.enable;
|
||||
}
|
||||
|
||||
function isShowExecuteButton(record: TestPlanItem) {
|
||||
return (
|
||||
((record.type === testPlanTypeEnum.TEST_PLAN && getFunctionalCount(record.id) > 0) ||
|
||||
(record.type === testPlanTypeEnum.GROUP && record.childrenCount)) &&
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE']) &&
|
||||
record.status !== 'ARCHIVED'
|
||||
);
|
||||
}
|
||||
|
||||
function getMoreActions(record: TestPlanItem) {
|
||||
const { status: planStatus } = record;
|
||||
const useCount = defaultCountDetailMap.value[record.id]?.caseTotal ?? 0;
|
||||
|
||||
// 有用例数量才可以执行 否则不展示执行
|
||||
const copyAction =
|
||||
useCount > 0 && hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && planStatus !== 'ARCHIVED' ? copyActions : [];
|
||||
const copyAction = isShowExecuteButton(record) ? copyActions : [];
|
||||
|
||||
let scheduledTaskAction: ActionsItem[] = [];
|
||||
if (planStatus !== 'ARCHIVED' && record.groupId && record.groupId === 'NONE') {
|
||||
|
Loading…
Reference in New Issue
Block a user