refactor(接口测试): 删除冗余代码
This commit is contained in:
parent
40b9babf62
commit
a60b7b2f01
|
@ -478,12 +478,7 @@
|
|||
v-model:visible="saveNewApiModalVisible"
|
||||
:detail="tempApiDetail"
|
||||
></saveAsApiModal>
|
||||
<addDependencyDrawer
|
||||
v-if="props.isDefinition"
|
||||
v-model:visible="showAddDependencyDrawer"
|
||||
:member-options="memberOptions"
|
||||
:mode="addDependencyMode"
|
||||
/>
|
||||
<addDependencyDrawer v-if="props.isDefinition" v-model:visible="showAddDependencyDrawer" :mode="addDependencyMode" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -510,7 +505,6 @@
|
|||
|
||||
import { getPluginScript, getProtocolList } from '@/api/modules/api-test/common';
|
||||
import { addCase } from '@/api/modules/api-test/management';
|
||||
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useShortcutSave from '@/hooks/useShortcutSave';
|
||||
import useWebsocket from '@/hooks/useWebsocket';
|
||||
|
@ -1702,11 +1696,6 @@
|
|||
function handleCancel() {
|
||||
saveModalFormRef.value?.resetFields();
|
||||
}
|
||||
const memberOptions = ref<{ label: string; value: string }[]>([]);
|
||||
async function initMemberOptions() {
|
||||
memberOptions.value = await getProjectOptions(appStore.currentProjectId);
|
||||
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
|
||||
}
|
||||
|
||||
const nameInputRef = ref<InputInstance>();
|
||||
const urlInputRef = ref<InputInstance>();
|
||||
|
@ -1724,7 +1713,6 @@
|
|||
});
|
||||
|
||||
onMounted(() => {
|
||||
initMemberOptions();
|
||||
if (
|
||||
!props.isCase &&
|
||||
(requestVModel.value.isNew
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
:offspring-ids="offspringIds"
|
||||
class="flex-1 overflow-hidden !pl-0 !pr-[16px]"
|
||||
:selected-protocols="selectedProtocols"
|
||||
:member-options="memberOptions"
|
||||
read-only
|
||||
/>
|
||||
</div>
|
||||
|
@ -38,7 +37,6 @@
|
|||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
mode: 'pre' | 'post'; // pre: 前置依赖,post: 后置依赖
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
|
|
@ -362,7 +362,6 @@
|
|||
readOnly?: boolean; // 是否是只读模式
|
||||
refreshTimeStamp?: number;
|
||||
moduleTreeData?: ModuleTreeNode[];
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'openApiTab', record: ApiDefinitionDetail, isExecute?: boolean): void;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
:module-tree-data="props.moduleTree"
|
||||
:selected-protocols="props.selectedProtocols"
|
||||
:refresh-time-stamp="refreshTableTimeStamp"
|
||||
:member-options="memberOptions"
|
||||
@open-api-tab="(record, isExecute) => openApiTab({ apiInfo: record, isCopy: false, isExecute })"
|
||||
@open-copy-api-tab="openApiTab({ apiInfo: $event, isCopy: true })"
|
||||
@add-api-tab="addApiTab"
|
||||
|
@ -91,7 +90,6 @@
|
|||
:selected-protocols="[activeApiTab.protocol]"
|
||||
:api-detail="activeApiTab"
|
||||
:offspring-ids="props.offspringIds"
|
||||
:member-options="memberOptions"
|
||||
:height-used="32"
|
||||
@open-case-tab="openCaseTab"
|
||||
/>
|
||||
|
@ -180,7 +178,6 @@
|
|||
moduleTree: ModuleTreeNode[]; // 模块树
|
||||
selectedProtocols: string[];
|
||||
currentTab: string;
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -379,7 +379,6 @@
|
|||
selectedProtocols: string[]; // 查看的协议类型
|
||||
apiDetail?: RequestParam;
|
||||
offspringIds: string[];
|
||||
memberOptions: { label: string; value: string }[];
|
||||
heightUsed?: number;
|
||||
}>();
|
||||
const cacheStore = useCacheStore();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
:is-api="false"
|
||||
:active-module="props.activeModule"
|
||||
:selected-protocols="props.selectedProtocols"
|
||||
:member-options="memberOptions"
|
||||
@open-case-tab="openCaseTab"
|
||||
@open-case-tab-and-execute="openCaseTabAndExecute"
|
||||
@handle-adv-search="(val) => emit('handleAdvSearch', val)"
|
||||
|
@ -60,7 +59,6 @@
|
|||
selectedProtocols: string[];
|
||||
offspringIds: string[];
|
||||
moduleTree: ModuleTreeNode[]; // 模块树
|
||||
memberOptions: { label: string; value: string }[];
|
||||
currentTab: string;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
:selected-protocols="props.selectedProtocols"
|
||||
:module-tree="props.moduleTree"
|
||||
:current-tab="currentTab"
|
||||
:member-options="memberOptions"
|
||||
@import="emit('import')"
|
||||
@open-case-tab="(apiCaseDetail:ApiCaseDetail)=>newCaseTab(apiCaseDetail.id)"
|
||||
@delete-api="(id) => handleDeleteApiFromModuleTree(id)"
|
||||
|
@ -68,7 +67,6 @@
|
|||
:module-tree="props.moduleTree"
|
||||
:current-tab="currentTab"
|
||||
:offspring-ids="props.offspringIds"
|
||||
:member-options="memberOptions"
|
||||
@delete-case="(id) => handleDeleteApiFromModuleTree(id)"
|
||||
@handle-adv-search="(val) => emit('handleAdvSearch', val)"
|
||||
/>
|
||||
|
@ -99,7 +97,6 @@
|
|||
import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue';
|
||||
|
||||
import { getProtocolList } from '@/api/modules/api-test/common';
|
||||
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useLeaveTabUnSaveCheck from '@/hooks/useLeaveTabUnSaveCheck';
|
||||
import useRequestCompositionStore from '@/store/modules/api/requestComposition';
|
||||
|
@ -143,11 +140,6 @@
|
|||
const cacheStore = useCacheStore();
|
||||
|
||||
const setActiveApi: ((params: RequestParam) => void) | undefined = inject('setActiveApi');
|
||||
const memberOptions = ref<{ label: string; value: string }[]>([]);
|
||||
async function initMemberOptions() {
|
||||
memberOptions.value = await getProjectOptions(appStore.currentProjectId);
|
||||
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
|
||||
}
|
||||
const currentTab = ref('api');
|
||||
const tabOptions = [
|
||||
{ label: 'API', value: 'api' },
|
||||
|
@ -370,7 +362,6 @@
|
|||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
initMemberOptions();
|
||||
initProtocolList();
|
||||
if ((route.query.tab as string) === 'case') {
|
||||
currentTab.value = 'case';
|
||||
|
|
|
@ -507,7 +507,6 @@
|
|||
updateScenarioPro,
|
||||
updateScenarioStatus,
|
||||
} from '@/api/modules/api-test/scenario';
|
||||
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import useTableStore from '@/hooks/useTableStore';
|
||||
|
|
Loading…
Reference in New Issue