Browse Source

add file-management view

pull/51/head
cKey 5 years ago
parent
commit
2ca2897cd0
  1. 1
      aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDto.cs
  2. 60
      aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs
  3. 10
      aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs
  4. 26
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs
  5. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
  6. 1
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
  7. 1
      vueJs/src/api/clients.ts
  8. 103
      vueJs/src/api/filemanagement.ts
  9. 14
      vueJs/src/lang/zh.ts
  10. 3
      vueJs/src/router/index.ts
  11. 27
      vueJs/src/router/modules/file-management.ts
  12. 220
      vueJs/src/views/file-management/index.vue

1
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDto.cs

@ -7,6 +7,7 @@ namespace LINGYUN.Abp.FileManagement
public FileSystemType Type { get; set; }
public string Name { get; set; }
public string Parent { get; set; }
public string Extension { get; set; }
public long? Size { get; set; }
public DateTime CreationTime { get; set; }
public DateTime? LastModificationTime { get; set; }

60
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs

@ -142,12 +142,13 @@ namespace LINGYUN.Abp.FileManagement
Type = FileSystemType.File,
Name = fileInfo.Name,
Size = fileInfo.Length,
Extension = fileInfo.Extension,
CreationTime = fileInfo.CreationTime,
LastModificationTime = fileInfo.LastWriteTime
};
if (fileInfo.Directory?.Parent != null && !fileInfo.Directory.Parent.Name.IsNullOrWhiteSpace())
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.Parent.FullName);
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName);
}
return Task.FromResult(fileSystem);
}
@ -161,7 +162,7 @@ namespace LINGYUN.Abp.FileManagement
CreationTime = directoryInfo.CreationTime,
LastModificationTime = directoryInfo.LastWriteTime
};
if (directoryInfo.Parent != null && !directoryInfo.Parent.Name.IsNullOrWhiteSpace())
if (directoryInfo.Parent != null && !directoryInfo.Parent.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(directoryInfo.Parent.FullName);
}
@ -207,19 +208,21 @@ namespace LINGYUN.Abp.FileManagement
CreationTime = fileSystemInfo.CreationTime,
LastModificationTime = fileSystemInfo.LastWriteTime,
};
if (fileSystemInfo is FileInfo fileInfo)
{
fileSystem.Type = FileSystemType.File;
fileSystem.Size = fileInfo.Length;
if (fileInfo.Directory?.Parent != null && !fileInfo.Directory.Parent.Name.IsNullOrWhiteSpace())
fileSystem.Extension = fileInfo.Extension;
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.Parent.FullName);
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName);
}
}
else if (fileSystemInfo is DirectoryInfo directory)
{
fileSystem.Type = FileSystemType.Folder;
if (directory.Parent != null && !directory.Parent.Name.IsNullOrWhiteSpace())
if (directory.Parent != null && !directory.Parent.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(directory.Parent.FullName);
}
@ -227,6 +230,11 @@ namespace LINGYUN.Abp.FileManagement
fileSystems.Add(fileSystem);
}
fileSystems = fileSystems
.OrderBy(f => f.Type)
.ThenBy(f => f.Name)
.ToList();
return Task.FromResult(new PagedResultDto<FileSystemDto>(
fileSystemInfos.Length, fileSystems
));
@ -288,12 +296,13 @@ namespace LINGYUN.Abp.FileManagement
Type = FileSystemType.File,
Name = fileInfo.Name,
Size = fileInfo.Length,
Extension = fileInfo.Extension,
CreationTime = fileInfo.CreationTime,
LastModificationTime = fileInfo.LastWriteTime
};
if (fileInfo.Directory?.Parent != null && !fileInfo.Directory.Parent.Name.IsNullOrWhiteSpace())
if (fileInfo.Directory != null && !fileInfo.Directory.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.Parent.FullName);
fileSystem.Parent = GetFileSystemRelativePath(fileInfo.Directory.FullName);
}
return Task.FromResult(fileSystem);
}
@ -314,7 +323,7 @@ namespace LINGYUN.Abp.FileManagement
CreationTime = directoryInfo.CreationTime,
LastModificationTime = directoryInfo.LastWriteTime
};
if (directoryInfo.Parent != null && !directoryInfo.Parent.Name.IsNullOrWhiteSpace())
if (directoryInfo.Parent != null && !directoryInfo.Parent.FullName.IsNullOrWhiteSpace())
{
fileSystem.Parent = GetFileSystemRelativePath(directoryInfo.Parent.FullName);
}
@ -322,10 +331,31 @@ namespace LINGYUN.Abp.FileManagement
}
throw new UserFriendlyException("文件或目录不存在!");
}
/// <summary>
/// 获取文件系统相对路径
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
protected virtual string GetFileSystemRelativePath(string path)
{
return path.Replace(Directory.GetCurrentDirectory(), "");
// 去除完整路径中的文件系统根目录
var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration();
var blobPath = fileSystemConfiguration.BasePath;
path = path.Replace(blobPath, "");
// 去除租户或宿主目录
if (CurrentTenant.Id == null)
{
path = path.Replace("\\host", "");
}
else
{
path = path.Replace($"\\tenants\\{CurrentTenant.Id.Value.ToString("D")}", "");
}
// 去除完整路径中的容器根目录
var containerName = BlobContainerNameAttribute.GetContainerName<FileSystemContainer>();
path = path.Replace($"\\{containerName}", "");
return path;
}
protected virtual string GetFileSystemPath(string path)
@ -354,6 +384,14 @@ namespace LINGYUN.Abp.FileManagement
{
blobPath = Path.Combine(blobPath, "tenants", CurrentTenant.Id.Value.ToString("D"));
}
var containerName = BlobContainerNameAttribute.GetContainerName<FileSystemContainer>();
blobPath = Path.Combine(blobPath, containerName);
if (!Directory.Exists(blobPath))
{
Directory.CreateDirectory(blobPath);
}
return blobPath;
}

