From 147379e190ddbee3f0afbfedd349e7fd792ca43f Mon Sep 17 00:00:00 2001 From: baiqi Date: Tue, 16 Apr 2024 18:40:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(all):=20=E4=BF=AE=E5=A4=8Dbugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.vue | 32 +++++ .../requrls/setting/organizationAndProject.ts | 2 - .../business/ms-detail-drawer/index.vue | 8 +- .../business/ms-prev-next-button/index.vue | 6 +- .../business/ms-thumbnail-card/index.vue | 90 +++++++++---- .../business/ms-user-group-comp/authTable.vue | 122 +++++++++--------- .../components/pure/ms-code-editor/index.vue | 29 +++-- .../pure/ms-sys-upgrade-tip/index.vue | 20 +++ .../pure/ms-sys-upgrade-tip/locale/en-US.ts | 3 + .../pure/ms-sys-upgrade-tip/locale/zh-CN.ts | 3 + .../components/pure/ms-table/select-all.vue | 2 +- .../src/components/pure/ms-table/useTable.ts | 2 +- frontend/src/components/pure/navbar/index.vue | 1 + frontend/src/hooks/useUser.ts | 36 +++--- frontend/src/locale/en-US/common.ts | 1 + frontend/src/locale/zh-CN/common.ts | 1 + frontend/src/models/apiTest/scenario.ts | 1 + frontend/src/store/modules/app/index.ts | 30 +---- .../api-test/components/condition/content.vue | 2 +- .../components/requestComposition/body.vue | 4 +- .../components/requestComposition/header.vue | 4 +- .../requestComposition/postcondition.vue | 4 +- .../components/requestComposition/query.vue | 4 +- .../response/result/console.vue | 2 - .../components/requestComposition/rest.vue | 4 +- .../components/common/customApiDrawer.vue | 2 +- .../components/common/customCaseDrawer.vue | 2 +- .../scenario/components/scenarioTable.vue | 1 + .../step/stepNodeComposition/quoteContent.vue | 5 +- .../components/index/reviewTable.vue | 2 - .../components/fileDetailDrawer.vue | 60 +++------ .../system/config/components/pageConfig.vue | 3 +- .../setting/system/resourcePool/detail.vue | 8 +- 33 files changed, 285 insertions(+), 211 deletions(-) create mode 100644 frontend/src/components/pure/ms-sys-upgrade-tip/index.vue create mode 100644 frontend/src/components/pure/ms-sys-upgrade-tip/locale/en-US.ts create mode 100644 frontend/src/components/pure/ms-sys-upgrade-tip/locale/zh-CN.ts diff --git a/frontend/src/App.vue b/frontend/src/App.vue index f588a6aa95..b0ffc45de7 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -8,6 +8,9 @@ - \ No newline at end of file + diff --git a/frontend/src/components/business/ms-prev-next-button/index.vue b/frontend/src/components/business/ms-prev-next-button/index.vue index 59498d0ebe..de0f9fde21 100644 --- a/frontend/src/components/business/ms-prev-next-button/index.vue +++ b/frontend/src/components/business/ms-prev-next-button/index.vue @@ -91,11 +91,11 @@ } ); - async function initDetail() { + async function initDetail(id?: string) { try { innerLoading.value = true; emit('loadingDetail'); - const res = await props.getDetailFunc(activeDetailId.value); + const res = await props.getDetailFunc(id || activeDetailId.value); emit('loaded', res); } catch (error) { // eslint-disable-next-line no-console @@ -172,4 +172,4 @@ }); - \ No newline at end of file + diff --git a/frontend/src/components/business/ms-thumbnail-card/index.vue b/frontend/src/components/business/ms-thumbnail-card/index.vue index af0f1cc77f..a793752b80 100644 --- a/frontend/src/components/business/ms-thumbnail-card/index.vue +++ b/frontend/src/components/business/ms-thumbnail-card/index.vue @@ -1,29 +1,65 @@ @@ -35,6 +71,8 @@ import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import type { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { FileIconMap, getFileEnum } from '@/components/pure/ms-upload/iconMap'; + import MsUpload from '@/components/pure/ms-upload/index.vue'; + import { MsFileItem } from '@/components/pure/ms-upload/types'; import { UploadStatus } from '@/enums/uploadEnum'; @@ -45,6 +83,7 @@ url?: string; footerText?: string; moreActions?: ActionsItem[]; + useUpload?: boolean; // 是否使用上传 }>(), { mode: 'default', @@ -53,6 +92,7 @@ const emit = defineEmits<{ (e: 'click'): void; (e: 'actionSelect', item: ActionsItem): void; + (e: 'change', fileItem: MsFileItem): void; }>(); const fileType = computed(() => { @@ -69,6 +109,10 @@ function handleMoreActionSelect(item: ActionsItem) { emit('actionSelect', item); } + + function handleChange(_fileList: MsFileItem[], fileItem: MsFileItem) { + emit('change', fileItem); + } diff --git a/frontend/src/components/pure/ms-sys-upgrade-tip/locale/en-US.ts b/frontend/src/components/pure/ms-sys-upgrade-tip/locale/en-US.ts new file mode 100644 index 0000000000..41cba60dce --- /dev/null +++ b/frontend/src/components/pure/ms-sys-upgrade-tip/locale/en-US.ts @@ -0,0 +1,3 @@ +export default { + 'ms.sys.upgrade.tip.content': 'The system has been updated, please refresh the page', +}; diff --git a/frontend/src/components/pure/ms-sys-upgrade-tip/locale/zh-CN.ts b/frontend/src/components/pure/ms-sys-upgrade-tip/locale/zh-CN.ts new file mode 100644 index 0000000000..f968f5b4fb --- /dev/null +++ b/frontend/src/components/pure/ms-sys-upgrade-tip/locale/zh-CN.ts @@ -0,0 +1,3 @@ +export default { + 'ms.sys.upgrade.tip.content': '系统已更新,请刷新页面', +}; diff --git a/frontend/src/components/pure/ms-table/select-all.vue b/frontend/src/components/pure/ms-table/select-all.vue index 6a4de0420a..25bb2d26e0 100644 --- a/frontend/src/components/pure/ms-table/select-all.vue +++ b/frontend/src/components/pure/ms-table/select-all.vue @@ -56,7 +56,7 @@ get: () => { // 如果是选中所有页则是全选状态(选中所有页分两种情况:一是直接通过下拉选项选中所有页;二是当前已选的数量等于表格总数) return ( - selectAllStatus.value === SelectAllEnum.ALL || + (props.selectedKeys.size > 0 && selectAllStatus.value === SelectAllEnum.ALL) || (props.selectedKeys.size > 0 && props.selectedKeys.size === props.total) ); }, diff --git a/frontend/src/components/pure/ms-table/useTable.ts b/frontend/src/components/pure/ms-table/useTable.ts index bfe1c89b5f..5ee34edd9e 100644 --- a/frontend/src/components/pure/ms-table/useTable.ts +++ b/frontend/src/components/pure/ms-table/useTable.ts @@ -403,7 +403,7 @@ export default function useTableProps( // 重置筛选 clearSelector: () => { propsRes.value.selectorStatus = SelectAllEnum.NONE; // 重置选择器状态 - resetSelector(); + resetSelector(true); }, // 表格SelectAll change diff --git a/frontend/src/components/pure/navbar/index.vue b/frontend/src/components/pure/navbar/index.vue index ac918fdd0d..fc4c4f7728 100644 --- a/frontend/src/components/pure/navbar/index.vue +++ b/frontend/src/components/pure/navbar/index.vue @@ -19,6 +19,7 @@ v-model:model-value="appStore.currentProjectId" class="w-[200px] focus-within:!bg-[var(--color-text-n8)] hover:!bg-[var(--color-text-n8)]" :bordered="false" + :fallback-option="() => undefined" allow-search @change="selectProject" > diff --git a/frontend/src/hooks/useUser.ts b/frontend/src/hooks/useUser.ts index 27e6b53441..fb8cb89429 100644 --- a/frontend/src/hooks/useUser.ts +++ b/frontend/src/hooks/useUser.ts @@ -1,28 +1,32 @@ -import { useRouter } from 'vue-router'; import { Message } from '@arco-design/web-vue'; import { useI18n } from '@/hooks/useI18n'; +import router from '@/router'; import { useAppStore, useUserStore } from '@/store'; export default function useUser() { - const router = useRouter(); const { t } = useI18n(); const logout = async (logoutTo?: string) => { - const appStore = useAppStore(); - const userStore = useUserStore(); - await userStore.logout(); - const currentRoute = router.currentRoute.value; - // 清空顶部菜单 - appStore.setTopMenus([]); - Message.success(t('message.logoutSuccess')); - router.push({ - name: logoutTo && typeof logoutTo === 'string' ? logoutTo : 'login', - query: { - ...router.currentRoute.value.query, - redirect: currentRoute.name as string, - }, - }); + try { + const userStore = useUserStore(); + await userStore.logout(); + const appStore = useAppStore(); + const currentRoute = router.currentRoute.value; + // 清空顶部菜单 + appStore.setTopMenus([]); + Message.success(t('message.logoutSuccess')); + router.push({ + name: logoutTo && typeof logoutTo === 'string' ? logoutTo : 'login', + query: { + ...router.currentRoute.value.query, + redirect: currentRoute.name as string, + }, + }); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } }; const isLoginPage = () => { diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index 5e48130f8e..340724641a 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -153,4 +153,5 @@ export default { 'common.image': 'Image', 'common.text': 'Text', 'common.resourceDeleted': 'Resource has been deleted', + 'common.refresh': 'Refresh', }; diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts index 89f224aad1..ed9a82156f 100644 --- a/frontend/src/locale/zh-CN/common.ts +++ b/frontend/src/locale/zh-CN/common.ts @@ -153,4 +153,5 @@ export default { 'common.image': '图片', 'common.text': '文本', 'common.resourceDeleted': '资源已被删除', + 'common.refresh': '刷新', }; diff --git a/frontend/src/models/apiTest/scenario.ts b/frontend/src/models/apiTest/scenario.ts index b4013f5829..886973cfc2 100644 --- a/frontend/src/models/apiTest/scenario.ts +++ b/frontend/src/models/apiTest/scenario.ts @@ -486,4 +486,5 @@ export interface ScenarioStepResourceInfo { name: string; projectId: string; projectName: string; + delete: boolean; } diff --git a/frontend/src/store/modules/app/index.ts b/frontend/src/store/modules/app/index.ts index f5c33fdf24..75fb576310 100644 --- a/frontend/src/store/modules/app/index.ts +++ b/frontend/src/store/modules/app/index.ts @@ -246,34 +246,11 @@ const useAppStore = defineStore('app', { console.log(error); } }, - async validateUserProjectPermission() { - try { - const router = useRouter(); - const HasProjectPermission = await getUserHasProjectPermission(this.currentProjectId); - if (!HasProjectPermission) { - // 没有项目权限(用户所在的当前项目被禁用&用户被移除出去该项目) - router.push({ - name: NO_PROJECT_ROUTE_NAME, - }); - return false; - } - - const res = await getProjectInfo(this.currentProjectId); - if (res.deleted) { - // 如果项目被删除或者被禁用,跳转到无项目页面 - router.push({ - name: NO_PROJECT_ROUTE_NAME, - }); - return false; - } - return true; - } catch (error) { - console.log(error); - return false; - } - }, async getProjectInfos() { try { + if (!this.currentProjectId) { + return; + } const res = await getProjectInfo(this.currentProjectId); if (!res || res.deleted) { const router = useRouter(); @@ -285,6 +262,7 @@ const useAppStore = defineStore('app', { this.setCurrentMenuConfig(res?.moduleIds || []); } } catch (error) { + // eslint-disable-next-line no-console console.log(error); } }, diff --git a/frontend/src/views/api-test/components/condition/content.vue b/frontend/src/views/api-test/components/condition/content.vue index d2faf19b48..33305215e3 100644 --- a/frontend/src/views/api-test/components/condition/content.vue +++ b/frontend/src/views/api-test/components/condition/content.vue @@ -373,7 +373,7 @@ :selectable="false" :scroll="{ x: '700px' }" :response="props.response" - :height-used="(props.heightUsed || 0) + 68" + :height-used="props.heightUsed" @change="handleExtractParamTableChange" @more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)" > diff --git a/frontend/src/views/api-test/components/requestComposition/body.vue b/frontend/src/views/api-test/components/requestComposition/body.vue index e866457ee9..28d796a5a4 100644 --- a/frontend/src/views/api-test/components/requestComposition/body.vue +++ b/frontend/src/views/api-test/components/requestComposition/body.vue @@ -258,7 +258,7 @@ watch( () => props.layout, (val) => { - const otherHeight = props.isDrawer ? 328 : 430; + const otherHeight = props.isDrawer ? 328 : 372; heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight; }, { @@ -270,7 +270,7 @@ () => props.secondBoxHeight, (val) => { if (props.layout === 'vertical') { - heightUsed.value = (props.isDrawer ? 328 : 430) + val; + heightUsed.value = (props.isDrawer ? 328 : 372) + val; } }, { diff --git a/frontend/src/views/api-test/components/requestComposition/header.vue b/frontend/src/views/api-test/components/requestComposition/header.vue index b71a97afaf..8ea8d43ee9 100644 --- a/frontend/src/views/api-test/components/requestComposition/header.vue +++ b/frontend/src/views/api-test/components/requestComposition/header.vue @@ -85,9 +85,9 @@ const heightUsed = computed(() => { if (props.layout === 'horizontal') { - return props.isDrawer ? 328 : 428; + return props.isDrawer ? 328 : 372; } - return (props.isDrawer ? 328 : 428) + props.secondBoxHeight; + return (props.isDrawer ? 328 : 372) + props.secondBoxHeight; }); const scroll = computed(() => (props.layout === 'horizontal' ? { x: '700px' } : { x: '100%' })); diff --git a/frontend/src/views/api-test/components/requestComposition/postcondition.vue b/frontend/src/views/api-test/components/requestComposition/postcondition.vue index ff5e2b36cb..6816697b97 100644 --- a/frontend/src/views/api-test/components/requestComposition/postcondition.vue +++ b/frontend/src/views/api-test/components/requestComposition/postcondition.vue @@ -57,9 +57,9 @@ const innerConfig = useVModel(props, 'config', emit); const heightUsed = computed(() => { if (props.layout === 'horizontal') { - return 428; + return 328; } - return 428 + (props.secondBoxHeight || 0); + return 328 + (props.secondBoxHeight || 0); }); const conditionTypes = computed(() => { diff --git a/frontend/src/views/api-test/components/requestComposition/query.vue b/frontend/src/views/api-test/components/requestComposition/query.vue index 109accb621..212723003c 100644 --- a/frontend/src/views/api-test/components/requestComposition/query.vue +++ b/frontend/src/views/api-test/components/requestComposition/query.vue @@ -124,7 +124,7 @@ watch( () => props.layout, (val) => { - const otherHeight = props.isDrawer ? 328 : 430; + const otherHeight = props.isDrawer ? 328 : 372; heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight; }, { @@ -136,7 +136,7 @@ () => props.secondBoxHeight, (val) => { if (props.layout === 'vertical') { - heightUsed.value = (props.isDrawer ? 328 : 430) + val; + heightUsed.value = (props.isDrawer ? 328 : 372) + val; } }, { diff --git a/frontend/src/views/api-test/components/requestComposition/response/result/console.vue b/frontend/src/views/api-test/components/requestComposition/response/result/console.vue index 4df86bbf04..4a9006ce34 100644 --- a/frontend/src/views/api-test/components/requestComposition/response/result/console.vue +++ b/frontend/src/views/api-test/components/requestComposition/response/result/console.vue @@ -14,8 +14,6 @@