|
@@ -130,6 +130,7 @@ module.exports = app => {
|
|
if (folderList.length > 0) {
|
|
if (folderList.length > 0) {
|
|
const leafFolderList = this._.filter(folderList, { is_leaf: 1 });
|
|
const leafFolderList = this._.filter(folderList, { is_leaf: 1 });
|
|
const parentFolderIdList = this._.map(this._.filter(folderList, { is_leaf: 0 }), 'id');
|
|
const parentFolderIdList = this._.map(this._.filter(folderList, { is_leaf: 0 }), 'id');
|
|
|
|
+ const allNotExistFolderIds = [];
|
|
for (const lf of leafFolderList) {
|
|
for (const lf of leafFolderList) {
|
|
let parentPathArray = lf.parent_path !== '' ? lf.parent_path.split('-') : [];
|
|
let parentPathArray = lf.parent_path !== '' ? lf.parent_path.split('-') : [];
|
|
if (parentPathArray.length > 0) {
|
|
if (parentPathArray.length > 0) {
|
|
@@ -139,14 +140,21 @@ module.exports = app => {
|
|
}
|
|
}
|
|
const notExistFolderIds = this._.difference(parentPathArray, parentFolderIdList);
|
|
const notExistFolderIds = this._.difference(parentPathArray, parentFolderIdList);
|
|
if (notExistFolderIds.length > 0) {
|
|
if (notExistFolderIds.length > 0) {
|
|
- const newFolderList = await this.getAllDataByCondition({ where: { id: notExistFolderIds } });
|
|
|
|
- console.log(newFolderList);
|
|
|
|
- folderList = [...folderList, ...newFolderList];
|
|
|
|
|
|
+ for (const id of notExistFolderIds) {
|
|
|
|
+ if (!this._.includes(allNotExistFolderIds, id)) {
|
|
|
|
+ allNotExistFolderIds.push(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (allNotExistFolderIds.length > 0) {
|
|
|
|
+ const newFolderList = await this.getAllDataByCondition({ where: { id: allNotExistFolderIds } });
|
|
|
|
+ folderList = [...folderList, ...newFolderList];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (folderList.length > 0) {
|
|
if (folderList.length > 0) {
|
|
|
|
+ // folderList = this._.uniqBy(folderList, 'id');
|
|
for (const f of folderList) {
|
|
for (const f of folderList) {
|
|
const userInfo = this._.find(accountList, { id: f.uid });
|
|
const userInfo = this._.find(accountList, { id: f.uid });
|
|
f.user_name = userInfo ? userInfo.name : '';
|
|
f.user_name = userInfo ? userInfo.name : '';
|