feat(测试计划): 测试计划-计划组执行历史

This commit is contained in:
baiqi 2024-07-04 17:30:59 +08:00 committed by 刘瑞斌
parent 9353382732
commit 95d103040c
6 changed files with 61 additions and 18 deletions

View File

@ -27,7 +27,7 @@
const cardItemList = ref<configItem[]>([]); const cardItemList = ref<configItem[]>([]);
async function getDetail() { async function getDetail() {
cardItemList.value = isGroup ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig); cardItemList.value = isGroup.value ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig);
try { try {
detail.value = await getReportDetail(reportId.value); detail.value = await getReportDetail(reportId.value);
} catch (error) { } catch (error) {

View File

@ -26,7 +26,7 @@
const cardItemList = ref<configItem[]>([]); const cardItemList = ref<configItem[]>([]);
async function getShareDetail() { async function getShareDetail() {
cardItemList.value = isGroup ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig); cardItemList.value = isGroup.value ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig);
try { try {
const hrefShareDetail = await planGetShareHref(route.query.shareId as string); const hrefShareDetail = await planGetShareHref(route.query.shareId as string);
reportId.value = hrefShareDetail.reportId; reportId.value = hrefShareDetail.reportId;

View File

@ -13,15 +13,15 @@
<div class="flex w-full items-center justify-between"> <div class="flex w-full items-center justify-between">
<div> <div>
<a-radio-group v-model="showType" type="button" class="file-show-type mr-2"> <a-radio-group v-model="showType" type="button" class="file-show-type mr-2">
<a-radio :value="testPlanTypeEnum.ALL" class="show-type-icon p-[2px]">{{ <a-radio :value="testPlanTypeEnum.ALL" class="show-type-icon p-[2px]">
t('testPlan.testPlanIndex.all') {{ t('testPlan.testPlanIndex.all') }}
}}</a-radio> </a-radio>
<a-radio :value="testPlanTypeEnum.TEST_PLAN" class="show-type-icon p-[2px]">{{ <a-radio :value="testPlanTypeEnum.TEST_PLAN" class="show-type-icon p-[2px]">
t('testPlan.testPlanIndex.plan') {{ t('testPlan.testPlanIndex.plan') }}
}}</a-radio> </a-radio>
<a-radio :value="testPlanTypeEnum.GROUP" class="show-type-icon p-[2px]">{{ <a-radio :value="testPlanTypeEnum.GROUP" class="show-type-icon p-[2px]">
t('testPlan.testPlanIndex.testPlanGroup') {{ t('testPlan.testPlanIndex.testPlanGroup') }}
}}</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</div> </div>
<div class="mr-[24px]"> <div class="mr-[24px]">
@ -350,6 +350,15 @@
:show-type="showType" :show-type="showType"
@success="successHandler" @success="successHandler"
/> />
<MsDrawer v-model:visible="executionHistoryDrawerVisible" :width="800" :footer="false">
<template #title>
<div class="flex items-center">
<div>{{ t('testPlan.featureCase.executionHistory') }}</div>
<div class="text-[var(--color-text-4)]"> {{ activeRecord?.name }} </div>
</div>
</template>
<executeHistoryTable v-if="executionHistoryDrawerVisible" :plan-id="activeRecord?.id" is-group />
</MsDrawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -362,6 +371,7 @@
import { MsAdvanceFilter } from '@/components/pure/ms-advance-filter'; import { MsAdvanceFilter } from '@/components/pure/ms-advance-filter';
import { FilterFormItem } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem } from '@/components/pure/ms-advance-filter/type';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { import type {
BatchActionParams, BatchActionParams,
@ -374,6 +384,7 @@
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import MsStatusTag from '@/components/business/ms-status-tag/index.vue'; import MsStatusTag from '@/components/business/ms-status-tag/index.vue';
import executeHistoryTable from '../detail/executeHistory/index.vue';
import ActionModal from './actionModal.vue'; import ActionModal from './actionModal.vue';
import BatchEditModal from './batchEditModal.vue'; import BatchEditModal from './batchEditModal.vue';
import BatchMoveOrCopy from './batchMoveOrCopy.vue'; import BatchMoveOrCopy from './batchMoveOrCopy.vue';
@ -757,12 +768,24 @@
const reportAction = const reportAction =
planStatus !== 'ARCHIVED' && record.type === testPlanTypeEnum.GROUP ? [...configReportActions] : []; planStatus !== 'ARCHIVED' && record.type === testPlanTypeEnum.GROUP ? [...configReportActions] : [];
const executeHistoryAction =
record.type === testPlanTypeEnum.GROUP
? [
{
label: 'testPlan.featureCase.executionHistory',
eventTag: 'executionHistory',
permission: ['PROJECT_TEST_PLAN:READ'],
},
]
: [];
// //
if (planStatus === 'ARCHIVED' || planStatus === 'PREPARED' || planStatus === 'UNDERWAY') { if (planStatus === 'ARCHIVED' || planStatus === 'PREPARED' || planStatus === 'UNDERWAY') {
return [ return [
...copyAction, ...copyAction,
...scheduledTaskAction, ...scheduledTaskAction,
...reportAction, ...reportAction,
...executeHistoryAction,
{ {
label: 'common.delete', label: 'common.delete',
danger: true, danger: true,
@ -776,6 +799,7 @@
...archiveAction, ...archiveAction,
...scheduledTaskAction, ...scheduledTaskAction,
...reportAction, ...reportAction,
...executeHistoryAction,
{ {
isDivider: true, isDivider: true,
}, },
@ -985,6 +1009,7 @@
fetchData(); fetchData();
cancelHandler(); cancelHandler();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} finally { } finally {
executeId.value = ''; executeId.value = '';
@ -1115,6 +1140,7 @@
); );
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }
@ -1158,6 +1184,7 @@
Message.success(t('common.batchArchiveSuccess')); Message.success(t('common.batchArchiveSuccess'));
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
}, },
@ -1203,6 +1230,7 @@
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
}, },
@ -1284,6 +1312,7 @@
fetchData(); fetchData();
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }
@ -1357,6 +1386,7 @@
Message.success(t('common.batchArchiveSuccess')); Message.success(t('common.batchArchiveSuccess'));
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
}, },
@ -1370,6 +1400,7 @@
Message.success(t('common.copySuccess')); Message.success(t('common.copySuccess'));
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }
@ -1380,10 +1411,17 @@
Message.success(t('testPlan.testPlanGroup.deleteScheduleTaskSuccess')); Message.success(t('testPlan.testPlanGroup.deleteScheduleTaskSuccess'));
fetchData(); fetchData();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }
const executionHistoryDrawerVisible = ref(false);
function openExecutionHistory(record: TestPlanItem) {
activeRecord.value = record;
executionHistoryDrawerVisible.value = true;
}
function handleMoreActionSelect(item: ActionsItem, record: TestPlanItem) { function handleMoreActionSelect(item: ActionsItem, record: TestPlanItem) {
switch (item.eventTag) { switch (item.eventTag) {
case 'copy': case 'copy':
@ -1407,6 +1445,9 @@
case 'archive': case 'archive':
archiveHandle(record); archiveHandle(record);
break; break;
case 'executionHistory':
openExecutionHistory(record);
break;
default: default:
break; break;
} }

View File

@ -31,7 +31,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -53,12 +52,15 @@
import { triggerModeOptions } from '@/views/api-test/report/utils'; import { triggerModeOptions } from '@/views/api-test/report/utils';
const props = defineProps<{
isGroup?: boolean;
planId?: string;
}>();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const planId = ref(route.query.id as string);
const statusResultOptions = computed(() => { const statusResultOptions = computed(() => {
return Object.keys(PlanReportStatus).map((key) => { return Object.keys(PlanReportStatus).map((key) => {
return { return {
@ -133,7 +135,7 @@
function loadExecuteList() { function loadExecuteList() {
setLoadListParams({ setLoadListParams({
testPlanId: planId.value, testPlanId: props.planId || route.query.id,
}); });
loadList(); loadList();
} }
@ -142,6 +144,7 @@
function toReport(record: PlanDetailExecuteHistoryItem) { function toReport(record: PlanDetailExecuteHistoryItem) {
openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT_DETAIL, { openNewPage(TestPlanRouteEnum.TEST_PLAN_REPORT_DETAIL, {
id: record.id, id: record.id,
type: props.isGroup ? 'GROUP' : undefined,
}); });
} }

View File

@ -548,6 +548,7 @@
initDetail(); initDetail();
initPlanTree(); initPlanTree();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} finally { } finally {
copyLoading.value = false; copyLoading.value = false;

View File

@ -117,7 +117,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsCard from '@/components/pure/ms-card/index.vue'; import MsCard from '@/components/pure/ms-card/index.vue';
@ -140,8 +139,6 @@
import Message from '@arco-design/web-vue/es/message'; import Message from '@arco-design/web-vue/es/message';
const router = useRouter();
const appStore = useAppStore(); const appStore = useAppStore();
const { t } = useI18n(); const { t } = useI18n();
const currentProjectId = computed(() => appStore.currentProjectId); const currentProjectId = computed(() => appStore.currentProjectId);
@ -218,6 +215,7 @@
try { try {
modulesCount.value = await getPlanModulesCount(params); modulesCount.value = await getPlanModulesCount(params);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
} }