feat: 新增功能-回收站
This commit is contained in:
parent
5c144b8298
commit
bbae7dc30b
File diff suppressed because one or more lines are too long
1
public/resource/font_2024484_jfax4gppvg.js
Normal file
1
public/resource/font_2024484_jfax4gppvg.js
Normal file
File diff suppressed because one or more lines are too long
@ -100,6 +100,35 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 返回原处
|
||||||
|
restore: function(params) {
|
||||||
|
return request({
|
||||||
|
url: 'restore',
|
||||||
|
method: 'post',
|
||||||
|
params,
|
||||||
|
paramsSerializer: function(params) {
|
||||||
|
return qs.stringify(params, { arrayFormat: 'repeat' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 彻底删除
|
||||||
|
sweep: function(params) {
|
||||||
|
return request({
|
||||||
|
url: 'sweep',
|
||||||
|
method: 'delete',
|
||||||
|
params,
|
||||||
|
paramsSerializer: function(params) {
|
||||||
|
return qs.stringify(params, { arrayFormat: 'repeat' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 清空回收站
|
||||||
|
clearTrash: function() {
|
||||||
|
return request({
|
||||||
|
url: 'clear-trash',
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
},
|
||||||
// 重名名
|
// 重名名
|
||||||
rename: function(params) {
|
rename: function(params) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { Icon } from 'ant-design-vue'
|
import { Icon } from 'ant-design-vue'
|
||||||
const IconFont = Icon.createFromIconfontCN({
|
const IconFont = Icon.createFromIconfontCN({
|
||||||
scriptUrl: document.location.protocol + '/resource/font_2024484_fwthqwcsomd.js'
|
scriptUrl: document.location.protocol + '/resource/font_2024484_jfax4gppvg.js'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 把此段代码贴到iconfont项目页面的控制台中, 以获取图标列表
|
// 把此段代码贴到iconfont项目页面的控制台中, 以获取图标列表
|
||||||
@ -15,7 +15,7 @@ const IconFont = Icon.createFromIconfontCN({
|
|||||||
// console.log(iconNames.slice(80,160))
|
// console.log(iconNames.slice(80,160))
|
||||||
|
|
||||||
export const iconFonts = {
|
export const iconFonts = {
|
||||||
list: ['gengxinjindu', 'duigou', 'bars-solid', 'sort-amount-down-solid', 'sort-amount-up-alt-solid', 'tag2', 'guazai', 'duplicate', 'play1', "qrcode", "arrow1_left", "wulianwang-","zuji","disk-drive", "menu-fuzhi", "iso", "zuijinhuoyue","key", "shouquan", "sort", "grid", "list", "emoji-a", "emoji-bizui", "emoji-baiyan", "emoji-aixin", "emoji-dajing", "emoji-ziya", "emoji-daxiao", "emoji-esi", "emoji-fadai", "emoji-fankun", "emoji-ganga", "emoji-fennu", "emoji-hanyan", "emoji-jingkong", "emoji-haochi", "emoji-emo", "emoji-jingsong", "emoji-jingya", "emoji-kaixin", "emoji-lengku", "emoji-danao", "emoji-liukoushui", "emoji-liulei", "emoji-mengbi", "mianwubiaoqing", "nanguo", "shuizhuo", "taoyan", "tanchi", "siliao", "tiaopi", "xiaochulei", "wuliao", "xingxingyan", "xieyan", "xiasi", "xiaolian", "ku", "shengqi", "yousiliao", "en", "bushufu", "bianbian", "fankun1", "feiwen", "ganmao", "huaixiao", "liuhan", "outu", "keshui", "renzhe", "santiaoxian", "guaiwu", "shoushang", "tianshi", "shuai", "xianwen", "xiaodiaodaya", "xiong", "yiwen", "yun", "liubixie", "shimo", "dianzan", "biti", "fendou", "huqi", "heng", "kulou", "leng", "taoyan1", "shuixing", "aini", "aixin1", "zhadan", "xinsui",
|
list: ['huanyuan', 'huishouzhan', 'glb', 'gengxinjindu', 'duigou', 'bars-solid', 'sort-amount-down-solid', 'sort-amount-up-alt-solid', 'tag2', 'guazai', 'duplicate', 'play1', "qrcode", "arrow1_left", "wulianwang-","zuji","disk-drive", "menu-fuzhi", "iso", "zuijinhuoyue","key", "shouquan", "sort", "grid", "list", "emoji-a", "emoji-bizui", "emoji-baiyan", "emoji-aixin", "emoji-dajing", "emoji-ziya", "emoji-daxiao", "emoji-esi", "emoji-fadai", "emoji-fankun", "emoji-ganga", "emoji-fennu", "emoji-hanyan", "emoji-jingkong", "emoji-haochi", "emoji-emo", "emoji-jingsong", "emoji-jingya", "emoji-kaixin", "emoji-lengku", "emoji-danao", "emoji-liukoushui", "emoji-liulei", "emoji-mengbi", "mianwubiaoqing", "nanguo", "shuizhuo", "taoyan", "tanchi", "siliao", "tiaopi", "xiaochulei", "wuliao", "xingxingyan", "xieyan", "xiasi", "xiaolian", "ku", "shengqi", "yousiliao", "en", "bushufu", "bianbian", "fankun1", "feiwen", "ganmao", "huaixiao", "liuhan", "outu", "keshui", "renzhe", "santiaoxian", "guaiwu", "shoushang", "tianshi", "shuai", "xianwen", "xiaodiaodaya", "xiong", "yiwen", "yun", "liubixie", "shimo", "dianzan", "biti", "fendou", "huqi", "heng", "kulou", "leng", "taoyan1", "shuixing", "aini", "aixin1", "zhadan", "xinsui",
|
||||||
"maren", "zhutou", "qie", "youling", "apple-fill", "attachment", "android-fill", "apple", "download", "arrow-up-circle", "arrow-right-circle", "arrow-down", "ashbin", "add", "file_music", "menu", "role", "jiaoseguanli", "yemianshezhi", "drop_down", "yuandian", "tag", "service-directory", "fabu", "wailian", "bianji-", "WEBSITE", "wangzhanguanli", "Up", "up", "fenlei", "guanlizhuanjiawenzhang", "pifu", "tuichudenglu", "shezhi", "wangzhan", "huaban", "yunshezhi", "UserSettings", "blogger", "biaoqian", "myself", "guidang", "quxiaoyulan1-copy", "yulan-copy", "quxiaoyulan1", "yulan"]
|
"maren", "zhutou", "qie", "youling", "apple-fill", "attachment", "android-fill", "apple", "download", "arrow-up-circle", "arrow-right-circle", "arrow-down", "ashbin", "add", "file_music", "menu", "role", "jiaoseguanli", "yemianshezhi", "drop_down", "yuandian", "tag", "service-directory", "fabu", "wailian", "bianji-", "WEBSITE", "wangzhanguanli", "Up", "up", "fenlei", "guanlizhuanjiawenzhang", "pifu", "tuichudenglu", "shezhi", "wangzhan", "huaban", "yunshezhi", "UserSettings", "blogger", "biaoqian", "myself", "guidang", "quxiaoyulan1-copy", "yulan-copy", "quxiaoyulan1", "yulan"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -434,15 +434,6 @@
|
|||||||
align="center"
|
align="center"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
>
|
>
|
||||||
<!-- 使用组件, 并传值到组件中 -->
|
|
||||||
<template slot="header">
|
|
||||||
<svg-icon
|
|
||||||
v-if="item.name !== ''"
|
|
||||||
class="button-class"
|
|
||||||
icon-class="more"
|
|
||||||
@click.stop="moreOperation($event)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
v-if="scope.row.index === cellMouseIndex"
|
v-if="scope.row.index === cellMouseIndex"
|
||||||
@ -951,16 +942,6 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
multipleMenus: {
|
|
||||||
type: Array,
|
|
||||||
default: function() {
|
|
||||||
return [
|
|
||||||
{ iconClass: 'menu-copy', label: '移动或复制', operation: 'copy' },
|
|
||||||
{ iconClass: 'menu-download', label: '下载', operation: 'download' },
|
|
||||||
{ iconClass: 'menu-remove', label: '删除', operation: 'remove' },
|
|
||||||
]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
multipleRightMenus: {
|
multipleRightMenus: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: function() {
|
default: function() {
|
||||||
@ -1922,6 +1903,11 @@ export default {
|
|||||||
}
|
}
|
||||||
// 开始拖拽
|
// 开始拖拽
|
||||||
container.ondragstart = e => {
|
container.ondragstart = e => {
|
||||||
|
if (this.queryFileType === 'trash') {
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
return false
|
||||||
|
}
|
||||||
// 正在选区获取按住关键键时禁止拖拽
|
// 正在选区获取按住关键键时禁止拖拽
|
||||||
if (_this.drawFlag || _this.isCmd || _this.selectPin) {
|
if (_this.drawFlag || _this.isCmd || _this.selectPin) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -2604,10 +2590,12 @@ export default {
|
|||||||
child[0].iconClass = 'menu-point'
|
child[0].iconClass = 'menu-point'
|
||||||
child[1].iconClass = 'menu-empty'
|
child[1].iconClass = 'menu-empty'
|
||||||
}
|
}
|
||||||
if (localStorage.getItem('showFolderSize') === 'true') {
|
if (child[2]) {
|
||||||
child[2].iconClass = 'duigou'
|
if (localStorage.getItem('showFolderSize') === 'true') {
|
||||||
} else {
|
child[2].iconClass = 'duigou'
|
||||||
child[2].iconClass = 'menu-empty'
|
} else {
|
||||||
|
child[2].iconClass = 'menu-empty'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arrangementModeIndex > -1) {
|
if (arrangementModeIndex > -1) {
|
||||||
@ -2863,6 +2851,7 @@ export default {
|
|||||||
order: this.sortable.order,
|
order: this.sortable.order,
|
||||||
isFolder: this.queryCondition.isFolder,
|
isFolder: this.queryCondition.isFolder,
|
||||||
isFavorite: this.queryCondition.isFavorite,
|
isFavorite: this.queryCondition.isFavorite,
|
||||||
|
isTrash: this.queryCondition.isTrash,
|
||||||
tagId: this.queryCondition.tagId,
|
tagId: this.queryCondition.tagId,
|
||||||
queryCondition: this.queryCondition,
|
queryCondition: this.queryCondition,
|
||||||
pageIndex: this.pagination.pageIndex,
|
pageIndex: this.pagination.pageIndex,
|
||||||
@ -3000,7 +2989,8 @@ export default {
|
|||||||
if (fileSize > 0) {
|
if (fileSize > 0) {
|
||||||
fileSum = fileSize + '个文件'
|
fileSum = fileSize + '个文件'
|
||||||
}
|
}
|
||||||
return folderSum + ' ' + fileSum
|
const stand = folderSize > 0 && fileSize > 0 ? '、' : ''
|
||||||
|
return folderSum + stand + fileSum
|
||||||
},
|
},
|
||||||
// 计算总大小
|
// 计算总大小
|
||||||
getShowSumSize(totalSize) {
|
getShowSumSize(totalSize) {
|
||||||
@ -3298,12 +3288,6 @@ export default {
|
|||||||
this.clearOnCreateFilename()
|
this.clearOnCreateFilename()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 更多操作(多选)
|
|
||||||
moreOperation(event) {
|
|
||||||
this.menusIsMultiple = true
|
|
||||||
this.menus = this.multipleMenus
|
|
||||||
this.showOperationMenus(event)
|
|
||||||
},
|
|
||||||
setMenus(row) {
|
setMenus(row) {
|
||||||
this.menus = JSON.parse(JSON.stringify(this.singleMenus))
|
this.menus = JSON.parse(JSON.stringify(this.singleMenus))
|
||||||
// 挂载的文件
|
// 挂载的文件
|
||||||
@ -3326,12 +3310,8 @@ export default {
|
|||||||
reservations.includes(item.operation)
|
reservations.includes(item.operation)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (!row.isFolder) {
|
if (!row.isFolder && this.queryFileType !== 'trash') {
|
||||||
this.menus.splice(-2, 0, {
|
this.menus.splice(-2, 0, { iconClass: 'duplicate', label: '创建副本', operation: 'duplicate'})
|
||||||
iconClass: 'duplicate',
|
|
||||||
label: '创建副本',
|
|
||||||
operation: 'duplicate',
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ((row.isShare && !row.shareBase) || row.ossFolder) {
|
if ((row.isShare && !row.shareBase) || row.ossFolder) {
|
||||||
// 删除分享选项
|
// 删除分享选项
|
||||||
@ -3557,6 +3537,9 @@ export default {
|
|||||||
case 'createMarkdownFile':
|
case 'createMarkdownFile':
|
||||||
this.newDocument()
|
this.newDocument()
|
||||||
break
|
break
|
||||||
|
case 'clearTrash':
|
||||||
|
this.clearTrash()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 新建文件
|
// 新建文件
|
||||||
@ -3642,6 +3625,14 @@ export default {
|
|||||||
// 删除
|
// 删除
|
||||||
this.deleteFile()
|
this.deleteFile()
|
||||||
break
|
break
|
||||||
|
case 'sweep':
|
||||||
|
// 清空回收站
|
||||||
|
this.sweepFile()
|
||||||
|
break
|
||||||
|
case 'restore':
|
||||||
|
// 返回原处
|
||||||
|
this.restoreFile()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
this.$refs.contextShow.hideMenu()
|
this.$refs.contextShow.hideMenu()
|
||||||
},
|
},
|
||||||
@ -4027,32 +4018,55 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
fileIds.push(this.rowContextData.id)
|
fileIds.push(this.rowContextData.id)
|
||||||
|
fileList.push(this.rowContextData)
|
||||||
}
|
}
|
||||||
const str = this.getShowSumFileAndFolder(fileList)
|
const str = this.getShowSumFileAndFolder(fileList)
|
||||||
this.$confirm('此操作将永久删除' + str + ', 是否继续?', '提示', {
|
this.$confirm('将 ' + str + ' 移至回收站, 是否继续?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
api
|
api.delete({
|
||||||
.delete({
|
|
||||||
currentDirectory: this.getQueryPath(),
|
currentDirectory: this.getQueryPath(),
|
||||||
username: this.$store.state.user.name,
|
username: this.$store.state.user.name,
|
||||||
fileIds: fileIds,
|
fileIds: fileIds,
|
||||||
})
|
}).then(() => {
|
||||||
.then(() => {
|
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
if (this.$route.query.folder) {
|
if (this.$route.query.folder) {
|
||||||
this.getFileList()
|
this.getFileList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
})
|
||||||
this.$notify({
|
},
|
||||||
title: '删除成功',
|
restoreFile() {
|
||||||
type: 'success',
|
const fileIds = this.getSelectIdList()
|
||||||
duration: 1000,
|
api.restore({fileIds: fileIds}).then(() => {
|
||||||
})
|
this.getFileList()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
sweepFile() {
|
||||||
|
const fileIds = this.getSelectIdList()
|
||||||
|
this.$confirm(`此操作将永久删除 ${fileIds.length}个文件, 是否继续?`, '提示', {
|
||||||
|
confirmButtonText: '彻底删除',
|
||||||
|
confirmButtonClass: 'el-button--danger',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
api.sweep({fileIds: fileIds}).then(() => {
|
||||||
|
this.getFileList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
clearTrash() {
|
||||||
|
this.$confirm(`是否清空回收站? 此操作将无法还原!!!`, '提示', {
|
||||||
|
confirmButtonText: '清空',
|
||||||
|
confirmButtonClass: 'el-button--danger',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
api.clearTrash().then(() => {
|
||||||
|
this.getFileList()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取选中项id列表
|
// 获取选中项id列表
|
||||||
@ -4158,6 +4172,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 点击文件或文件夹
|
// 点击文件或文件夹
|
||||||
fileClick(row) {
|
fileClick(row) {
|
||||||
|
if (this.queryFileType === 'trash') {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.editingIndex === row.index) {
|
if (this.editingIndex === row.index) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,7 +123,7 @@ export default {
|
|||||||
isLoginType: this.type === 'LOGIN',
|
isLoginType: this.type === 'LOGIN',
|
||||||
// 查询条件
|
// 查询条件
|
||||||
queryCondition: {
|
queryCondition: {
|
||||||
excludeUsername: 'other',
|
excludeUsername: undefined,
|
||||||
username: undefined,
|
username: undefined,
|
||||||
ip: undefined,
|
ip: undefined,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
@ -191,12 +191,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.queryLogList()
|
this.queryLogList()
|
||||||
},
|
},
|
||||||
queryLogList() {
|
queryLogList(val) {
|
||||||
if (this.queryCondition.username) {
|
|
||||||
this.queryCondition.excludeUsername = null;
|
|
||||||
} else {
|
|
||||||
this.queryCondition.excludeUsername = 'other';
|
|
||||||
}
|
|
||||||
this.$refs.tableList.initPageIndex()
|
this.$refs.tableList.initPageIndex()
|
||||||
this.getLogList()
|
this.getLogList()
|
||||||
},
|
},
|
||||||
|
|||||||
72
src/views/trash/index.vue
Normal file
72
src/views/trash/index.vue
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<show-file
|
||||||
|
queryFileType="trash"
|
||||||
|
:defaultGrid="true"
|
||||||
|
:orderCustom="true"
|
||||||
|
:sortable="sortable"
|
||||||
|
:queryCondition="queryCondition"
|
||||||
|
:showNavigation="true"
|
||||||
|
:show-search-button="false"
|
||||||
|
:context-menus="contextMenus"
|
||||||
|
:single-menus="singleMenus"
|
||||||
|
:multiple-right-menus="multipleRightMenus"
|
||||||
|
:show-upload-button="false"
|
||||||
|
></show-file>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ShowFile from "@/components/ShowFile/ShowFile";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {ShowFile},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sortable: {
|
||||||
|
prop: 'updateDate', order: 'descending'
|
||||||
|
},
|
||||||
|
queryCondition: {
|
||||||
|
isFolder: false,
|
||||||
|
isTrash: 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: 'arrangement', child: [
|
||||||
|
{ label: '名称', operation: 'orderName', orderProp: 'name' },
|
||||||
|
{ label: '大小', operation: 'orderSize', orderProp: 'size' },
|
||||||
|
{ label: '日期', operation: 'orderUpdateDate', orderProp: 'updateDate' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ label: '刷新', operation: 'refresh' },
|
||||||
|
{ divider: true, operation: 'divider' },
|
||||||
|
{ label: '清空回收站', operation: 'clearTrash' },
|
||||||
|
],
|
||||||
|
singleMenus: [
|
||||||
|
{iconClass: 'huanyuan', label: '放回原处', operation: 'restore'},
|
||||||
|
{iconClass: 'menu-remove', label: '彻底删除', operation: 'sweep'}
|
||||||
|
],
|
||||||
|
multipleRightMenus: [
|
||||||
|
{
|
||||||
|
iconClass: 'menu-deselect',
|
||||||
|
label: '取消选定',
|
||||||
|
operation: 'deselect',
|
||||||
|
},
|
||||||
|
{iconClass: 'huanyuan', label: '放回原处', operation: 'restore'},
|
||||||
|
{ iconClass: 'menu-remove', label: '彻底删除', operation: 'sweep' },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user