mirror of https://gitee.com/xiaonuobase/snowy
【更新】个人中心组织架构图调整为只显示本级及以上,同时升级vueTree前端组件
parent
abd51015c7
commit
c62778a0d2
|
@ -54,7 +54,7 @@
|
|||
"vue-i18n": "9.2.2",
|
||||
"vue-router": "4.1.6",
|
||||
"vue3-colorpicker": "2.0.4",
|
||||
"vue3-tree-org": "4.1.1",
|
||||
"vue3-tree-org": "4.2.2",
|
||||
"vuedraggable-es": "4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item>
|
||||
<a @click="GrantResourceForm.onOpen(record)">授权资源</a>
|
||||
<a @click="grantResourceFormRef.onOpen(record)">授权资源</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="GrantMobileResourceForm.onOpen(record)">授权移动端资源</a>
|
||||
|
@ -95,7 +95,7 @@
|
|||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<grantResourceForm ref="GrantResourceForm" @successful="table.refresh()" />
|
||||
<grantResourceForm ref="grantResourceFormRef" @successful="table.refresh()" />
|
||||
<grantMobileResourceForm ref="GrantMobileResourceForm" @successful="table.refresh()" />
|
||||
<grantPermissionForm ref="GrantPermissionForm" @successful="table.refresh()" />
|
||||
<Form ref="formRef" @successful="table.refresh()" />
|
||||
|
@ -161,7 +161,7 @@
|
|||
// 定义tableDOM
|
||||
const table = ref()
|
||||
const formRef = ref()
|
||||
const GrantResourceForm = ref()
|
||||
const grantResourceFormRef = ref()
|
||||
const GrantMobileResourceForm = ref()
|
||||
const GrantPermissionForm = ref()
|
||||
const userselectorPlusRef = ref()
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
<div style="height: 500px">
|
||||
<vue3-tree-org
|
||||
style="background: var(--card-actions-background)"
|
||||
:data="data"
|
||||
:data="treeData"
|
||||
:tool-bar="{ scale: true, restore: false, expand: false, zoom: true, fullscreen: true }"
|
||||
:disabled="false"
|
||||
:center="true"
|
||||
:scalable="true"
|
||||
:draggable-on-node="false"
|
||||
:node-draggable="false"
|
||||
|
@ -18,26 +19,19 @@
|
|||
<script setup name="organizationChart">
|
||||
import { Vue3TreeOrg } from 'vue3-tree-org'
|
||||
import 'vue3-tree-org/lib/vue3-tree-org.css'
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
import userCenterApi from '@/api/sys/userCenterApi'
|
||||
let data = ref({})
|
||||
userCenterApi.userLoginOrgTree().then((res) => {
|
||||
const userInfo = tool.data.get('USER_INFO')
|
||||
res = Array.from(res)
|
||||
res.forEach((item) => {
|
||||
if (item.id === userInfo.orgId) {
|
||||
data.value = item
|
||||
}
|
||||
})
|
||||
const treeData = ref({})
|
||||
userCenterApi.userLoginOrgTree().then((data) => {
|
||||
treeData.value = data[0]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.tree-org-node__content {
|
||||
background: var(--body-background) !important;
|
||||
<style lang="less" scoped>
|
||||
:deep(tree-org-node__content) {
|
||||
background: var(--body-background);
|
||||
}
|
||||
.tree-org {
|
||||
padding-top: 10px !important;
|
||||
:deep(.tree-org) {
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*/
|
||||
package vip.xiaonuo.sys.modular.user.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
|
@ -833,15 +833,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
@Override
|
||||
public List<Tree<String>> loginOrgTree(SysUserIdParam sysUserIdParam) {
|
||||
List<SysOrg> sysOrgList = sysOrgService.getCachedAllOrgList();
|
||||
SysUser sysUser = this.queryEntity(sysUserIdParam.getId());
|
||||
List<SysOrg> originDataList = sysOrgService.getAllOrgList();
|
||||
List<SysOrg> sysOrgList = sysOrgService.getParentListById(originDataList, sysUser.getOrgId(), true);
|
||||
List<TreeNode<String>> treeNodeList = sysOrgList.stream().map(sysOrg -> {
|
||||
TreeNode<String> treeNode = new TreeNode<>(sysOrg.getId(), sysOrg.getParentId(), sysOrg.getName(), sysOrg.getSortCode());
|
||||
if (ObjectUtil.isNotEmpty(sysUser.getOrgId())) {
|
||||
if (sysOrg.getId().equals(sysUser.getOrgId())) {
|
||||
treeNode.setExtra(JSONUtil.createObj().set("style", JSONUtil.createObj().set("color", "#FFF")
|
||||
.set("background", "var(--primary-color)")));
|
||||
}
|
||||
if (sysOrg.getId().equals(sysUser.getOrgId())) {
|
||||
treeNode.setExtra(JSONUtil.createObj().set("style", JSONUtil.createObj().set("color", "#FFF")
|
||||
.set("background", "var(--primary-color)")));
|
||||
}
|
||||
return treeNode;
|
||||
}).collect(Collectors.toList());
|
||||
|
|
Loading…
Reference in New Issue