perf: 右键菜单加上显示文件夹大小

This commit is contained in:
jmal 2024-05-08 15:11:57 +08:00
parent ad629765d1
commit d0df620741
3 changed files with 23 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -685,12 +685,7 @@
</el-form-item> </el-form-item>
<el-form-item label="大小:"> <el-form-item label="大小:">
<span> <span>
{{ rowContextData.size }}字节 {{formatSize(rowContextData.size)}}</span
{{
rowContextData.size > 0
? "(" + formatSize(rowContextData.size) + ")"
: ""
}}</span
> >
</el-form-item> </el-form-item>
<el-form-item label="位置:" class="details-position"> <el-form-item label="位置:" class="details-position">
@ -1112,6 +1107,7 @@ export default {
dragLoop: null, dragLoop: null,
positionX: 0, positionX: 0,
positionY: 0, positionY: 0,
showFolderSize: false,
grid: this.defaultGrid, grid: this.defaultGrid,
vmode: this.defaultGrid ? "grid" : "list", vmode: this.defaultGrid ? "grid" : "list",
gridColumnNum: -1, gridColumnNum: -1,
@ -2585,6 +2581,11 @@ export default {
child[0].iconClass = "menu-point"; child[0].iconClass = "menu-point";
child[1].iconClass = "menu-empty"; child[1].iconClass = "menu-empty";
} }
if (this.showFolderSize) {
child[2].iconClass = "duigou";
} else {
child[2].iconClass = "menu-empty";
}
} }
if (arrangementModeIndex > -1) { if (arrangementModeIndex > -1) {
const child = this.contextMenus[arrangementModeIndex].child; const child = this.contextMenus[arrangementModeIndex].child;
@ -2728,7 +2729,8 @@ export default {
isFavorite: this.queryCondition.isFavorite, isFavorite: this.queryCondition.isFavorite,
queryFileType: this.queryFileType, queryFileType: this.queryFileType,
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize pageSize: this.pagination.pageSize,
showFolderSize: this.showFolderSize
}) })
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
@ -2751,7 +2753,8 @@ export default {
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
folder: this.$route.query.folder folder: this.$route.query.folder,
showFolderSize: this.showFolderSize
}) })
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
@ -2771,7 +2774,8 @@ export default {
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize, pageSize: this.pagination.pageSize,
folder: this.$route.query.folder folder: this.$route.query.folder,
showFolderSize: this.showFolderSize
}) })
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
@ -2803,7 +2807,8 @@ export default {
tagId: this.queryCondition.tagId, tagId: this.queryCondition.tagId,
queryCondition: this.queryCondition, queryCondition: this.queryCondition,
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize pageSize: this.pagination.pageSize,
showFolderSize: this.showFolderSize
}) })
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
@ -2819,7 +2824,8 @@ export default {
currentDirectory: this.getQueryPath(), currentDirectory: this.getQueryPath(),
folder: this.$route.query.folder, folder: this.$route.query.folder,
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize pageSize: this.pagination.pageSize,
showFolderSize: this.showFolderSize
}) })
.then(res => { .then(res => {
this.loadData(res, onLoad); this.loadData(res, onLoad);
@ -3417,6 +3423,10 @@ export default {
this.grid = false; this.grid = false;
this.changeVmode(); this.changeVmode();
break; break;
case "show-folder-size":
this.showFolderSize = !this.showFolderSize;
this.getFileList();
break;
case "orderName": case "orderName":
this.sortChangeOfMenu("name", 2); this.sortChangeOfMenu("name", 2);
break; break;

View File

@ -23,6 +23,7 @@ export default {
{ label: '查看', operation: 'viewMode' ,child: [ { label: '查看', operation: 'viewMode' ,child: [
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'}, { iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'}, { iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
{ label: '显示文件夹大小', operation: 'show-folder-size'},
] ]
}, },
{ label: '排列方式', operation: 'arrangement' ,child: [ { label: '排列方式', operation: 'arrangement' ,child: [