fix(接口测试): 来回切换api或case时会出现关闭页签提示&下拉菜单执行当前api时执行无效&用例表格样式

--bug=1037675 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037675
--bug=1037365 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037365
--bug=1037796 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037796
This commit is contained in:
teukkk 2024-04-07 16:24:00 +08:00 committed by 刘瑞斌
parent 3058e2f486
commit ccfb4e1d19
4 changed files with 17 additions and 3 deletions

View File

@ -16,6 +16,7 @@
:disabled="props.disabled" :disabled="props.disabled"
@press-enter="tagInputEnter" @press-enter="tagInputEnter"
@blur="tagInputBlur" @blur="tagInputBlur"
@change="(value) => emit('change', value)"
@clear="emit('clear')" @clear="emit('clear')"
@click="emit('click')" @click="emit('click')"
> >
@ -100,7 +101,6 @@
tagsLength.value = val.length; tagsLength.value = val.length;
} }
emit('update:modelValue', val); emit('update:modelValue', val);
emit('change', val);
} }
); );

View File

@ -1286,6 +1286,7 @@
if (isHttpProtocol.value) { if (isHttpProtocol.value) {
try { try {
if (!props.executeApi) return; if (!props.executeApi) return;
await nextTick();
requestVModel.value.executeLoading = true; requestVModel.value.executeLoading = true;
requestVModel.value.response = cloneDeep(defaultResponse); requestVModel.value.response = cloneDeep(defaultResponse);
const res = await props.executeApi(makeRequestParams(executeType)); const res = await props.executeApi(makeRequestParams(executeType));

View File

@ -304,6 +304,7 @@
); );
const loading = ref(false); const loading = ref(false);
const requestCompositionRef = ref<InstanceType<typeof requestComposition>>();
async function openApiTab( async function openApiTab(
apiInfo: ModuleTreeNode | ApiDefinitionDetail | string, apiInfo: ModuleTreeNode | ApiDefinitionDetail | string,
isCopy = false, isCopy = false,
@ -314,6 +315,7 @@
(e) => e.id === (typeof apiInfo === 'string' ? apiInfo : apiInfo.id) (e) => e.id === (typeof apiInfo === 'string' ? apiInfo : apiInfo.id)
); );
if (isLoadedTabIndex > -1 && !isCopy) { if (isLoadedTabIndex > -1 && !isCopy) {
const preActiveApiTabId = activeApiTab.value.id;
// tabtab // tabtab
activeApiTab.value = { activeApiTab.value = {
...(apiTabs.value[isLoadedTabIndex] as RequestParam), ...(apiTabs.value[isLoadedTabIndex] as RequestParam),
@ -321,6 +323,10 @@
isExecute, isExecute,
mode: isExecute ? 'debug' : 'definition', mode: isExecute ? 'debug' : 'definition',
}; };
// requestCompositionRefid,id
if (preActiveApiTabId === apiTabs.value[isLoadedTabIndex].id) {
requestCompositionRef.value?.execute(userStore.isPriorityLocalExec ? 'localExec' : 'serverExec');
}
return; return;
} }
try { try {
@ -383,12 +389,11 @@
} }
// tab // tab
const requestCompositionRef = ref<InstanceType<typeof requestComposition>>();
function toExecuteDefinition() { function toExecuteDefinition() {
activeApiTab.value.definitionActiveKey = 'definition'; activeApiTab.value.definitionActiveKey = 'definition';
activeApiTab.value.isExecute = true; activeApiTab.value.isExecute = true;
activeApiTab.value.mode = 'debug'; activeApiTab.value.mode = 'debug';
requestCompositionRef.value?.execute(userStore.localExecuteUrl ? 'localExec' : 'serverExec'); requestCompositionRef.value?.execute(userStore.isPriorityLocalExec ? 'localExec' : 'serverExec');
} }
function handleDelete() { function handleDelete() {

View File

@ -37,6 +37,14 @@
@drag-change="handleDragChange" @drag-change="handleDragChange"
@module-change="loadCaseList" @module-change="loadCaseList"
> >
<template v-if="hasAnyPermission(['PROJECT_API_DEFINITION_CASE:READ+ADD']) && props.isApi" #empty>
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
{{ t('apiTestManagement.tableNoDataAndPlease') }}
<MsButton class="ml-[8px]" @click="createCase">
{{ t('caseManagement.featureCase.creatingCase') }}
</MsButton>
</div>
</template>
<template #num="{ record }"> <template #num="{ record }">
<MsButton type="text" @click="isApi ? openCaseDetailDrawer(record.id) : openCaseTab(record)">{{ <MsButton type="text" @click="isApi ? openCaseDetailDrawer(record.id) : openCaseTab(record)">{{
record.num record.num