添加部门树

This commit is contained in:
zhangzhiqiang
2022-12-01 08:51:50 +08:00
parent f0c119865d
commit e306540bb8
3 changed files with 23 additions and 5 deletions

View File

@@ -31,8 +31,9 @@ import java.util.Objects;
@Getter
@Setter
public class DeptTree implements Serializable {
private Long Dept_id;
private Long pid;
private String name;
@JsonInclude(JsonInclude.Include.NON_EMPTY)

View File

@@ -92,3 +92,20 @@
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
PAGEQUERY
SELECT
max(t3.childId)
from
(
select *,
if( find_in_set(t1.pid, @p) > 0,@p := concat(@p,',',id),0 ) as childId
from
(select dept_id as id, pid from sys_dept t order by id) t1,
(select @p := '输入.pid') t2
) t3
where childId != '0'
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -78,10 +78,9 @@
<el-input v-model="form.email" style="width: 200px;" />
</el-form-item>
<el-form-item label="部门" prop="dept.id" :rules="[{ required: true, message: '请选择部门', trigger: 'change' }]">
<treeselect
<el-tree-select
v-model="form.dept.id"
:options="depts"
:load-options="loadDepts"
:data="deptDatas"
style="width: 200px"
placeholder="选择部门"
/>
@@ -365,7 +364,6 @@ export default {
getDeptTree() {
setTimeout(() => {
getDeptTreee().then(res => {
debugger
this.deptDatas = res.content
})
}, 100)
@@ -374,6 +372,7 @@ export default {
console.log('获取部门')
getDepts({ is_used: 1 }).then(res => {
console.log('获取的部门信息', res)
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
@@ -402,6 +401,7 @@ export default {
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
debugger
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ is_used: 1, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {