fix(测试规划脑图): 打开配置抽屉更改内容时点击脑图的保存未将配置表单内容提交问题修复

This commit is contained in:
baiqi 2024-07-24 15:56:01 +08:00 committed by 刘瑞斌
parent 42954c609c
commit e6fae5ddb0
2 changed files with 37 additions and 22 deletions

View File

@ -23,14 +23,12 @@
import MsCaseAssociate from '@/components/business/ms-associate-case/index.vue'; import MsCaseAssociate from '@/components/business/ms-associate-case/index.vue';
import type { saveParams } from '@/components/business/ms-associate-case/types'; import type { saveParams } from '@/components/business/ms-associate-case/types';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import type { AssociateCaseRequestParams } from '@/models/testPlan/testPlan'; import type { AssociateCaseRequestParams } from '@/models/testPlan/testPlan';
import { CaseCountApiTypeEnum, CaseModulesApiTypeEnum, CasePageApiTypeEnum } from '@/enums/associateCaseEnum'; import { CaseCountApiTypeEnum, CaseModulesApiTypeEnum, CasePageApiTypeEnum } from '@/enums/associateCaseEnum';
import { CaseLinkEnum } from '@/enums/caseEnum'; import { CaseLinkEnum } from '@/enums/caseEnum';
const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
associationType: CaseLinkEnum; associationType: CaseLinkEnum;
modulesMaps?: Record<string, saveParams>; modulesMaps?: Record<string, saveParams>;

View File

@ -805,6 +805,25 @@
deletedIds: [], deletedIds: [],
}); });
/**
* 保存测试点配置
*/
function handleConfigSave() {
configFormRef.value?.validate((errors) => {
if (!errors) {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (node && node?.data && configForm.value) {
node.data = {
...node.data,
...cloneDeep(configForm.value),
};
}
// SAVE_MINDER
minderStore.dispatchEvent(MinderEventName.SAVE_MINDER);
}
});
}
/** /**
* 生成脑图保存的入参 * 生成脑图保存的入参
*/ */
@ -831,8 +850,25 @@
async function handleMinderSave(fullJson: MinderJson, callback: () => void) { async function handleMinderSave(fullJson: MinderJson, callback: () => void) {
try { try {
let configFormValidResult = false;
if (extraVisible.value) {
//
await configFormRef.value?.validate((errors) => {
if (!errors) {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (node && node?.data && configForm.value) {
node.data = {
...node.data,
...cloneDeep(configForm.value),
};
}
configFormValidResult = true;
}
});
}
if (!configFormValidResult) return;
loading.value = true; loading.value = true;
await editPlanMinder(makeMinderParams(fullJson)); await editPlanMinder(makeMinderParams(extraVisible.value ? window.minder.exportJson() : fullJson));
Message.success(t('common.saveSuccess')); Message.success(t('common.saveSuccess'));
emit('save'); emit('save');
clearSelectedCases(); clearSelectedCases();
@ -853,25 +889,6 @@
} }
} }
/**
* 保存测试点配置
*/
function handleConfigSave() {
configFormRef.value?.validate((errors) => {
if (!errors) {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (node && node?.data && configForm.value) {
node.data = {
...node.data,
...cloneDeep(configForm.value),
};
}
// SAVE_MINDER
minderStore.dispatchEvent(MinderEventName.SAVE_MINDER);
}
});
}
async function initResourcePoolList() { async function initResourcePoolList() {
try { try {
const res = await getPoolOption(appStore.currentProjectId); const res = await getPoolOption(appStore.currentProjectId);