fix(测试用例&测试计划): 用例详情-修复自动下一条顺序不对的缺陷

--bug=1045034 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045034
This commit is contained in:
teukkk 2024-08-14 16:55:40 +08:00 committed by 刘瑞斌
parent 48897e83ac
commit d82745cd98
3 changed files with 344 additions and 297 deletions

View File

@ -86,6 +86,8 @@
</a-spin> </a-spin>
</div> </div>
<a-spin :loading="caseDetailLoading" class="relative flex flex-1 flex-col overflow-hidden"> <a-spin :loading="caseDetailLoading" class="relative flex flex-1 flex-col overflow-hidden">
<MsEmpty v-if="!caseList.length" />
<template v-else>
<div class="content-center"> <div class="content-center">
<div class="rounded-[var(--border-radius-small)] bg-[var(--color-text-n9)] p-[16px]"> <div class="rounded-[var(--border-radius-small)] bg-[var(--color-text-n9)] p-[16px]">
<div class="mb-[12px] flex items-center"> <div class="mb-[12px] flex items-center">
@ -272,6 +274,7 @@
@done="reviewDone" @done="reviewDone"
/> />
</div> </div>
</template>
</a-spin> </a-spin>
</div> </div>
</MsCard> </MsCard>
@ -524,6 +527,7 @@
watch( watch(
() => activeCaseId.value, () => activeCaseId.value,
() => { () => {
console.log('🤔️ =>', activeCaseId.value);
loadCaseDetail(); loadCaseDetail();
initReviewerAndStatus(); initReviewerAndStatus();
initReviewHistoryList(); initReviewHistoryList();
@ -546,10 +550,28 @@
); );
} }
async function reviewDone() { async function reviewDone(status: string) {
if (autoNext.value) { if (autoNext.value) {
// id // id
const index = caseList.value.findIndex((e) => e.caseId === activeCaseId.value); const index = caseList.value.findIndex((e) => e.caseId === activeCaseId.value);
//
const oneMissingCase = type.value !== '' && status !== type.value;
if (oneMissingCase) {
if ((pageNation.value.current - 1) * pageNation.value.pageSize + index + 1 < pageNation.value.total) {
//
await loadCaseList();
activeCaseId.value = caseList.value[index].caseId;
} else {
//
await loadCaseList();
if (caseList.value.length > 1) {
activeCaseId.value = caseList.value[0].caseId;
}
}
return;
}
if (index < caseList.value.length - 1) { if (index < caseList.value.length - 1) {
await loadCaseList(); await loadCaseList();
activeCaseId.value = caseList.value[index + 1].caseId; activeCaseId.value = caseList.value[index + 1].caseId;

View File

@ -178,7 +178,7 @@
if (typeof done === 'function') { if (typeof done === 'function') {
done(true); done(true);
} }
emit('done'); emit('done', params.status);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);

View File

@ -59,10 +59,14 @@
</div> </div>
<!-- 右侧 --> <!-- 右侧 -->
<a-spin :loading="caseDetailLoading" class="relative flex h-full flex-1 flex-col overflow-hidden"> <a-spin :loading="caseDetailLoading" class="relative flex h-full flex-1 flex-col overflow-hidden">
<MsEmpty v-if="!caseList.length" />
<template v-else>
<div class="flex px-[16px] pt-[16px]"> <div class="flex px-[16px] pt-[16px]">
<div class="mr-[24px] flex flex-1 items-center overflow-hidden"> <div class="mr-[24px] flex flex-1 items-center overflow-hidden">
<MsStatusTag :status="caseDetail.lastExecuteResult || 'PREPARED'" /> <MsStatusTag :status="caseDetail.lastExecuteResult || 'PREPARED'" />
<div class="ml-[8px] mr-[2px] cursor-pointer font-medium text-[rgb(var(--primary-5))]" @click="goCaseDetail" <div
class="ml-[8px] mr-[2px] cursor-pointer font-medium text-[rgb(var(--primary-5))]"
@click="goCaseDetail"
>[{{ caseDetail.num }}]</div >[{{ caseDetail.num }}]</div
> >
<div class="flex-1 overflow-hidden"> <div class="flex-1 overflow-hidden">
@ -204,6 +208,7 @@
show-step-detail-trigger show-step-detail-trigger
/> />
</div> </div>
</template>
</a-spin> </a-spin>
</div> </div>
</MsCard> </MsCard>
@ -451,10 +456,30 @@
}); });
}); });
const autoNext = ref(true); const autoNext = ref(true);
async function executeDone() { async function executeDone(status: LastExecuteResults) {
if (autoNext.value) { if (autoNext.value) {
// id // id
const index = caseList.value.findIndex((e) => e.id === activeId.value); const index = caseList.value.findIndex((e) => e.id === activeId.value);
//
const oneMissingCase = lastExecResult.value !== '' && status !== lastExecResult.value;
if (oneMissingCase) {
if ((pageNation.value.current - 1) * pageNation.value.pageSize + index + 1 < pageNation.value.total) {
//
await loadCaseList();
activeCaseId.value = caseList.value[index].caseId;
activeId.value = caseList.value[index].id;
} else {
//
await loadCaseList();
if (caseList.value.length > 1) {
activeCaseId.value = caseList.value[0].caseId;
activeId.value = caseList.value[0].id;
}
}
return;
}
if (index < caseList.value.length - 1) { if (index < caseList.value.length - 1) {
await loadCaseList(); await loadCaseList();
activeCaseId.value = caseList.value[index + 1].caseId; activeCaseId.value = caseList.value[index + 1].caseId;