Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
9f4918cc
Commit
9f4918cc
authored
May 16, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上级部门(选择项排除本身和下级)
parent
8c7aca25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
9 deletions
+38
-9
ruoyi-ui/src/api/system/dept.js
ruoyi-ui/src/api/system/dept.js
+8
-0
ruoyi-ui/src/views/system/dept/index.vue
ruoyi-ui/src/views/system/dept/index.vue
+7
-9
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
...om/ruoyi/project/system/controller/SysDeptController.java
+23
-0
No files found.
ruoyi-ui/src/api/system/dept.js
View file @
9f4918cc
...
...
@@ -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
)
{
return
request
({
...
...
ruoyi-ui/src/views/system/dept/index.vue
View file @
9f4918cc
...
...
@@ -138,7 +138,7 @@
</template>
<
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
"
@riophae/vue-treeselect/dist/vue-treeselect.css
"
;
...
...
@@ -220,12 +220,6 @@ export default {
children
:
node
.
children
};
},
/** 查询部门下拉树结构 */
getTreeselect
()
{
listDept
().
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"
deptId
"
);
});
},
// 字典状态字典翻译
statusFormat
(
row
,
column
)
{
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
);
...
...
@@ -256,22 +250,26 @@ export default {
/** 新增按钮操作 */
handleAdd
(
row
)
{
this
.
reset
();
this
.
getTreeselect
();
if
(
row
!=
undefined
)
{
this
.
form
.
parentId
=
row
.
deptId
;
}
this
.
open
=
true
;
this
.
title
=
"
添加部门
"
;
listDept
().
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"
deptId
"
);
});
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
this
.
getTreeselect
();
getDept
(
row
.
deptId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改部门
"
;
});
listDeptExcludeChild
(
row
.
deptId
).
then
(
response
=>
{
this
.
deptOptions
=
this
.
handleTree
(
response
.
data
,
"
deptId
"
);
});
},
/** 提交按钮 */
submitForm
:
function
()
{
...
...
ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java
View file @
9f4918cc
package
com.ruoyi.project.system.controller
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -45,6 +47,27 @@ public class SysDeptController extends BaseController
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
);
}
/**
* 根据部门编号获取详细信息
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment