|
@@ -1,7 +1,7 @@
|
|
import CreateFolder from "./popup/CreateFolder";
|
|
import CreateFolder from "./popup/CreateFolder";
|
|
import RenameFolder from "./popup/RenameFolder";
|
|
import RenameFolder from "./popup/RenameFolder";
|
|
import MoveFolder from "./popup/MoveFolder";
|
|
import MoveFolder from "./popup/MoveFolder";
|
|
-
|
|
|
|
|
|
+import { nodeIdList2nodeInfoListByNodeTree } from "@/utils/other.js";
|
|
import {
|
|
import {
|
|
getMaterialList,
|
|
getMaterialList,
|
|
getFolderTree,
|
|
getFolderTree,
|
|
@@ -79,6 +79,9 @@ export default function(materialType) {
|
|
this.isShowNewFolder = false
|
|
this.isShowNewFolder = false
|
|
createFolderApi(
|
|
createFolderApi(
|
|
{
|
|
{
|
|
|
|
+ ancestors: this.folderPath.map((item) => {
|
|
|
|
+ return item.id
|
|
|
|
+ }).join(','),
|
|
name: v,
|
|
name: v,
|
|
parentId: this.currentFolderId,
|
|
parentId: this.currentFolderId,
|
|
type: materialType,
|
|
type: materialType,
|
|
@@ -157,7 +160,10 @@ export default function(materialType) {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onSubmitMoveFolder(targetFolderId) {
|
|
onSubmitMoveFolder(targetFolderId) {
|
|
- moveToFolder(this.selectedList, targetFolderId).then(() => {
|
|
|
|
|
|
+ const ancestors = this.folderPath.map((item) => {
|
|
|
|
+ return item.id
|
|
|
|
+ }).join(',')
|
|
|
|
+ moveToFolder(this.selectedList, targetFolderId, ancestors).then(() => {
|
|
this.$msg.success(this.$i18n.t('gather.success'))
|
|
this.$msg.success(this.$i18n.t('gather.success'))
|
|
this.isShowMoveFolder = false
|
|
this.isShowMoveFolder = false
|
|
this.refreshListDebounced()
|
|
this.refreshListDebounced()
|
|
@@ -190,14 +196,34 @@ export default function(materialType) {
|
|
this.folderPath = this.folderPath.slice(0, idx + 1)
|
|
this.folderPath = this.folderPath.slice(0, idx + 1)
|
|
this.selectedList = []
|
|
this.selectedList = []
|
|
},
|
|
},
|
|
|
|
+
|
|
onClickFolder(folder) {
|
|
onClickFolder(folder) {
|
|
- this.folderPath.push({
|
|
|
|
- name: folder.name,
|
|
|
|
- id: folder.id,
|
|
|
|
|
|
+ getFolderTree({
|
|
|
|
+ type: materialType,
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ this.folderTree = res.data
|
|
|
|
+ const targetPathIdList = folder.ancestors.split(',').map((item) => {
|
|
|
|
+ return Number(item)
|
|
|
|
+ })
|
|
|
|
+ targetPathIdList.push(folder.id)
|
|
|
|
+ this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
|
|
|
|
+ this.searchKey = ''
|
|
|
|
+ this.selectedList = []
|
|
})
|
|
})
|
|
- this.searchKey = ''
|
|
|
|
- this.selectedList = []
|
|
|
|
},
|
|
},
|
|
|
|
+ onClickParentFolder(folder) {
|
|
|
|
+ getFolderTree({
|
|
|
|
+ type: materialType,
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ this.folderTree = res.data
|
|
|
|
+ const targetPathIdList = folder.ancestors.split(',').map((item) => {
|
|
|
|
+ return Number(item)
|
|
|
|
+ })
|
|
|
|
+ this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
|
|
|
|
+ this.searchKey = ''
|
|
|
|
+ this.selectedList = []
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|