From c50b7ead9c159c3c57db8b252f7c16e41cf37e22 Mon Sep 17 00:00:00 2001 From: baiqi Date: Thu, 25 Apr 2024 17:08:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=A8=E5=B1=80):=20=20bug=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-add-attachment/saveAsFilePopover.vue | 4 ++-- .../ms-assertion/comp/ResponseBodyTab.vue | 8 ++++---- .../src/components/business/ms-menu/index.vue | 4 ++-- .../components/business/ms-menu/use-menu-tree.ts | 6 +++++- frontend/src/models/projectManagement/file.ts | 1 + frontend/src/router/routes/modules/apiTest.ts | 2 +- frontend/src/utils/permission.ts | 2 +- .../components/requestComposition/index.vue | 16 ++++++++++------ frontend/src/views/api-test/management/index.vue | 4 ++-- .../caseReview/components/detail/caseTable.vue | 8 +------- .../components/fileDetailDrawer.vue | 5 +++++ .../fileManagement/locale/en-US.ts | 3 ++- .../fileManagement/locale/zh-CN.ts | 3 ++- 13 files changed, 38 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/business/ms-add-attachment/saveAsFilePopover.vue b/frontend/src/components/business/ms-add-attachment/saveAsFilePopover.vue index e6e6f8887f..60f9b85c6e 100644 --- a/frontend/src/components/business/ms-add-attachment/saveAsFilePopover.vue +++ b/frontend/src/components/business/ms-add-attachment/saveAsFilePopover.vue @@ -120,7 +120,7 @@ (visible) => { if (visible) { initModuleOptions(); - saveFileForm.value.name = props.savingFile?.name || ''; + saveFileForm.value.name = props.savingFile?.name?.split('.').shift() || ''; } }, { @@ -153,7 +153,7 @@ local: true, moduleId: saveFileForm.value.moduleId, fileName: saveFileForm.value.name, - originalName: props.savingFile.name || '', + originalName: props.savingFile.name || props.savingFile.fileName || '', }); emit('finish', res, `${saveFileForm.value.name}.${props.savingFile.name?.split('.').pop()}`); Message.success(t('ms.add.attachment.saveAsSuccess')); diff --git a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue index 1efe95d5ef..e5142f82fb 100644 --- a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue +++ b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue @@ -858,10 +858,10 @@ parent.rowSpan = parent.rowSpan ? parent.rowSpan + 1 : 2; } else { // 找到第一个子节点 - const fisrtChildNode = findFirstByGroupId(condition.value.documentAssertion.jsonAssertion, record.groupId); - if (fisrtChildNode) { - fisrtChildNode.rowSpan = fisrtChildNode.rowSpan - ? fisrtChildNode.rowSpan + 1 + const firstChildNode = findFirstByGroupId(condition.value.documentAssertion.jsonAssertion, record.groupId); + if (firstChildNode) { + firstChildNode.rowSpan = firstChildNode.rowSpan + ? firstChildNode.rowSpan + 1 : countNodesByGroupId(condition.value.documentAssertion.jsonAssertion, record.groupId) + 1; } } diff --git a/frontend/src/components/business/ms-menu/index.vue b/frontend/src/components/business/ms-menu/index.vue index 5184138eaf..569206ac89 100644 --- a/frontend/src/components/business/ms-menu/index.vue +++ b/frontend/src/components/business/ms-menu/index.vue @@ -17,7 +17,7 @@ import useLicenseStore from '@/store/modules/setting/license'; import { openWindow, regexUrl } from '@/utils'; import { scrollIntoView } from '@/utils/dom'; - import { getFisrtRouterNameByCurrentRoute } from '@/utils/permission'; + import { getFirstRouterNameByCurrentRoute } from '@/utils/permission'; import { listenerRouteChange } from '@/utils/route-listener'; import { ProjectManagementRouteEnum, SettingRouteEnum } from '@/enums/routeEnum'; @@ -66,7 +66,7 @@ } if (item.meta?.hideChildrenInMenu) { // 顶级菜单路由跳转到该菜单下有权限的第一个顶部子菜单 - const childName = getFisrtRouterNameByCurrentRoute(item.name as string); + const childName = getFirstRouterNameByCurrentRoute(item.name as string); router.push({ name: childName, }); diff --git a/frontend/src/components/business/ms-menu/use-menu-tree.ts b/frontend/src/components/business/ms-menu/use-menu-tree.ts index f978560c10..f9fcce34c7 100644 --- a/frontend/src/components/business/ms-menu/use-menu-tree.ts +++ b/frontend/src/components/business/ms-menu/use-menu-tree.ts @@ -20,6 +20,10 @@ export default function useMenuTree() { if (!_routes) return null; const collector = _routes.map((element) => { + if (element.meta?.hideInMenu === true) { + return null; + } + // 权限校验不通过 if (!permission.accessRouter(element)) { return null; @@ -41,7 +45,7 @@ export default function useMenuTree() { element.children = subItem as RouteRecordRaw[]; return element; } - // the else logic + if (layer > 1) { element.children = subItem as RouteRecordRaw[]; return element; diff --git a/frontend/src/models/projectManagement/file.ts b/frontend/src/models/projectManagement/file.ts index be88e38e1f..515c383bce 100644 --- a/frontend/src/models/projectManagement/file.ts +++ b/frontend/src/models/projectManagement/file.ts @@ -15,6 +15,7 @@ export interface ModuleCount { export interface FileItem { id: string; name: string; + originalName: string; // 原文件名 fileType: string; // 文件类型 tags: string[]; // 标签 description: string; diff --git a/frontend/src/router/routes/modules/apiTest.ts b/frontend/src/router/routes/modules/apiTest.ts index 6962295711..821161faa6 100644 --- a/frontend/src/router/routes/modules/apiTest.ts +++ b/frontend/src/router/routes/modules/apiTest.ts @@ -1,4 +1,4 @@ -import { ApiTestRouteEnum, SettingRouteEnum } from '@/enums/routeEnum'; +import { ApiTestRouteEnum } from '@/enums/routeEnum'; import { DEFAULT_LAYOUT } from '../base'; import type { AppRouteRecordRaw } from '../types'; diff --git a/frontend/src/utils/permission.ts b/frontend/src/utils/permission.ts index 7caf43e34b..b6d01796a4 100644 --- a/frontend/src/utils/permission.ts +++ b/frontend/src/utils/permission.ts @@ -138,7 +138,7 @@ export function findRouteByName(name: string) { } // 找到当前路由下 第一个由权限的子路由 -export function getFisrtRouterNameByCurrentRoute(parentName: string) { +export function getFirstRouterNameByCurrentRoute(parentName: string) { const currentRoute = findRouteByName(parentName); if (currentRoute) { const hasAuthChildrenRouter = currentRoute.children.find((item) => hasAnyPermission(item.meta?.roles || [])); diff --git a/frontend/src/views/api-test/components/requestComposition/index.vue b/frontend/src/views/api-test/components/requestComposition/index.vue index d6bb38801d..5fac1c2cbf 100644 --- a/frontend/src/views/api-test/components/requestComposition/index.vue +++ b/frontend/src/views/api-test/components/requestComposition/index.vue @@ -990,12 +990,16 @@ }); const saveModalFormRef = ref(); const saveLoading = ref(false); - const selectTree = computed(() => - filterTree(cloneDeep(props.moduleTree || []), (e) => { - e.draggable = false; - return e.type === 'MODULE'; - }) - ); + const selectTree = computed(() => { + if (saveModalVisible.value || (!props.isCase && props.isDefinition && saveModalVisible.value)) { + // 调试模式打开保存弹窗,或者是接口定义模式下打开保存弹窗才进行计算,避免大数据量导致进入时就计算卡顿 TODO:worker线程处理计算任务 + return filterTree(cloneDeep(props.moduleTree || []), (e) => { + e.draggable = false; + return e.type === 'MODULE'; + }); + } + return []; + }); watch( () => saveModalVisible.value, diff --git a/frontend/src/views/api-test/management/index.vue b/frontend/src/views/api-test/management/index.vue index 2a61e20900..b650911e51 100644 --- a/frontend/src/views/api-test/management/index.vue +++ b/frontend/src/views/api-test/management/index.vue @@ -100,9 +100,9 @@ const managementRef = ref>(); function handleModuleInit(tree: ModuleTreeNode[], _protocol: string, pathMap: Record) { - folderTree.value = tree; + // folderTree.value = tree; protocol.value = _protocol; - folderTreePathMap.value = pathMap; + // folderTreePathMap.value = pathMap; } function newApi() { diff --git a/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue b/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue index 5810d96581..492ffd161c 100644 --- a/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue +++ b/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue @@ -317,13 +317,7 @@ import useUserStore from '@/store/modules/user'; import { hasAnyPermission } from '@/utils/permission'; - import { - ReviewCaseItem, - ReviewItem, - ReviewPassRule, - ReviewResult, - ReviewStatus, - } from '@/models/caseManagement/caseReview'; + import { ReviewCaseItem, ReviewItem, ReviewPassRule, ReviewResult } from '@/models/caseManagement/caseReview'; import { BatchApiParams, ModuleTreeNode } from '@/models/common'; import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { TableKeyEnum } from '@/enums/tableEnum'; diff --git a/frontend/src/views/project-management/fileManagement/components/fileDetailDrawer.vue b/frontend/src/views/project-management/fileManagement/components/fileDetailDrawer.vue index d945aad9cd..706fc56306 100644 --- a/frontend/src/views/project-management/fileManagement/components/fileDetailDrawer.vue +++ b/frontend/src/views/project-management/fileManagement/components/fileDetailDrawer.vue @@ -562,6 +562,11 @@ value: detail.name, key: 'name', }, + { + label: t('project.fileManagement.originName'), + value: detail.originalName, + key: 'originalName', + }, { label: t('project.fileManagement.desc'), value: detail.description, diff --git a/frontend/src/views/project-management/fileManagement/locale/en-US.ts b/frontend/src/views/project-management/fileManagement/locale/en-US.ts index a1e94dab10..8f2cc913bc 100644 --- a/frontend/src/views/project-management/fileManagement/locale/en-US.ts +++ b/frontend/src/views/project-management/fileManagement/locale/en-US.ts @@ -71,7 +71,8 @@ export default { 'project.fileManagement.cancelTipContent': 'After cancellation, files that have not been successfully uploaded will not be saved, so please operate with caution!', 'project.fileManagement.cancelConfirm': 'Cancel upload', - 'project.fileManagement.name': 'File name', + 'project.fileManagement.name': 'File alias', + 'project.fileManagement.originName': 'File original name', 'project.fileManagement.type': 'Format', 'project.fileManagement.fileNamePlaceholder': 'Please enter the file name and press Enter to save', 'project.fileManagement.desc': 'Description', diff --git a/frontend/src/views/project-management/fileManagement/locale/zh-CN.ts b/frontend/src/views/project-management/fileManagement/locale/zh-CN.ts index 3c11d938de..138a3f7eca 100644 --- a/frontend/src/views/project-management/fileManagement/locale/zh-CN.ts +++ b/frontend/src/views/project-management/fileManagement/locale/zh-CN.ts @@ -67,7 +67,8 @@ export default { 'project.fileManagement.cancelTipTitle': '确认取消正在上传的文件吗?', 'project.fileManagement.cancelTipContent': '取消后,未上传成功的文件不会被保存,请谨慎操作!', 'project.fileManagement.cancelConfirm': '取消上传', - 'project.fileManagement.name': '文件名称', + 'project.fileManagement.name': '文件别名', + 'project.fileManagement.originName': '文件原名', 'project.fileManagement.fileNamePlaceholder': '请输入文件名称,按回车键保存', 'project.fileManagement.desc': '文件描述', 'project.fileManagement.updateDesc': '更新描述',