|
@@ -2,7 +2,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="left-folder" v-loading="loading">
|
|
<div class="left-folder" v-loading="loading">
|
|
<el-scrollbar style="height: 100%">
|
|
<el-scrollbar style="height: 100%">
|
|
- <el-row style="padding: 6px 12px; margin-top: 10px">
|
|
|
|
|
|
+ <el-row style="padding: 16px 12px 6px;">
|
|
<span style="font-size: 12px; color: #646c73">文件夹</span>
|
|
<span style="font-size: 12px; color: #646c73">文件夹</span>
|
|
<i class="el-icon-plus add-folder-icon" title="添加文件夹" @click="handleShowAddFolder"></i>
|
|
<i class="el-icon-plus add-folder-icon" title="添加文件夹" @click="handleShowAddFolder"></i>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -146,14 +146,19 @@ export default {
|
|
},
|
|
},
|
|
// 点击文件夹
|
|
// 点击文件夹
|
|
handleCheckFolder(folderId) {
|
|
handleCheckFolder(folderId) {
|
|
- this.folderData.forEach((item) => {
|
|
|
|
- if (item.id === folderId) {
|
|
|
|
- item.checked = true;
|
|
|
|
- this.$emit("changeFolder", item);
|
|
|
|
- } else {
|
|
|
|
- item.checked = false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ // 如未传文件夹id则画布列表置空
|
|
|
|
+ if (folderId) {
|
|
|
|
+ this.folderData.forEach((item) => {
|
|
|
|
+ if (item.id === folderId) {
|
|
|
|
+ item.checked = true;
|
|
|
|
+ this.$emit("changeFolder", item);
|
|
|
|
+ } else {
|
|
|
|
+ item.checked = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$emit("changeFolder");
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 右键文件夹
|
|
// 右键文件夹
|
|
openMenu(e, folder) {
|
|
openMenu(e, folder) {
|
|
@@ -218,12 +223,18 @@ export default {
|
|
}).then(async () => {
|
|
}).then(async () => {
|
|
const res = await folderDelete([{ id: this.rightClickFolder.id }]);
|
|
const res = await folderDelete([{ id: this.rightClickFolder.id }]);
|
|
if (res.result === "success") {
|
|
if (res.result === "success") {
|
|
- this.folderData.splice(
|
|
|
|
- this.folderData.findIndex((item) => {
|
|
|
|
- return item.id === this.rightClickFolder.id;
|
|
|
|
- }),
|
|
|
|
- 1
|
|
|
|
- );
|
|
|
|
|
|
+ const index = this.folderData.findIndex((item) => { return item.id === this.rightClickFolder.id; })
|
|
|
|
+ this.folderData.splice(index, 1);
|
|
|
|
+ /**
|
|
|
|
+ * 删除文件夹后选中文件夹判断
|
|
|
|
+ */
|
|
|
|
+ if (this.folderData[index]) {// 如果删除的文件夹后面有文件夹则选中
|
|
|
|
+ this.handleCheckFolder(this.folderData[index].id)
|
|
|
|
+ } else if (this.folderData[index - 1]) {// 如果删除的文件夹后面没有前面有则选中前一个文件夹
|
|
|
|
+ this.handleCheckFolder(this.folderData[index - 1].id)
|
|
|
|
+ } else {// 如果都没有则文件夹列表为空
|
|
|
|
+ this.handleCheckFolder();
|
|
|
|
+ }
|
|
this.$message.success("删除成功!");
|
|
this.$message.success("删除成功!");
|
|
} else {
|
|
} else {
|
|
this.$message.error(res.message);
|
|
this.$message.error(res.message);
|