mirror of https://gitee.com/xiaonuobase/snowy
【更新】修复业务模块下机构选择器树无法构造的bug,前端保持左树右表跟form表单各自统一
parent
545cced87c
commit
4d2a987c9b
|
@ -37,5 +37,13 @@ export default {
|
|||
// 获取岗位详情
|
||||
positionDetail(data) {
|
||||
return request('detail', data, 'get')
|
||||
},
|
||||
// 获取机构树选择器
|
||||
positionOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取岗位选择器
|
||||
positionPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,5 +37,13 @@ export default {
|
|||
// 获取职位详情
|
||||
positionDetail(data) {
|
||||
return request('detail', data, 'get')
|
||||
},
|
||||
// 获取组织树选择器
|
||||
positionOrgTreeSelector(data) {
|
||||
return request('orgTreeSelector', data, 'get')
|
||||
},
|
||||
// 获取职位选择器
|
||||
positionPositionSelector(data) {
|
||||
return request('positionSelector', data, 'get')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
})
|
||||
}
|
||||
// 获取机构树并加入顶级
|
||||
bizOrgApi.orgTree().then((res) => {
|
||||
bizOrgApi.orgTreeSelector().then((res) => {
|
||||
treeData.value = [
|
||||
{
|
||||
id: 0,
|
||||
|
|
|
@ -50,14 +50,13 @@
|
|||
|
||||
<script setup name="bizPositionForm">
|
||||
import { required } from '@/utils/formRules'
|
||||
import bizOrgApi from '@/api/biz/bizOrgApi'
|
||||
import bizPositionApi from '@/api/biz/bizPositionApi'
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits({ successful: null })
|
||||
// 默认是关闭状态
|
||||
let visible = $ref(false)
|
||||
const visible = ref(false)
|
||||
const formRef = ref()
|
||||
// 表单数据,也就是默认给一些数据
|
||||
const formData = ref({})
|
||||
|
@ -67,7 +66,7 @@
|
|||
|
||||
// 打开抽屉
|
||||
const onOpen = (record, orgId) => {
|
||||
visible = true
|
||||
visible.value = true
|
||||
formData.value = {
|
||||
sortCode: 99
|
||||
}
|
||||
|
@ -78,13 +77,13 @@
|
|||
formData.value = Object.assign({}, record)
|
||||
}
|
||||
// 获取机构树
|
||||
bizOrgApi.orgTree().then((res) => {
|
||||
bizPositionApi.positionOrgTreeSelector().then((res) => {
|
||||
treeData.value = res
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
}
|
||||
// 默认要校验的
|
||||
const formRules = {
|
||||
|
@ -103,7 +102,7 @@
|
|||
bizPositionApi
|
||||
.submitForm(formData.value, formData.value.id)
|
||||
.then(() => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
emit('successful')
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -117,5 +116,3 @@
|
|||
onOpen
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
@ -155,6 +155,7 @@
|
|||
import tool from '@/utils/tool'
|
||||
import downloadUtil from '@/utils/downloadUtil'
|
||||
import bizUserApi from '@/api/biz/bizUserApi'
|
||||
import bizOrgApi from '@/api/biz/bizOrgApi'
|
||||
import userCenterApi from '@/api/sys/userCenterApi'
|
||||
import roleSelectorPlus from '@/components/Selector/roleSelectorPlus.vue'
|
||||
import Form from './form.vue'
|
||||
|
@ -237,8 +238,8 @@
|
|||
table.value.refresh(true)
|
||||
}
|
||||
// 左侧树查询
|
||||
bizUserApi
|
||||
.userOrgTreeSelector()
|
||||
bizOrgApi
|
||||
.orgTree()
|
||||
.then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
})
|
||||
}
|
||||
// 获取机构树并加入顶级
|
||||
orgApi.orgTree().then((res) => {
|
||||
orgApi.orgOrgTreeSelector().then((res) => {
|
||||
treeData.value = [
|
||||
{
|
||||
id: 0,
|
||||
|
|
|
@ -49,14 +49,13 @@
|
|||
|
||||
<script setup name="positionForm">
|
||||
import { required } from '@/utils/formRules'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import positionApi from '@/api/sys/positionApi'
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits({ successful: null })
|
||||
// 默认是关闭状态
|
||||
let visible = $ref(false)
|
||||
const visible = ref(false)
|
||||
const formRef = ref()
|
||||
// 表单数据,也就是默认给一些数据
|
||||
const formData = ref({})
|
||||
|
@ -66,7 +65,7 @@
|
|||
|
||||
// 打开抽屉
|
||||
const onOpen = (record, orgId) => {
|
||||
visible = true
|
||||
visible.value = true
|
||||
formData.value = {
|
||||
sortCode: 99
|
||||
}
|
||||
|
@ -77,13 +76,13 @@
|
|||
formData.value = Object.assign({}, record)
|
||||
}
|
||||
// 获取机构树
|
||||
orgApi.orgTree().then((res) => {
|
||||
positionApi.positionOrgTreeSelector().then((res) => {
|
||||
treeData.value = res
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
}
|
||||
// 默认要校验的
|
||||
const formRules = {
|
||||
|
@ -98,7 +97,7 @@
|
|||
formRef.value.validate().then(() => {
|
||||
submitLoading.value = true
|
||||
positionApi.submitForm(formData.value, formData.value.id).then(() => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
submitLoading.value = false
|
||||
emit('successful')
|
||||
})
|
||||
|
|
|
@ -50,13 +50,12 @@
|
|||
<script setup name="roleForm">
|
||||
import { required } from '@/utils/formRules'
|
||||
import tool from '@/utils/tool'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import roleApi from '@/api/sys/roleApi'
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits({ successful: null })
|
||||
// 默认是关闭状态
|
||||
let visible = $ref(false)
|
||||
const visible = ref(false)
|
||||
const formRef = ref()
|
||||
// 表单数据,也就是默认给一些数据
|
||||
const formData = ref({})
|
||||
|
@ -66,7 +65,7 @@
|
|||
|
||||
// 打开抽屉
|
||||
const onOpen = (record, category, orgId) => {
|
||||
visible = true
|
||||
visible.value = true
|
||||
formData.value = {
|
||||
sortCode: 99
|
||||
}
|
||||
|
@ -82,13 +81,13 @@
|
|||
formData.value = Object.assign({}, record)
|
||||
}
|
||||
// 获取机构树并加入顶级
|
||||
orgApi.orgTree().then((res) => {
|
||||
roleApi.roleOrgTreeSelector().then((res) => {
|
||||
treeData.value = res
|
||||
})
|
||||
}
|
||||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
}
|
||||
// 默认要校验的
|
||||
const formRules = {
|
||||
|
@ -106,7 +105,7 @@
|
|||
roleApi
|
||||
.submitForm(formData.value, formData.value.id)
|
||||
.then(() => {
|
||||
visible = false
|
||||
visible.value = false
|
||||
emit('successful')
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
|
@ -153,6 +153,7 @@
|
|||
import tool from '@/utils/tool'
|
||||
import downloadUtil from '@/utils/downloadUtil'
|
||||
import userApi from '@/api/sys/userApi'
|
||||
import orgApi from '@/api/sys/orgApi'
|
||||
import userCenterApi from '@/api/sys/userCenterApi'
|
||||
import roleSelectorPlus from '@/components/Selector/roleSelectorPlus.vue'
|
||||
import Form from './form.vue'
|
||||
|
@ -231,7 +232,7 @@
|
|||
})
|
||||
}
|
||||
// 左侧树查询
|
||||
userApi.userOrgTreeSelector().then((res) => {
|
||||
orgApi.orgTree().then((res) => {
|
||||
cardLoading.value = false
|
||||
if (res !== null) {
|
||||
treeData.value = res
|
||||
|
|
|
@ -321,8 +321,14 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
|||
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// 校验数据范围
|
||||
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
||||
// 定义机构集合
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScope);
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = this.list();
|
||||
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);
|
||||
} else {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
|
|
|
@ -216,8 +216,14 @@ public class BizPositionServiceImpl extends ServiceImpl<BizPositionMapper, BizPo
|
|||
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// 校验数据范围
|
||||
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
||||
// 定义机构集合
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScope);
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = bizOrgService.list();
|
||||
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
|
||||
List<String> loginUserDataScopeFullList = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScopeFullList);
|
||||
} else {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
|
|
|
@ -611,8 +611,14 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|||
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// 校验数据范围
|
||||
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
||||
// 定义机构集合
|
||||
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
||||
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScope);
|
||||
// 获取所有机构
|
||||
List<BizOrg> allOrgList = bizOrgService.list();
|
||||
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
|
||||
List<String> loginUserDataScopeFullList = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScopeFullList);
|
||||
} else {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue