diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java index 51ef925fe7..cc17c8cbb1 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugAttachmentService.java @@ -221,6 +221,8 @@ public class BugAttachmentService { fileId = fileAssociationService.transferAndAssociation(association); // 删除本地上传的附件 deleteLocalFile(request.getBugId(), null, request.getProjectId(), null, attachment.getId(), null); + } catch (MSException e) { + throw e; } catch (Exception e) { throw new MSException(Translator.get("file.transfer.failed")); } diff --git a/frontend/src/views/bug-management/edit.vue b/frontend/src/views/bug-management/edit.vue index 8c22408e69..b955870da7 100644 --- a/frontend/src/views/bug-management/edit.vue +++ b/frontend/src/views/bug-management/edit.vue @@ -194,6 +194,7 @@ } from '@/api/modules/bug-management'; import { getModules, getModulesCount } from '@/api/modules/project-management/fileManagement'; import { useI18n } from '@/hooks/useI18n'; + import useLeaveUnSaveTip from '@/hooks/useLeaveUnSaveTip'; import useVisit from '@/hooks/useVisit'; import router from '@/router'; import { useAppStore } from '@/store'; @@ -215,9 +216,10 @@ import { convertToFileByBug } from './utils'; defineOptions({ name: 'BugEditPage' }); + const { setState } = useLeaveUnSaveTip(); + setState(false); const { t } = useI18n(); - interface TemplateOption { label: string; value: string; @@ -494,6 +496,7 @@ // 执行保存操作 const res = await createOrUpdateBug({ request: tmpObj, fileList: localFiles as unknown as File[] }); if (isEdit.value) { + setState(true); Message.success(t('common.updateSuccess')); router.push({ name: BugManagementRouteEnum.BUG_MANAGEMENT_INDEX, @@ -501,6 +504,7 @@ } else { Message.success(t('common.createSuccess')); if (isContinue) { + setState(false); // 如果是保存并继续创建 const { templateId } = form.value; // 用当前模板初始化自定义字段 @@ -515,6 +519,7 @@ // 清空文件列表 fileList.value = []; } else { + setState(true); // 否则跳转到成功页 if (getIsVisited()) { router.push({