zhuwei пре 2 година
родитељ
комит
2448e23846
2 измењених фајлова са 29 додато и 3 уклоњено
  1. 13 1
      src/api/modules/system/organization.js
  2. 16 2
      src/views/system/organization.vue

+ 13 - 1
src/api/modules/system/organization.js

@@ -3,7 +3,7 @@ import {useAppStore} from "~src/store";
 const useAppState = useAppStore();
 
 export default {
-    //列表数据
+    //列表数据 tree
     async deptList() {
         return httpApi({
             url: '/api/blade-system/dept/tree',
@@ -13,6 +13,18 @@ export default {
             }
         }, false);
     },
+
+    //列表数据(用户部门)
+    async treeUserdept() {
+        return httpApi({
+            url: '/api/blade-system/dept/tree-userdept-info',
+            method: 'get',
+            params: {
+                tenantId: useAppState.tenantId,
+            }
+        }, false);
+    },
+
     //删除
     async remove(ids) {
         return httpApi({

+ 16 - 2
src/views/system/organization.vue

@@ -9,7 +9,7 @@
             </el-button>
         </template>
         <div class="h-full text-center" v-if="!isedit">
-            <vue3-tree-org :data="deptTreeData" :horizontal="false" :collapsable="false" :node-draggable="false" draggable
+            <vue3-tree-org :data="userDeptTreeData" :horizontal="false" :collapsable="false" :node-draggable="false" draggable
                 center :scalable="false" :default-expand-level="5" :define-menus="[]" disabled
             >
                 <template v-slot="{node}">
@@ -70,7 +70,9 @@ const isedit = ref(true)
 
 //页面被激活时
 onActivated(() => {
-    getTreeData()
+    getTreeData();
+    // 获取用户节点树
+    getUserDeptTreeData();
 })
 
 //获取树数据
@@ -85,6 +87,18 @@ const getTreeData = async () => {
     }
 }
 
+//获取树数据
+const userDeptTreeData = ref({})
+const getUserDeptTreeData = async () => {
+    const {error, code, data} = await mainApi.treeUserdept()
+    if (!error && code === 200) {
+        const res = await setDeptTreeData(data)
+        userDeptTreeData.value = res[0]
+    } else {
+        userDeptTreeData.value = {}
+    }
+}
+
 //组织架构显示信息
 const lavel1_style = {color: "#fff", background: "#108ffe", borderColor: "#108ffe", padding: '10px 15px'}
 const lavel2_style = {background: "#E8E8E8", padding: '10px 15px'}