【更新】修复业务模块下机构选择器树无法构造的bug,前端保持左树右表跟form表单各自统一

pull/146/MERGE
小诺 2023-07-29 01:02:52 +08:00 committed by 俞宝山
parent 545cced87c
commit 4d2a987c9b
12 changed files with 59 additions and 28 deletions

View File

@ -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')
}
}

View File

@ -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')
}
}

View File

@ -102,7 +102,7 @@
})
}
//
bizOrgApi.orgTree().then((res) => {
bizOrgApi.orgTreeSelector().then((res) => {
treeData.value = [
{
id: 0,

View File

@ -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>

View File

@ -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) {

View File

@ -102,7 +102,7 @@
})
}
//
orgApi.orgTree().then((res) => {
orgApi.orgOrgTreeSelector().then((res) => {
treeData.value = [
{
id: 0,

View File

@ -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')
})

View File

@ -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(() => {

View File

@ -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

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}