feat(项目管理): 文件管理和接口定义表格支持是否显示子目录数据
This commit is contained in:
parent
4e8b71f853
commit
3d0a99adef
|
@ -188,7 +188,7 @@
|
|||
}
|
||||
});
|
||||
tableStore.getSubShow(props.tableKey).then((res) => {
|
||||
subdirectoryVal.value = res || true;
|
||||
subdirectoryVal.value = res === undefined ? true : res;
|
||||
});
|
||||
tableStore.getPageSize(props.tableKey).then((res) => {
|
||||
pageSize.value = res;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
@selected-change="handleTableSelect"
|
||||
@batch-action="handleTableBatch"
|
||||
@drag-change="handleTableDragSort"
|
||||
@module-change="loadApiList"
|
||||
>
|
||||
<template v-if="props.protocol === 'HTTP'" #methodFilter="{ columnConfig }">
|
||||
<a-trigger
|
||||
|
@ -448,17 +449,26 @@
|
|||
const methodFilters = ref(Object.keys(RequestMethods));
|
||||
const statusFilterVisible = ref(false);
|
||||
const statusFilters = ref(Object.keys(RequestDefinitionStatus));
|
||||
const moduleIds = computed(() => {
|
||||
if (props.activeModule === 'all') {
|
||||
return [];
|
||||
|
||||
const tableStore = useTableStore();
|
||||
async function getModuleIds() {
|
||||
let moduleIds: string[] = [];
|
||||
if (props.activeModule !== 'all') {
|
||||
moduleIds = [props.activeModule];
|
||||
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.API_TEST);
|
||||
if (getAllChildren) {
|
||||
moduleIds = [props.activeModule, ...props.offspringIds];
|
||||
}
|
||||
return [props.activeModule];
|
||||
});
|
||||
function loadApiList() {
|
||||
}
|
||||
return moduleIds;
|
||||
}
|
||||
async function loadApiList() {
|
||||
const moduleIds = await getModuleIds();
|
||||
|
||||
const params = {
|
||||
keyword: keyword.value,
|
||||
projectId: appStore.currentProjectId,
|
||||
moduleIds: moduleIds.value,
|
||||
moduleIds,
|
||||
protocol: props.protocol,
|
||||
filter: {
|
||||
status:
|
||||
|
@ -561,7 +571,7 @@
|
|||
excludeIds: params?.excludeIds || [],
|
||||
condition: { keyword: keyword.value },
|
||||
projectId: appStore.currentProjectId,
|
||||
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
|
||||
moduleIds: await getModuleIds(),
|
||||
deleteAll: true,
|
||||
protocol: props.protocol,
|
||||
});
|
||||
|
@ -679,7 +689,7 @@
|
|||
excludeIds: batchParams.value?.excludeIds || [],
|
||||
condition: { keyword: keyword.value },
|
||||
projectId: appStore.currentProjectId,
|
||||
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
|
||||
moduleIds: await getModuleIds(),
|
||||
protocol: props.protocol,
|
||||
type: batchForm.value.attr,
|
||||
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
||||
|
@ -716,7 +726,7 @@
|
|||
excludeIds: batchParams.value?.excludeIds || [],
|
||||
condition: { keyword: keyword.value },
|
||||
projectId: appStore.currentProjectId,
|
||||
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
|
||||
moduleIds: await getModuleIds(),
|
||||
moduleId: selectedModuleKeys.value[0],
|
||||
protocol: props.protocol,
|
||||
});
|
||||
|
@ -805,7 +815,6 @@
|
|||
});
|
||||
|
||||
if (!props.readOnly) {
|
||||
const tableStore = useTableStore();
|
||||
await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer', true);
|
||||
} else {
|
||||
columns = columns.filter(
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
:active-module="props.activeModule"
|
||||
:protocol="activeApiTab.protocol"
|
||||
:api-detail="activeApiTab"
|
||||
:offspring-ids="props.offspringIds"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane v-if="!activeApiTab.isNew" key="mock" title="MOCK" class="ms-api-tab-pane"> </a-tab-pane> -->
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
@selected-change="handleTableSelect"
|
||||
@batch-action="handleTableBatch"
|
||||
@drag-change="handleDragChange"
|
||||
@module-change="loadCaseList"
|
||||
>
|
||||
<template #num="{ record }">
|
||||
<MsButton type="text" @click="isApi ? openCaseDetailDrawer(record.id) : openCaseTab(record)">{{
|
||||
|
@ -414,6 +415,7 @@
|
|||
activeModule: string;
|
||||
protocol: string; // 查看的协议类型
|
||||
apiDetail?: RequestParam;
|
||||
offspringIds: string[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
@ -617,15 +619,25 @@
|
|||
const resourcePoolList = ref<ResourcePoolItem[]>();
|
||||
const defaultPoolId = ref<string>();
|
||||
|
||||
const moduleIds = computed(() => {
|
||||
return props.activeModule === 'all' ? [] : [props.activeModule];
|
||||
});
|
||||
function loadCaseList() {
|
||||
async function getModuleIds() {
|
||||
let moduleIds: string[] = [];
|
||||
if (props.activeModule !== 'all') {
|
||||
moduleIds = [props.activeModule];
|
||||
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.API_TEST_MANAGEMENT_CASE);
|
||||
if (getAllChildren) {
|
||||
moduleIds = [props.activeModule, ...props.offspringIds];
|
||||
}
|
||||
}
|
||||
return moduleIds;
|
||||
}
|
||||
|
||||
async function loadCaseList() {
|
||||
const selectModules = await getModuleIds();
|
||||
const params = {
|
||||
apiDefinitionId: props.apiDetail?.id,
|
||||
keyword: keyword.value,
|
||||
projectId: appStore.currentProjectId,
|
||||
moduleIds: moduleIds.value,
|
||||
moduleIds: selectModules,
|
||||
protocol: props.protocol,
|
||||
filter: {
|
||||
status: statusFilters.value,
|
||||
|
@ -734,7 +746,9 @@
|
|||
excludeIds: [],
|
||||
currentSelectCount: 0,
|
||||
});
|
||||
const batchConditionParams = computed(() => {
|
||||
|
||||
async function genBatchConditionParams() {
|
||||
const selectModules = await getModuleIds();
|
||||
return {
|
||||
condition: {
|
||||
keyword: keyword.value,
|
||||
|
@ -746,10 +760,10 @@
|
|||
},
|
||||
projectId: appStore.currentProjectId,
|
||||
protocol: props.protocol,
|
||||
moduleIds: moduleIds.value,
|
||||
moduleIds: selectModules,
|
||||
apiDefinitionId: props.apiDetail?.id as string,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function handleDeleteCase(record?: ApiCaseDetail, isBatch?: boolean) {
|
||||
const title = isBatch
|
||||
|
@ -771,11 +785,12 @@
|
|||
onBeforeOk: async () => {
|
||||
try {
|
||||
if (isBatch) {
|
||||
const batchConditionParams = await genBatchConditionParams();
|
||||
await batchDeleteCase({
|
||||
selectIds: tableSelected.value as string[],
|
||||
selectAll: batchParams.value.selectAll,
|
||||
excludeIds: batchParams.value?.excludeIds || [],
|
||||
...batchConditionParams.value,
|
||||
...batchConditionParams,
|
||||
});
|
||||
} else {
|
||||
await deleteCase(record?.id as string);
|
||||
|
@ -899,11 +914,12 @@
|
|||
if (!errors) {
|
||||
try {
|
||||
batchEditLoading.value = true;
|
||||
const batchConditionParams = await genBatchConditionParams();
|
||||
await batchEditCase({
|
||||
selectIds: batchParams.value?.selectedIds || [],
|
||||
selectAll: !!batchParams.value?.selectAll,
|
||||
excludeIds: batchParams.value?.excludeIds || [],
|
||||
...batchConditionParams.value,
|
||||
...batchConditionParams,
|
||||
type: batchForm.value.attr.charAt(0).toUpperCase() + batchForm.value.attr.slice(1), // 首字母大写
|
||||
[batchForm.value.attr]: batchForm.value.attr === 'tags' ? batchForm.value.values : batchForm.value.value,
|
||||
});
|
||||
|
@ -934,11 +950,12 @@
|
|||
if (!errors) {
|
||||
try {
|
||||
batchExecuteLoading.value = true;
|
||||
const batchConditionParams = await genBatchConditionParams();
|
||||
await batchExecuteCase({
|
||||
selectIds: batchParams.value?.selectedIds || [],
|
||||
selectAll: !!batchParams.value?.selectAll,
|
||||
excludeIds: batchParams.value?.excludeIds || [],
|
||||
...batchConditionParams.value,
|
||||
...batchConditionParams,
|
||||
runModeConfig: {
|
||||
runMode: batchExecuteForm.value.runMode,
|
||||
integratedReport: batchExecuteForm.value.integratedReport === 'true',
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<div v-show="activeApiTab.id === 'all'" class="flex-1 overflow-hidden">
|
||||
<caseTable
|
||||
ref="caseTableRef"
|
||||
:offspring-ids="props.offspringIds"
|
||||
:is-api="false"
|
||||
:active-module="props.activeModule"
|
||||
:protocol="props.protocol"
|
||||
|
@ -41,6 +42,7 @@
|
|||
const props = defineProps<{
|
||||
activeModule: string;
|
||||
protocol: string;
|
||||
offspringIds: string[];
|
||||
moduleTree: ModuleTreeNode[]; // 模块树
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
:active-module="props.activeModule"
|
||||
:protocol="props.protocol"
|
||||
:module-tree="props.moduleTree"
|
||||
:offspring-ids="props.offspringIds"
|
||||
@delete-case="(id) => handleDeleteApiFromModuleTree(id)"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div :class="['p-[16px_16px]', props.class]">
|
||||
<div class="mb-[16px] flex items-center justify-between">
|
||||
<div class="flex items-center gap-[8px]">
|
||||
<div class="flex items-center"> </div>
|
||||
<div class="items-right flex gap-[8px]">
|
||||
<a-input-search
|
||||
v-model:model-value="keyword"
|
||||
:placeholder="t('api_scenario.table.searchPlaceholder')"
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
v-on="propsEvent"
|
||||
@selected-change="handleTableSelect"
|
||||
@batch-action="handleTableBatch"
|
||||
@module-change="searchList"
|
||||
>
|
||||
<template #name="{ record, rowIndex }">
|
||||
<MsTag
|
||||
|
@ -838,7 +839,16 @@
|
|||
selectedModuleKeys.value = [];
|
||||
}
|
||||
|
||||
function setTableParams() {
|
||||
async function getModuleIds() {
|
||||
let moduleIds = [props.activeFolder];
|
||||
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.FILE_MANAGEMENT_FILE);
|
||||
if (getAllChildren) {
|
||||
moduleIds = [props.activeFolder, ...props.offspringIds];
|
||||
}
|
||||
return moduleIds;
|
||||
}
|
||||
|
||||
async function setTableParams() {
|
||||
if (props.activeFolder === 'my') {
|
||||
combine.value.createUser = userStore.id;
|
||||
} else {
|
||||
|
@ -849,10 +859,11 @@
|
|||
} else {
|
||||
combine.value.storage = 'minio';
|
||||
}
|
||||
let moduleIds: string[] = [props.activeFolder, ...props.offspringIds];
|
||||
|
||||
let moduleIds: string[];
|
||||
if (isMyOrAllFolder.value) {
|
||||
moduleIds = [];
|
||||
} else {
|
||||
moduleIds = await getModuleIds();
|
||||
}
|
||||
setLoadListParams({
|
||||
keyword: keyword.value,
|
||||
|
@ -869,7 +880,7 @@
|
|||
async function changeFileType() {
|
||||
await initFileTypes();
|
||||
resetSelector();
|
||||
setTableParams();
|
||||
await setTableParams();
|
||||
if (showType.value === 'card') {
|
||||
cardListRef.value?.reload();
|
||||
} else {
|
||||
|
@ -898,8 +909,8 @@
|
|||
}
|
||||
);
|
||||
|
||||
const searchList = debounce(() => {
|
||||
setTableParams();
|
||||
const searchList = debounce(async () => {
|
||||
await setTableParams();
|
||||
if (showType.value === 'card') {
|
||||
cardListRef.value?.reload();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue