mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
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-space>
|
||||
</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
|
||||
field="name"
|
||||
:label="t('ms.minders.caseName')"
|
||||
@ -230,6 +237,11 @@
|
||||
fApi.value?.validate(async (valid) => {
|
||||
if (valid === true) {
|
||||
realSave();
|
||||
} else {
|
||||
// 滚动到报错的位置
|
||||
const firstErrorId = Object.keys(valid)[0];
|
||||
const fieldElement = document.getElementById(firstErrorId);
|
||||
fieldElement?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -176,6 +176,7 @@
|
||||
handleDblclick() {
|
||||
const state = window.editor.fsm.state();
|
||||
if (state === 'input') {
|
||||
minderStore.setMinderUnsaved(true);
|
||||
floatMenuVisible.value = false;
|
||||
}
|
||||
},
|
||||
|
@ -4,10 +4,11 @@ import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
|
||||
|
||||
import useLocalForage from '@/hooks/useLocalForage';
|
||||
import { getGenerateId, mapTree } from '@/utils';
|
||||
import { getLocalStorage, setLocalStorage } from '@/utils/local-storage';
|
||||
|
||||
import { MinderEventName, MinderKeyEnum } from '@/enums/minderEnum';
|
||||
|
||||
import { MinderNodePosition, MinderState, MinderStoreLocalItem, ModeType } from './types';
|
||||
import { MinderNodePosition, MinderState, MinderStoreLocalItem, ModeType, ShowType } from './types';
|
||||
|
||||
// 脑图组件的 store
|
||||
const useMinderStore = defineStore('minder', {
|
||||
@ -26,6 +27,7 @@ const useMinderStore = defineStore('minder', {
|
||||
activeMode: 'right',
|
||||
clipboard: [],
|
||||
minderUnsaved: false,
|
||||
showType: 'list',
|
||||
}),
|
||||
getters: {
|
||||
getMinderUnsaved(): boolean {
|
||||
@ -63,6 +65,14 @@ const useMinderStore = defineStore('minder', {
|
||||
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) {
|
||||
const { getItem } = useLocalForage();
|
||||
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';
|
||||
|
||||
export type ModeType = 'filetree' | 'default' | 'right';
|
||||
export type ShowType = 'list' | 'minder';
|
||||
|
||||
export interface MinderStoreLocalItem {
|
||||
mode?: ModeType;
|
||||
showType?: ShowType;
|
||||
}
|
||||
|
||||
export interface MinderNodePosition {
|
||||
@ -35,4 +37,5 @@ export interface MinderState {
|
||||
activeMode: ModeType;
|
||||
clipboard: MinderJsonNode[]; // 剪切板
|
||||
minderUnsaved: boolean; // 脑图是否有未保存的内容
|
||||
showType: ShowType;
|
||||
}
|
||||
|
@ -434,6 +434,7 @@
|
||||
import useCacheStore from '@/store/modules/cache/cache';
|
||||
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
||||
import useMinderStore from '@/store/modules/components/minder-editor';
|
||||
import { ShowType } from '@/store/modules/components/minder-editor/types';
|
||||
import {
|
||||
characterLimit,
|
||||
downloadByteFile,
|
||||
@ -456,6 +457,7 @@
|
||||
import { ModuleTreeNode } from '@/models/common';
|
||||
import { FilterType, ViewTypeEnum } from '@/enums/advancedFilterEnum';
|
||||
import { CacheTabTypeEnum } from '@/enums/cacheTabEnum';
|
||||
import { MinderKeyEnum } from '@/enums/minderEnum';
|
||||
import { CaseManagementRouteEnum, RouteEnum } from '@/enums/routeEnum';
|
||||
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterRemoteMethodsEnum, FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
@ -493,9 +495,10 @@
|
||||
const keyword = ref<string>('');
|
||||
const groupKeyword = ref<string>('');
|
||||
|
||||
const showType = ref<string>('list');
|
||||
const showType = ref<ShowType>('list');
|
||||
|
||||
function handleShowTypeChange(val: string | number | boolean) {
|
||||
minderStore.setShowType(MinderKeyEnum.FEATURE_CASE_MINDER, val as ShowType);
|
||||
if (minderStore.minderUnsaved && val === 'list') {
|
||||
showType.value = 'minder';
|
||||
openModal({
|
||||
@ -1838,6 +1841,8 @@
|
||||
onMounted(() => {
|
||||
if (!isActivated.value) {
|
||||
mountedLoad();
|
||||
// 切换菜单默认还是列表;已经在脑图的时候,刷新浏览器,保持脑图状态
|
||||
showType.value = minderStore.getShowType(MinderKeyEnum.FEATURE_CASE_MINDER);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user