10
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs

@ -46,7 +46,7 @@ namespace LINGYUN.Abp.FileManagement
}
[HttpPost]
[Route("files/upload")]
[Route("files")]
public virtual async Task CreateFileAsync(FileCreateDto input)
{
// 检查文件大小
@ -138,28 +138,28 @@ namespace LINGYUN.Abp.FileManagement
}
[HttpPost]
[Route("folders/add")]
[Route("folders")]
public virtual async Task CreateFolderAsync(FolderCreateDto input)
{
await FileSystemAppService.CreateFolderAsync(input);
}
[HttpDelete]
[Route("files/delete")]
[Route("files")]
public virtual async Task DeleteFileAsync(FileDeleteDto input)
{
await FileSystemAppService.DeleteFileAsync(input);
}
[HttpDelete]
[Route("folders/delete")]
[Route("folders")]
public virtual async Task DeleteFolderAsync([Required, StringLength(255)] string path)
{
await FileSystemAppService.DeleteFolderAsync(path);
}
[HttpGet]
[Route("files/download")]
[Route("files")]
public virtual async Task DownloadFileAsync(FileSystemGetDto input)
{
var fileStream = await FileSystemAppService.DownloadFileAsync(input);

26
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs

@ -21,20 +21,20 @@ namespace LINGYUN.Platform.Permissions
// TODO: 2020-07-27 目前abp不支持对象存储管理(或者属于企业版?)需要创建一个 LINGYUN.Abp.BlobStoring 项目自行实现
var fileSystem = platform.AddPermission(PlatformPermissions.FileSystem.Default, L("Permission:FileSystem"));
fileSystem.AddChild(PlatformPermissions.FileSystem.Create, L("Permission:CreateFolder"));
fileSystem.AddChild(PlatformPermissions.FileSystem.Delete, L("Permission:DeleteFolder"));
fileSystem.AddChild(PlatformPermissions.FileSystem.Rename, L("Permission:RenameFolder"));
fileSystem.AddChild(PlatformPermissions.FileSystem.Copy, L("Permission:CopyFolder"));
fileSystem.AddChild(PlatformPermissions.FileSystem.Move, L("Permission:MoveFolder"));
//var fileSystem = platform.AddPermission(PlatformPermissions.FileSystem.Default, L("Permission:FileSystem"));
//fileSystem.AddChild(PlatformPermissions.FileSystem.Create, L("Permission:CreateFolder"));
//fileSystem.AddChild(PlatformPermissions.FileSystem.Delete, L("Permission:DeleteFolder"));
//fileSystem.AddChild(PlatformPermissions.FileSystem.Rename, L("Permission:RenameFolder"));
//fileSystem.AddChild(PlatformPermissions.FileSystem.Copy, L("Permission:CopyFolder"));
//fileSystem.AddChild(PlatformPermissions.FileSystem.Move, L("Permission:MoveFolder"));
var fileManager = fileSystem.AddChild(PlatformPermissions.FileSystem.FileManager.Default, L("Permission:FileManager"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile"));
fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile"));
//var fileManager = fileSystem.AddChild(PlatformPermissions.FileSystem.FileManager.Default, L("Permission:FileManager"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile"));
//fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile"));
}
private static LocalizableString L(string name)

2
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs

@ -3,6 +3,7 @@ using IdentityModel;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.FileManagement;
using LINGYUN.Abp.Location.Tencent;
using LINGYUN.Abp.MessageService;
using LINGYUN.Abp.SettingManagement;
@ -59,6 +60,7 @@ namespace LINGYUN.BackendAdmin
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AppPlatformApplicationContractModule),
typeof(ApiGatewayApplicationContractsModule),
typeof(AbpFileManagementApplicationContractsModule),
typeof(AbpMessageServiceApplicationContractsModule),
typeof(LINGYUN.Abp.Identity.AbpIdentityHttpApiModule),
typeof(LINGYUN.Abp.Identity.AbpIdentityApplicationModule),

1
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj

@ -62,6 +62,7 @@
<ProjectReference Include="..\..\..\modules\apigateway\LINGYUN.ApiGateway.Application.Contracts\LINGYUN.ApiGateway.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\..\modules\file-management\LINGYUN.Abp.FileManagement.Application.Contracts\LINGYUN.Abp.FileManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\identity\LINGYUN.Abp.Identity.Application\LINGYUN.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\modules\identity\LINGYUN.Abp.Identity.HttpApi\LINGYUN.Abp.Identity.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Location.Tencent\LINGYUN.Abp.Location.Tencent.csproj" />

1
vueJs/src/api/clients.ts

@ -1,4 +1,3 @@
import ApiService from './serviceBase'
import { pagerFormat } from '@/utils/index'
import { FullAuditedEntityDto, PagedAndSortedResultRequestDto, PagedResultDto } from './types'

103
vueJs/src/api/filemanagement.ts

@ -0,0 +1,103 @@
import ApiService from './serviceBase'
import { PagedAndSortedResultRequestDto, PagedResultDto } from './types'
const serviceUrl = process.env.VUE_APP_BASE_API
const baseUrl = '/api/file-management/file-system'
export const FileManagementUrl = serviceUrl + baseUrl
export default class FileManagementService {
public static getFileSystem(name: string, path: string | undefined) {
let _url = baseUrl + '?name=' + name
if (path) {
_url += '&path=' + path
}
return ApiService.Get<FileSystem>(_url, serviceUrl)
}
public static getFileSystemList(payload: FileSystemGetByPaged) {
let _url = baseUrl + '?skipCount=' + payload.skipCount
_url += '&maxResultCount=' + payload.maxResultCount
_url += '&sorting=' + payload.sorting
if (payload.filter) {
_url += '&filter=' + payload.filter
}
if (payload.parent) {
_url += '&parent=' + payload.parent
}
return ApiService.Get<PagedResultDto<FileSystem>>(_url, serviceUrl)
}
public static editFileSystem(name: string, newName: string) {
const _payload = { newName }
return ApiService.Put<FileSystem>(baseUrl, _payload, serviceUrl)
}
public static createFolder(path: string, parent: string | undefined) {
const _url = baseUrl + '/folders'
const _payload = {
path,
parent
}
return ApiService.Post<void>(_url, _payload, serviceUrl)
}
public static deleteFolder(path: string) {
const _url = baseUrl + '/folders?path=' + path
return ApiService.Delete(_url, serviceUrl)
}
public static moveFolder(path: string, toPath: string) {
const _url = baseUrl + '/folders/move?path=' + path
const _payload = { toPath }
return ApiService.Put<void>(_url, _payload, serviceUrl)
}
public static copyFolder(path: string, toPath: string) {
const _url = baseUrl + '/folders/copy?path=' + path
const _payload = { toPath }
return ApiService.Put<void>(_url, _payload, serviceUrl)
}
public static deleteFile(path: string, name: string) {
let _url = baseUrl + '/files?path=' + path
_url += '&name=' + name
return ApiService.Delete(_url, serviceUrl)
}
public static moveFile(payload: FileCopyOrMove) {
const _url = baseUrl + '/files/move'
return ApiService.Put<void>(_url, payload, serviceUrl)
}
public static copyFile(payload: FileCopyOrMove) {
const _url = baseUrl + '/files/copy'
return ApiService.Put<void>(_url, payload, serviceUrl)
}
}
export enum FileSystemType {
Folder = 0,
File = 1
}
export class FileSystem {
type!: FileSystemType
name!: string
parent?: string
size?: number
extension?: string
creationTime!: Date
lastModificationTime?: Date
}
export class FileSystemGetByPaged extends PagedAndSortedResultRequestDto {
parent?: string
filter?: string
}
export class FileCopyOrMove {
path!: string
name!: string
toPath!: string
toName?: string
}

14
vueJs/src/lang/zh.ts

@ -78,7 +78,9 @@ export default {
clients: '客户端管理',
apiresources: 'Api资源管理',
identityresources: '身份资源管理',
organizationUnit: '组织机构管理'
organizationUnit: '组织机构管理',
filemanagement: '文件管理',
filesystem: '文件系统'
},
navbar: {
logOut: '退出登录',
@ -617,5 +619,15 @@ export default {
messages: {
noNotifications: '没有通知',
noMessages: '没有消息'
},
fileSystem: {
name: '名称',
creationTime: '创建时间',
lastModificationTime: '修改时间',
type: '类型',
folder: '文件夹',
fileType: '{exten}文件',
size: '大小',
root: '根目录'
}
}

3
vueJs/src/router/index.ts

@ -13,9 +13,9 @@ import taskRouter from './modules/task'
import adminRouter from './modules/admin'
import apigatewayRouter from './modules/apigateway'
import identityServerRouter from './modules/identityServer'
import fileManagementRouter from './modules/file-management'
Vue.use(Router)
/*
Note: sub-menu only appear when children.length>=1
Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@ -128,6 +128,7 @@ export const asyncRoutes: RouteConfig[] = [
adminRouter,
apigatewayRouter,
identityServerRouter,
fileManagementRouter,
{
path: '*',
component: () => import(/* webpackChunkName: "error-page-404" */ '@/views/error-page/404.vue'),

27
vueJs/src/router/modules/file-management.ts

@ -0,0 +1,27 @@
import { RouteConfig } from 'vue-router'
import Layout from '@/layout/index.vue'
const fileManagementRouter: RouteConfig = {
path: '/file-management',
component: Layout,
meta: {
title: 'filemanagement',
icon: 'manager',
roles: ['Abp.FileManagement.FileSystem'],
alwaysShow: true
},
children: [
{
path: 'file-system',
component: () => import('@/views/file-management/index.vue'),
name: 'filesystem',
meta: {
title: 'filesystem',
icon: 'file-system',
roles: ['Abp.FileManagement.FileSystem']
}
}
]
}
export default fileManagementRouter

220
vueJs/src/views/file-management/index.vue

@ -0,0 +1,220 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-breadcrumb
ref="fileSystemBreadCrumb"
separator-class="el-icon-arrow-right"
>
<el-breadcrumb-item
v-for="(fileRoot, index) in fileSystemRoot"
:key="index"
class="file-system-breadcrumb"
@click.native="handleBreadCrumbClick"
>
{{ fileRoot }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<el-table
ref="fileSystemTable"
v-loading="fileSystemListLoading"
row-key="name"
:data="fileSystemList"
border
fit
highlight-current-row
style="width: 100%;"
@row-click="handleRowClick"
@row-dblclick="handleRowDoubleClick"
>
<el-table-column
type="selection"
width="50px"
align="center"
/>
<el-table-column
:label="$t('fileSystem.name')"
prop="name"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('fileSystem.creationTime')"
prop="creationTime"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.creationTime | dateTimeFilter }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('fileSystem.lastModificationTime')"
prop="lastModificationTime"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.lastModificationTime | dateTimeFilter }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('fileSystem.type')"
prop="type"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.type === 0 ? $t('fileSystem.folder') : $t('fileSystem.fileType', {exten: row.extension}) }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('fileSystem.size')"
prop="size"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.size | fileSystemSizeFilter }}</span>
</template>
</el-table-column>
</el-table>
<Pagination
v-show="fileSystemCount>0"
:total="fileSystemCount"
:page.sync="fileSystemGetFilter.skipCount"
:limit.sync="fileSystemGetFilter.maxResultCount"
@pagination="handleGetFileSystemList"
/>
</div>
</template>
<script lang="ts">
import { dateFormat } from '@/utils'
import { Component, Vue } from 'vue-property-decorator'
import Pagination from '@/components/Pagination/index.vue'
import FileSystemService, { FileSystem, FileSystemGetByPaged, FileSystemType } from '@/api/filemanagement'
const kbUnit = 1 * 1024
const mbUnit = kbUnit * 1024
const gbUnit = mbUnit * 1024
@Component({
name: 'FileManagement',
components: {
Pagination
},
filters: {
dateTimeFilter(datetime: string) {
const date = new Date(datetime)
return dateFormat(date, 'YYYY-mm-dd HH:MM')
},
fileSystemTypeFilter(type: FileSystemType) {
if (type === FileSystemType.Folder) {
return 'fileSystem.folder'
}
return 'fileSystem.fileType'
},
fileSystemSizeFilter(size: number) {
if (size > gbUnit) {
let gb = Math.round(size / gbUnit)
if (gb < 1) {
gb = 1
}
return gb + 'GB'
}
if (size > mbUnit) {
let mb = Math.round(size / mbUnit)
if (mb < 1) {
mb = 1
}
return mb + 'MB'
}
let kb = Math.round(size / kbUnit)
if (kb < 1) {
kb = 1
}
return kb + 'KB'
}
}
})
export default class extends Vue {
private lastFilePath!: string
private fileSystemRoot!: string[]
private fileSystemList?: FileSystem[]
private fileSystemCount!: number
private fileSystemListLoading!: boolean
private fileSystemGetFilter!: FileSystemGetByPaged
constructor() {
super()
this.lastFilePath = ''
this.fileSystemCount = 0
this.fileSystemListLoading = false
this.fileSystemRoot = new Array<string>()
this.fileSystemList = new Array<FileSystem>()
this.fileSystemGetFilter = new FileSystemGetByPaged()
}
mounted() {
console.log(this.$route.params)
this.fileSystemRoot.push(this.$t('fileSystem.root').toString())
this.handleGetFileSystemList()
}
private handleGetFileSystemList() {
this.fileSystemListLoading = true
FileSystemService.getFileSystemList(this.fileSystemGetFilter).then(res => {
this.fileSystemCount = res.totalCount
this.fileSystemList = res.items
}).finally(() => {
this.fileSystemListLoading = false
})
}
private handleRowClick(row: any) {
console.log(row)
const table = this.$refs.fileSystemTable as any
table.setCurrentRow(row)
}
private handleRowDoubleClick(row: any) {
if (row.type === FileSystemType.Folder) {
this.fileSystemRoot.push(row.name)
this.navigationToFilePath()
}
}
private handleBreadCrumbClick(event: any) {
const nodeIndex = this.fileSystemRoot.findIndex(f => f === event.target.textContent)
this.fileSystemRoot.splice(nodeIndex)
this.navigationToFilePath()
}
private navigationToFilePath() {
const fileSystemPathArray = this.fileSystemRoot.slice(1)
const fileSystemPath = fileSystemPathArray.join('\\')
console.log(fileSystemPath)
this.fileSystemGetFilter.parent = fileSystemPath
this.handleGetFileSystemList()
}
}
</script>
<style lang="scss">
.file-system-breadcrumb .el-breadcrumb__inner {
color: rgb(34, 34, 173);
cursor: pointer;
}
</style>
Loading…
Cancel
Save