From 00a83cfd7703420ccd89b98581b0862680efb906 Mon Sep 17 00:00:00 2001
From: mk <2403457699@qq.com>
Date: Tue, 20 May 2025 13:56:25 +0800
Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E5=B1=8B=E7=BB=84=E7=BB=87=E6=A0=91?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=20=E6=A5=BC=E6=A0=8B?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=88=BF=E5=B1=8B=E5=8A=9F=E8=83=BD=E5=AE=9E?=
=?UTF-8?q?=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/dept.js | 7 +++
src/layout/components/Navbar.vue | 4 +-
src/utils/ruoyi.js | 13 +++--
src/views/mz/building/index.vue | 11 +++-
src/views/mz/house/index.vue | 88 ++++++++++++++++++++++++++------
5 files changed, 101 insertions(+), 22 deletions(-)
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 @@
-