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