feat: 添加挂载文件菜单(直接列出所有挂载文件), 优化搜索选项

This commit is contained in:
jmal 2025-04-28 14:22:11 +08:00
parent a0993eaf0f
commit 007475bce6
9 changed files with 110 additions and 11 deletions

View File

@ -3,7 +3,14 @@
<div class="search-option-wrapper">
<div class="search-option-result">
<div>
<span>搜索 <span class="search-scope">{{searchScope}}</span>:</span>
<span>
搜索
<span class="search-scope" v-if="searchScope">
<el-tooltip class="item" effect="dark" :content="searchScope" placement="top">
<i class="el-icon-warning-outline"></i>
</el-tooltip>
</span>:
</span>
<span>{{ keyword }}</span>
</div>
<div>
@ -189,6 +196,10 @@ export default {
type: Object,
default: function() {}
},
queryCondition: {
type: Object,
default: function() {}
},
searchPath: {
type: String,
default: '/'
@ -212,9 +223,30 @@ export default {
computed: {
searchScope() {
const queryTagId = this.$route.query.tagId
const path = this.$route.query.path;
if (queryTagId && path === '/') {
return '(当前标签)'
const isRootPath = this.$route.query.path === '/';
if (queryTagId && isRootPath) {
return '搜索范围: 仅包含标签文件, 不含子文件'
}
if (this.queryCondition.isMount && isRootPath) {
return '搜索范围: 挂载目录里的所有文件, 不含挂载目录本身'
}
if (this.queryCondition.isFavorite && isRootPath) {
return '搜索范围: 仅包含收藏文件, 不含子文件'
}
if (this.queryCondition.audio && isRootPath) {
return '搜索范围: 仅包含音频文件'
}
if (this.queryCondition.video && isRootPath) {
return '搜索范围: 仅包含视频文件'
}
if (this.queryCondition.document && isRootPath) {
return '搜索范围: 仅包含文档文件'
}
if (this.queryCondition.image && isRootPath) {
return '搜索范围: 仅包含图片文件'
}
if (this.queryCondition.recently && isRootPath) {
return '搜索范围: 仅包含文件, 不含目录'
}
return ''
},

View File

@ -186,6 +186,7 @@
:has-search-conditions-param.sync="hasSearchFilterOption"
:keyword.sync="searchFileName"
:filter-option-param.sync="filterOption"
:query-condition="queryCondition"
:search-path="currentDirectory"
:search-result-count="pagination['total']"
@filter-change="searchFilterChange" >
@ -979,7 +980,7 @@ export default {
queryCondition: {
type: Object,
default: function() {
return { isFolder: null }
return { isFolder: null, isMount: null }
},
},
singleMenus: {
@ -2966,6 +2967,7 @@ export default {
this.vmode
}&path=${path}${keyword}${searchOpenFolder}${queryTagId}${basePath}${folder}`
)
api.searchFile({
userId: this.$store.state.user.userId,
username: this.$store.state.user.name,
@ -2987,6 +2989,7 @@ export default {
querySizeMin: this.filterOption.sizeMin,
querySizeMax: this.filterOption.sizeMax,
searchMount: this.filterOption.searchMount,
isMount: this.queryCondition.isMount,
searchOverall: this.filterOption.searchOverall,
}).then(res => {
this.loadData(res, onLoad)
@ -3083,6 +3086,7 @@ export default {
order: this.sortable.order,
isFolder: this.queryCondition.isFolder,
isFavorite: this.queryCondition.isFavorite,
isMount: this.queryCondition.isMount,
isTrash: this.queryCondition.isTrash,
tagId: this.queryCondition.tagId,
queryCondition: this.queryCondition,
@ -3546,7 +3550,6 @@ export default {
},
// 鼠标右击
rowContextmenu(row) {
console.log('rowContextmenu', row, row.userId, this.$store.getters.userId)
if (this.selectFile) {
return
}

View File

@ -26,7 +26,8 @@ export default {
prop: 'updateDate', order: 'descending'
},
queryCondition: {
isFolder:false
isFolder:false,
audio: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [

View File

@ -26,7 +26,8 @@ export default {
prop: 'updateDate', order: 'descending'
},
queryCondition: {
isFolder: false
isFolder: false,
document: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [

View File

@ -25,7 +25,8 @@ export default {
prop: 'updateDate', order: 'descending'
},
queryCondition: {
isFolder: false
isFolder: false,
image: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [

View File

@ -26,7 +26,8 @@ export default {
prop: 'updateDate', order: 'descending'
},
queryCondition: {
isFolder: false
isFolder: false,
video: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [

56
src/views/mount/index.vue Normal file
View File

@ -0,0 +1,56 @@
<template>
<div>
<show-file
:isCollectView="true"
:defaultGrid="true"
:sortable="sortable"
:orderCustom="true"
:showClipboard="true"
:defaultSort="sortable"
:queryCondition="queryCondition"
:contextMenus="contextMenus"
homeHidden
>
</show-file>
</div>
</template>
<script>
import ShowFile from "@/components/ShowFile/ShowFile";
import { createFiles, fileArrangements } from '@/utils/file-operations'
export default {
components: {ShowFile},
data() {
return {
sortable: {
prop: 'name', order: 'ascending'
},
queryCondition: {
isMount: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [
{ iconClass: this.grid?'':'menu-point', label: '列表', operation: 'vmode-list'},
{ iconClass: this.grid?'menu-point':'', label: '缩略图', operation: 'vmode-grid'},
{ label: '显示文件夹大小', operation: 'show-folder-size'},
]
},
{ label: '排列方式', operation: 'arrangement' ,child: fileArrangements
},
{ label: '刷新', operation: 'refresh'},
{ divider: true, operation: 'divider' },
{ label: '新建', operation: 'create' , homeDisable: true, child: createFiles
},
{ divider: true, operation: 'divider' },
{ label: '写文章', operation: 'createMarkdownFile'},
]
}
},
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -24,7 +24,8 @@
prop: 'uploadDate', order: 'descending'
},
queryCondition: {
isFolder:false
isFolder: false,
recently: true
},
contextMenus: [
{ label: '查看', operation: 'viewMode' ,child: [

View File

@ -392,4 +392,7 @@ export default {
>>>.box-card {
max-width: 1440px;
}
>>> .el-table .cell.el-tooltip {
display: flex;
}
</style>