😎1、文件实体增加MIME类型字段 2、处理路由参数tid 3、增加默认dwg文件格式处理

This commit is contained in:
zuohuaijun 2025-02-18 12:06:10 +08:00
parent 9c1fd32052
commit 5cdc2494bf
7 changed files with 22 additions and 9 deletions

View File

@ -28,7 +28,8 @@
".dll": "application/octet-stream",
".exe": "application/octet-stream",
".pdb": "application/octet-stream",
".so": "application/octet-stream"
".so": "application/octet-stream",
".dwg": "application/octet-stream"
},
"LocalizationSettings": {
"SupportedCultures": [ "zh-CN", "en" ], //

View File

@ -4,7 +4,7 @@
"Upload": {
"Path": "upload/{yyyy}/{MM}/{dd}", //
"MaxSize": 51200, // KB1024*50
"ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "text/xml", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "video/mp4", "application/wps-office.docx", "application/wps-office.xlsx", "application/wps-office.pptx", "application/vnd.android.package-archive" ],
"ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "text/xml", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "video/mp4", "application/wps-office.docx", "application/wps-office.xlsx", "application/wps-office.pptx", "application/vnd.android.package-archive", "application/octet-stream" ],
"EnableMd5": false // MDF5-
},
"OSSProvider": {

View File

@ -42,6 +42,13 @@ public partial class SysFile : EntityTenantBaseData
[MaxLength(16)]
public string? Suffix { get; set; }
/// <summary>
/// MIME类型
/// </summary>
[SugarColumn(ColumnDescription = "MIME类型", Length = 128)]
[MaxLength(128)]
public string? ContentType { get; set; }
/// <summary>
/// 存储路径
/// </summary>

View File

@ -286,6 +286,7 @@ public class SysFileService : IDynamicApiController, ITransient
newFile.BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Bucket : "Local"; // 阿里云对bucket名称有要求1.只能包括小写字母,数字,短横线(-2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
newFile.FileName = Path.GetFileNameWithoutExtension(input.File.FileName);
newFile.Suffix = suffix;
newFile.ContentType = input.File.ContentType;
newFile.SizeKb = sizeKb;
newFile.FilePath = path;
newFile.FileMd5 = fileMd5;

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2025.02.16",
"lastBuildTime": "2025.02.18",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -45,7 +45,7 @@
"jsplumb": "^2.15.6",
"jwchat": "^2.0.3",
"lodash-es": "^4.17.21",
"md-editor-v3": "^5.2.2",
"md-editor-v3": "^5.2.3",
"mitt": "^3.0.1",
"monaco-editor": "^0.52.2",
"mqtt": "^5.10.3",
@ -74,11 +74,11 @@
"vue-router": "^4.5.0",
"vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.3.86",
"vxe-pc-ui": "^4.3.90",
"vxe-table": "^4.10.0",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.7",
"xe-utils": "^3.7.0",
"xe-utils": "^3.7.2",
"xlsx-js-style": "^1.2.0"
},
"devDependencies": {
@ -88,8 +88,8 @@
"@types/node": "^20.17.19",
"@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"@typescript-eslint/eslint-plugin": "^8.24.1",
"@typescript-eslint/parser": "^8.24.1",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vue/compiler-sfc": "^3.5.13",

View File

@ -86,6 +86,7 @@ const getThemeConfig = computed(() => {
//
onMounted(async () => {
// Id
if (!route.query.tid) Local.remove('tid');
var tenantid = Number(route.query.tid);
if (isNaN(tenantid)) {
tenantid = 0;

View File

@ -210,6 +210,7 @@ const options = useVxeTable<SysFile>(
{ field: 'url', title: '预览', minWidth: 100, slots: { default: 'row_url' } },
{ field: 'sizeKb', title: '大小(KB)', minWidth: 100, showOverflow: 'tooltip' },
{ field: 'suffix', title: '后缀', minWidth: 80, showOverflow: 'tooltip', slots: { default: 'row_suffix' } },
{ field: 'contentType', title: 'MIME类型', minWidth: 180, showOverflow: 'tooltip' },
{ field: 'bucketName', title: '存储位置', minWidth: 180, showOverflow: 'tooltip' },
{ field: 'id', title: '存储标识', minWidth: 120, showOverflow: 'tooltip' },
{ field: 'isPublic', title: '是否公开', minWidth: 140, showOverflow: 'tooltip', slots: { default: 'row_isPublic' } },
@ -286,7 +287,9 @@ const handleUpload = async () => {
//
const handleDownload = async (row: any) => {
// var res = await getAPI(SysFileApi).sysFileDownloadPost({ id: row.id });
// var res = await getAPI(SysFileApi).apiSysFileDownloadFilePost({ id: row.id });
// downloadStreamFile(res, row.fileName);
var fileUrl = fetchFileUrl(row);
downloadByUrl({ url: fileUrl, fileName: row.fileName });
};