From ea173ac5b11bb681ad63d40a62063cd44e24449d Mon Sep 17 00:00:00 2001 From: zuohuaijun Date: Sun, 12 Oct 2025 12:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E1=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E6=A0=91=E5=BD=A2=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=81=94=E5=8A=A8=E6=9F=A5=E8=AF=A2=20=20=202?= =?UTF-8?q?=E3=80=81=E8=B0=83=E6=95=B4=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BA=E5=A4=9A=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=20=203=E3=80=81=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=A7=8D=E5=AD=90=E5=92=8C=E9=BB=98=E8=AE=A4=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E8=A7=92=E8=89=B2=E8=8F=9C=E5=8D=95=E7=A7=8D=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Admin.NET.Core.csproj | 2 +- .../SeedData/SysMenuSeedData.cs | 1 + .../SeedData/SysRoleMenuSeedData.cs | 27 ++++ .../Service/File/Dto/FileInput.cs | 92 ++++++----- .../Service/File/SysFileService.cs | 29 +++- Web/package.json | 6 +- .../api-services/system/apis/sys-file-api.ts | 152 +++++++++++++++++- Web/src/api-services/system/models/index.ts | 1 + .../system/models/page-file-input.ts | 8 + .../models/sys-file-upload-file-list-body.ts | 28 ++++ .../models/sys-file-upload-files-body.ts | 50 ++++++ .../models/upload-file-from-base64-input.ts | 8 - .../views/system/file/component/fileTree.vue | 19 ++- Web/src/views/system/file/index.vue | 10 +- .../views/system/org/component/orgTree.vue | 2 +- 15 files changed, 364 insertions(+), 71 deletions(-) create mode 100644 Web/src/api-services/system/models/sys-file-upload-file-list-body.ts diff --git a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj index c44ee01c..44f3862a 100644 --- a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj +++ b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj @@ -55,7 +55,7 @@ - + diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysMenuSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysMenuSeedData.cs index 557d7cf9..82529dba 100644 --- a/Admin.NET/Admin.NET.Core/SeedData/SysMenuSeedData.cs +++ b/Admin.NET/Admin.NET.Core/SeedData/SysMenuSeedData.cs @@ -151,6 +151,7 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData new SysMenu{ Id=1310000000394, Pid=1310000000391, Title="下载", Permission="sysFile/downloadFile", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 }, new SysMenu{ Id=1310000000395, Pid=1310000000391, Title="删除", Permission="sysFile/delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 }, new SysMenu{ Id=1310000000396, Pid=1310000000391, Title="编辑", Permission="sysFile/update", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2023-10-27 00:00:00"), OrderNo=100 }, + new SysMenu{ Id=1310000000397, Pid=1310000000391, Title="预览", Permission="sysFile/preview", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2023-10-27 00:00:00"), OrderNo=100 }, new SysMenu{ Id=1310000000401, Pid=1310000000301, Title="打印模板", Path="/platform/print", Name="sysPrint", Component="/system/print/index", Icon="ele-Printer", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=190 }, new SysMenu{ Id=1310000000402, Pid=1310000000401, Title="查询", Permission="sysPrint/page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 }, diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs index 6a9bd351..5117657e 100644 --- a/Admin.NET/Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs +++ b/Admin.NET/Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs @@ -63,6 +63,8 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData new SysRoleMenu{ Id=1300000000164, RoleId=roleList[0].Id, MenuId=1310000000154 }, new SysRoleMenu{ Id=1300000000165, RoleId=roleList[0].Id, MenuId=1310000000155 }, new SysRoleMenu{ Id=1300000000166, RoleId=roleList[0].Id, MenuId=1310000000156 }, + new SysRoleMenu{ Id=1300000000167, RoleId=roleList[0].Id, MenuId=1310000000157 }, + new SysRoleMenu{ Id=1300000000168, RoleId=roleList[0].Id, MenuId=1310000000158 }, // 个人中心 new SysRoleMenu{ Id=1300000000171, RoleId=roleList[0].Id, MenuId=1310000000161 }, new SysRoleMenu{ Id=1300000000172, RoleId=roleList[0].Id, MenuId=1310000000162 }, @@ -138,6 +140,7 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData new SysRoleMenu{ Id=1300000000294, RoleId=roleList[0].Id, MenuId=1310000000394 }, new SysRoleMenu{ Id=1300000000295, RoleId=roleList[0].Id, MenuId=1310000000395 }, new SysRoleMenu{ Id=1300000000296, RoleId=roleList[0].Id, MenuId=1310000000396 }, + new SysRoleMenu{ Id=1300000000297, RoleId=roleList[0].Id, MenuId=1310000000397 }, // 打印模板 new SysRoleMenu{ Id=1300000001401, RoleId=roleList[0].Id, MenuId=1310000000401 }, new SysRoleMenu{ Id=1300000001402, RoleId=roleList[0].Id, MenuId=1310000000402 }, @@ -167,6 +170,13 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData new SysRoleMenu{ Id=1300000001446, RoleId=roleList[0].Id, MenuId=1310000000446 }, // 更新日志 new SysRoleMenu{ Id=1300000001451, RoleId=roleList[0].Id, MenuId=1310000000451 }, + // 流水序号 + new SysRoleMenu{ Id=1300000001501, RoleId=roleList[0].Id, MenuId=1310000000471 }, + new SysRoleMenu{ Id=1300000001502, RoleId=roleList[0].Id, MenuId=1310000000472 }, + new SysRoleMenu{ Id=1300000001503, RoleId=roleList[0].Id, MenuId=1310000000473 }, + new SysRoleMenu{ Id=1300000001504, RoleId=roleList[0].Id, MenuId=1310000000474 }, + new SysRoleMenu{ Id=1300000001505, RoleId=roleList[0].Id, MenuId=1310000000475 }, + new SysRoleMenu{ Id=1300000001506, RoleId=roleList[0].Id, MenuId=1310000000476 }, ////// 日志管理 new SysRoleMenu{ Id=1300000000301, RoleId=roleList[0].Id, MenuId=1310000000501 }, new SysRoleMenu{ Id=1300000000311, RoleId=roleList[0].Id, MenuId=1310000000511 }, @@ -187,6 +197,23 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData new SysRoleMenu{ Id=1300000000351, RoleId=roleList[0].Id, MenuId=1310000000551 }, new SysRoleMenu{ Id=1300000000352, RoleId=roleList[0].Id, MenuId=1310000000552 }, new SysRoleMenu{ Id=1300000000353, RoleId=roleList[0].Id, MenuId=1310000000553 }, + new SysRoleMenu{ Id=1300000000361, RoleId=roleList[0].Id, MenuId=1310000000561 }, + new SysRoleMenu{ Id=1300000000362, RoleId=roleList[0].Id, MenuId=1310000000562 }, + new SysRoleMenu{ Id=1300000000363, RoleId=roleList[0].Id, MenuId=1310000000563 }, + ////// 报表开发 + new SysRoleMenu{ Id=1300000001601, RoleId=roleList[0].Id, MenuId=1310000000701 }, + new SysRoleMenu{ Id=1300000001611, RoleId=roleList[0].Id, MenuId=1310000000711 }, + new SysRoleMenu{ Id=1300000001612, RoleId=roleList[0].Id, MenuId=1310000000712 }, + new SysRoleMenu{ Id=1300000001613, RoleId=roleList[0].Id, MenuId=1310000000713 }, + new SysRoleMenu{ Id=1300000001614, RoleId=roleList[0].Id, MenuId=1310000000714 }, + new SysRoleMenu{ Id=1300000001615, RoleId=roleList[0].Id, MenuId=1310000000715 }, + new SysRoleMenu{ Id=1300000001616, RoleId=roleList[0].Id, MenuId=1310000000716 }, + new SysRoleMenu{ Id=1300000001621, RoleId=roleList[0].Id, MenuId=1310000000721 }, + new SysRoleMenu{ Id=1300000001622, RoleId=roleList[0].Id, MenuId=1310000000722 }, + new SysRoleMenu{ Id=1300000001623, RoleId=roleList[0].Id, MenuId=1310000000723 }, + new SysRoleMenu{ Id=1300000001624, RoleId=roleList[0].Id, MenuId=1310000000724 }, + new SysRoleMenu{ Id=1300000001625, RoleId=roleList[0].Id, MenuId=1310000000725 }, + new SysRoleMenu{ Id=1300000001631, RoleId=roleList[0].Id, MenuId=1310000000731 }, ////// 帮助文档 new SysRoleMenu{ Id=1300000000401, RoleId=roleList[0].Id, MenuId=1320000000101 }, new SysRoleMenu{ Id=1300000000402, RoleId=roleList[0].Id, MenuId=1320000000111 }, diff --git a/Admin.NET/Admin.NET.Core/Service/File/Dto/FileInput.cs b/Admin.NET/Admin.NET.Core/Service/File/Dto/FileInput.cs index 173d2023..deb5679d 100644 --- a/Admin.NET/Admin.NET.Core/Service/File/Dto/FileInput.cs +++ b/Admin.NET/Admin.NET.Core/Service/File/Dto/FileInput.cs @@ -31,53 +31,35 @@ public class PageFileInput : BasePageInput /// 结束时间 /// public DateTime? EndTime { get; set; } + + /// + /// 文件路径 + /// + public string FilePath { get; set; } +} + +/// +/// 多文件上传 +/// +public class UploadFilesInput : BaseUploadFileInput +{ + /// + /// 文件集合 + /// + [Required] + public IFormFileCollection Files { get; set; } } /// /// 上传文件 /// -public class UploadFileInput +public class UploadFileInput : BaseUploadFileInput { /// /// 文件 /// [Required] public IFormFile File { get; set; } - - /// - /// 文件类别 - /// - /// - public string FileType { get; set; } - - /// - /// 文件别名 - /// - /// - public string FileAlias { get; set; } - - /// - /// 是否公开 - /// - public bool IsPublic { get; set; } = false; - - /// - /// 允许格式:.jpeg.jpg.png.bmp.gif.tif - /// - /// - public string AllowSuffix { get; set; } - - /// - /// 业务数据Id - /// - public long DataId { get; set; } - - /// - /// 上传用户Id(解决跨租户上传时用户所属不一致问题) - /// - [Newtonsoft.Json.JsonIgnore] - [System.Text.Json.Serialization.JsonIgnore] - public long UserId { get; set; } } /// @@ -123,6 +105,44 @@ public class UploadFileFromBase64Input /// public long? DataId { get; set; } + /// + /// 上传用户Id(解决跨租户上传时用户所属不一致问题) + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public long UserId { get; set; } +} + +public class BaseUploadFileInput +{ + /// + /// 文件类别 + /// + /// + public string FileType { get; set; } + + /// + /// 文件别名 + /// + /// + public string FileAlias { get; set; } + + /// + /// 是否公开 + /// + public bool IsPublic { get; set; } = false; + + /// + /// 允许格式:.jpeg.jpg.png.bmp.gif.tif + /// + /// + public string AllowSuffix { get; set; } + + /// + /// 业务数据Id + /// + public long DataId { get; set; } + /// /// 上传用户Id(解决跨租户上传时用户所属不一致问题) /// diff --git a/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs b/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs index b0a965f6..ad2b9300 100644 --- a/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs +++ b/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs @@ -60,15 +60,11 @@ public class SysFileService : IDynamicApiController, ITransient [DisplayName("获取文件分页列表")] public async Task> Page(PageFileInput input) { - // 获取所有公开文件 - var publicList = _sysFileRep.AsQueryable().ClearFilter().Where(u => u.IsPublic == true); - // 获取私有文件 - var privateList = _sysFileRep.AsQueryable().Where(u => u.IsPublic == false); - // 合并公开和私有并分页 - return await _sysFileRep.Context.UnionAll(publicList, privateList) + return await _sysFileRep.AsQueryable() .WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName.Contains(input.FileName.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()) && !string.IsNullOrWhiteSpace(input.EndTime.ToString()), u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime) + .WhereIF(!string.IsNullOrWhiteSpace(input.FilePath), u => u.FilePath.Contains(input.FilePath.Trim())) .OrderBy(u => u.CreateTime, OrderByType.Desc) .ToPagedListAsync(input.Page, input.PageSize); } @@ -109,13 +105,32 @@ public class SysFileService : IDynamicApiController, ITransient /// /// [DisplayName("上传多文件")] - public List UploadFiles([Required] List files) + public List UploadFileList([Required] List files) { var fileList = new List(); files.ForEach(file => fileList.Add(UploadFile(new UploadFileInput { File = file }).Result)); return fileList; } + /// + /// 上传多文件 🔖 + /// + /// + /// + [DisplayName("上传多文件")] + public async Task> UploadFiles([FromForm] UploadFilesInput input) + { + var fileList = new List(); + foreach (var file in input.Files) + { + var uploadFileInput = input.Adapt(); + uploadFileInput.File = file; + var sysFile = await UploadFile(uploadFileInput); + fileList.Add(sysFile); + } + return fileList; + } + /// /// 根据文件Id或Url下载 🔖 /// diff --git a/Web/package.json b/Web/package.json index 9929759f..61c16498 100644 --- a/Web/package.json +++ b/Web/package.json @@ -2,7 +2,7 @@ "name": "admin.net.pro", "type": "module", "version": "2.4.33", - "lastBuildTime": "2025.10.10", + "lastBuildTime": "2025.10.12", "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架", "author": "zuohuaijun", "license": "MIT", @@ -62,7 +62,7 @@ "qs": "^6.14.0", "relation-graph": "^2.2.11", "screenfull": "^6.0.2", - "sm-crypto-v2": "^1.14.0", + "sm-crypto-v2": "^1.15.0", "sortablejs": "^1.15.6", "splitpanes": "^4.0.4", "sql-formatter": "^15.6.10", @@ -81,7 +81,7 @@ "vue-router": "^4.5.1", "vue-signature-pad": "^3.0.2", "vue3-tree-org": "^4.2.2", - "vxe-pc-ui": "^4.9.41", + "vxe-pc-ui": "^4.9.42", "vxe-table": "^4.16.21", "xe-utils": "^3.7.9", "xlsx-js-style": "^1.2.0" diff --git a/Web/src/api-services/system/apis/sys-file-api.ts b/Web/src/api-services/system/apis/sys-file-api.ts index bf5880c6..e92290fc 100644 --- a/Web/src/api-services/system/apis/sys-file-api.ts +++ b/Web/src/api-services/system/apis/sys-file-api.ts @@ -630,6 +630,59 @@ export const SysFileApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary 上传多文件 🔖 + * @param {Array} [files] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysFileUploadFileListPostForm: async (files?: Array, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/sysFile/uploadFileList`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new FormData(); + + // authentication Bearer required + // http bearer authentication required + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; + } + + if (files) { + files.forEach((element) => { + localVarFormParams.append('files', element as any); + }) + } + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, /** * * @summary 上传文件 🔖 @@ -716,10 +769,16 @@ export const SysFileApiAxiosParamCreator = function (configuration?: Configurati * * @summary 上传多文件 🔖 * @param {Array} [files] + * @param {string} [fileType] + * @param {string} [fileAlias] + * @param {boolean} [isPublic] + * @param {string} [allowSuffix] + * @param {number} [dataId] + * @param {number} [userId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - apiSysFileUploadFilesPostForm: async (files?: Array, options: AxiosRequestConfig = {}): Promise => { + apiSysFileUploadFilesPostForm: async (files?: Array, fileType?: string, fileAlias?: string, isPublic?: boolean, allowSuffix?: string, dataId?: number, userId?: number, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/sysFile/uploadFiles`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); @@ -743,10 +802,34 @@ export const SysFileApiAxiosParamCreator = function (configuration?: Configurati if (files) { files.forEach((element) => { - localVarFormParams.append('files', element as any); + localVarFormParams.append('Files', element as any); }) } + if (fileType !== undefined) { + localVarFormParams.append('FileType', fileType as any); + } + + if (fileAlias !== undefined) { + localVarFormParams.append('FileAlias', fileAlias as any); + } + + if (isPublic !== undefined) { + localVarFormParams.append('IsPublic', isPublic as any); + } + + if (allowSuffix !== undefined) { + localVarFormParams.append('AllowSuffix', allowSuffix as any); + } + + if (dataId !== undefined) { + localVarFormParams.append('DataId', dataId as any); + } + + if (userId !== undefined) { + localVarFormParams.append('UserId', userId as any); + } + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { @@ -1107,6 +1190,20 @@ export const SysFileApiFp = function(configuration?: Configuration) { return axios.request(axiosRequestArgs); }; }, + /** + * + * @summary 上传多文件 🔖 + * @param {Array} [files] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysFileUploadFileListPostForm(files?: Array, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysFileApiAxiosParamCreator(configuration).apiSysFileUploadFileListPostForm(files, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, /** * * @summary 上传文件 🔖 @@ -1131,11 +1228,17 @@ export const SysFileApiFp = function(configuration?: Configuration) { * * @summary 上传多文件 🔖 * @param {Array} [files] + * @param {string} [fileType] + * @param {string} [fileAlias] + * @param {boolean} [isPublic] + * @param {string} [allowSuffix] + * @param {number} [dataId] + * @param {number} [userId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async apiSysFileUploadFilesPostForm(files?: Array, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { - const localVarAxiosArgs = await SysFileApiAxiosParamCreator(configuration).apiSysFileUploadFilesPostForm(files, options); + async apiSysFileUploadFilesPostForm(files?: Array, fileType?: string, fileAlias?: string, isPublic?: boolean, allowSuffix?: string, dataId?: number, userId?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysFileApiAxiosParamCreator(configuration).apiSysFileUploadFilesPostForm(files, fileType, fileAlias, isPublic, allowSuffix, dataId, userId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); @@ -1316,6 +1419,16 @@ export const SysFileApiFactory = function (configuration?: Configuration, basePa async apiSysFileUploadFileFromBase64Post(body?: UploadFileFromBase64Input, options?: AxiosRequestConfig): Promise> { return SysFileApiFp(configuration).apiSysFileUploadFileFromBase64Post(body, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary 上传多文件 🔖 + * @param {Array} [files] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysFileUploadFileListPostForm(files?: Array, options?: AxiosRequestConfig): Promise> { + return SysFileApiFp(configuration).apiSysFileUploadFileListPostForm(files, options).then((request) => request(axios, basePath)); + }, /** * * @summary 上传文件 🔖 @@ -1336,11 +1449,17 @@ export const SysFileApiFactory = function (configuration?: Configuration, basePa * * @summary 上传多文件 🔖 * @param {Array} [files] + * @param {string} [fileType] + * @param {string} [fileAlias] + * @param {boolean} [isPublic] + * @param {string} [allowSuffix] + * @param {number} [dataId] + * @param {number} [userId] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async apiSysFileUploadFilesPostForm(files?: Array, options?: AxiosRequestConfig): Promise> { - return SysFileApiFp(configuration).apiSysFileUploadFilesPostForm(files, options).then((request) => request(axios, basePath)); + async apiSysFileUploadFilesPostForm(files?: Array, fileType?: string, fileAlias?: string, isPublic?: boolean, allowSuffix?: string, dataId?: number, userId?: number, options?: AxiosRequestConfig): Promise> { + return SysFileApiFp(configuration).apiSysFileUploadFilesPostForm(files, fileType, fileAlias, isPublic, allowSuffix, dataId, userId, options).then((request) => request(axios, basePath)); }, /** * @@ -1518,6 +1637,17 @@ export class SysFileApi extends BaseAPI { public async apiSysFileUploadFileFromBase64Post(body?: UploadFileFromBase64Input, options?: AxiosRequestConfig) : Promise> { return SysFileApiFp(this.configuration).apiSysFileUploadFileFromBase64Post(body, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary 上传多文件 🔖 + * @param {Array} [files] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SysFileApi + */ + public async apiSysFileUploadFileListPostForm(files?: Array, options?: AxiosRequestConfig) : Promise> { + return SysFileApiFp(this.configuration).apiSysFileUploadFileListPostForm(files, options).then((request) => request(this.axios, this.basePath)); + } /** * * @summary 上传文件 🔖 @@ -1539,12 +1669,18 @@ export class SysFileApi extends BaseAPI { * * @summary 上传多文件 🔖 * @param {Array} [files] + * @param {string} [fileType] + * @param {string} [fileAlias] + * @param {boolean} [isPublic] + * @param {string} [allowSuffix] + * @param {number} [dataId] + * @param {number} [userId] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SysFileApi */ - public async apiSysFileUploadFilesPostForm(files?: Array, options?: AxiosRequestConfig) : Promise> { - return SysFileApiFp(this.configuration).apiSysFileUploadFilesPostForm(files, options).then((request) => request(this.axios, this.basePath)); + public async apiSysFileUploadFilesPostForm(files?: Array, fileType?: string, fileAlias?: string, isPublic?: boolean, allowSuffix?: string, dataId?: number, userId?: number, options?: AxiosRequestConfig) : Promise> { + return SysFileApiFp(this.configuration).apiSysFileUploadFilesPostForm(files, fileType, fileAlias, isPublic, allowSuffix, dataId, userId, options).then((request) => request(this.axios, this.basePath)); } /** * diff --git a/Web/src/api-services/system/models/index.ts b/Web/src/api-services/system/models/index.ts index 527fd0c2..375f281a 100644 --- a/Web/src/api-services/system/models/index.ts +++ b/Web/src/api-services/system/models/index.ts @@ -485,6 +485,7 @@ export * from './sys-dict-type'; export * from './sys-file'; export * from './sys-file-upload-avatar-body'; export * from './sys-file-upload-file-body'; +export * from './sys-file-upload-file-list-body'; export * from './sys-file-upload-files-body'; export * from './sys-file-upload-signature-body'; export * from './sys-info-input'; diff --git a/Web/src/api-services/system/models/page-file-input.ts b/Web/src/api-services/system/models/page-file-input.ts index 1a5213b6..a260852c 100644 --- a/Web/src/api-services/system/models/page-file-input.ts +++ b/Web/src/api-services/system/models/page-file-input.ts @@ -113,4 +113,12 @@ export interface PageFileInput { * @memberof PageFileInput */ endTime?: Date | null; + + /** + * 文件路径 + * + * @type {string} + * @memberof PageFileInput + */ + filePath?: string | null; } diff --git a/Web/src/api-services/system/models/sys-file-upload-file-list-body.ts b/Web/src/api-services/system/models/sys-file-upload-file-list-body.ts new file mode 100644 index 00000000..4f28be46 --- /dev/null +++ b/Web/src/api-services/system/models/sys-file-upload-file-list-body.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface SysFileUploadFileListBody + */ +export interface SysFileUploadFileListBody { + + /** + * @type {Array} + * @memberof SysFileUploadFileListBody + */ + files: Array; +} diff --git a/Web/src/api-services/system/models/sys-file-upload-files-body.ts b/Web/src/api-services/system/models/sys-file-upload-files-body.ts index 21bb5a93..ff254201 100644 --- a/Web/src/api-services/system/models/sys-file-upload-files-body.ts +++ b/Web/src/api-services/system/models/sys-file-upload-files-body.ts @@ -21,8 +21,58 @@ export interface SysFileUploadFilesBody { /** + * 文件集合 + * * @type {Array} * @memberof SysFileUploadFilesBody */ files: Array; + + /** + * 文件类别 + * + * @type {string} + * @memberof SysFileUploadFilesBody + */ + fileType?: string; + + /** + * 文件别名 + * + * @type {string} + * @memberof SysFileUploadFilesBody + */ + fileAlias?: string; + + /** + * 是否公开 + * + * @type {boolean} + * @memberof SysFileUploadFilesBody + */ + isPublic?: boolean; + + /** + * 允许格式:.jpeg.jpg.png.bmp.gif.tif + * + * @type {string} + * @memberof SysFileUploadFilesBody + */ + allowSuffix?: string; + + /** + * 业务数据Id + * + * @type {number} + * @memberof SysFileUploadFilesBody + */ + dataId?: number; + + /** + * 上传用户Id(解决跨租户上传时用户所属不一致问题) + * + * @type {number} + * @memberof SysFileUploadFilesBody + */ + userId?: number; } diff --git a/Web/src/api-services/system/models/upload-file-from-base64-input.ts b/Web/src/api-services/system/models/upload-file-from-base64-input.ts index 494e982a..182744b8 100644 --- a/Web/src/api-services/system/models/upload-file-from-base64-input.ts +++ b/Web/src/api-services/system/models/upload-file-from-base64-input.ts @@ -75,12 +75,4 @@ export interface UploadFileFromBase64Input { * @memberof UploadFileFromBase64Input */ dataId?: number | null; - - /** - * 上传用户Id(解决跨租户上传时用户所属不一致问题) - * - * @type {number} - * @memberof UploadFileFromBase64Input - */ - userId?: number; } diff --git a/Web/src/views/system/file/component/fileTree.vue b/Web/src/views/system/file/component/fileTree.vue index e72c1f24..cdda023f 100644 --- a/Web/src/views/system/file/component/fileTree.vue +++ b/Web/src/views/system/file/component/fileTree.vue @@ -4,7 +4,7 @@
- +
@@ -126,11 +126,22 @@ const handleCommand = async (command: string | number | object) => { // 与父组件的交互逻辑 const emits = defineEmits(['node-click']); -const nodeClick = (node: any) => { - emits('node-click', { id: node.id, name: node.name }); +const nodeClick = (node: any, data: any) => { + var path = node.name; + if (data.level == 4) { + // 当点击日节点时,获取对应的月和年 + var monthNode = treeRef.value!.getNode(node.pid); + var yearNode = treeRef.value!.getNode(monthNode.data.pid); + path = `${yearNode.data.name}/${monthNode.data.name}/${node.name}`; + } else if (data.level == 3) { + // 当点击月节点时,获取对应的年 + var yearNode = treeRef.value!.getNode(node.pid); + path = `${yearNode.data.name}/${node.name}`; + } + emits('node-click', { id: node.id, name: node.name, path: path }); }; -//设置当前选中节点 +// 设置当前选中节点 const setCurrentKey = (key?: TreeKey | undefined, shouldAutoExpandParent?: boolean | undefined) => { treeRef.value?.setCurrentKey(key, shouldAutoExpandParent); }; diff --git a/Web/src/views/system/file/index.vue b/Web/src/views/system/file/index.vue index 8648d112..64fb9d0f 100644 --- a/Web/src/views/system/file/index.vue +++ b/Web/src/views/system/file/index.vue @@ -105,7 +105,7 @@ - + @@ -281,7 +281,11 @@ const handleChange = (file: any, fileList: []) => { // 上传 const handleUpload = async () => { if (state.fileList.length < 1) return; - await getAPI(SysFileApi).apiSysFileUploadFilePostForm(state.fileList[0].raw, state.fileType, '', state.isPublic); + // // 单文件上传 + // await getAPI(SysFileApi).apiSysFileUploadFilePostForm(state.fileList[0].raw, state.fileType, '', state.isPublic); + // 多文件上传 + var files = state.fileList.map((file: any) => file.raw); + await getAPI(SysFileApi).apiSysFileUploadFilesPostForm(files, state.fileType, '', state.isPublic); handleQuery(); ElMessage.success('上传成功'); state.visible = false; @@ -332,7 +336,7 @@ const gridEvents: VxeGridListeners = { // 树组件点击 const handleNodeChange = async (node: any) => { state.queryParams.fileName = undefined; - state.queryParams.filePath = node.name; + state.queryParams.filePath = node.path; state.queryParams.startTime = undefined; state.queryParams.endTime = undefined; await handleQuery(); diff --git a/Web/src/views/system/org/component/orgTree.vue b/Web/src/views/system/org/component/orgTree.vue index dc5f802e..af760409 100644 --- a/Web/src/views/system/org/component/orgTree.vue +++ b/Web/src/views/system/org/component/orgTree.vue @@ -140,7 +140,7 @@ const nodeClick = (node: any) => { emits('node-click', { id: node.id, name: node.name }); }; -//设置当前选中节点 +// 设置当前选中节点 const setCurrentKey = (key?: TreeKey | undefined, shouldAutoExpandParent?: boolean | undefined) => { treeRef.value?.setCurrentKey(key, shouldAutoExpandParent); };