diff --git a/frontend/src/components/business/ms-minders/testPlanMinder/associateDrawer.vue b/frontend/src/components/business/ms-minders/testPlanMinder/associateDrawer.vue index 41572f5644..f8e856ca4b 100644 --- a/frontend/src/components/business/ms-minders/testPlanMinder/associateDrawer.vue +++ b/frontend/src/components/business/ms-minders/testPlanMinder/associateDrawer.vue @@ -23,14 +23,12 @@ import MsCaseAssociate from '@/components/business/ms-associate-case/index.vue'; import type { saveParams } from '@/components/business/ms-associate-case/types'; - import { useI18n } from '@/hooks/useI18n'; import useAppStore from '@/store/modules/app'; import type { AssociateCaseRequestParams } from '@/models/testPlan/testPlan'; import { CaseCountApiTypeEnum, CaseModulesApiTypeEnum, CasePageApiTypeEnum } from '@/enums/associateCaseEnum'; import { CaseLinkEnum } from '@/enums/caseEnum'; - const { t } = useI18n(); const props = defineProps<{ associationType: CaseLinkEnum; modulesMaps?: Record; diff --git a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue index a942e49aad..6ad23568ba 100644 --- a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue +++ b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue @@ -805,6 +805,25 @@ 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) { 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; - await editPlanMinder(makeMinderParams(fullJson)); + await editPlanMinder(makeMinderParams(extraVisible.value ? window.minder.exportJson() : fullJson)); Message.success(t('common.saveSuccess')); emit('save'); 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() { try { const res = await getPoolOption(appStore.currentProjectId);