Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
9f4918cc
提交
9f4918cc
authored
5月 16, 2020
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改上级部门(选择项排除本身和下级)
上级
8c7aca25
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
9 行删除
+38
-9
dept.js
ruoyi-ui/src/api/system/dept.js
+8
-0
index.vue
ruoyi-ui/src/views/system/dept/index.vue
+7
-9
SysDeptController.java
...om/ruoyi/project/system/controller/SysDeptController.java
+23
-0
没有找到文件。
ruoyi-ui/src/api/system/dept.js
浏览文件 @
9f4918cc
...
@@ -9,6 +9,14 @@ export function listDept(query) {
...
@@ -9,6 +9,14 @@ export function listDept(query) {
})
})
}
}
// 查询部门列表(排除节点)
export
function
listDeptExcludeChild
(
deptId
)
{
return
request
({
url
:
'/system/dept/list/exclude/'
+
deptId
,
method
:
'get'
})
}
// 查询部门详细
// 查询部门详细
export
function
getDept
(
deptId
)
{
export
function
getDept
(
deptId
)
{
return
request
({
return
request
({
...
...
ruoyi-ui/src/views/system/dept/index.vue
浏览文件 @
9f4918cc
...
@@ -138,7 +138,7 @@
...
@@ -138,7 +138,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
listDept
,
getDept
,
delDept
,
addDept
,
updateDept
}
from
"@/api/system/dept"
;
import
{
listDept
,
getDept
,
delDept
,
addDept
,
updateDept
,
listDeptExcludeChild
}
from
"@/api/system/dept"
;
import
Treeselect
from
"@riophae/vue-treeselect"
;
import
Treeselect
from
"@riophae/vue-treeselect"
;
import
"@riophae/vue-treeselect/dist/vue-treeselect.css"
;
import
"@riophae/vue-treeselect/dist/vue-treeselect.css"
;
...
@@ -220,12 +220,6 @@ export default {
...
@@ -220,12 +220,6 @@ export default {
children
:
node
.
children
children
:
node
.
children
};
};
},
},
/** 查询部门下拉树结构 */
getTreeselect
()
{
listDept
().
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"deptId"
);
});
},
// 字典状态字典翻译
// 字典状态字典翻译
statusFormat
(
row
,
column
)
{
statusFormat
(
row
,
column
)
{
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
);
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
);
...
@@ -256,22 +250,26 @@ export default {
...
@@ -256,22 +250,26 @@ export default {
/** 新增按钮操作 */
/** 新增按钮操作 */
handleAdd
(
row
)
{
handleAdd
(
row
)
{
this
.
reset
();
this
.
reset
();
this
.
getTreeselect
();
if
(
row
!=
undefined
)
{
if
(
row
!=
undefined
)
{
this
.
form
.
parentId
=
row
.
deptId
;
this
.
form
.
parentId
=
row
.
deptId
;
}
}
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"添加部门"
;
this
.
title
=
"添加部门"
;
listDept
().
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"deptId"
);
});
},
},
/** 修改按钮操作 */
/** 修改按钮操作 */
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
this
.
reset
();
this
.
reset
();
this
.
getTreeselect
();
getDept
(
row
.
deptId
).
then
(
response
=>
{
getDept
(
row
.
deptId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"修改部门"
;
this
.
title
=
"修改部门"
;
});
});
listDeptExcludeChild
(
row
.
deptId
).
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"deptId"
);
});
},
},
/** 提交按钮 */
/** 提交按钮 */
submitForm
:
function
()
{
submitForm
:
function
()
{
...
...
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
浏览文件 @
9f4918cc
package
com
.
ruoyi
.
project
.
system
.
controller
;
package
com
.
ruoyi
.
project
.
system
.
controller
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -45,6 +47,27 @@ public class SysDeptController extends BaseController
...
@@ -45,6 +47,27 @@ public class SysDeptController extends BaseController
return
AjaxResult
.
success
(
depts
);
return
AjaxResult
.
success
(
depts
);
}
}
/**
* 查询部门列表(排除节点)
*/
@PreAuthorize
(
"@ss.hasPermi('system:dept:list')"
)
@GetMapping
(
"/list/exclude/{deptId}"
)
public
AjaxResult
excludeChild
(
@PathVariable
(
value
=
"deptId"
,
required
=
false
)
Long
deptId
)
{
List
<
SysDept
>
depts
=
deptService
.
selectDeptList
(
new
SysDept
());
Iterator
<
SysDept
>
it
=
depts
.
iterator
();
while
(
it
.
hasNext
())
{
SysDept
d
=
(
SysDept
)
it
.
next
();
if
(
d
.
getDeptId
().
intValue
()
==
deptId
||
ArrayUtils
.
contains
(
StringUtils
.
split
(
d
.
getAncestors
(),
","
),
deptId
+
""
))
{
it
.
remove
();
}
}
return
AjaxResult
.
success
(
depts
);
}
/**
/**
* 根据部门编号获取详细信息
* 根据部门编号获取详细信息
*/
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论