diff --git a/src/api/system/dept.js b/src/api/system/dept.js
index fc943cd..ed3b08f 100644
--- a/src/api/system/dept.js
+++ b/src/api/system/dept.js
@@ -49,4 +49,11 @@ export function delDept(deptId) {
url: '/system/dept/' + deptId,
method: 'delete'
})
+}
+// 房屋专属左侧组织树
+export function getdeptList() {
+ return request({
+ url: '/mz/building/getdeptList',
+ method: 'get'
+ })
}
\ No newline at end of file
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 9369b06..311faea 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -88,7 +88,9 @@ export default {
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
- location.href = '/index';
+ this.$router.replace({
+ path: "/login"
+ });
})
}).catch(() => {});
}
diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index 44bf9c4..0cf3799 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -157,7 +157,7 @@ export function mergeRecursive(source, target) {
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
-export function handleTree(data, id, parentId, children) {
+export function handleTree(data, id, parentId, children, maxLevel) {
let config = {
id: id || 'id',
parentId: parentId || 'parentId',
@@ -185,16 +185,21 @@ export function handleTree(data, id, parentId, children) {
}
for (let t of tree) {
- adaptToChildrenList(t);
+ adaptToChildrenList(t, 1);
}
- function adaptToChildrenList(o) {
+ function adaptToChildrenList(o, level) {
if (childrenListMap[o[config.id]] !== null) {
+ if (maxLevel && level >= maxLevel) {
+ // 当达到最大层级时,清除子节点数据
+ o[config.childrenList] = [];
+ return;
+ }
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
- adaptToChildrenList(c);
+ adaptToChildrenList(c, level + 1);
}
}
}
diff --git a/src/views/mz/building/index.vue b/src/views/mz/building/index.vue
index 4ae3c65..d1b164f 100644
--- a/src/views/mz/building/index.vue
+++ b/src/views/mz/building/index.vue
@@ -50,7 +50,13 @@
-