perf: 优化挂载的文件的菜单显示和重命名操作
This commit is contained in:
parent
e7872067ad
commit
14ea2ac105
@ -1225,11 +1225,7 @@ export default {
|
|||||||
created() {},
|
created() {},
|
||||||
mounted() {
|
mounted() {
|
||||||
Bus.$on("fileSuccess", (filename) => {
|
Bus.$on("fileSuccess", (filename) => {
|
||||||
if (this.$route.query.folder) {
|
this.setOnCreateFilename(filename)
|
||||||
this.onCreateFilename = filename
|
|
||||||
this.getFileList()
|
|
||||||
this.clearOnCreateFilename()
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Bus.$on("loadFileFaild", () => {
|
Bus.$on("loadFileFaild", () => {
|
||||||
this.notPreviewDialogVisible = true;
|
this.notPreviewDialogVisible = true;
|
||||||
@ -2489,11 +2485,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const that = this;
|
const that = this;
|
||||||
if (this.$route.query.folder) {
|
this.setOnCreateFilename(newFileName)
|
||||||
this.onCreateFilename = newFileName
|
|
||||||
this.getFileList()
|
|
||||||
this.clearOnCreateFilename()
|
|
||||||
}
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
that.newCreateFileDialog = false;
|
that.newCreateFileDialog = false;
|
||||||
}, 200)
|
}, 200)
|
||||||
@ -3142,12 +3134,20 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$refs.fileListTable.clearSelection();
|
this.$refs.fileListTable.clearSelection();
|
||||||
|
this.setOnCreateFilename(newFileName)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.renameLoading = false;
|
this.renameLoading = false;
|
||||||
this.editingIndex = -1;
|
this.editingIndex = -1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
setOnCreateFilename(newFileName) {
|
||||||
|
if (this.$route.query.folder) {
|
||||||
|
this.onCreateFilename = newFileName
|
||||||
|
this.getFileList()
|
||||||
|
this.clearOnCreateFilename()
|
||||||
|
}
|
||||||
|
},
|
||||||
// 更多操作(多选)
|
// 更多操作(多选)
|
||||||
moreOperation(event) {
|
moreOperation(event) {
|
||||||
this.menusIsMultiple = true;
|
this.menusIsMultiple = true;
|
||||||
@ -3156,14 +3156,43 @@ export default {
|
|||||||
},
|
},
|
||||||
setMenus(row) {
|
setMenus(row) {
|
||||||
this.menus = JSON.parse(JSON.stringify(this.singleMenus));
|
this.menus = JSON.parse(JSON.stringify(this.singleMenus));
|
||||||
if (row.suffix && row.suffix === "md") {
|
// 挂载的文件
|
||||||
this.menus.splice(2, 0, { iconClass: "menu-edit1", label: "编辑", operation: "edit" })
|
if (this.$route.query.folder) {
|
||||||
}
|
// 根据权限设置菜单
|
||||||
if (!row.isFolder) {
|
this.setMenusByPermission(row);
|
||||||
this.menus.splice(5, 0, { iconClass: "duplicate", label: "创建副本", operation: "duplicate" })
|
} else {
|
||||||
|
if (row.suffix && row.suffix === "md") {
|
||||||
|
this.menus.splice(2, 0, { iconClass: "menu-edit1", label: "编辑", operation: "edit" })
|
||||||
|
}
|
||||||
|
if (row.isFolder && row.mountFileId) {
|
||||||
|
const indicesToDelete = [6, 5, 4, 3, 1];
|
||||||
|
for(let i of indicesToDelete) {
|
||||||
|
this.menus.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!row.isFolder) {
|
||||||
|
this.menus.splice(-2, 0, { iconClass: "duplicate", label: "创建副本", operation: "duplicate" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.preliminaryRowData(row);
|
this.preliminaryRowData(row);
|
||||||
},
|
},
|
||||||
|
setMenusByPermission(file) {
|
||||||
|
const indicesToDelete = [7, 5, 4, 3, 2, 1];
|
||||||
|
for(let i of indicesToDelete) {
|
||||||
|
this.menus.splice(i, 1);
|
||||||
|
}
|
||||||
|
if (file.operationPermissionList && file.operationPermissionList.length > 0) {
|
||||||
|
if (file.operationPermissionList.indexOf('PUT') > -1) {
|
||||||
|
this.menus.splice(this.menus.length - 1, 0, { iconClass: "menu-rename", label: "重命名", operation: "rename" })
|
||||||
|
}
|
||||||
|
if (file.operationPermissionList.indexOf('UPLOAD') > -1 && !file.isFolder) {
|
||||||
|
this.menus.splice(this.menus.length - 1, 0, { iconClass: "duplicate", label: "创建副本", operation: "duplicate" })
|
||||||
|
}
|
||||||
|
if (file.operationPermissionList.indexOf('DELETE') > -1) {
|
||||||
|
this.menus.splice(this.menus.length, 0, { iconClass: "menu-remove", label: "删除", operation: "remove" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
// 更多操作(单选)
|
// 更多操作(单选)
|
||||||
moreClick(row, event) {
|
moreClick(row, event) {
|
||||||
this.menusIsMultiple = false;
|
this.menusIsMultiple = false;
|
||||||
@ -3487,6 +3516,7 @@ export default {
|
|||||||
const newFilename = this.getDuplicateFileName(this.fileList, this.rowContextData.name)
|
const newFilename = this.getDuplicateFileName(this.fileList, this.rowContextData.name)
|
||||||
api.duplicateFile({fileId: this.rowContextData.id, newFilename: newFilename}).then(() => {
|
api.duplicateFile({fileId: this.rowContextData.id, newFilename: newFilename}).then(() => {
|
||||||
this.$message.success('创建副本成功')
|
this.$message.success('创建副本成功')
|
||||||
|
this.setOnCreateFilename(newFilename)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
moveOrCopy() {
|
moveOrCopy() {
|
||||||
|
|||||||
@ -57,7 +57,6 @@ export default {
|
|||||||
this.show = true
|
this.show = true
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
console.log('this.$refs', this.$refs)
|
|
||||||
let url = fileConfig.previewUrl(this.$store.state.user.name, newFile, this.$store.getters.token)
|
let url = fileConfig.previewUrl(this.$store.state.user.name, newFile, this.$store.getters.token)
|
||||||
if (this.$store.getters.token === undefined) {
|
if (this.$store.getters.token === undefined) {
|
||||||
url = fileConfig.publicPreviewUrl(newFile, window.shareId, this.$store.getters.shareToken);
|
url = fileConfig.publicPreviewUrl(newFile, window.shareId, this.$store.getters.shareToken);
|
||||||
@ -77,7 +76,6 @@ export default {
|
|||||||
this.list.push(this.currentMusic)
|
this.list.push(this.currentMusic)
|
||||||
}
|
}
|
||||||
this.$refs.audioPlayer.thenPlay()
|
this.$refs.audioPlayer.thenPlay()
|
||||||
console.log(this.$refs.audioPlayer.repeat, this.$refs.audioPlayer.shuffle);
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -117,7 +117,7 @@ export default {
|
|||||||
getImageUrl(element) {
|
getImageUrl(element) {
|
||||||
let url = fileConfig.previewUrl(this.$store.state.user.name, element, this.$store.getters.token)
|
let url = fileConfig.previewUrl(this.$store.state.user.name, element, this.$store.getters.token)
|
||||||
if (this.shareId) {
|
if (this.shareId) {
|
||||||
url = fileConfig.publicPreviewUrl(element, window.shareId, this.$store.getters.shareToken);
|
url = fileConfig.publicPreviewUrl(element, window.shareId, this.$store.getters.shareToken)
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user