mirror of
https://gitee.com/xiaonuobase/snowy.git
synced 2026-03-22 02:37:16 +08:00
【机构】机构增加缓存、异步树
This commit is contained in:
@@ -30,6 +30,10 @@ export default {
|
||||
orgTree(data) {
|
||||
return request('tree', data, 'get')
|
||||
},
|
||||
// 获取机构树(懒加载)
|
||||
orgTreeLazy(data) {
|
||||
return request('treeLazy', data, 'get')
|
||||
},
|
||||
// 提交表单 edit为true时为编辑,默认为新增
|
||||
submitForm(data, edit = false) {
|
||||
return request(edit ? 'edit' : 'add', data)
|
||||
@@ -46,6 +50,10 @@ export default {
|
||||
orgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取机构树选择器(懒加载)
|
||||
orgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取人员选择器
|
||||
orgUserSelector(data) {
|
||||
return request('userSelector', data, 'get')
|
||||
|
||||
@@ -42,6 +42,10 @@ export default {
|
||||
positionOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取机构树选择器(懒加载)
|
||||
positionOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取岗位选择器
|
||||
positionPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
|
||||
@@ -50,6 +50,10 @@ export default {
|
||||
userOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取组织选择器(懒加载)
|
||||
userOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取职位选择器
|
||||
userPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
|
||||
@@ -54,6 +54,10 @@ export default {
|
||||
configOrgTree(data) {
|
||||
return request('orgTree', data, 'get')
|
||||
},
|
||||
// 获取机构树(懒加载)
|
||||
configOrgTreeLazy(data) {
|
||||
return request('orgTreeLazy', data, 'get')
|
||||
},
|
||||
// 获取机构选择器
|
||||
configOrgSelector(data) {
|
||||
return request('orgSelector', data, 'get')
|
||||
|
||||
@@ -26,6 +26,10 @@ export default {
|
||||
orgTree(data) {
|
||||
return request('tree', data, 'get')
|
||||
},
|
||||
// 获取组织树(懒加载)
|
||||
orgTreeLazy(data) {
|
||||
return request('treeLazy', data, 'get')
|
||||
},
|
||||
// 提交表单 edit为true时为编辑,默认为新增
|
||||
submitForm(data, edit = false) {
|
||||
return request(edit ? 'edit' : 'add', data)
|
||||
@@ -42,6 +46,10 @@ export default {
|
||||
orgOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取组织树选择器(懒加载)
|
||||
orgOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取用户选择器
|
||||
orgUserSelector(data) {
|
||||
return request('userSelector', data, 'get')
|
||||
|
||||
@@ -42,6 +42,10 @@ export default {
|
||||
positionOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取组织树选择器(懒加载)
|
||||
positionOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取职位选择器
|
||||
positionPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
|
||||
@@ -70,6 +70,10 @@ export default {
|
||||
roleOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取机构树(懒加载)
|
||||
roleOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取资源授权树
|
||||
roleResourceTreeSelector(data) {
|
||||
return request('resourceTreeSelector', data, 'get')
|
||||
|
||||
@@ -50,6 +50,10 @@ export default {
|
||||
userOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取组织选择器(懒加载)
|
||||
userOrgTreeLazySelector(data) {
|
||||
return request('orgTreeLazySelector', data, 'get')
|
||||
},
|
||||
// 获取职位选择器
|
||||
userPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -201,6 +202,9 @@
|
||||
orgTreeApi: {
|
||||
type: Function
|
||||
},
|
||||
orgTreeLazyApi: {
|
||||
type: Function
|
||||
},
|
||||
orgPageApi: {
|
||||
type: Function
|
||||
},
|
||||
@@ -248,6 +252,31 @@
|
||||
const current = ref(0) // 当前页数
|
||||
const pageSize = ref(10) // 每页条数
|
||||
const total = ref(0) // 数据总数
|
||||
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (typeof props.orgTreeLazyApi !== 'function' || treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
props
|
||||
.orgTreeLazyApi({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const hasContent = (slotName) => {
|
||||
return !!(slots[slotName] && slots[slotName]().length > 0)
|
||||
}
|
||||
@@ -293,28 +322,50 @@
|
||||
}
|
||||
visible.value = true
|
||||
// 获取机构树
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
if (typeof props.orgTreeLazyApi === 'function') {
|
||||
props
|
||||
.orgTreeLazyApi()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
} else {
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
searchFormState.value.size = pageSize.value
|
||||
loadData()
|
||||
if (isEmpty(recordIds.value)) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -197,6 +198,9 @@
|
||||
orgTreeApi: {
|
||||
type: Function
|
||||
},
|
||||
orgTreeLazyApi: {
|
||||
type: Function
|
||||
},
|
||||
positionPageApi: {
|
||||
type: Function
|
||||
},
|
||||
@@ -244,6 +248,31 @@
|
||||
const current = ref(0) // 当前页数
|
||||
const pageSize = ref(10) // 每页条数
|
||||
const total = ref(0) // 数据总数
|
||||
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (typeof props.orgTreeLazyApi !== 'function' || treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
props
|
||||
.orgTreeLazyApi({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const hasContent = (slotName) => {
|
||||
return !!(slots[slotName] && slots[slotName]().length > 0)
|
||||
}
|
||||
@@ -289,28 +318,50 @@
|
||||
}
|
||||
visible.value = true
|
||||
// 获取机构树
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
if (typeof props.orgTreeLazyApi === 'function') {
|
||||
props
|
||||
.orgTreeLazyApi()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
} else {
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
searchFormState.value.size = pageSize.value
|
||||
loadData()
|
||||
if (isEmpty(recordIds.value)) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -198,6 +199,9 @@
|
||||
orgTreeApi: {
|
||||
type: Function
|
||||
},
|
||||
orgTreeLazyApi: {
|
||||
type: Function
|
||||
},
|
||||
rolePageApi: {
|
||||
type: Function
|
||||
},
|
||||
@@ -251,6 +255,31 @@
|
||||
const current = ref(0) // 当前页数
|
||||
const pageSize = ref(10) // 每页条数
|
||||
const total = ref(0) // 数据总数
|
||||
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (typeof props.orgTreeLazyApi !== 'function' || treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
props
|
||||
.orgTreeLazyApi({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const hasContent = (slotName) => {
|
||||
return !!(slots[slotName] && slots[slotName]().length > 0)
|
||||
}
|
||||
@@ -296,39 +325,61 @@
|
||||
}
|
||||
visible.value = true
|
||||
// 获取机构树
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 树中插入全局角色类型
|
||||
if (props.roleGlobal) {
|
||||
const globalRoleType = [
|
||||
{
|
||||
id: 'GLOBAL',
|
||||
parentId: '-1',
|
||||
name: '全局'
|
||||
}
|
||||
]
|
||||
treeData.value = globalRoleType.concat(data)
|
||||
}
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
if (typeof props.orgTreeLazyApi === 'function') {
|
||||
props
|
||||
.orgTreeLazyApi()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
} else {
|
||||
orgTree()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data
|
||||
// 树中插入全局角色类型
|
||||
if (props.roleGlobal) {
|
||||
const globalRoleType = [
|
||||
{
|
||||
id: 'GLOBAL',
|
||||
parentId: '-1',
|
||||
name: '全局'
|
||||
}
|
||||
]
|
||||
treeData.value = globalRoleType.concat(data)
|
||||
}
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
searchFormState.value.size = pageSize.value
|
||||
loadData()
|
||||
if (isEmpty(recordIds.value)) {
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -211,6 +212,9 @@
|
||||
orgTreeApi: {
|
||||
type: Function
|
||||
},
|
||||
orgTreeLazyApi: {
|
||||
type: Function
|
||||
},
|
||||
userPageApi: {
|
||||
type: Function
|
||||
},
|
||||
@@ -255,7 +259,7 @@
|
||||
const recordIds = ref([])
|
||||
// 分页相关
|
||||
const current = ref(0) // 当前页数
|
||||
const pageSize = ref(20) // 每页条数
|
||||
const pageSize = ref(10) // 每页条数
|
||||
const total = ref(0) // 数据总数
|
||||
// 获取选中列表的api
|
||||
const userListByIdList = (param) => {
|
||||
@@ -280,40 +284,83 @@
|
||||
const onMouseLeave = (index) => {
|
||||
deleteShow.value = ''
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (typeof props.orgTreeLazyApi !== 'function' || treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
props
|
||||
.orgTreeLazyApi({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 打开弹框
|
||||
const openModal = () => {
|
||||
if (typeof props.orgTreeApi !== 'function') {
|
||||
message.warning('未配置选择器需要的orgTreeApi接口')
|
||||
return
|
||||
}
|
||||
if (typeof props.userPageApi !== 'function') {
|
||||
message.warning('未配置选择器需要的userPageApi接口')
|
||||
if (typeof props.orgTreeApi !== 'function' || typeof props.userPageApi !== 'function') {
|
||||
message.warning('未配置用户选择器API')
|
||||
return
|
||||
}
|
||||
visible.value = true
|
||||
// 获取机构树
|
||||
props
|
||||
.orgTreeApi()
|
||||
.then((data) => {
|
||||
if (data !== null) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
if (typeof props.orgTreeLazyApi === 'function') {
|
||||
props
|
||||
.orgTreeLazyApi()
|
||||
.then((data) => {
|
||||
if (!isEmpty(data)) {
|
||||
treeData.value = data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
} else {
|
||||
props
|
||||
.orgTreeApi()
|
||||
.then((data) => {
|
||||
if (data !== null) {
|
||||
treeData.value = data
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
cardLoading.value = false
|
||||
})
|
||||
}
|
||||
searchFormState.value.size = pageSize.value
|
||||
loadData()
|
||||
if (isEmpty(recordIds.value)) {
|
||||
@@ -326,6 +373,7 @@
|
||||
userListByIdList(param)
|
||||
.then((data) => {
|
||||
selectedData.value = data
|
||||
userObj.value = data
|
||||
})
|
||||
.finally(() => {
|
||||
selectedTableListLoading.value = false
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择上级机构"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="机构名称:" name="name">
|
||||
@@ -42,6 +41,7 @@
|
||||
<a-form-item label="指定主管:" name="directorId">
|
||||
<xn-user-selector
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectorApiFunction.orgTreeLazyApi"
|
||||
:user-page-api="selectorApiFunction.userPageApi"
|
||||
:radio-model="true"
|
||||
v-model:value="formData.directorId"
|
||||
@@ -90,17 +90,46 @@
|
||||
})
|
||||
}
|
||||
// 获取机构树并加入顶级
|
||||
bizOrgApi.orgTreeSelector().then((res) => {
|
||||
bizOrgApi.orgTreeLazySelector().then((res) => {
|
||||
treeData.value = [
|
||||
{
|
||||
id: 0,
|
||||
id: '0',
|
||||
parentId: '-1',
|
||||
name: '顶级',
|
||||
children: res
|
||||
children: res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
}),
|
||||
isLeaf: false
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizOrgApi
|
||||
.orgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
visible.value = false
|
||||
@@ -139,6 +168,11 @@
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
orgTreeLazyApi: (param) => {
|
||||
return bizOrgApi.orgTreeLazySelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
userPageApi: (param) => {
|
||||
return bizOrgApi.orgUserSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -182,27 +183,46 @@
|
||||
}
|
||||
// 加载左侧的树
|
||||
const loadTreeData = () => {
|
||||
bizOrgApi.orgTree().then((res) => {
|
||||
bizOrgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizOrgApi
|
||||
.orgTreeLazy({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择组织"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
></a-tree-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="岗位名称:" name="name">
|
||||
@@ -77,8 +76,36 @@
|
||||
formData.value = Object.assign({}, record)
|
||||
}
|
||||
// 获取机构树
|
||||
bizPositionApi.positionOrgTreeSelector().then((res) => {
|
||||
treeData.value = res
|
||||
bizPositionApi.positionOrgTreeLazySelector().then((res) => {
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizPositionApi
|
||||
.positionOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -171,26 +172,52 @@
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
bizOrgApi.orgTree().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
const loadTreeData = () => {
|
||||
bizOrgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开顶级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
loadTreeData()
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children || treeNode.dataRef.isLeaf) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizOrgApi
|
||||
.orgTreeLazy({ parentId: treeNode.dataRef.id })
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
.catch(() => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择机构"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:tree-default-expanded-keys="treeDefaultExpandedKeys"
|
||||
:field-names="{
|
||||
@@ -59,6 +58,7 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
:load-data="onLoadData"
|
||||
@change="selePositionData(formData.orgId, 0)"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -135,6 +135,7 @@
|
||||
:tree-data="treeData"
|
||||
:tree-default-expanded-keys="treeDefaultExpandedKeys"
|
||||
:field-names="{ children: 'children', label: 'name', value: 'id' }"
|
||||
:load-data="onLoadData"
|
||||
@select="childOrgSelect(positionInfo, 0, index)"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -340,26 +341,45 @@
|
||||
}
|
||||
nextTick(() => {
|
||||
// 机构选择器数据
|
||||
bizUserApi.userOrgTreeSelector().then((res) => {
|
||||
bizUserApi.userOrgTreeLazySelector().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
treeDefaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
treeDefaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
treeDefaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizUserApi
|
||||
.userOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
treeData.value = []
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -158,6 +159,7 @@
|
||||
<xn-role-selector
|
||||
ref="RoleSelectorPlusRef"
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectorApiFunction.orgTreeLazyApi"
|
||||
:role-page-api="selectorApiFunction.rolePageApi"
|
||||
:add-show="false"
|
||||
:role-global="true"
|
||||
@@ -244,27 +246,53 @@
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 左侧树查询
|
||||
bizOrgApi.orgTree().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
// 加载左侧树
|
||||
const loadTreeData = () => {
|
||||
bizOrgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开顶级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
loadTreeData()
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children || treeNode.dataRef.isLeaf) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
bizOrgApi
|
||||
.orgTreeLazy({ parentId: treeNode.dataRef.id })
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
.catch(() => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
@@ -279,7 +307,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// 点击树查询
|
||||
// 左侧树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
searchFormState.value.orgId = selectedKeys.toString()
|
||||
@@ -403,6 +431,11 @@
|
||||
return Promise.resolve(orgTree)
|
||||
})
|
||||
},
|
||||
orgTreeLazyApi: (param) => {
|
||||
return bizUserApi.userOrgTreeLazySelector(param).then((orgTree) => {
|
||||
return Promise.resolve(orgTree)
|
||||
})
|
||||
},
|
||||
rolePageApi: (param) => {
|
||||
return bizUserApi.userRoleSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
>
|
||||
<xn-org-selector
|
||||
:org-tree-api="selectApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectApiFunction.orgTreeLazyApi"
|
||||
:org-page-api="selectApiFunction.orgPageApi"
|
||||
:radio-model="true"
|
||||
dataType="string"
|
||||
@@ -70,6 +71,7 @@
|
||||
>
|
||||
<xn-position-selector
|
||||
:org-tree-api="selectApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectApiFunction.orgTreeLazyApi"
|
||||
:position-page-api="selectApiFunction.positionPageApi"
|
||||
:radio-model="true"
|
||||
dataType="string"
|
||||
@@ -85,6 +87,7 @@
|
||||
>
|
||||
<xn-role-selector
|
||||
:org-tree-api="selectApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectApiFunction.orgTreeLazyApi"
|
||||
:role-page-api="selectApiFunction.rolePageApi"
|
||||
:radio-model="true"
|
||||
dataType="string"
|
||||
@@ -144,6 +147,11 @@
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
orgTreeLazyApi: (param) => {
|
||||
return configApi.configOrgTreeLazy(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
orgPageApi: (param) => {
|
||||
return configApi.configOrgSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择上级组织"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="组织名称:" name="name">
|
||||
@@ -42,6 +41,7 @@
|
||||
<a-form-item label="指定主管:" name="directorId">
|
||||
<xn-user-selector
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectorApiFunction.orgTreeLazyApi"
|
||||
:user-page-api="selectorApiFunction.userPageApi"
|
||||
:radio-model="true"
|
||||
v-model:value="formData.directorId"
|
||||
@@ -89,17 +89,46 @@
|
||||
})
|
||||
}
|
||||
// 获取机构树并加入顶级
|
||||
orgApi.orgOrgTreeSelector().then((res) => {
|
||||
orgApi.orgOrgTreeLazySelector().then((res) => {
|
||||
treeData.value = [
|
||||
{
|
||||
id: 0,
|
||||
id: '0',
|
||||
parentId: '-1',
|
||||
name: '顶级',
|
||||
children: res
|
||||
children: res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
}),
|
||||
isLeaf: false
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
orgApi
|
||||
.orgOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
visible.value = false
|
||||
@@ -138,6 +167,11 @@
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
orgTreeLazyApi: (param) => {
|
||||
return orgApi.orgOrgTreeLazySelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
userPageApi: (param) => {
|
||||
return orgApi.orgUserSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -179,27 +180,46 @@
|
||||
}
|
||||
// 加载左侧的树
|
||||
const loadTreeData = () => {
|
||||
orgApi.orgTree().then((res) => {
|
||||
orgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
orgApi
|
||||
.orgTreeLazy({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择组织"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:field-names="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
></a-tree-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="职位名称:" name="name">
|
||||
@@ -76,8 +75,36 @@
|
||||
formData.value = Object.assign({}, record)
|
||||
}
|
||||
// 获取机构树
|
||||
positionApi.positionOrgTreeSelector().then((res) => {
|
||||
treeData.value = res
|
||||
positionApi.positionOrgTreeLazySelector().then((res) => {
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
positionApi
|
||||
.positionOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -168,26 +169,45 @@
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
orgApi.orgTree().then((res) => {
|
||||
orgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
orgApi
|
||||
.orgTreeLazy({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
@change="onCategoryOrOrgIdSelect"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -132,6 +133,7 @@
|
||||
<xn-user-selector
|
||||
ref="userSelectorPlusRef"
|
||||
:org-tree-api="selectorApiFunction.orgTreeApi"
|
||||
:org-tree-lazy-api="selectorApiFunction.orgTreeLazyApi"
|
||||
:user-page-api="selectorApiFunction.userPageApi"
|
||||
data-type="object"
|
||||
:user-show="false"
|
||||
@@ -217,34 +219,63 @@
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
// 加载左侧的树
|
||||
orgApi.orgTree().then((res) => {
|
||||
if (res !== null) {
|
||||
// 树中插入全局角色类型
|
||||
const globalRoleType = [
|
||||
{
|
||||
id: 'GLOBAL',
|
||||
parentId: '-1',
|
||||
name: '全局'
|
||||
}
|
||||
]
|
||||
treeData.value = globalRoleType.concat(res)
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
const loadTreeData = () => {
|
||||
orgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
// 树中插入全局角色类型
|
||||
const globalRoleType = [
|
||||
{
|
||||
id: 'GLOBAL',
|
||||
parentId: '-1',
|
||||
name: '全局',
|
||||
isLeaf: true
|
||||
}
|
||||
})
|
||||
]
|
||||
treeData.value = globalRoleType.concat(
|
||||
res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
)
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开顶级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
loadTreeData()
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children || treeNode.dataRef.isLeaf) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
orgApi
|
||||
.orgTreeLazy({ parentId: treeNode.dataRef.id })
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
.catch(() => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 点击树查询
|
||||
const treeSelect = (selectedKeys) => {
|
||||
if (selectedKeys.length > 0) {
|
||||
@@ -316,6 +347,11 @@
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
orgTreeLazyApi: (param) => {
|
||||
return orgApi.orgOrgTreeLazySelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
})
|
||||
},
|
||||
userPageApi: (param) => {
|
||||
return roleApi.roleUserSelector(param).then((data) => {
|
||||
return Promise.resolve(data)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
checkable
|
||||
check-strictly
|
||||
:selectable="false"
|
||||
:load-data="onLoadData"
|
||||
@check="treeCheck"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -65,9 +66,14 @@
|
||||
visible.value = true
|
||||
resultDataModel.dataScopeId = id
|
||||
// const treeData = data.data;
|
||||
roleApi.roleOrgTreeSelector().then((res) => {
|
||||
roleApi.roleOrgTreeLazySelector().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 赋值选中项
|
||||
echoOrgSelectKeys(checkKeys)
|
||||
// 默认展开2级
|
||||
@@ -75,17 +81,34 @@
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
roleApi
|
||||
.roleOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
const onClose = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
placeholder="请选择组织"
|
||||
allow-clear
|
||||
tree-default-expand-all
|
||||
:tree-data="treeData"
|
||||
:tree-default-expanded-keys="treeDefaultExpandedKeys"
|
||||
:field-names="{
|
||||
@@ -59,6 +58,7 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
:load-data="onLoadData"
|
||||
@change="selePositionData(formData.orgId, 0)"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -135,6 +135,7 @@
|
||||
:tree-data="treeData"
|
||||
:tree-default-expanded-keys="treeDefaultExpandedKeys"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="childOrgSelect(positionInfo, 0, index)"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -340,26 +341,45 @@
|
||||
}
|
||||
nextTick(() => {
|
||||
// 机构选择器数据
|
||||
userApi.userOrgTreeSelector().then((res) => {
|
||||
userApi.userOrgTreeLazySelector().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
treeDefaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
treeDefaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
treeDefaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
userApi
|
||||
.userOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
treeData.value = []
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
v-model:expandedKeys="defaultExpandedKeys"
|
||||
:tree-data="treeData"
|
||||
:field-names="treeFieldNames"
|
||||
:load-data="onLoadData"
|
||||
@select="treeSelect"
|
||||
/>
|
||||
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
|
||||
@@ -27,8 +28,8 @@
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}"
|
||||
selectable="false"
|
||||
tree-line
|
||||
:load-data="onLoadData"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -262,26 +263,45 @@
|
||||
})
|
||||
}
|
||||
// 左侧树查询
|
||||
orgApi.orgTree().then((res) => {
|
||||
orgApi.orgTreeLazy().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
if (isEmpty(defaultExpandedKeys.value)) {
|
||||
// 默认展开2级
|
||||
treeData.value.forEach((item) => {
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
// 默认展开第一级
|
||||
if (treeData.value.length > 0) {
|
||||
defaultExpandedKeys.value.push(treeData.value[0].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// 懒加载子节点
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
orgApi
|
||||
.orgTreeLazy({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
// 列表选择配置
|
||||
const options = {
|
||||
alert: {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
checkable
|
||||
check-strictly
|
||||
:selectable="false"
|
||||
:load-data="onLoadData"
|
||||
@check="treeCheck"
|
||||
>
|
||||
</a-tree>
|
||||
@@ -65,9 +66,14 @@
|
||||
visible.value = true
|
||||
resultDataModel.dataScopeId = id
|
||||
// const treeData = data.data;
|
||||
userApi.userOrgTreeSelector().then((res) => {
|
||||
userApi.userOrgTreeLazySelector().then((res) => {
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
treeData.value = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
// 赋值选中项
|
||||
echoOrgSelectKeys(checkKeys)
|
||||
// 默认展开2级
|
||||
@@ -75,17 +81,33 @@
|
||||
// 因为0的顶级
|
||||
if (item.parentId === '0') {
|
||||
defaultExpandedKeys.value.push(item.id)
|
||||
// 取到下级ID
|
||||
if (item.children) {
|
||||
item.children.forEach((items) => {
|
||||
defaultExpandedKeys.value.push(items.id)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const onLoadData = (treeNode) => {
|
||||
return new Promise((resolve) => {
|
||||
if (treeNode.dataRef.children) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
userApi
|
||||
.userOrgTreeLazySelector({
|
||||
parentId: treeNode.dataRef.id
|
||||
})
|
||||
.then((res) => {
|
||||
treeNode.dataRef.children = res.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
isLeaf: item.isLeaf === undefined ? false : item.isLeaf
|
||||
}
|
||||
})
|
||||
treeData.value = [...treeData.value]
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
const onClose = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
@@ -34,6 +34,14 @@ public interface BizOrgApi {
|
||||
**/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2024/11/1 18:27:51
|
||||
**/
|
||||
List<JSONObject> orgTreeLazySelector(String parentId);
|
||||
|
||||
/**
|
||||
* 获取组织列表选择器
|
||||
*
|
||||
|
||||
@@ -50,6 +50,14 @@ public interface SysOrgApi {
|
||||
**/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/7/22 14:46
|
||||
**/
|
||||
List<JSONObject> orgTreeLazySelector(String parentId);
|
||||
|
||||
/**
|
||||
* 获取组织列表选择器
|
||||
*
|
||||
|
||||
@@ -14,6 +14,7 @@ package vip.xiaonuo.biz.modular.org.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -80,6 +81,20 @@ public class BizOrgController {
|
||||
return CommonResult.data(bizOrgService.tree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取机构树(懒加载)")
|
||||
@SaCheckPermission("/biz/org/treeLazy")
|
||||
@GetMapping("/biz/org/treeLazy")
|
||||
public CommonResult<List<JSONObject>> treeLazy(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return CommonResult.data(bizOrgService.treeLazy(bizOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加机构
|
||||
*
|
||||
@@ -175,6 +190,20 @@ public class BizOrgController {
|
||||
return CommonResult.data(bizOrgService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "获取机构树选择器(懒加载)")
|
||||
@SaCheckPermission("/biz/org/orgTreeLazySelector")
|
||||
@GetMapping("/biz/org/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return CommonResult.data(bizOrgService.treeLazy(bizOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员选择器
|
||||
*
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright [2022] [https://www.xiaonuo.vip]
|
||||
*
|
||||
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件.
|
||||
* 2.请不要删除和修改Snowy源码头部的版权声明.
|
||||
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等.
|
||||
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作.
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package vip.xiaonuo.biz.modular.org.param;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 机构树懒加载参数
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/21 16:13
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
public class BizOrgTreeLazyParam {
|
||||
|
||||
/** 父id */
|
||||
@Schema(description = "父id")
|
||||
private String parentId;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vip.xiaonuo.biz.api.BizOrgApi;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgSelectorOrgListParam;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
import vip.xiaonuo.biz.modular.org.service.BizOrgService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -41,6 +42,13 @@ public class BizOrgApiProvider implements BizOrgApi {
|
||||
return bizOrgService.orgTreeSelector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(String parentId) {
|
||||
BizOrgTreeLazyParam bizOrgTreeLazyParam = new BizOrgTreeLazyParam();
|
||||
bizOrgTreeLazyParam.setParentId(parentId);
|
||||
return bizOrgService.treeLazy(bizOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@Override
|
||||
public Page<JSONObject> orgListSelector(String parentId) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package vip.xiaonuo.biz.modular.org.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import vip.xiaonuo.biz.modular.org.entity.BizOrg;
|
||||
@@ -45,6 +46,14 @@ public interface BizOrgService extends IService<BizOrg> {
|
||||
*/
|
||||
List<Tree<String>> tree();
|
||||
|
||||
/**
|
||||
* 获取机构树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:08
|
||||
*/
|
||||
List<JSONObject> treeLazy(BizOrgTreeLazyParam bizOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 添加机构
|
||||
*
|
||||
|
||||
@@ -43,6 +43,7 @@ import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.position.service.BizPositionService;
|
||||
import vip.xiaonuo.biz.modular.user.entity.BizUser;
|
||||
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
||||
import vip.xiaonuo.common.cache.CommonCacheOperator;
|
||||
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
||||
import vip.xiaonuo.common.exception.CommonException;
|
||||
import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
||||
@@ -61,6 +62,11 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> implements BizOrgService {
|
||||
|
||||
private static final String ORG_ALL_LIST_CACHE_KEY = "biz-org:all-list";
|
||||
|
||||
@Resource
|
||||
private CommonCacheOperator commonCacheOperator;
|
||||
|
||||
@Resource
|
||||
private SysRoleApi sysRoleApi;
|
||||
|
||||
@@ -105,7 +111,7 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
@Override
|
||||
public List<Tree<String>> tree() {
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = this.list();
|
||||
List<BizOrg> allOrgList = this.getAllOrgList();
|
||||
// 定义机构集合
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
// 校验数据范围
|
||||
@@ -130,6 +136,58 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> treeLazy(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
String parentId = ObjectUtil.isNotEmpty(bizOrgTreeLazyParam.getParentId()) ? bizOrgTreeLazyParam.getParentId() : "0";
|
||||
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
||||
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = this.getAllOrgList();
|
||||
Set<String> visibleOrgIds = null;
|
||||
|
||||
// 如果数据范围不为空,则计算可见机构ID集合(包含自身及其所有父级)
|
||||
if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(this.getParentListById(allOrgList, orgId, true)));
|
||||
visibleOrgIds = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// 过滤出当前父级下的可见子级
|
||||
final Set<String> finalVisibleOrgIds = visibleOrgIds;
|
||||
List<BizOrg> sysOrgList = allOrgList.stream()
|
||||
.filter(bizOrg -> bizOrg.getParentId().equals(parentId))
|
||||
.filter(bizOrg -> finalVisibleOrgIds == null || finalVisibleOrgIds.contains(bizOrg.getId()))
|
||||
.sorted(Comparator.comparingInt(BizOrg::getSortCode).thenComparing(BizOrg::getId))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isEmpty(sysOrgList)) {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
|
||||
// 判断这些机构是否还有可见子机构
|
||||
return sysOrgList.stream().map(bizOrg -> {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(bizOrg);
|
||||
// 计算是否有可见的子节点
|
||||
boolean hasChildren = allOrgList.stream()
|
||||
.anyMatch(item -> item.getParentId().equals(bizOrg.getId()) && (finalVisibleOrgIds == null || finalVisibleOrgIds.contains(item.getId())));
|
||||
|
||||
jsonObject.set("isLeaf", !hasChildren);
|
||||
return jsonObject;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:08
|
||||
*/
|
||||
public List<JSONObject> treeLazy(String parentId) {
|
||||
BizOrgTreeLazyParam bizOrgTreeLazyParam = new BizOrgTreeLazyParam();
|
||||
bizOrgTreeLazyParam.setParentId(parentId);
|
||||
return this.treeLazy(bizOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void add(BizOrgAddParam bizOrgAddParam, String sourceFromType) {
|
||||
@@ -158,6 +216,8 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
bizOrgExtService.createExtInfo(bizOrg.getId(), sourceFromType);
|
||||
// 发布增加事件
|
||||
CommonDataChangeEventCenter.doAddWithData(BizDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(bizOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -183,7 +243,7 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
if(repeatName) {
|
||||
throw new CommonException("存在重复的同级机构,名称为:{}", bizOrg.getName());
|
||||
}
|
||||
List<BizOrg> originDataList = this.list();
|
||||
List<BizOrg> originDataList = this.getAllOrgList();
|
||||
boolean errorLevel = this.getChildListById(originDataList, bizOrg.getId(), true).stream()
|
||||
.map(BizOrg::getId).collect(Collectors.toList()).contains(bizOrg.getParentId());
|
||||
if(errorLevel) {
|
||||
@@ -193,6 +253,8 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
this.updateById(bizOrg);
|
||||
// 发布更新事件
|
||||
CommonDataChangeEventCenter.doUpdateWithData(BizDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(bizOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -209,7 +271,7 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
} else {
|
||||
throw new CommonException("您没有权限删除这些机构,机构id:{}", orgIdList);
|
||||
}
|
||||
List<BizOrg> allOrgList = this.list();
|
||||
List<BizOrg> allOrgList = this.getAllOrgList();
|
||||
// 获取所有子机构
|
||||
List<String> toDeleteOrgIdList = CollectionUtil.newArrayList();
|
||||
orgIdList.forEach(orgId -> toDeleteOrgIdList.addAll(this.getChildListById(allOrgList, orgId, true).stream()
|
||||
@@ -246,6 +308,8 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
|
||||
// 发布删除事件
|
||||
CommonDataChangeEventCenter.doDeleteWithDataIdList(BizDataTypeEnum.ORG.getValue(), toDeleteOrgIdList);
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +329,13 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
|
||||
@Override
|
||||
public List<BizOrg> getAllOrgList() {
|
||||
return this.list(new LambdaQueryWrapper<BizOrg>().orderByAsc(BizOrg::getSortCode));
|
||||
Object cached = commonCacheOperator.get(ORG_ALL_LIST_CACHE_KEY);
|
||||
if (cached != null) {
|
||||
return JSONUtil.toList(JSONUtil.parseArray(cached), BizOrg.class);
|
||||
}
|
||||
List<BizOrg> list = this.list(new LambdaQueryWrapper<BizOrg>().orderByAsc(BizOrg::getSortCode));
|
||||
commonCacheOperator.put(ORG_ALL_LIST_CACHE_KEY, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -314,6 +384,8 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
this.save(bizOrg);
|
||||
// 发布增加事件
|
||||
CommonDataChangeEventCenter.doAddWithData(BizDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(bizOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
return bizOrg.getId();
|
||||
}
|
||||
|
||||
@@ -328,7 +400,7 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = this.list();
|
||||
List<BizOrg> allOrgList = this.getAllOrgList();
|
||||
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(this.getParentListById(allOrgList, orgId, true)));
|
||||
List<String> loginUserDataScopeFullList = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScopeFullList);
|
||||
|
||||
@@ -14,6 +14,7 @@ package vip.xiaonuo.biz.modular.position.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -31,6 +32,7 @@ import vip.xiaonuo.biz.modular.position.param.*;
|
||||
import vip.xiaonuo.biz.modular.position.service.BizPositionService;
|
||||
import vip.xiaonuo.common.annotation.CommonLog;
|
||||
import vip.xiaonuo.common.pojo.CommonResult;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
@@ -143,6 +145,20 @@ public class BizPositionController {
|
||||
return CommonResult.data(bizPositionService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "获取组织树选择器(懒加载)")
|
||||
@SaCheckPermission("/biz/position/orgTreeLazySelector")
|
||||
@GetMapping("/biz/position/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return CommonResult.data(bizPositionService.orgTreeLazySelector(bizOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择器
|
||||
*
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
package vip.xiaonuo.biz.modular.position.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.position.param.*;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -94,6 +96,14 @@ public interface BizPositionService extends IService<BizPosition> {
|
||||
*/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取机构树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:08
|
||||
*/
|
||||
List<JSONObject> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 获取岗位选择器
|
||||
*
|
||||
|
||||
@@ -32,8 +32,8 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
||||
import vip.xiaonuo.biz.core.enums.BizDataTypeEnum;
|
||||
import vip.xiaonuo.biz.modular.org.entity.BizOrg;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
import vip.xiaonuo.biz.modular.org.service.BizOrgService;
|
||||
import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.position.enums.BizPositionCategoryEnum;
|
||||
@@ -42,6 +42,7 @@ import vip.xiaonuo.biz.modular.position.param.*;
|
||||
import vip.xiaonuo.biz.modular.position.service.BizPositionService;
|
||||
import vip.xiaonuo.biz.modular.user.entity.BizUser;
|
||||
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
||||
import vip.xiaonuo.biz.core.enums.BizDataTypeEnum;
|
||||
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
||||
import vip.xiaonuo.common.exception.CommonException;
|
||||
import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
||||
@@ -239,6 +240,11 @@ public class BizPositionServiceImpl extends ServiceImpl<BizPositionMapper, BizPo
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return bizOrgService.treeLazy(bizOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BizPosition> positionSelector(BizPositionSelectorPositionParam bizPositionSelectorPositionParam) {
|
||||
QueryWrapper<BizPosition> queryWrapper = new QueryWrapper<BizPosition>();
|
||||
|
||||
@@ -14,6 +14,7 @@ package vip.xiaonuo.biz.modular.user.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vip.xiaonuo.biz.modular.org.entity.BizOrg;
|
||||
import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
import vip.xiaonuo.biz.modular.user.entity.BizUser;
|
||||
import vip.xiaonuo.biz.modular.user.enums.BizUserSourceFromTypeEnum;
|
||||
import vip.xiaonuo.biz.modular.user.param.*;
|
||||
@@ -258,6 +260,20 @@ public class BizUserController {
|
||||
return CommonResult.data(bizUserService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "获取机构树选择器(懒加载)")
|
||||
@SaCheckPermission("/biz/user/orgTreeLazySelector")
|
||||
@GetMapping("/biz/user/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return CommonResult.data(bizUserService.orgTreeLazySelector(bizOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构列表选择器
|
||||
*
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
package vip.xiaonuo.biz.modular.user.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import vip.xiaonuo.biz.modular.org.entity.BizOrg;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.user.entity.BizUser;
|
||||
import vip.xiaonuo.biz.modular.user.param.*;
|
||||
@@ -147,6 +149,14 @@ public interface BizUserService extends IService<BizUser> {
|
||||
*/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取机构树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/5/13 21:00
|
||||
*/
|
||||
List<JSONObject> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 获取机构列表选择器
|
||||
*
|
||||
|
||||
@@ -57,6 +57,7 @@ import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
||||
import vip.xiaonuo.biz.core.enums.BizBuildInEnum;
|
||||
import vip.xiaonuo.biz.core.enums.BizDataTypeEnum;
|
||||
import vip.xiaonuo.biz.modular.org.entity.BizOrg;
|
||||
import vip.xiaonuo.biz.modular.org.param.BizOrgTreeLazyParam;
|
||||
import vip.xiaonuo.biz.modular.org.service.BizOrgService;
|
||||
import vip.xiaonuo.biz.modular.position.entity.BizPosition;
|
||||
import vip.xiaonuo.biz.modular.position.service.BizPositionService;
|
||||
@@ -640,6 +641,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(BizOrgTreeLazyParam bizOrgTreeLazyParam) {
|
||||
return bizOrgService.treeLazy(bizOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BizOrg> orgListSelector(BizUserSelectorOrgListParam bizUserSelectorOrgListParam) {
|
||||
QueryWrapper<BizOrg> queryWrapper = new QueryWrapper<BizOrg>().checkSqlInjection();
|
||||
|
||||
@@ -201,6 +201,18 @@ public class DevConfigController {
|
||||
return CommonResult.data(sysOrgApi.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构选树(懒加载)
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2025/4/23 20:00
|
||||
*/
|
||||
@Operation(summary = "获取机构选树(懒加载)")
|
||||
@GetMapping("/dev/config/orgTreeLazy")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazy(String parentId) {
|
||||
return CommonResult.data(sysOrgApi.orgTreeLazySelector(parentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择器
|
||||
*
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package vip.xiaonuo.sys.modular.org.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -77,6 +78,19 @@ public class SysOrgController {
|
||||
return CommonResult.data(sysOrgService.tree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取组织树(懒加载)")
|
||||
@GetMapping("/sys/org/treeLazy")
|
||||
public CommonResult<List<JSONObject>> treeLazy(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return CommonResult.data(sysOrgService.treeLazy(sysOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加组织
|
||||
*
|
||||
@@ -166,6 +180,19 @@ public class SysOrgController {
|
||||
return CommonResult.data(sysOrgService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "获取组织树选择器(懒加载)")
|
||||
@GetMapping("/sys/org/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return CommonResult.data(sysOrgService.treeLazy(sysOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户选择器
|
||||
*
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright [2022] [https://www.xiaonuo.vip]
|
||||
*
|
||||
* Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||
*
|
||||
* 1.请不要删除和修改根目录下的LICENSE文件.
|
||||
* 2.请不要删除和修改Snowy源码头部的版权声明.
|
||||
* 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等.
|
||||
* 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
|
||||
* 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作.
|
||||
* 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||
*/
|
||||
package vip.xiaonuo.sys.modular.org.param;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 组织树懒加载参数
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/21 16:13
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysOrgTreeLazyParam {
|
||||
|
||||
/** 父id */
|
||||
@Schema(description = "父id")
|
||||
private String parentId;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
import vip.xiaonuo.sys.api.SysOrgApi;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgSelectorOrgListParam;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.org.service.SysOrgService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -59,6 +60,13 @@ public class SysOrgApiProvider implements SysOrgApi {
|
||||
return sysOrgService.orgTreeSelector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(String parentId) {
|
||||
SysOrgTreeLazyParam sysOrgTreeLazyParam = new SysOrgTreeLazyParam();
|
||||
sysOrgTreeLazyParam.setParentId(parentId);
|
||||
return sysOrgService.treeLazy(sysOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@Override
|
||||
public Page<JSONObject> orgListSelector(String parentId) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package vip.xiaonuo.sys.modular.org.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
@@ -45,6 +46,14 @@ public interface SysOrgService extends IService<SysOrg> {
|
||||
*/
|
||||
List<Tree<String>> tree();
|
||||
|
||||
/**
|
||||
* 获取机构树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/21 16:13
|
||||
**/
|
||||
List<JSONObject> treeLazy(SysOrgTreeLazyParam sysOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 添加组织
|
||||
*
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
|
||||
import vip.xiaonuo.common.cache.CommonCacheOperator;
|
||||
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
||||
import vip.xiaonuo.common.exception.CommonException;
|
||||
import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
||||
@@ -53,6 +55,7 @@ import vip.xiaonuo.sys.modular.user.service.SysUserService;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -64,6 +67,11 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> implements SysOrgService {
|
||||
|
||||
private static final String ORG_ALL_LIST_CACHE_KEY = "sys-org:all-list";
|
||||
|
||||
@Resource
|
||||
private CommonCacheOperator commonCacheOperator;
|
||||
|
||||
@Resource
|
||||
private SysOrgExtService sysOrgExtService;
|
||||
|
||||
@@ -111,6 +119,58 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> treeLazy(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
String parentId = ObjectUtil.isNotEmpty(sysOrgTreeLazyParam.getParentId()) ? sysOrgTreeLazyParam.getParentId() : "0";
|
||||
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
||||
|
||||
// 获取所有机构
|
||||
List<SysOrg> allOrgList = this.getAllOrgList();
|
||||
Set<String> visibleOrgIds = null;
|
||||
|
||||
// 如果数据范围不为空,则计算可见机构ID集合(包含自身及其所有父级)
|
||||
if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
Set<SysOrg> sysOrgSet = CollectionUtil.newHashSet();
|
||||
loginUserDataScope.forEach(orgId -> sysOrgSet.addAll(this.getParentListById(allOrgList, orgId, true)));
|
||||
visibleOrgIds = sysOrgSet.stream().map(SysOrg::getId).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// 过滤出当前父级下的可见子级
|
||||
final Set<String> finalVisibleOrgIds = visibleOrgIds;
|
||||
List<SysOrg> sysOrgList = allOrgList.stream()
|
||||
.filter(sysOrg -> sysOrg.getParentId().equals(parentId))
|
||||
.filter(sysOrg -> finalVisibleOrgIds == null || finalVisibleOrgIds.contains(sysOrg.getId()))
|
||||
.sorted(Comparator.comparingInt(SysOrg::getSortCode).thenComparing(SysOrg::getId))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(sysOrgList)) {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
|
||||
// 判断这些机构是否还有可见子机构
|
||||
return sysOrgList.stream().map(sysOrg -> {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(sysOrg);
|
||||
// 计算是否有可见的子节点
|
||||
boolean hasChildren = allOrgList.stream()
|
||||
.anyMatch(item -> item.getParentId().equals(sysOrg.getId()) && (finalVisibleOrgIds == null || finalVisibleOrgIds.contains(item.getId())));
|
||||
|
||||
jsonObject.set("isLeaf", !hasChildren);
|
||||
return jsonObject;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构树(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/21 16:13
|
||||
**/
|
||||
public List<JSONObject> treeLazy(String parentId) {
|
||||
SysOrgTreeLazyParam sysOrgTreeLazyParam = new SysOrgTreeLazyParam();
|
||||
sysOrgTreeLazyParam.setParentId(parentId);
|
||||
return this.treeLazy(sysOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void add(SysOrgAddParam sysOrgAddParam, String sourceFromType) {
|
||||
@@ -129,6 +189,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
sysOrgExtService.createExtInfo(sysOrg.getId(), sourceFromType);
|
||||
// 发布增加事件
|
||||
CommonDataChangeEventCenter.doAddWithData(SysDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(sysOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -152,6 +214,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
this.updateById(sysOrg);
|
||||
// 发布更新事件
|
||||
CommonDataChangeEventCenter.doUpdateWithData(SysDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(sysOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -197,6 +261,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
|
||||
// 发布删除事件
|
||||
CommonDataChangeEventCenter.doDeleteWithDataIdList(SysDataTypeEnum.ORG.getValue(), toDeleteOrgIdList);
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +311,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
}
|
||||
}
|
||||
});
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +327,13 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
|
||||
@Override
|
||||
public List<SysOrg> getAllOrgList() {
|
||||
return this.list(new LambdaQueryWrapper<SysOrg>().orderByAsc(SysOrg::getSortCode));
|
||||
Object cached = commonCacheOperator.get(ORG_ALL_LIST_CACHE_KEY);
|
||||
if (cached != null) {
|
||||
return JSONUtil.toList(JSONUtil.parseArray(cached), SysOrg.class);
|
||||
}
|
||||
List<SysOrg> list = this.list(new LambdaQueryWrapper<SysOrg>().orderByAsc(SysOrg::getSortCode));
|
||||
commonCacheOperator.put(ORG_ALL_LIST_CACHE_KEY, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,6 +385,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
sysOrgExtService.createExtInfo(sysOrg.getId(), SysOrgSourceFromTypeEnum.SYSTEM_ADD.getValue());
|
||||
// 发布增加事件
|
||||
CommonDataChangeEventCenter.doAddWithData(SysDataTypeEnum.ORG.getValue(), JSONUtil.createArray().put(sysOrg));
|
||||
// 清除缓存
|
||||
commonCacheOperator.remove(ORG_ALL_LIST_CACHE_KEY);
|
||||
return sysOrg.getId();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package vip.xiaonuo.sys.modular.position.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vip.xiaonuo.common.annotation.CommonLog;
|
||||
import vip.xiaonuo.common.pojo.CommonResult;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.position.param.*;
|
||||
import vip.xiaonuo.sys.modular.position.service.SysPositionService;
|
||||
@@ -136,6 +138,19 @@ public class SysPositionController {
|
||||
return CommonResult.data(sysPositionService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "获取组织树选择器(懒加载)")
|
||||
@GetMapping("/sys/position/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return CommonResult.data(sysPositionService.orgTreeLazySelector(sysOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职位选择器
|
||||
*
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
package vip.xiaonuo.sys.modular.position.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.position.param.*;
|
||||
|
||||
@@ -102,6 +104,14 @@ public interface SysPositionService extends IService<SysPosition> {
|
||||
*/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/22 15:53
|
||||
**/
|
||||
List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 获取职位选择器
|
||||
*
|
||||
|
||||
@@ -36,6 +36,7 @@ import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
||||
import vip.xiaonuo.common.page.CommonPageRequest;
|
||||
import vip.xiaonuo.sys.core.enums.SysDataTypeEnum;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.org.service.SysOrgService;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.position.enums.SysPositionCategoryEnum;
|
||||
@@ -200,6 +201,11 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return sysOrgService.treeLazy(sysOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysPosition> positionSelector(SysPositionSelectorPositionParam sysPositionSelectorPositionParam) {
|
||||
QueryWrapper<SysPosition> queryWrapper = new QueryWrapper<SysPosition>().checkSqlInjection();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package vip.xiaonuo.sys.modular.role.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xingfudeshi.knife4j.annotations.ApiSupport;
|
||||
@@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vip.xiaonuo.common.annotation.CommonLog;
|
||||
import vip.xiaonuo.common.pojo.CommonResult;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.role.entity.SysRole;
|
||||
import vip.xiaonuo.sys.modular.role.param.*;
|
||||
import vip.xiaonuo.sys.modular.role.result.*;
|
||||
@@ -251,6 +253,19 @@ public class SysRoleController {
|
||||
return CommonResult.data(sysRoleService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 15)
|
||||
@Operation(summary = "获取组织树选择器(懒加载)")
|
||||
@GetMapping("/sys/role/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return CommonResult.data(sysRoleService.orgTreeLazySelector(sysOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源授权树
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@ import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.resource.entity.SysMenu;
|
||||
import vip.xiaonuo.sys.modular.role.entity.SysRole;
|
||||
import vip.xiaonuo.sys.modular.role.param.*;
|
||||
@@ -154,6 +155,14 @@ public interface SysRoleService extends IService<SysRole> {
|
||||
*/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 获取资源授权树
|
||||
*
|
||||
|
||||
@@ -41,6 +41,7 @@ import vip.xiaonuo.mobile.api.MobileMenuApi;
|
||||
import vip.xiaonuo.sys.core.enums.SysBuildInEnum;
|
||||
import vip.xiaonuo.sys.core.enums.SysDataTypeEnum;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.org.service.SysOrgService;
|
||||
import vip.xiaonuo.sys.modular.relation.entity.SysRelation;
|
||||
import vip.xiaonuo.sys.modular.relation.enums.SysRelationCategoryEnum;
|
||||
@@ -357,6 +358,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return sysOrgService.treeLazy(sysOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRoleGrantResourceTreeResult> resourceTreeSelector(boolean containsTen) {
|
||||
LambdaQueryWrapper<SysMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -31,6 +31,7 @@ import vip.xiaonuo.common.pojo.CommonResult;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.role.entity.SysRole;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.user.entity.SysUser;
|
||||
import vip.xiaonuo.sys.modular.user.enums.SysUserSourceFromTypeEnum;
|
||||
import vip.xiaonuo.sys.modular.user.param.*;
|
||||
@@ -329,6 +330,19 @@ public class SysUserController {
|
||||
return CommonResult.data(sysUserService.orgTreeSelector());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/4/24 20:00
|
||||
*/
|
||||
@ApiOperationSupport(order = 19)
|
||||
@Operation(summary = "获取组织树选择器(懒加载)")
|
||||
@GetMapping("/sys/user/orgTreeLazySelector")
|
||||
public CommonResult<List<JSONObject>> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return CommonResult.data(sysUserService.orgTreeLazySelector(sysOrgTreeLazyParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织列表选择器
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@ import vip.xiaonuo.sys.modular.group.entity.SysGroup;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.role.entity.SysRole;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.user.entity.SysUser;
|
||||
import vip.xiaonuo.sys.modular.user.entity.SysUserExt;
|
||||
import vip.xiaonuo.sys.modular.user.param.*;
|
||||
@@ -480,6 +481,14 @@ public interface SysUserService extends IService<SysUser> {
|
||||
*/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织树选择器(懒加载)
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/5/13 21:00
|
||||
*/
|
||||
List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam);
|
||||
|
||||
/**
|
||||
* 获取组织列表选择器
|
||||
*
|
||||
|
||||
@@ -88,6 +88,7 @@ import vip.xiaonuo.sys.core.util.SysPasswordUtl;
|
||||
import vip.xiaonuo.sys.modular.group.entity.SysGroup;
|
||||
import vip.xiaonuo.sys.modular.group.service.SysGroupService;
|
||||
import vip.xiaonuo.sys.modular.org.entity.SysOrg;
|
||||
import vip.xiaonuo.sys.modular.org.param.SysOrgTreeLazyParam;
|
||||
import vip.xiaonuo.sys.modular.org.service.SysOrgService;
|
||||
import vip.xiaonuo.sys.modular.position.entity.SysPosition;
|
||||
import vip.xiaonuo.sys.modular.position.service.SysPositionService;
|
||||
@@ -2004,6 +2005,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return TreeUtil.build(treeNodeList, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> orgTreeLazySelector(SysOrgTreeLazyParam sysOrgTreeLazyParam) {
|
||||
return sysOrgService.treeLazy(sysOrgTreeLazyParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysOrg> orgListSelector(SysUserSelectorOrgListParam sysUserSelectorOrgListParam) {
|
||||
QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<SysOrg>().checkSqlInjection();
|
||||
|
||||
Reference in New Issue
Block a user