feat(接口测试): 点击api/case引用关系的ID跳转到场景详情

--bug=1039577 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039577
This commit is contained in:
teukkk 2024-04-17 17:12:40 +08:00 committed by 刘瑞斌
parent 1527cf6890
commit 69fc71c3d3
2 changed files with 24 additions and 18 deletions

View File

@ -9,16 +9,14 @@
@press-enter="loadQuoteList" @press-enter="loadQuoteList"
/> />
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent"> <ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
<template #id="{ record }"> <template #num="{ record }">
<MsButton type="text" @click="gotoResource(record)">{{ record.id }}</MsButton> <MsButton type="text" @click="toScenario(record.id)">{{ record.num }}</MsButton>
</template> </template>
</ms-base-table> </ms-base-table>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
// import { useRouter } from 'vue-router';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import { MsTableColumn } from '@/components/pure/ms-table/type'; import { MsTableColumn } from '@/components/pure/ms-table/type';
@ -26,15 +24,16 @@
import { getDefinitionReference } from '@/api/modules/api-test/management'; import { getDefinitionReference } from '@/api/modules/api-test/management';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import { RouteEnum } from '@/enums/routeEnum';
const props = defineProps<{ const props = defineProps<{
sourceId: string | number; sourceId: string | number;
}>(); }>();
// const router = useRouter();
const appStore = useAppStore();
const { t } = useI18n(); const { t } = useI18n();
const { openNewPage } = useOpenNewPage();
const keyword = ref(''); const keyword = ref('');
const quoteLocaleMap = { const quoteLocaleMap = {
@ -99,13 +98,10 @@
loadList(); loadList();
} }
function gotoResource(record: any) { function toScenario(id: string) {
// router.push({ openNewPage(RouteEnum.API_TEST_SCENARIO, {
// name: 'apiTestManagementApiPreview', id,
// query: { });
// id: record.id,
// },
// });
} }
onBeforeMount(() => { onBeforeMount(() => {

View File

@ -13,8 +13,8 @@
</div> </div>
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent"> <ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
<template #id="{ record }"> <template #num="{ record }">
<MsButton type="text">{{ record.id }}</MsButton> <MsButton type="text" @click="toScenario(record.id)">{{ record.num }}</MsButton>
</template> </template>
</ms-base-table> </ms-base-table>
</div> </div>
@ -28,12 +28,16 @@
import { getApiCaseDependency } from '@/api/modules/api-test/management'; import { getApiCaseDependency } from '@/api/modules/api-test/management';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage';
import { RouteEnum } from '@/enums/routeEnum';
const props = defineProps<{ const props = defineProps<{
sourceId: string | number; sourceId: string | number;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
const { openNewPage } = useOpenNewPage();
const keyword = ref(''); const keyword = ref('');
const quoteLocaleMap = { const quoteLocaleMap = {
@ -112,6 +116,12 @@
loadList(); loadList();
} }
function toScenario(id: string) {
openNewPage(RouteEnum.API_TEST_SCENARIO, {
id,
});
}
onBeforeMount(() => { onBeforeMount(() => {
loadQuoteList(); loadQuoteList();
}); });
@ -125,9 +135,9 @@
} }
.history-table-before { .history-table-before {
display: flex; display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between; justify-content: space-between;
align-items: center;
padding-bottom: 16px; padding-bottom: 16px;
flex-direction: row;
} }
</style> </style>