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