fix(接口管理):修复接口定义回收站不显示数据问题

--bug=1038414 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001038414
This commit is contained in:
guoyuqi 2024-04-08 10:04:24 +08:00 committed by 刘瑞斌
parent 0a548d6865
commit 693a2f9fef
3 changed files with 19 additions and 11 deletions

View File

@ -144,7 +144,6 @@
getDefinitionPage, getDefinitionPage,
recoverDefinition, recoverDefinition,
} from '@/api/modules/api-test/management'; } 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 useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore'; import useTableStore from '@/hooks/useTableStore';
@ -161,6 +160,7 @@
offspringIds: string[]; offspringIds: string[];
protocol: string; // protocol: string; //
readOnly?: boolean; // readOnly?: boolean; //
memberOptions: { label: string; value: string }[];
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();
@ -290,7 +290,6 @@
const statusFilters = ref<string[]>([]); const statusFilters = ref<string[]>([]);
const deleteUserFilterVisible = ref(false); const deleteUserFilterVisible = ref(false);
const deleteUserFilters = ref<string[]>([]); const deleteUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const moduleIds = computed(() => { const moduleIds = computed(() => {
if (props.activeModule === 'all') { if (props.activeModule === 'all') {
return []; return [];
@ -299,10 +298,7 @@
}); });
const tableQueryParams = ref<any>(); const tableQueryParams = ref<any>();
async function loadApiList() { function loadApiList() {
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = { const params = {
keyword: keyword.value, keyword: keyword.value,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,

View File

@ -230,12 +230,10 @@
recoverCase, recoverCase,
} from '@/api/modules/api-test/management'; } from '@/api/modules/api-test/management';
import { getCaseDefaultFields } from '@/api/modules/case-management/featureCase'; import { getCaseDefaultFields } from '@/api/modules/case-management/featureCase';
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';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { hasAnyPermission } from '@/utils/permission';
import { ApiCaseBatchParams, ApiCaseDetail } from '@/models/apiTest/management'; import { ApiCaseBatchParams, ApiCaseDetail } from '@/models/apiTest/management';
import { RequestDefinitionStatus } from '@/enums/apiEnum'; import { RequestDefinitionStatus } from '@/enums/apiEnum';
@ -246,6 +244,7 @@
activeModule: string; activeModule: string;
offspringIds: string[]; offspringIds: string[];
protocol: string; // protocol: string; //
memberOptions: { label: string; value: string }[];
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();
@ -458,15 +457,12 @@
const updateUserFilters = ref<string[]>([]); const updateUserFilters = ref<string[]>([]);
const deleteUserFilterVisible = ref(false); const deleteUserFilterVisible = ref(false);
const deleteUserFilters = ref<string[]>([]); const deleteUserFilters = ref<string[]>([]);
const memberOptions = ref<{ label: string; value: string }[]>([]);
const moduleIds = computed(() => { const moduleIds = computed(() => {
return props.activeModule === 'all' ? [] : [props.activeModule]; return props.activeModule === 'all' ? [] : [props.activeModule];
}); });
async function loadCaseList() { async function loadCaseList() {
memberOptions.value = await getProjectOptions(appStore.currentProjectId, keyword.value);
memberOptions.value = memberOptions.value.map((e: any) => ({ label: e.name, value: e.id }));
const params = { const params = {
keyword: keyword.value, keyword: keyword.value,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,

View File

@ -24,6 +24,7 @@
<api <api
v-show="currentTab === 'api'" v-show="currentTab === 'api'"
ref="apiRef" ref="apiRef"
:member-options="memberOptions"
:module-tree="props.moduleTree" :module-tree="props.moduleTree"
:active-module="props.activeModule" :active-module="props.activeModule"
:offspring-ids="props.offspringIds" :offspring-ids="props.offspringIds"
@ -31,6 +32,7 @@
/> />
<api-case <api-case
v-show="currentTab === 'case'" v-show="currentTab === 'case'"
:member-options="memberOptions"
:active-module="props.activeModule" :active-module="props.activeModule"
:offspring-ids="props.offspringIds" :offspring-ids="props.offspringIds"
:protocol="protocol" :protocol="protocol"
@ -44,7 +46,9 @@
import apiMethodName from '@/views/api-test/components/apiMethodName.vue'; import apiMethodName from '@/views/api-test/components/apiMethodName.vue';
import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue'; import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue';
import { getProjectOptions } from '@/api/modules/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
@ -56,6 +60,7 @@
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStore();
const currentTab = ref('api'); const currentTab = ref('api');
const tabOptions = [ const tabOptions = [
@ -72,10 +77,21 @@
]); ]);
const activeApiTab = ref<RequestParam>(apiTabs.value[0] as RequestParam); const activeApiTab = ref<RequestParam>(apiTabs.value[0] as RequestParam);
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 }));
}
// //
function currentTabChange(val: any) { function currentTabChange(val: any) {
apiTabs.value[0].label = val === 'api' ? t('apiTestManagement.allApi') : t('case.allCase'); apiTabs.value[0].label = val === 'api' ? t('apiTestManagement.allApi') : t('case.allCase');
} }
onBeforeMount(() => {
initMemberOptions();
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>