fix(脑图): 功能用例脑图新建模块下用例保存拦截

This commit is contained in:
baiqi 2024-12-16 10:43:49 +08:00 committed by Craftsman
parent ada7ddffdd
commit b402c165e0
8 changed files with 31 additions and 10 deletions

View File

@ -35,14 +35,17 @@
</a-form> </a-form>
</div> </div>
<div v-if="hasEditPermission" class="flex items-center gap-[12px] bg-[var(--color-text-fff)] py-[16px]"> <div v-if="hasEditPermission" class="flex items-center gap-[12px] bg-[var(--color-text-fff)] py-[16px]">
<a-button <a-tooltip :content="t('ms.minders.moduleNewTip')" :disabled="!props.activeCase.moduleIsNew">
v-permission="['FUNCTIONAL_CASE:READ+UPDATE']" <a-button
type="primary" v-permission="['FUNCTIONAL_CASE:READ+UPDATE']"
:loading="saveLoading" type="primary"
@click="handleSave" :loading="saveLoading"
> :disabled="props.activeCase.moduleIsNew"
{{ t('common.save') }} @click="handleSave"
</a-button> >
{{ t('common.save') }}
</a-button>
</a-tooltip>
<a-button type="secondary" :disabled="saveLoading" @click="handleCancel">{{ t('common.cancel') }}</a-button> <a-button type="secondary" :disabled="saveLoading" @click="handleCancel">{{ t('common.cancel') }}</a-button>
</div> </div>
</div> </div>

View File

@ -27,6 +27,7 @@
:can-show-batch-delete="true" :can-show-batch-delete="true"
:priority-tooltip="t('caseManagement.caseReview.caseLevel')" :priority-tooltip="t('caseManagement.caseReview.caseLevel')"
:disabled="!hasEditPermission" :disabled="!hasEditPermission"
:disabled-extra-tab="!!activeCase.moduleIsNew"
can-show-more-batch-menu can-show-more-batch-menu
single-tag single-tag
tag-enable tag-enable
@ -426,6 +427,7 @@
id: data.id, id: data.id,
name: data.text, name: data.text,
moduleId: node.parent?.data?.id || '', moduleId: node.parent?.data?.id || '',
moduleIsNew: !!node.parent?.data?.isNew, //
isNew: true, isNew: true,
}; };
} }

View File

@ -17,6 +17,8 @@ export default {
'ms.minders.createChildCase': 'Insert child Case', 'ms.minders.createChildCase': 'Insert child Case',
'ms.minders.moreCase': 'More Cases...', 'ms.minders.moreCase': 'More Cases...',
'ms.minders.moreModule': 'More Modules...', 'ms.minders.moreModule': 'More Modules...',
'ms.minders.moduleNewTip':
'The module node to which the current use case belongs has not been saved. Please save the mind map first',
// 测试规划脑图文案 // 测试规划脑图文案
'ms.minders.failStop': 'Failure stop', 'ms.minders.failStop': 'Failure stop',
'ms.minders.failRetry': 'Retry on failure', 'ms.minders.failRetry': 'Retry on failure',

View File

@ -17,6 +17,7 @@ export default {
'ms.minders.createChildCase': '添加子级用例', 'ms.minders.createChildCase': '添加子级用例',
'ms.minders.moreCase': '更多用例...', 'ms.minders.moreCase': '更多用例...',
'ms.minders.moreModule': '更多模块...', 'ms.minders.moreModule': '更多模块...',
'ms.minders.moduleNewTip': '当前用例所属模块节点未保存,请先保存脑图',
// 测试规划脑图文案 // 测试规划脑图文案
'ms.minders.failStop': '失败停止', 'ms.minders.failStop': '失败停止',
'ms.minders.failRetry': '失败重试', 'ms.minders.failRetry': '失败重试',

View File

@ -182,6 +182,7 @@ export default function useMinderOperation(options: MinderOperationProps) {
// 由于粘贴逻辑中为了排除子节点重新排序导致逆序,因此复制的时候倒过来 // 由于粘贴逻辑中为了排除子节点重新排序导致逆序,因此复制的时候倒过来
for (let i = noFakeNodeTree.length - 1; i >= 0; i--) { for (let i = noFakeNodeTree.length - 1; i >= 0; i--) {
_node = minder.createNode(null, node); _node = minder.createNode(null, node);
_node.setData({ isNew: true });
minder.importNode(_node, noFakeNodeTree[i]); minder.importNode(_node, noFakeNodeTree[i]);
selectedNodes.push(_node); selectedNodes.push(_node);
node.appendChild(_node); node.appendChild(_node);

View File

@ -21,7 +21,12 @@
</div> </div>
<div class="ms-minder-editor-extra" :class="[extraVisible ? 'ms-minder-editor-extra--visible' : '']"> <div class="ms-minder-editor-extra" :class="[extraVisible ? 'ms-minder-editor-extra--visible' : '']">
<div v-if="props.extractContentTabList?.length" class="pl-[16px] pt-[16px]"> <div v-if="props.extractContentTabList?.length" class="pl-[16px] pt-[16px]">
<MsTab v-model:activeKey="activeExtraKey" :content-tab-list="props.extractContentTabList" mode="button" /> <MsTab
v-model:activeKey="activeExtraKey"
:content-tab-list="props.extractContentTabList"
mode="button"
:disabled="props.disabledExtraTab"
/>
</div> </div>
<div class="ms-minder-editor-extra-content"> <div class="ms-minder-editor-extra-content">
<slot name="extractTabContent"></slot> <slot name="extractTabContent"></slot>

View File

@ -64,6 +64,7 @@ export const mainEditorProps = {
minderKey: String as PropType<MinderKeyEnum>, minderKey: String as PropType<MinderKeyEnum>,
disabled: Boolean, disabled: Boolean,
extractContentTabList: Array as PropType<{ label: string; value: string }[]>, extractContentTabList: Array as PropType<{ label: string; value: string }[]>,
disabledExtraTab: Boolean,
insertNode: { insertNode: {
type: Function as PropType<(node: MinderJsonNode, type: string, value?: string) => void>, type: Function as PropType<(node: MinderJsonNode, type: string, value?: string) => void>,
default: undefined, default: undefined,

View File

@ -5,7 +5,12 @@
:class="[props.class, props.noContent ? 'no-content' : '']" :class="[props.class, props.noContent ? 'no-content' : '']"
@change="(val) => handleTabClick(val as string)" @change="(val) => handleTabClick(val as string)"
> >
<a-tab-pane v-for="item of props.contentTabList" :key="item.value" :title="`${item.label}`"> <a-tab-pane
v-for="item of props.contentTabList"
:key="item.value"
:title="`${item.label}`"
:disabled="props.disabled"
>
<template v-if="props.showBadge" #title> <template v-if="props.showBadge" #title>
<a-badge <a-badge
v-if="props.getTextFunc(item.value) !== ''" v-if="props.getTextFunc(item.value) !== ''"
@ -50,6 +55,7 @@
showBadge?: boolean; showBadge?: boolean;
changeInterceptor?: (newVal: string | number, oldVal: string | number, done: () => void) => void; changeInterceptor?: (newVal: string | number, oldVal: string | number, done: () => void) => void;
buttonSize?: 'small' | 'default'; buttonSize?: 'small' | 'default';
disabled?: boolean;
}>(), }>(),
{ {
mode: 'origin', mode: 'origin',