fix(接口测试): 修复接口定义进入页面不展示数据的问题
This commit is contained in:
parent
a0c6ed78a7
commit
24181eada0
|
@ -412,7 +412,12 @@
|
|||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
<addDependencyDrawer v-if="props.isDefinition" v-model:visible="showAddDependencyDrawer" :mode="addDependencyMode" />
|
||||
<addDependencyDrawer
|
||||
v-if="props.isDefinition"
|
||||
v-model:visible="showAddDependencyDrawer"
|
||||
:member-options="memberOptions"
|
||||
:mode="addDependencyMode"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -439,6 +444,7 @@
|
|||
import { getPluginScript, getProtocolList } from '@/api/modules/api-test/common';
|
||||
import { addCase } from '@/api/modules/api-test/management';
|
||||
import { getSocket } from '@/api/modules/project-management/commonScript';
|
||||
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
@ -1532,8 +1538,13 @@
|
|||
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 }));
|
||||
}
|
||||
onMounted(() => {
|
||||
initMemberOptions();
|
||||
if (!props.isDefinition) {
|
||||
registerCatchSaveShortcut(handleSaveShortcut);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
:offspring-ids="offspringIds"
|
||||
class="flex-1 overflow-hidden !pl-0 !pr-[16px]"
|
||||
:protocol="protocol"
|
||||
:member-options="memberOptions"
|
||||
read-only
|
||||
/>
|
||||
</div>
|
||||
|
@ -30,13 +31,17 @@
|
|||
import apiTable from './management/api/apiTable.vue';
|
||||
import moduleTree from '@/views/api-test/management/components/moduleTree.vue';
|
||||
|
||||
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import { ModuleTreeNode } from '@/models/common';
|
||||
|
||||
import useAppStore from '../../../../store/modules/app';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
mode: 'pre' | 'post'; // pre: 前置依赖,post: 后置依赖
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
|
|
@ -363,6 +363,7 @@
|
|||
protocol: string; // 查看的协议类型
|
||||
readOnly?: boolean; // 是否是只读模式
|
||||
refreshTimeStamp?: number;
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'openApiTab', record: ApiDefinitionDetail, isExecute?: boolean): void;
|
||||
|
@ -554,7 +555,6 @@
|
|||
const statusFilters = ref<string[]>([]);
|
||||
const createUserFilterVisible = ref(false);
|
||||
const createUserFilters = ref<string[]>([]);
|
||||
const memberOptions = ref<{ label: string; value: string }[]>([]);
|
||||
|
||||
async function getModuleIds() {
|
||||
let moduleIds: string[] = [];
|
||||
|
@ -567,11 +567,9 @@
|
|||
}
|
||||
return moduleIds;
|
||||
}
|
||||
|
||||
async function loadApiList() {
|
||||
const moduleIds = await getModuleIds();
|
||||
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
|
||||
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
|
||||
|
||||
const params = {
|
||||
keyword: keyword.value,
|
||||
projectId: appStore.currentProjectId,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
:offspring-ids="props.offspringIds"
|
||||
:protocol="props.protocol"
|
||||
:refresh-time-stamp="refreshTableTimeStamp"
|
||||
:member-options="memberOptions"
|
||||
@open-api-tab="(record, isExecute) => openApiTab(record, false, isExecute)"
|
||||
@open-copy-api-tab="openApiTab($event, true)"
|
||||
@add-api-tab="addApiTab"
|
||||
|
@ -109,6 +110,7 @@
|
|||
:protocol="activeApiTab.protocol"
|
||||
:api-detail="activeApiTab"
|
||||
:offspring-ids="props.offspringIds"
|
||||
:member-options="memberOptions"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane v-if="!activeApiTab.isNew" key="mock" title="MOCK" class="ms-api-tab-pane"> </a-tab-pane> -->
|
||||
|
@ -168,6 +170,7 @@
|
|||
offspringIds: string[];
|
||||
moduleTree: ModuleTreeNode[]; // 模块树
|
||||
protocol: string;
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -423,6 +423,7 @@
|
|||
protocol: string; // 查看的协议类型
|
||||
apiDetail?: RequestParam;
|
||||
offspringIds: string[];
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
|
||||
const caseExecute = ref(false);
|
||||
|
@ -634,7 +635,6 @@
|
|||
const caseFilters = ref<string[]>([]);
|
||||
const createUserFilterVisible = ref(false);
|
||||
const createUserFilters = ref<string[]>([]);
|
||||
const memberOptions = ref<{ label: string; value: string }[]>([]);
|
||||
const lastReportStatusFilterVisible = ref(false);
|
||||
const lastReportStatusList = computed(() => {
|
||||
return Object.keys(ReportStatus[ReportEnum.API_REPORT]);
|
||||
|
@ -652,12 +652,8 @@
|
|||
}
|
||||
return moduleIds;
|
||||
}
|
||||
|
||||
async function loadCaseList() {
|
||||
const selectModules = await getModuleIds();
|
||||
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
|
||||
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
|
||||
|
||||
const params = {
|
||||
apiDefinitionId: props.apiDetail?.id,
|
||||
keyword: keyword.value,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
:is-api="false"
|
||||
:active-module="props.activeModule"
|
||||
:protocol="props.protocol"
|
||||
:member-options="memberOptions"
|
||||
@open-case-tab="openCaseTab"
|
||||
@open-case-tab-and-execute="openCaseTabAndExecute"
|
||||
/>
|
||||
|
@ -46,6 +47,7 @@
|
|||
protocol: string;
|
||||
offspringIds: string[];
|
||||
moduleTree: ModuleTreeNode[]; // 模块树
|
||||
memberOptions: { label: string; value: string }[];
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'deleteCase', id: string): void;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
:offspring-ids="props.offspringIds"
|
||||
:protocol="props.protocol"
|
||||
:module-tree="props.moduleTree"
|
||||
:member-options="memberOptions"
|
||||
@import="emit('import')"
|
||||
@delete-api="(id) => handleDeleteApiFromModuleTree(id)"
|
||||
/>
|
||||
|
@ -51,6 +52,7 @@
|
|||
:protocol="props.protocol"
|
||||
:module-tree="props.moduleTree"
|
||||
:offspring-ids="props.offspringIds"
|
||||
:member-options="memberOptions"
|
||||
@delete-case="(id) => handleDeleteApiFromModuleTree(id)"
|
||||
/>
|
||||
</template>
|
||||
|
@ -67,6 +69,7 @@
|
|||
|
||||
// import MockTable from '@/views/api-test/management/components/management/mock/mockTable.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 useAppStore from '@/store/modules/app';
|
||||
|
@ -98,7 +101,11 @@
|
|||
const { t } = useI18n();
|
||||
|
||||
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' },
|
||||
|
@ -297,6 +304,7 @@
|
|||
const currentEnvConfig = computed<EnvConfig | undefined>(() => environmentSelectRef.value?.currentEnvConfig);
|
||||
|
||||
onBeforeMount(() => {
|
||||
initMemberOptions();
|
||||
initProtocolList();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue