|
@@ -77,7 +77,7 @@ class MenusService extends CrudService {
|
|
arr.push(...parent);
|
|
arr.push(...parent);
|
|
}
|
|
}
|
|
arr = _.uniqBy(arr, '_id');
|
|
arr = _.uniqBy(arr, '_id');
|
|
- const headLevel = arr.filter(f => !f.parent_id);
|
|
|
|
|
|
+ let headLevel = arr.filter(f => !f.parent_id);
|
|
// 变成树形结构
|
|
// 变成树形结构
|
|
const toTree = (allMenu, menus) => {
|
|
const toTree = (allMenu, menus) => {
|
|
for (const m of menus) {
|
|
for (const m of menus) {
|
|
@@ -87,6 +87,9 @@ class MenusService extends CrudService {
|
|
}
|
|
}
|
|
return menus;
|
|
return menus;
|
|
};
|
|
};
|
|
|
|
+ // 排序
|
|
|
|
+ arr = _.orderBy(arr, [ 'order_num' ], [ 'asc' ]);
|
|
|
|
+ headLevel = _.orderBy(headLevel, [ 'order_num' ], [ 'asc' ]);
|
|
arr = toTree(arr, headLevel);
|
|
arr = toTree(arr, headLevel);
|
|
return arr;
|
|
return arr;
|
|
}
|
|
}
|