fix(日志): 接口测试日志跳转 api、case、mock

This commit is contained in:
baiqi 2024-08-14 14:23:24 +08:00 committed by 刘瑞斌
parent 8394a5a5c7
commit 3128e80916
4 changed files with 35 additions and 0 deletions

View File

@ -79,6 +79,9 @@ export const pathMap: PathMapItem[] = [
route: RouteEnum.API_TEST_MANAGEMENT,
permission: [],
level: MENU_LEVEL[2],
routeQuery: {
tab: 'api',
},
},
{
key: 'API_TEST_MANAGEMENT_MOCK', // 接口测试-接口定义-mock
@ -86,6 +89,9 @@ export const pathMap: PathMapItem[] = [
route: RouteEnum.API_TEST_MANAGEMENT,
permission: [],
level: MENU_LEVEL[2],
routeQuery: {
tab: 'mock',
},
},
{
key: 'API_TEST_MANAGEMENT_CASE', // 接口测试-接口定义-case
@ -93,6 +99,9 @@ export const pathMap: PathMapItem[] = [
route: RouteEnum.API_TEST_MANAGEMENT,
permission: [],
level: MENU_LEVEL[2],
routeQuery: {
tab: 'case',
},
},
{
key: 'API_TEST_MANAGEMENT_RECYCLE', // 接口测试-回收站

View File

@ -107,6 +107,7 @@
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
import { cloneDeep } from 'lodash-es';
import { TabItem } from '@/components/pure/ms-editable-tab/types';
@ -180,6 +181,7 @@
(e: 'openCaseTab', apiCaseDetail: ApiCaseDetail): void;
}>();
const route = useRoute();
const userStore = useUserStore();
const appStore = useAppStore();
const { t } = useI18n();
@ -563,6 +565,12 @@
});
}
onBeforeMount(() => {
if (!['case', 'mock'].includes(route.query.tab as string) && route.query.id) {
openApiTab({ apiInfo: route.query.id as string });
}
});
defineExpose({
openApiTab,
addApiTab,

View File

@ -26,6 +26,7 @@
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
import { cloneDeep } from 'lodash-es';
import { TabItem } from '@/components/pure/ms-editable-tab/types';
@ -54,6 +55,8 @@
(e: 'deleteCase', id: string): void;
}>();
const route = useRoute();
const apiTabs = defineModel<RequestParam[]>('apiTabs', {
required: true,
});
@ -136,6 +139,12 @@
caseTableRef.value?.loadCaseList();
}
onBeforeMount(() => {
if (route.query.tab === 'case' && route.query.id) {
openCaseTab(route.query.id as string);
}
});
defineExpose({
openCaseTab,
openCaseTabAndExecute,

View File

@ -81,6 +81,7 @@
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
import { cloneDeep } from 'lodash-es';
import MsEditableTab from '@/components/pure/ms-editable-tab/index.vue';
@ -127,6 +128,7 @@
(e: 'import'): void;
}>();
const appStore = useAppStore();
const route = useRoute();
const { t } = useI18n();
const requestCompositionStore = useRequestCompositionStore();
@ -359,6 +361,13 @@
onBeforeMount(() => {
initMemberOptions();
initProtocolList();
if ((route.query.tab as string) === 'case') {
currentTab.value = 'case';
currentTabChange('case');
} else if ((route.query.tab as string) === 'mock') {
currentTab.value = 'mock';
currentTabChange('mock');
}
});
useLeaveTabUnSaveCheck(apiTabs.value, [