😎修复文件上次错误
This commit is contained in:
parent
d877c0569d
commit
d5e4a6e188
@ -100,12 +100,12 @@ public partial class SysFile : EntityTenantBaseData
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "文件类别", Length = 128)]
|
||||
[MaxLength(128)]
|
||||
public string? FileType { get; set; }
|
||||
public virtual string? FileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否公开
|
||||
/// 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否公开")]
|
||||
public bool IsPublic { get; set; } = false;
|
||||
public virtual bool IsPublic { get; set; } = false;
|
||||
}
|
||||
@ -56,6 +56,16 @@ public class UploadFileInput : SysFile
|
||||
[Required]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件类别
|
||||
/// </summary>
|
||||
public override string FileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否公开
|
||||
/// </summary>
|
||||
public override bool IsPublic { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 文件路径
|
||||
/// </summary>
|
||||
|
||||
@ -274,7 +274,6 @@ public class SysFileService : IDynamicApiController, ITransient
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[ApiDescriptionSettings(Name = "File"), HttpGet]
|
||||
[DisplayName("获取文件")]
|
||||
public async Task<SysFile> GetFile([FromQuery] long id)
|
||||
{
|
||||
@ -286,29 +285,26 @@ public class SysFileService : IDynamicApiController, ITransient
|
||||
/// 获取文件路径 🔖
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[ApiDescriptionSettings(Name = "Folder"), HttpGet]
|
||||
[DisplayName("获取文件路径")]
|
||||
public async Task<dynamic> GetFolder()
|
||||
{
|
||||
var files = await _sysFileRep.AsQueryable().ToListAsync();
|
||||
var folders = files.GroupBy(x => x.FilePath).Select(g => g.First().FilePath).ToList();
|
||||
var folders = files.GroupBy(u => u.FilePath).Select(u => u.First().FilePath).ToList();
|
||||
var result = folders
|
||||
.GroupBy(p => p.Split('/').First())
|
||||
.Select((g, index) => new
|
||||
.GroupBy(u => u.Split('/').First())
|
||||
.Select((u, index) => new
|
||||
{
|
||||
id = index + 1, // 组的索引加1作为id
|
||||
pid = 0,
|
||||
name = g.Key,
|
||||
children = g.Select((item, subIndex) => new
|
||||
Id = index + 1, // 组的索引加1作为Id
|
||||
Pid = 0,
|
||||
Name = u.Key,
|
||||
Children = u.Select((item, subIndex) => new
|
||||
{
|
||||
id = (index + 1 * 100) + subIndex + 1, // 子项的索引加1作为id
|
||||
pid = index + 1,
|
||||
name = item.Split('/').Last(),
|
||||
children = new List<string>()
|
||||
})
|
||||
.ToList()
|
||||
})
|
||||
.ToList();
|
||||
Id = (index + 1 * 100) + subIndex + 1, // 子项的索引加1作为Id
|
||||
Pid = index + 1,
|
||||
Name = item.Split('/').Last(),
|
||||
Children = new List<string>()
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -35,6 +35,22 @@ export interface SysFileUploadFileBody {
|
||||
*/
|
||||
file: Blob;
|
||||
|
||||
/**
|
||||
* 文件类别
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SysFileUploadFileBody
|
||||
*/
|
||||
fileType?: string;
|
||||
|
||||
/**
|
||||
* 是否公开
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof SysFileUploadFileBody
|
||||
*/
|
||||
isPublic?: boolean;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*
|
||||
@ -155,22 +171,6 @@ export interface SysFileUploadFileBody {
|
||||
*/
|
||||
belongId?: number;
|
||||
|
||||
/**
|
||||
* 文件类别
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SysFileUploadFileBody
|
||||
*/
|
||||
fileType?: string;
|
||||
|
||||
/**
|
||||
* 是否公开 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof SysFileUploadFileBody
|
||||
*/
|
||||
isPublic?: boolean;
|
||||
|
||||
/**
|
||||
* 租户Id
|
||||
*
|
||||
|
||||
@ -85,6 +85,14 @@ export interface SysOAuthUser {
|
||||
*/
|
||||
isDelete?: boolean;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SysOAuthUser
|
||||
*/
|
||||
email?: string | null;
|
||||
|
||||
/**
|
||||
* 系统用户Id
|
||||
*
|
||||
@ -147,14 +155,6 @@ export interface SysOAuthUser {
|
||||
*/
|
||||
avatar?: string | null;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SysOAuthUser
|
||||
*/
|
||||
email?: string | null;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template lang="">
|
||||
<el-card class="box-card" shadow="hover" body-style="height:100%; overflow:auto;padding:5px;">
|
||||
<template #header>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<div class="tree-h-flex">
|
||||
<div class="tree-h-left">
|
||||
@ -42,7 +42,7 @@
|
||||
:load="loadNode"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@ -79,13 +79,11 @@ const loadNode = async (node: any, resolve: any) => {
|
||||
console.log(node);
|
||||
if (node.data == undefined || Array.isArray(node.data)) return;
|
||||
state.loading = true;
|
||||
var data = state.folderData.find(u => u.id == node.data.id);
|
||||
var data = state.folderData.find((u) => u.id == node.data.id);
|
||||
state.loading = false;
|
||||
console.log(data);
|
||||
if (data)
|
||||
resolve(data.children);
|
||||
else
|
||||
resolve([]);
|
||||
if (data) resolve(data.children);
|
||||
else resolve([]);
|
||||
};
|
||||
|
||||
// 获取已经选择
|
||||
|
||||
@ -277,7 +277,7 @@ 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, undefined);
|
||||
await getAPI(SysFileApi).apiSysFileUploadFilePostForm(state.fileList[0].raw, state.fileType, state.isPublic);
|
||||
handleQuery();
|
||||
ElMessage.success('上传成功');
|
||||
state.visible = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user