fix(接口测试): 调整组件treeFolderAll操作按钮显隐

This commit is contained in:
teukkk 2024-06-12 12:22:43 +08:00 committed by 刘瑞斌
parent 90f6c45d0b
commit 635d92fad0
2 changed files with 15 additions and 13 deletions

View File

@ -9,7 +9,7 @@
<template #expandLeft> <template #expandLeft>
<a-dropdown v-model:popup-visible="visible" :hide-on-select="false"> <a-dropdown v-model:popup-visible="visible" :hide-on-select="false">
<MsButton <MsButton
v-show="typeof isExpandAll !== 'undefined'" v-show="!props.notShowOperation"
type="icon" type="icon"
status="secondary" status="secondary"
class="!mr-[4px] p-[4px]" class="!mr-[4px] p-[4px]"
@ -81,6 +81,7 @@
folderName: string; // folderName: string; //
allCount: number; // allCount: number; //
showExpandApi?: boolean; // showExpandApi?: boolean; //
notShowOperation?: boolean; //
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'setActiveFolder', val: string): void; (e: 'setActiveFolder', val: string): void;
@ -88,7 +89,7 @@
(e: 'selectedProtocolsChange'): void; (e: 'selectedProtocolsChange'): void;
}>(); }>();
const isExpandAll = defineModel<boolean>('isExpandAll', { const isExpandAll = defineModel<boolean | undefined>('isExpandAll', {
required: false, required: false,
default: undefined, default: undefined,
}); });
@ -147,6 +148,17 @@
} }
); );
watch(
() => props.notShowOperation,
(val) => {
if (val) {
isExpandAll.value = undefined;
} else {
isExpandAll.value = false;
}
}
);
onBeforeMount(() => { onBeforeMount(() => {
initProtocolList(); initProtocolList();
}); });

View File

@ -10,6 +10,7 @@
<TreeFolderAll <TreeFolderAll
v-model:isExpandAll="isExpandAll" v-model:isExpandAll="isExpandAll"
v-model:selectedProtocols="selectedProtocols" v-model:selectedProtocols="selectedProtocols"
:not-show-operation="props.treeType === 'COLLECTION'"
:active-folder="activeFolder" :active-folder="activeFolder"
:folder-name="t('apiTestManagement.allApi')" :folder-name="t('apiTestManagement.allApi')"
:all-count="allCount" :all-count="allCount"
@ -90,17 +91,6 @@
const allCount = ref(0); const allCount = ref(0);
const isExpandAll = ref<boolean | undefined>(false); const isExpandAll = ref<boolean | undefined>(false);
watch(
() => props.treeType,
(val) => {
if (val === 'COLLECTION') {
isExpandAll.value = undefined;
} else {
isExpandAll.value = false;
}
}
);
function setActiveFolder(id: string) { function setActiveFolder(id: string) {
activeFolder.value = id; activeFolder.value = id;
emit('folderNodeSelect', [id], []); emit('folderNodeSelect', [id], []);