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

View File

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

View File

@ -17,6 +17,8 @@ export default {
'ms.minders.createChildCase': 'Insert child Case',
'ms.minders.moreCase': 'More Cases...',
'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.failRetry': 'Retry on failure',

View File

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

View File

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

View File

@ -21,7 +21,12 @@
</div>
<div class="ms-minder-editor-extra" :class="[extraVisible ? 'ms-minder-editor-extra--visible' : '']">
<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 class="ms-minder-editor-extra-content">
<slot name="extractTabContent"></slot>

View File

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

View File

@ -5,7 +5,12 @@
:class="[props.class, props.noContent ? 'no-content' : '']"
@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>
<a-badge
v-if="props.getTextFunc(item.value) !== ''"
@ -50,6 +55,7 @@
showBadge?: boolean;
changeInterceptor?: (newVal: string | number, oldVal: string | number, done: () => void) => void;
buttonSize?: 'small' | 'default';
disabled?: boolean;
}>(),
{
mode: 'origin',