feat: 右键功能新增'新建文件夹'

This commit is contained in:
jmal 2023-05-30 11:36:48 +08:00
parent 88c1801496
commit 82c6b84be3
2 changed files with 20 additions and 1 deletions

View File

@ -1823,6 +1823,7 @@ export default {
return;
}
this.newFolderLoading = true
this.createFileLoading = true
api.uploadFolder({
isFolder: true,
filename: encodeURI(this.newFolderName),
@ -1837,6 +1838,8 @@ export default {
type: 'warning'
});
} else {
this.createFileLoading = false
this.newCreateFileDialog = false
this.newFolderLoading = false
this.showNewFolder = false
this.isShowNewFolder = false
@ -1853,6 +1856,7 @@ export default {
}
}).catch(() => {
this.newFolderLoading = false
this.createFileLoading = false
})
} else {
this.newFolderLoading = false
@ -1864,6 +1868,11 @@ export default {
},
// 新建文件
createFile(newFileName) {
if (this.newCreateFileDialogTitle === "新建文件夹") {
this.newFolderName = newFileName
this.newFolderNameClick()
return
}
if (newFileName) {
if (/[\[\]\/\\"<>\?\*]/gi.test(newFileName)) {
this.$message({
@ -2636,6 +2645,10 @@ export default {
this.newCreateFileDialogTitle = "新建文本文件"
this.createNewFile('txt')
break
case 'createFolder':
this.newCreateFileDialogTitle = "新建文件夹"
this.createNewFile('')
break
case 'createDrawioFile':
this.newCreateFileDialogTitle = "新建流程图"
this.createNewFile('drawio')
@ -2663,7 +2676,11 @@ export default {
},
// 新建文件
createNewFile(suffix) {
this.newCreateFileName = `未命名文件.${suffix}`
if (this.newCreateFileDialogTitle === "新建文件夹") {
this.newCreateFileName = `新建文件夹`
} else {
this.newCreateFileName = `未命名文件.${suffix}`
}
this.newCreateFileName = this.getNewFileName(this.fileList, this.newCreateFileName)
this.newCreateFileDialog = true
this.$nextTick(() => {

View File

@ -34,6 +34,8 @@ export default {
{ label: '刷新', operation: 'refresh'},
{ divider: true, operation: 'divider' },
{ label: '新建', operation: 'create' ,child: [
{ label: '文件夹', operation: 'createFolder', iconClass: 'folder'},
{ divider: true, operation: 'divider' },
{ label: '文本', operation: 'createTextFile', iconClass: 'file-txt'},
{ label: '思维导图', operation: 'createMinderFile', iconClass: 'file-mind'},
{ label: '流程图', operation: 'createDrawioFile', iconClass: 'file-drawio'},