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