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>
<a-spin :loading="bugListLoading" class="block h-full pl-[16px]">
<a-button v-if="hasEditPermission" class="mr-3" type="primary" @click="linkBug">
{{ t('caseManagement.featureCase.linkDefect') }}
</a-button>
<a-button v-permission="['PROJECT_BUG:READ+ADD']" type="outline" @click="createBug">
{{ t('caseManagement.featureCase.createDefect') }}
</a-button>
<div class="flex items-center justify-between">
<div class="flex items-center justify-between">
<a-button v-if="hasEditPermission" class="mr-3" type="primary" @click="linkBug">
{{ t('caseManagement.featureCase.linkDefect') }}
</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
v-model:data="bugList"
mode="remote"
@ -91,6 +108,7 @@
pageSize: 10,
current: 1,
});
const showType = ref<'link' | 'testPlan'>('link');
const bugListLoading = ref(false);
async function loadBugList() {
@ -99,7 +117,8 @@
const res = await getLinkedCaseBugList({
keyword: '',
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,
pageSize: pageNation.value.pageSize,
});
@ -117,6 +136,11 @@
}
}
function handleShowTypeChange() {
pageNation.value.current = 1;
loadBugList();
}
//
function handleReachBottom() {
pageNation.value.current += 1;

View File

@ -128,8 +128,6 @@
'zoom',
'zoomin',
'zoomout',
'appendchildnode',
'appendsiblingnode',
]);
if (selectNodes.length > 0 && !notChangeCommands.has(event.commandName.toLocaleLowerCase())) {
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 type { ModalType } from '@/hooks/useModal';
@ -27,6 +27,25 @@ export default function useLeaveUnSaveTip(leaveProp = leaveProps) {
const setIsSave = (flag: boolean) => {
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) => {
if (to.path === from.path) {
next();
@ -34,26 +53,14 @@ export default function useLeaveUnSaveTip(leaveProp = leaveProps) {
}
if (!isSave.value) {
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,
});
openUnsavedTip(next);
} else {
next();
}
});
return {
setIsSave,
openUnsavedTip,
isSave,
};
}