fix(测试用例): 脑图-修改节点名称后切换tab弹出提示&用例信息保存校验失败后页面滚动到报错的位置
--bug=1047836 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001047836
This commit is contained in:
parent
1595ad5db9
commit
22d62b4ccd
|
@ -6,7 +6,14 @@
|
||||||
<a-skeleton-line :rows="10" :line-height="30" :line-spacing="30" />
|
<a-skeleton-line :rows="10" :line-height="30" :line-spacing="30" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-skeleton>
|
</a-skeleton>
|
||||||
<a-form v-else ref="baseInfoFormRef" :model="baseInfoForm" :disabled="!hasEditPermission" layout="vertical">
|
<a-form
|
||||||
|
v-else
|
||||||
|
ref="baseInfoFormRef"
|
||||||
|
scroll-to-first-error
|
||||||
|
:model="baseInfoForm"
|
||||||
|
:disabled="!hasEditPermission"
|
||||||
|
layout="vertical"
|
||||||
|
>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
field="name"
|
field="name"
|
||||||
:label="t('ms.minders.caseName')"
|
:label="t('ms.minders.caseName')"
|
||||||
|
@ -230,6 +237,11 @@
|
||||||
fApi.value?.validate(async (valid) => {
|
fApi.value?.validate(async (valid) => {
|
||||||
if (valid === true) {
|
if (valid === true) {
|
||||||
realSave();
|
realSave();
|
||||||
|
} else {
|
||||||
|
// 滚动到报错的位置
|
||||||
|
const firstErrorId = Object.keys(valid)[0];
|
||||||
|
const fieldElement = document.getElementById(firstErrorId);
|
||||||
|
fieldElement?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -176,6 +176,7 @@
|
||||||
handleDblclick() {
|
handleDblclick() {
|
||||||
const state = window.editor.fsm.state();
|
const state = window.editor.fsm.state();
|
||||||
if (state === 'input') {
|
if (state === 'input') {
|
||||||
|
minderStore.setMinderUnsaved(true);
|
||||||
floatMenuVisible.value = false;
|
floatMenuVisible.value = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,10 +4,11 @@ import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
|
||||||
|
|
||||||
import useLocalForage from '@/hooks/useLocalForage';
|
import useLocalForage from '@/hooks/useLocalForage';
|
||||||
import { getGenerateId, mapTree } from '@/utils';
|
import { getGenerateId, mapTree } from '@/utils';
|
||||||
|
import { getLocalStorage, setLocalStorage } from '@/utils/local-storage';
|
||||||
|
|
||||||
import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum';
|
import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum';
|
||||||
|
|
||||||
import { MinderNodePosition, MinderState, MinderStoreLocalItem, ModeType } from './types';
|
import { MinderNodePosition, MinderState, MinderStoreLocalItem, ModeType, ShowType } from './types';
|
||||||
|
|
||||||
// 脑图组件的 store
|
// 脑图组件的 store
|
||||||
const useMinderStore = defineStore('minder', {
|
const useMinderStore = defineStore('minder', {
|
||||||
|
@ -26,6 +27,7 @@ const useMinderStore = defineStore('minder', {
|
||||||
activeMode: 'right',
|
activeMode: 'right',
|
||||||
clipboard: [],
|
clipboard: [],
|
||||||
minderUnsaved: false,
|
minderUnsaved: false,
|
||||||
|
showType: 'list',
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getMinderUnsaved(): boolean {
|
getMinderUnsaved(): boolean {
|
||||||
|
@ -63,6 +65,14 @@ const useMinderStore = defineStore('minder', {
|
||||||
this.setClipboard(nodes);
|
this.setClipboard(nodes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getShowType(MinderKey: MinderKeyEnum) {
|
||||||
|
const showType = getLocalStorage(`${MinderKey}_showType`) as ShowType;
|
||||||
|
return showType || 'list';
|
||||||
|
},
|
||||||
|
setShowType(MinderKey: MinderKeyEnum, showType: ShowType) {
|
||||||
|
this.showType = showType;
|
||||||
|
setLocalStorage(`${MinderKey}_showType`, showType);
|
||||||
|
},
|
||||||
async getMode(MinderKey: MinderKeyEnum) {
|
async getMode(MinderKey: MinderKeyEnum) {
|
||||||
const { getItem } = useLocalForage();
|
const { getItem } = useLocalForage();
|
||||||
const minderStoreLocalMap = await getItem<MinderStoreLocalItem>(MinderKey);
|
const minderStoreLocalMap = await getItem<MinderStoreLocalItem>(MinderKey);
|
||||||
|
|
|
@ -3,9 +3,11 @@ import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
|
||||||
import type { MinderEventName } from '@/enums/minderEnum';
|
import type { MinderEventName } from '@/enums/minderEnum';
|
||||||
|
|
||||||
export type ModeType = 'filetree' | 'default' | 'right';
|
export type ModeType = 'filetree' | 'default' | 'right';
|
||||||
|
export type ShowType = 'list' | 'minder';
|
||||||
|
|
||||||
export interface MinderStoreLocalItem {
|
export interface MinderStoreLocalItem {
|
||||||
mode?: ModeType;
|
mode?: ModeType;
|
||||||
|
showType?: ShowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MinderNodePosition {
|
export interface MinderNodePosition {
|
||||||
|
@ -35,4 +37,5 @@ export interface MinderState {
|
||||||
activeMode: ModeType;
|
activeMode: ModeType;
|
||||||
clipboard: MinderJsonNode[]; // 剪切板
|
clipboard: MinderJsonNode[]; // 剪切板
|
||||||
minderUnsaved: boolean; // 脑图是否有未保存的内容
|
minderUnsaved: boolean; // 脑图是否有未保存的内容
|
||||||
|
showType: ShowType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,6 +434,7 @@
|
||||||
import useCacheStore from '@/store/modules/cache/cache';
|
import useCacheStore from '@/store/modules/cache/cache';
|
||||||
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
||||||
import useMinderStore from '@/store/modules/components/minder-editor';
|
import useMinderStore from '@/store/modules/components/minder-editor';
|
||||||
|
import { ShowType } from '@/store/modules/components/minder-editor/types';
|
||||||
import {
|
import {
|
||||||
characterLimit,
|
characterLimit,
|
||||||
downloadByteFile,
|
downloadByteFile,
|
||||||
|
@ -456,6 +457,7 @@
|
||||||
import { ModuleTreeNode } from '@/models/common';
|
import { ModuleTreeNode } from '@/models/common';
|
||||||
import { FilterType, ViewTypeEnum } from '@/enums/advancedFilterEnum';
|
import { FilterType, ViewTypeEnum } from '@/enums/advancedFilterEnum';
|
||||||
import { CacheTabTypeEnum } from '@/enums/cacheTabEnum';
|
import { CacheTabTypeEnum } from '@/enums/cacheTabEnum';
|
||||||
|
import { MinderKeyEnum } from '@/enums/minderEnum';
|
||||||
import { CaseManagementRouteEnum, RouteEnum } from '@/enums/routeEnum';
|
import { CaseManagementRouteEnum, RouteEnum } from '@/enums/routeEnum';
|
||||||
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
||||||
import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||||
|
@ -493,9 +495,10 @@
|
||||||
const keyword = ref<string>('');
|
const keyword = ref<string>('');
|
||||||
const groupKeyword = ref<string>('');
|
const groupKeyword = ref<string>('');
|
||||||
|
|
||||||
const showType = ref<string>('list');
|
const showType = ref<ShowType>('list');
|
||||||
|
|
||||||
function handleShowTypeChange(val: string | number | boolean) {
|
function handleShowTypeChange(val: string | number | boolean) {
|
||||||
|
minderStore.setShowType(MinderKeyEnum.FEATURE_CASE_MINDER, val as ShowType);
|
||||||
if (minderStore.minderUnsaved && val === 'list') {
|
if (minderStore.minderUnsaved && val === 'list') {
|
||||||
showType.value = 'minder';
|
showType.value = 'minder';
|
||||||
openModal({
|
openModal({
|
||||||
|
@ -1838,6 +1841,8 @@
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!isActivated.value) {
|
if (!isActivated.value) {
|
||||||
mountedLoad();
|
mountedLoad();
|
||||||
|
// 切换菜单默认还是列表;已经在脑图的时候,刷新浏览器,保持脑图状态
|
||||||
|
showType.value = minderStore.getShowType(MinderKeyEnum.FEATURE_CASE_MINDER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue