diff --git a/frontend/src/api/http/Axios.ts b/frontend/src/api/http/Axios.ts index fd2cc66a39..b6adc066c9 100644 --- a/frontend/src/api/http/Axios.ts +++ b/frontend/src/api/http/Axios.ts @@ -96,6 +96,13 @@ export class MSAxios { const requestData = JSON.stringify(params.request); formData.append('request', new Blob([requestData], { type: ContentTypeEnum.JSON })); } + const transform = this.getTransform(); + + const { requestOptions } = this.options; + + const opt = { ...requestOptions, isTransformResponse: false }; + + const { transformRequestHook } = transform || {}; return new Promise((resolve, reject) => { this.axiosInstance .request>({ @@ -109,11 +116,6 @@ export class MSAxios { }, }) .then((res: AxiosResponse) => { - const transform = this.getTransform(); - const { requestOptions } = this.options; - const opt = { ...requestOptions }; - - const { transformRequestHook } = transform || {}; // 请求成功后的处理 if (transformRequestHook && isFunction(transformRequestHook)) { try { diff --git a/frontend/src/api/http/index.ts b/frontend/src/api/http/index.ts index 69c7e9d2dd..774601aea6 100644 --- a/frontend/src/api/http/index.ts +++ b/frontend/src/api/http/index.ts @@ -170,7 +170,7 @@ const transform: AxiosTransform = { throw new Error(e as unknown as string); } checkStatus(error?.response?.status, msg, errorMessageMode); - return Promise.reject(error); + return Promise.reject(error?.response?.data?.message); }, }; diff --git a/frontend/src/components/business/ms-tree/index.vue b/frontend/src/components/business/ms-tree/index.vue index 854d700750..345bb56bef 100644 --- a/frontend/src/components/business/ms-tree/index.vue +++ b/frontend/src/components/business/ms-tree/index.vue @@ -295,7 +295,7 @@ * 处理树节点选中(非复选框) */ function select(selectedKeys: Array, data: MsTreeSelectedData) { - emit('select', selectedKeys, data.selectedNodes); + emit('select', selectedKeys, data.selectedNodes[0]); } function checked(checkedKeys: Array) { @@ -472,6 +472,19 @@ } } } + .arco-tree-node-disabled { + &:hover { + background-color: transparent; + } + * { + color: var(--color-text-4) !important; + } + .arco-tree-node-title { + &:hover { + background-color: transparent; + } + } + } } } diff --git a/frontend/src/components/pure/ms-upload/fileList.vue b/frontend/src/components/pure/ms-upload/fileList.vue index b5ac9c02a1..d341d6e02c 100644 --- a/frontend/src/components/pure/ms-upload/fileList.vue +++ b/frontend/src/components/pure/ms-upload/fileList.vue @@ -47,7 +47,7 @@ class="w-[200px]" />
- {{ t('ms.upload.uploadFail') }} + {{ item.errMsg || t('ms.upload.uploadFail') }}
diff --git a/frontend/src/components/pure/ms-upload/types.ts b/frontend/src/components/pure/ms-upload/types.ts index 894ccf742a..5afff9bc42 100644 --- a/frontend/src/components/pure/ms-upload/types.ts +++ b/frontend/src/components/pure/ms-upload/types.ts @@ -10,4 +10,5 @@ export type MsFileItem = FileItem & { status?: keyof typeof UploadStatus; enable?: boolean; // jar类型文件是否可用 uploadedTime?: string | number; // 上传完成时间 + errMsg?: string; // 上传失败的错误信息 }; diff --git a/frontend/src/store/modules/app/asyncTask.ts b/frontend/src/store/modules/app/asyncTask.ts index 97832f6738..6ad7f52cde 100644 --- a/frontend/src/store/modules/app/asyncTask.ts +++ b/frontend/src/store/modules/app/asyncTask.ts @@ -197,6 +197,7 @@ const useAsyncTaskStore = defineStore('asyncTask', { console.log(error); if (fileItem) { fileItem.status = UploadStatus.error; + fileItem.errMsg = error as string; } } finally { // 上传完成/失败,重置进度和定时器 diff --git a/frontend/src/views/project-management/fileManagement/components/folderTree.vue b/frontend/src/views/project-management/fileManagement/components/folderTree.vue index 66fae7b6ac..2df129f95c 100644 --- a/frontend/src/views/project-management/fileManagement/components/folderTree.vue +++ b/frontend/src/views/project-management/fileManagement/components/folderTree.vue @@ -77,12 +77,7 @@ import type { MsTreeNodeData } from '@/components/business/ms-tree/types'; import popConfirm from './popConfirm.vue'; - import { - deleteModule, - getModules, - getModulesCount, - moveModule, - } from '@/api/modules/project-management/fileManagement'; + import { deleteModule, getModules, moveModule } from '@/api/modules/project-management/fileManagement'; import { useI18n } from '@/hooks/useI18n'; import useModal from '@/hooks/useModal'; import useAppStore from '@/store/modules/app'; @@ -92,6 +87,7 @@ const props = defineProps<{ isExpandAll: boolean; + activeFolder?: string; // 当前选中的文件夹,弹窗模式下需要使用 selectedKeys?: Array; // 选中的节点 key isModal?: boolean; // 是否是弹窗模式 modulesCount?: Record; // 模块数量统计对象 @@ -158,11 +154,14 @@ try { loading.value = true; const res = await getModules(appStore.currentProjectId); - folderTree.value = res.map((e) => ({ - ...e, - hideMoreAction: e.id === 'root', - draggable: e.id !== 'root' && !props.isModal, - })); + folderTree.value = mapTree(res, (e) => { + return { + ...e, + hideMoreAction: e.id === 'root', + draggable: e.id !== 'root' && !props.isModal, + disabled: e.id === props.activeFolder && props.isModal, + }; + }); if (isSetDefaultKey) { selectedKeys.value = [folderTree.value[0].id]; } @@ -217,8 +216,14 @@ /** * 处理文件夹树节点选中事件 */ - function folderNodeSelect(_selectedKeys: (string | number)[]) { - emit('folderNodeSelect', _selectedKeys); + function folderNodeSelect(_selectedKeys: (string | number)[], node: MsTreeNodeData) { + const offspringIds: string[] = []; + mapTree(node.children || [], (e) => { + offspringIds.push(e.id); + return e; + }); + + emit('folderNodeSelect', _selectedKeys, offspringIds); } /** diff --git a/frontend/src/views/project-management/fileManagement/components/rightBox.vue b/frontend/src/views/project-management/fileManagement/components/rightBox.vue index e3d409b21f..1e55a9fbb1 100644 --- a/frontend/src/views/project-management/fileManagement/components/rightBox.vue +++ b/frontend/src/views/project-management/fileManagement/components/rightBox.vue @@ -249,15 +249,16 @@ - - (); const emit = defineEmits<{ (e: 'init', params: FileListQueryParams): void; @@ -466,7 +467,7 @@ ]; const tableStore = useTableStore(); tableStore.initColumn(TableKeyEnum.FILE_MANAGEMENT_FILE, columns, 'drawer'); - const { propsRes, propsEvent, loadList, setLoadListParams } = useTable( + const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( getFileList, { tableKey: TableKeyEnum.FILE_MANAGEMENT_FILE, @@ -543,6 +544,7 @@ moduleIds: [props.activeFolder], }); downloadByteFile(res, 'files.zip'); + resetSelector(); } catch (error) { // eslint-disable-next-line no-console console.log(error); @@ -608,6 +610,7 @@ cardListRef.value?.reload(); } else { loadList(); + resetSelector(); } emitTableParams(); } catch (error) { @@ -620,7 +623,7 @@ } const moveModalVisible = ref(false); // 移动文件弹窗 - const selectedModuleKeys = ref<(string | number)[]>([]); // 移动文件搜索关键字 + const selectedModuleKeys = ref<(string | number)[]>([]); // 移动文件选中节点 const isBatchMove = ref(false); // 是否批量移动文件 const activeFile = ref(null); // 当前查看的文件信息 @@ -682,6 +685,7 @@ cardListRef.value?.reload(); } else { loadList(); + resetSelector(); } emitTableParams(); } catch (error) { @@ -704,10 +708,14 @@ if (fileType.value === 'storage') { combine.value.storage = 'git'; } + let moduleIds: string[] = [props.activeFolder, ...props.offspringIds]; + if (['all', 'my'].includes(props.activeFolder)) { + moduleIds = []; + } setLoadListParams({ keyword: keyword.value, fileType: tableFileType.value, - moduleIds: ['all', 'my'].includes(props.activeFolder) ? [] : [props.activeFolder], + moduleIds, projectId: appStore.currentProjectId, comebine: combine.value, }); @@ -745,6 +753,7 @@ () => { keyword.value = ''; searchList(); + resetSelector(); }, { immediate: true } ); diff --git a/frontend/src/views/project-management/fileManagement/index.vue b/frontend/src/views/project-management/fileManagement/index.vue index af88f6bb8b..f3831f0ec6 100644 --- a/frontend/src/views/project-management/fileManagement/index.vue +++ b/frontend/src/views/project-management/fileManagement/index.vue @@ -72,7 +72,12 @@ @@ -127,6 +132,7 @@ get: () => [activeFolder.value], set: (val) => val, }); + const offspringIds = ref([]); function setActiveFolder(id: string) { activeFolder.value = id; @@ -151,9 +157,10 @@ /** * 处理文件夹树节点选中事件 */ - function folderNodeSelect(keys: string[]) { + function folderNodeSelect(keys: string[], _offspringIds: string[]) { [activeFolder.value] = keys; activeFolderType.value = 'module'; + offspringIds.value = [..._offspringIds]; } /**