|
@@ -159,13 +159,21 @@ export default function (materialType) {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ filterAncestors(ancestors) {
|
|
|
+ if (ancestors && ancestors.length > 0) {
|
|
|
+ const array = ancestors.split(',').map(item => item);
|
|
|
+ return array.join(',')
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ },
|
|
|
async onSubmitMoveFolder(targetFolderId) {
|
|
|
// const ancestors = this.folderPath.map((item) => {
|
|
|
// return item.id
|
|
|
// }).join(',')
|
|
|
const target = this.findFolderTreeById(this.folderTree, targetFolderId);
|
|
|
- let targetAncestors = target ? target.ancestors + ',' + target.id : '1'
|
|
|
- console.log('targetAncestors', targetAncestors);
|
|
|
+ let targetAncestors = target && target.ancestors && target.ancestors.length > 0 ? this.filterAncestors(target.ancestors) + ',' + target.id : '1'
|
|
|
+ console.log('filter-targetAncestors', targetAncestors);
|
|
|
const res = await moveToFolder(this.selectedList, targetFolderId, targetAncestors);
|
|
|
// console.log('res', res.code === 0);
|
|
|
if (res) {
|
|
@@ -228,7 +236,7 @@ export default function (materialType) {
|
|
|
this.folderTree = res.data
|
|
|
const targetPathIdList = folder.ancestors.split(',').map((item) => {
|
|
|
return Number(item)
|
|
|
- })
|
|
|
+ }).filter(i => i)
|
|
|
console.log('targetPathIdList', targetPathIdList);
|
|
|
targetPathIdList.push(folder.id)
|
|
|
this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
|