优化挂载文件夹功能
This commit is contained in:
parent
2a320c1f48
commit
e7872067ad
@ -44,6 +44,10 @@ export default {
|
||||
showFooter: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
hideMountFile: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -162,6 +166,7 @@ export default {
|
||||
api.queryFileTree({
|
||||
userId: this.$store.state.user.userId,
|
||||
username: this.$store.state.user.name,
|
||||
hideMountFile: this.hideMountFile,
|
||||
fileId: fileId
|
||||
}).then(res => {
|
||||
const nextNodes = res.data;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<span v-else>{{ filename }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-form ref="form" class="share-option" :model="shareOption" label-width="82px" size="mini">
|
||||
<el-form ref="form" class="share-option" :model="shareOption" label-width="86px" size="mini">
|
||||
<el-form-item :label="shareOptionConfig.linkLabel">
|
||||
<el-col :span="shareOptionConfig.shared ? 9 : 20" class="share-expires-data" v-if="!shareOptionConfig.shared">
|
||||
<el-form-item prop="expiresDateOption">
|
||||
|
||||
@ -1224,7 +1224,13 @@ export default {
|
||||
},
|
||||
created() {},
|
||||
mounted() {
|
||||
Bus.$on("fileSuccess", () => {});
|
||||
Bus.$on("fileSuccess", (filename) => {
|
||||
if (this.$route.query.folder) {
|
||||
this.onCreateFilename = filename
|
||||
this.getFileList()
|
||||
this.clearOnCreateFilename()
|
||||
}
|
||||
});
|
||||
Bus.$on("loadFileFaild", () => {
|
||||
this.notPreviewDialogVisible = true;
|
||||
});
|
||||
@ -1457,8 +1463,8 @@ export default {
|
||||
// 延时清空onCreateFilename
|
||||
clearOnCreateFilename() {
|
||||
setTimeout(() => {
|
||||
this.onCreateFilename = "";
|
||||
}, 3000);
|
||||
this.onCreateFilename = '';
|
||||
}, 2000);
|
||||
},
|
||||
load() {
|
||||
this.getFileList(true);
|
||||
@ -2212,6 +2218,7 @@ export default {
|
||||
// 打开文件选择框
|
||||
Bus.$emit("openUploader", {
|
||||
// 传入的参数
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: this.path,
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
@ -2222,6 +2229,7 @@ export default {
|
||||
// 打开文件夹选择框
|
||||
Bus.$emit("uploadFolder", {
|
||||
// 传入的参数
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: this.path,
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
@ -2391,6 +2399,7 @@ export default {
|
||||
isFolder: true,
|
||||
filename: encodeURI(this.newFolderName),
|
||||
currentDirectory: encodeURI(this.path),
|
||||
folder: this.$route.query.folder,
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
})
|
||||
@ -2458,12 +2467,13 @@ export default {
|
||||
.addFile({
|
||||
fileName: encodeURI(newFileName),
|
||||
isFolder: false,
|
||||
folder: this.$route.query.folder,
|
||||
username: this.$store.state.user.name,
|
||||
parentPath: encodeURI(parentPath)
|
||||
})
|
||||
.then(res => {
|
||||
this.createFileLoading = false;
|
||||
switch (suffix) {
|
||||
switch (suffix && !this.$route.query.folder) {
|
||||
case "txt":
|
||||
// 打开编辑器
|
||||
this.textPreviewRow = res.data;
|
||||
@ -2479,9 +2489,14 @@ export default {
|
||||
break;
|
||||
}
|
||||
const that = this;
|
||||
if (this.$route.query.folder) {
|
||||
this.onCreateFilename = newFileName
|
||||
this.getFileList()
|
||||
this.clearOnCreateFilename()
|
||||
}
|
||||
setTimeout(function() {
|
||||
that.newCreateFileDialog = false;
|
||||
}, 200);
|
||||
}, 200)
|
||||
})
|
||||
.catch(() => {
|
||||
this.createFileLoading = false;
|
||||
@ -3115,6 +3130,7 @@ export default {
|
||||
.rename({
|
||||
newFileName: encodeURI(newFileName),
|
||||
username: this.$store.state.user.name,
|
||||
folder: this.$route.query.folder,
|
||||
id: row.id
|
||||
})
|
||||
.then(res => {
|
||||
@ -3123,7 +3139,6 @@ export default {
|
||||
row.suffix = newFileName.replace(/.+\./, "");
|
||||
this.fileList[row.index] = row;
|
||||
this.editingIndex = -1;
|
||||
this.$message.success("重命名中...");
|
||||
})
|
||||
.then(() => {
|
||||
this.$refs.fileListTable.clearSelection();
|
||||
@ -3591,6 +3606,7 @@ export default {
|
||||
isFolder: true,
|
||||
filename: encodeURI(newFolderName),
|
||||
currentDirectory: encodeURI(path),
|
||||
folder: this.$route.query.folder,
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
})
|
||||
@ -3746,8 +3762,10 @@ export default {
|
||||
fileIds: fileIds
|
||||
})
|
||||
.then(() => {
|
||||
// 移除列表
|
||||
// this.removeSelectItme()
|
||||
// 刷新列表
|
||||
if (this.$route.query.folder) {
|
||||
this.getFileList()
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.$notify({
|
||||
|
||||
@ -261,7 +261,8 @@ export default {
|
||||
this.params = {
|
||||
currentDirectory: this.$route.query.path || '/',
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
userId: this.$store.state.user.userId,
|
||||
folder: this.$route.query.folder
|
||||
}
|
||||
},
|
||||
onFilesAdded(files) {
|
||||
@ -280,6 +281,7 @@ export default {
|
||||
isFolder: true,
|
||||
folderPath: encodeURI(folder.parent.path),
|
||||
filename: encodeURI(folder.name),
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: encodeURI(this.params.currentDirectory),
|
||||
username: this.params.username,
|
||||
userId: this.params.userId
|
||||
@ -359,6 +361,7 @@ export default {
|
||||
filename: encodeURI(file.name),
|
||||
relativePath: encodeURI(file.relativePath),
|
||||
identifier: file.uniqueIdentifier,
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: encodeURI(this.params.currentDirectory),
|
||||
username: this.params.username,
|
||||
userId: this.params.userId,
|
||||
@ -367,7 +370,7 @@ export default {
|
||||
}).then(() => {
|
||||
// console.log('文件合并成功', res)
|
||||
// 文件合并成功
|
||||
Bus.$emit('fileSuccess')
|
||||
Bus.$emit('fileSuccess', file.name)
|
||||
this.statusRemove(file.id)
|
||||
this.statusSet(file.id, 'success')
|
||||
// file.removeFile(file)
|
||||
@ -376,7 +379,7 @@ export default {
|
||||
})
|
||||
// 不需要合并
|
||||
} else {
|
||||
Bus.$emit('fileSuccess')
|
||||
Bus.$emit('fileSuccess', file.name)
|
||||
// 完成后从文件列表移除
|
||||
// file.removeFile(file)
|
||||
// console.log('上传成功')
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
</div>
|
||||
<div class="editor-resize" :style="{marginLeft: panelReadOnly || moblie || contentsHide ?`0px`:`${contentsWidth}px`,transition: transition}">
|
||||
<div class="darg-resize-conter"></div>
|
||||
<i v-show="!panelReadOnly && !moblie " class="editor-resize-conter" icon="el-icon-arrow-right" title="隐藏文件目录" @click="hideContents"/>
|
||||
<i v-show="!panelReadOnly" class="editor-resize-conter" icon="el-icon-arrow-right" :title="contentsHide ? '展开目录' : '隐藏目录'" @click="hideContents"/>
|
||||
</div>
|
||||
<div :style="{width: editorWidth-2+'px'}">
|
||||
<el-tabs v-model="editableTabsValue" type="card" closable @tab-remove="removeTab" @tab-click="clickTab()">
|
||||
@ -204,6 +204,7 @@
|
||||
lineWrapping: false,
|
||||
moblie: false,
|
||||
panelReadOnly: true,
|
||||
mountFileId: undefined,
|
||||
options: {
|
||||
fontSize: 14,
|
||||
contextmenu: true,
|
||||
@ -292,7 +293,7 @@
|
||||
}
|
||||
this.editableTabs = []
|
||||
this.checkMobile()
|
||||
this.checkReadOnly(file.userId)
|
||||
this.checkReadOnly(file)
|
||||
this.loadEditorSize()
|
||||
this.loading = this.$message({
|
||||
iconClass: 'el-icon-loading',
|
||||
@ -472,7 +473,7 @@
|
||||
},
|
||||
async requestStream(request, params, index) {
|
||||
try {
|
||||
const readOnly = this.panelReadOnly
|
||||
const readOnly = this.options.readOnly
|
||||
this.options.readOnly = true
|
||||
this.abortControllerAbort(index)
|
||||
const queryString = this.buildQueryString(params)
|
||||
@ -800,14 +801,22 @@
|
||||
checkMobile() {
|
||||
this.moblie = !this.$pc;
|
||||
},
|
||||
checkReadOnly(fileUserId){
|
||||
if(this.$store.state.user.token && this.$store.state.user.userId === fileUserId){
|
||||
checkReadOnly(file){
|
||||
if(this.$store.state.user.token && this.$store.state.user.userId === file.userId){
|
||||
this.options.readOnly = false
|
||||
this.panelReadOnly = false
|
||||
return
|
||||
} else {
|
||||
this.mountFileId = file.id
|
||||
}
|
||||
if (file.operationPermissionList && file.operationPermissionList.indexOf('PUT') > -1) {
|
||||
this.options.readOnly = false
|
||||
this.panelReadOnly = true
|
||||
return
|
||||
}
|
||||
if (!this.$pc) {
|
||||
this.options.readOnly = true
|
||||
this.panelReadOnly = false
|
||||
this.options.readOnly = false
|
||||
this.panelReadOnly = true
|
||||
}
|
||||
if(this.panelReadOnly || this.moblie){
|
||||
this.$nextTick(()=> {
|
||||
@ -923,6 +932,7 @@
|
||||
relativePath: encodeURI(path),
|
||||
userId: this.$store.state.user.userId,
|
||||
username: this.$store.state.user.name,
|
||||
mountFileId: this.mountFileId,
|
||||
contentText: value
|
||||
}).then(() => {
|
||||
this.updating = false
|
||||
|
||||
@ -588,6 +588,7 @@ export default {
|
||||
api.rename({
|
||||
newFileName: encodeURI(newFileName),
|
||||
username: this.$store.state.user.name,
|
||||
folder: this.$route.query.folder,
|
||||
id: row.id
|
||||
}).then(() => {
|
||||
this.renameLoading = false
|
||||
@ -1205,6 +1206,7 @@ export default {
|
||||
// 打开文件选择框
|
||||
Bus.$emit('openUploader', {
|
||||
// 传入的参数
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: encodeURI(this.path),
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
@ -1215,6 +1217,7 @@ export default {
|
||||
// 打开文件夹选择框
|
||||
Bus.$emit('uploadFolder', {
|
||||
// 传入的参数
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: encodeURI(this.path),
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
@ -1228,6 +1231,7 @@ export default {
|
||||
api.uploadFolder({
|
||||
isFolder: true,
|
||||
filename: encodeURI(this.newFolderName),
|
||||
folder: this.$route.query.folder,
|
||||
currentDirectory: encodeURI(this.path),
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
|
||||
@ -989,6 +989,7 @@ export default {
|
||||
fileId: this.selectTreeNode.id
|
||||
}).then(() => {
|
||||
this.$message.success("挂载成功")
|
||||
this.mountToVisible = false
|
||||
})
|
||||
},
|
||||
fileTreeAndNewFolder() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user