Bladeren bron

:zap: 用户管理列表的部门树改为懒加载

smallchill 6 jaren geleden
bovenliggende
commit
56a9c29ff3

File diff suppressed because it is too large
+ 0 - 0
public/cdn/avue/2.3.4/avue.min.js


File diff suppressed because it is too large
+ 0 - 0
public/cdn/avue/2.3.4/index.css


+ 11 - 0
src/api/system/dept.js

@@ -58,6 +58,7 @@ export const getDept = (id) => {
     }
   })
 }
+
 export const getDeptTree = (tenantId) => {
   return request({
     url: '/api/blade-system/dept/tree',
@@ -68,3 +69,13 @@ export const getDeptTree = (tenantId) => {
   })
 }
 
+export const getDeptLazyTree = (parentId) => {
+  return request({
+    url: '/api/blade-system/dept/lazy-tree',
+    method: 'get',
+    params: {
+      parentId
+    }
+  })
+}
+

+ 3 - 1
src/views/monitor/log/api.vue

@@ -50,6 +50,7 @@
             {
               label: "服务id",
               prop: "serviceId",
+              width:'120',
               search: true
             },
             {
@@ -59,7 +60,8 @@
             },
             {
               label: "服务ip",
-              prop: "serverIp"
+              prop: "serverIp",
+              width:'160'
             },
             {
               label: "软件环境",

+ 13 - 4
src/views/system/user.vue

@@ -64,7 +64,7 @@
     add,
     resetPassword
   } from "@/api/system/user";
-  import {getDeptTree} from "@/api/system/dept";
+  import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
   import {getRoleTree} from "@/api/system/role";
   import {mapGetters} from "vuex";
   import website from '@/config/website';
@@ -105,6 +105,18 @@
         treeData: [],
         treeOption: {
           nodeKey: 'id',
+          lazy: true,
+          treeLoad: function (node, resolve) {
+            const parentId = (node.level === 0) ? 0 : node.data.id;
+            getDeptLazyTree(parentId).then(res => {
+              resolve(res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                }
+              }))
+            });
+          },
           addBtn: false,
           menu: false,
           size: 'small',
@@ -322,9 +334,6 @@
         this.onLoad(this.page);
       },
       initData() {
-        getDeptTree().then(res => {
-          this.treeData = res.data.data;
-        });
         getDeptTree(this.form.tenantId).then(res => {
           const index = this.$refs.crud.findColumnIndex("deptId");
           this.option.column[index].dicData = res.data.data;

Some files were not shown because too many files changed in this diff