fix(测试计划): 修复测试计划详情状态展示

This commit is contained in:
xinxin.wu 2024-08-21 12:56:08 +08:00 committed by Craftsman
parent 95007e5cc4
commit d4b7cec42b
1 changed files with 29 additions and 12 deletions

View File

@ -33,14 +33,18 @@
<MsIcon type="icon-icon_edit_outlined" class="mr-[8px]" /> <MsIcon type="icon-icon_edit_outlined" class="mr-[8px]" />
{{ t('common.edit') }} {{ t('common.edit') }}
</MsButton> </MsButton>
<MsTableMoreAction v-if="detail.status !== 'ARCHIVED'" :list="reportMoreAction" @select="handleMoreReportSelect"> <MsTableMoreAction
v-if="countDetail.status !== 'ARCHIVED'"
:list="reportMoreAction"
@select="handleMoreReportSelect"
>
<MsButton v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])" type="button" status="default"> <MsButton v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])" type="button" status="default">
<MsIcon type="icon-icon_generate_report" class="mr-[8px]" /> <MsIcon type="icon-icon_generate_report" class="mr-[8px]" />
{{ t('testPlan.testPlanDetail.generateReport') }} {{ t('testPlan.testPlanDetail.generateReport') }}
</MsButton> </MsButton>
</MsTableMoreAction> </MsTableMoreAction>
<MsButton <MsButton
v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && detail.status !== 'ARCHIVED'" v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD']) && countDetail.status !== 'ARCHIVED'"
type="button" type="button"
status="default" status="default"
:loading="copyLoading" :loading="copyLoading"
@ -56,7 +60,7 @@
/> />
{{ t(detail.followFlag ? 'common.forked' : 'common.fork') }} {{ t(detail.followFlag ? 'common.forked' : 'common.fork') }}
</MsButton> </MsButton>
<MsButton v-if="detail.status === 'ARCHIVED'" status="danger" type="button" @click="deleteHandler"> <MsButton v-if="countDetail.status === 'ARCHIVED'" status="danger" type="button" @click="deleteHandler">
<MsIcon type="icon-icon_delete-trash_outlined1" class="mr-[8px] text-[rgb(var(--danger-6))]" /> <MsIcon type="icon-icon_delete-trash_outlined1" class="mr-[8px] text-[rgb(var(--danger-6))]" />
<span class="text-[rgb(var(--danger-6))]"> {{ t('common.delete') }}</span> <span class="text-[rgb(var(--danger-6))]"> {{ t('common.delete') }}</span>
</MsButton> </MsButton>
@ -105,31 +109,36 @@
</MsCard> </MsCard>
<!-- special-height的169: 上面卡片高度153 + mt的16 --> <!-- special-height的169: 上面卡片高度153 + mt的16 -->
<MsCard class="mt-[16px]" :special-height="169" simple has-breadcrumb no-content-padding> <MsCard class="mt-[16px]" :special-height="169" simple has-breadcrumb no-content-padding>
<Plan v-if="activeTab === 'plan'" :plan-id="planId" :status="detail.status || 'PREPARED'" @refresh="initDetail" /> <Plan
v-if="activeTab === 'plan'"
:plan-id="planId"
:status="countDetail.status || 'PREPARED'"
@refresh="initDetail"
/>
<FeatureCase <FeatureCase
v-else-if="activeTab === 'featureCase'" v-else-if="activeTab === 'featureCase'"
ref="featureCaseRef" ref="featureCaseRef"
:tree-type="treeType" :tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'" :can-edit="countDetail.status !== 'ARCHIVED'"
@refresh="initDetail" @refresh="initDetail"
/> />
<BugManagement <BugManagement
v-else-if="activeTab === 'defectList'" v-else-if="activeTab === 'defectList'"
:can-edit="detail.status !== 'ARCHIVED'" :can-edit="countDetail.status !== 'ARCHIVED'"
@refresh="initDetail" @refresh="initDetail"
/> />
<ApiCase <ApiCase
v-else-if="activeTab === 'apiCase'" v-else-if="activeTab === 'apiCase'"
ref="apiCaseRef" ref="apiCaseRef"
:tree-type="treeType" :tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'" :can-edit="countDetail.status !== 'ARCHIVED'"
@refresh="initDetail" @refresh="initDetail"
/> />
<ApiScenario <ApiScenario
v-else-if="activeTab === 'apiScenario'" v-else-if="activeTab === 'apiScenario'"
ref="apiScenarioRef" ref="apiScenarioRef"
:tree-type="treeType" :tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'" :can-edit="countDetail.status !== 'ARCHIVED'"
@refresh="initDetail" @refresh="initDetail"
/> />
<ExecuteHistory v-else-if="activeTab === 'executeHistory'" /> <ExecuteHistory v-else-if="activeTab === 'executeHistory'" />
@ -140,7 +149,12 @@
:module-tree="testPlanTree" :module-tree="testPlanTree"
@load-plan-list="successHandler" @load-plan-list="successHandler"
/> />
<ActionModal v-model:visible="showStatusDeleteModal" :record="activeRecord" @success="okHandler" /> <ActionModal
v-model:visible="showStatusDeleteModal"
:schedule-config="countDetail.scheduleConfig"
:record="activeRecord"
@success="okHandler"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -251,14 +265,14 @@
}, },
]; ];
const moreAction = computed(() => { const moreAction = computed(() => {
if (detail.value.status === 'COMPLETED') { if (countDetail.value.status === 'COMPLETED') {
return [...fullActions]; return [...fullActions];
} }
return fullActions.filter((e) => e.eventTag !== 'archive'); return fullActions.filter((e) => e.eventTag !== 'archive');
}); });
const isEnableEdit = computed(() => { const isEnableEdit = computed(() => {
return hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && detail.value.status !== 'ARCHIVED'; return hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && countDetail.value.status !== 'ARCHIVED';
}); });
function archiveHandler() { function archiveHandler() {
@ -289,13 +303,16 @@
// //
function deleteHandler() { function deleteHandler() {
activeRecord.value = cloneDeep(detail.value); activeRecord.value = cloneDeep(detail.value);
activeRecord.value.status = countDetail.value.status;
showStatusDeleteModal.value = true; showStatusDeleteModal.value = true;
} }
// //
function okHandler(isDelete: boolean) { function okHandler(isDelete: boolean) {
if (isDelete) { if (isDelete) {
router.back(); router.push({
name: TestPlanRouteEnum.TEST_PLAN_INDEX,
});
} else { } else {
initDetail(); initDetail();
} }