feat(脑图): 脑图抽屉缺陷列表新增测试计划

This commit is contained in:
baiqi 2024-06-24 11:00:55 +08:00 committed by 刘瑞斌
parent f8a96b1004
commit 283e55a675
3 changed files with 54 additions and 25 deletions

View File

@ -1,11 +1,28 @@
<template> <template>
<a-spin :loading="bugListLoading" class="block h-full pl-[16px]"> <a-spin :loading="bugListLoading" class="block h-full pl-[16px]">
<a-button v-if="hasEditPermission" class="mr-3" type="primary" @click="linkBug"> <div class="flex items-center justify-between">
{{ t('caseManagement.featureCase.linkDefect') }} <div class="flex items-center justify-between">
</a-button> <a-button v-if="hasEditPermission" class="mr-3" type="primary" @click="linkBug">
<a-button v-permission="['PROJECT_BUG:READ+ADD']" type="outline" @click="createBug"> {{ t('caseManagement.featureCase.linkDefect') }}
{{ t('caseManagement.featureCase.createDefect') }} </a-button>
</a-button> <a-button v-permission="['PROJECT_BUG:READ+ADD']" type="outline" @click="createBug">
{{ t('caseManagement.featureCase.createDefect') }}
</a-button>
</div>
<a-radio-group
v-model:model-value="showType"
type="button"
class="file-show-type ml-[4px]"
@change="handleShowTypeChange"
>
<a-radio value="link" class="show-type-icon p-[2px]">
{{ t('caseManagement.featureCase.directLink') }}
</a-radio>
<a-radio value="testPlan" class="show-type-icon p-[2px]">
{{ t('caseManagement.featureCase.testPlan') }}
</a-radio>
</a-radio-group>
</div>
<MsList <MsList
v-model:data="bugList" v-model:data="bugList"
mode="remote" mode="remote"
@ -91,6 +108,7 @@
pageSize: 10, pageSize: 10,
current: 1, current: 1,
}); });
const showType = ref<'link' | 'testPlan'>('link');
const bugListLoading = ref(false); const bugListLoading = ref(false);
async function loadBugList() { async function loadBugList() {
@ -99,7 +117,8 @@
const res = await getLinkedCaseBugList({ const res = await getLinkedCaseBugList({
keyword: '', keyword: '',
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
caseId: props.activeCase.id, testPlanCaseId: showType.value === 'testPlan' ? props.activeCase.id : undefined,
caseId: showType.value === 'link' ? props.activeCase.id : undefined,
current: pageNation.value.current || 1, current: pageNation.value.current || 1,
pageSize: pageNation.value.pageSize, pageSize: pageNation.value.pageSize,
}); });
@ -117,6 +136,11 @@
} }
} }
function handleShowTypeChange() {
pageNation.value.current = 1;
loadBugList();
}
// //
function handleReachBottom() { function handleReachBottom() {
pageNation.value.current += 1; pageNation.value.current += 1;

View File

@ -128,8 +128,6 @@
'zoom', 'zoom',
'zoomin', 'zoomin',
'zoomout', 'zoomout',
'appendchildnode',
'appendsiblingnode',
]); ]);
if (selectNodes.length > 0 && !notChangeCommands.has(event.commandName.toLocaleLowerCase())) { if (selectNodes.length > 0 && !notChangeCommands.has(event.commandName.toLocaleLowerCase())) {
minderStore.setMinderUnsaved(true); minderStore.setMinderUnsaved(true);

View File

@ -1,4 +1,4 @@
import { onBeforeRouteLeave } from 'vue-router'; import { type NavigationGuardNext, onBeforeRouteLeave } from 'vue-router';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import type { ModalType } from '@/hooks/useModal'; import type { ModalType } from '@/hooks/useModal';
@ -27,6 +27,25 @@ export default function useLeaveUnSaveTip(leaveProp = leaveProps) {
const setIsSave = (flag: boolean) => { const setIsSave = (flag: boolean) => {
isSave.value = flag; isSave.value = flag;
}; };
function openUnsavedTip(next: NavigationGuardNext | (() => void)) {
openModal({
type: tipType,
title: t(leaveTitle),
content: t(leaveContent),
okText: t('common.leave'),
cancelText: t('common.stay'),
okButtonProps: {
status: 'normal',
},
onBeforeOk: async () => {
isSave.value = true;
next();
},
hideCancel: false,
});
}
onBeforeRouteLeave((to, from, next) => { onBeforeRouteLeave((to, from, next) => {
if (to.path === from.path) { if (to.path === from.path) {
next(); next();
@ -34,26 +53,14 @@ export default function useLeaveUnSaveTip(leaveProp = leaveProps) {
} }
if (!isSave.value) { if (!isSave.value) {
openModal({ openUnsavedTip(next);
type: tipType,
title: t(leaveTitle),
content: t(leaveContent),
okText: t('common.leave'),
cancelText: t('common.stay'),
okButtonProps: {
status: 'normal',
},
onBeforeOk: async () => {
isSave.value = true;
next();
},
hideCancel: false,
});
} else { } else {
next(); next();
} }
}); });
return { return {
setIsSave, setIsSave,
openUnsavedTip,
isSave,
}; };
} }