Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
04f292f4
Commit
04f292f4
authored
Dec 11, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部门列表展示
parent
b9ff2e18
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
23 deletions
+104
-23
src/main/webapp/WEB-INF/common/_container.html
+6
-0
src/main/webapp/WEB-INF/system/dept/dept.html
+13
-3
src/main/webapp/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.css
+20
-0
src/main/webapp/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.js
+2
-0
src/main/webapp/assets/modular/system/dept/dept.js
+63
-20
No files found.
src/main/webapp/WEB-INF/common/_container.html
View file @
04f292f4
...
@@ -65,6 +65,9 @@
...
@@ -65,6 +65,9 @@
@if(array.contain(plugins,"bootstrap-treetable")){
@if(array.contain(plugins,"bootstrap-treetable")){
<link
href=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
@}
@}
@if(array.contain(plugins,"treeview")){
<link
href=
"${ctxPath}/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
@}
@}
@}
<!--其他业务用的css-->
<!--其他业务用的css-->
...
@@ -166,6 +169,9 @@
...
@@ -166,6 +169,9 @@
<script
src=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.js"
></script>
<script
src=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.js"
></script>
<script
src=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable-object.js"
></script>
<script
src=
"${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable-object.js"
></script>
@}
@}
@if(array.contain(plugins,"treeview")){
<script
src=
"${ctxPath}/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.js"
></script>
@}
@}
@}
<!--其他业务用的js-->
<!--其他业务用的js-->
...
...
src/main/webapp/WEB-INF/system/dept/dept.html
View file @
04f292f4
@layout("/common/_container.html",{plugins:["table","layer","
bootstrap-treetable
"],js:["/assets/modular/system/dept/dept.js"]}){
@layout("/common/_container.html",{plugins:["table","layer","
sweet-alert","treeview
"],js:["/assets/modular/system/dept/dept.js"]}){
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-12"
id=
"deptPage"
>
<div
class=
"col-lg-2 col-sm-3 p-r-0"
>
<div
class=
"card card-outline-theme"
>
<div
class=
"card-header"
>
<h5
class=
"m-b-0 text-white"
>
部门树列表
</h5>
</div>
<div
class=
"card-body"
>
<ul
id=
"deptTree"
class=
"p-l-0"
></ul>
</div>
</div>
</div>
<div
class=
"col-lg-10 col-sm-9"
id=
"deptPage"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<div
class=
"card card-outline-theme m-b-10"
>
<div
class=
"card card-outline-theme m-b-10"
>
...
@@ -41,7 +51,7 @@
...
@@ -41,7 +51,7 @@
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<div
class=
"card m-b-0 p-b-0"
>
<div
class=
"card m-b-0 p-b-0"
>
<div
class=
"hidden-xs"
id=
"
manager
TableToolbar"
role=
"group"
>
<div
class=
"hidden-xs"
id=
"
Dept
TableToolbar"
role=
"group"
>
@if(shiro.hasPermission("/dept/add")){
@if(shiro.hasPermission("/dept/add")){
<button
type=
"button"
class=
"btn btn-primary waves-effect m-l-5"
onclick=
"Dept.openAddDept()"
>
<button
type=
"button"
class=
"btn btn-primary waves-effect m-l-5"
onclick=
"Dept.openAddDept()"
>
<i
class=
"fa fa-check-circle"
></i>
添加
<i
class=
"fa fa-check-circle"
></i>
添加
...
...
src/main/webapp/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.css
0 → 100644
View file @
04f292f4
.treeview
.list-group-item
{
cursor
:
pointer
;
padding
:
.5rem
1.25rem
;
}
.treeview
span
.indent
{
margin-left
:
10px
;
margin-right
:
10px
}
.treeview
span
.icon
{
width
:
12px
;
margin-right
:
5px
}
.treeview
.node-disabled
{
color
:
silver
;
cursor
:
not-allowed
}
\ No newline at end of file
src/main/webapp/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.js
0 → 100644
View file @
04f292f4
!
function
(
a
,
b
,
c
,
d
){
"use strict"
;
var
e
=
"treeview"
,
f
=
{};
f
.
settings
=
{
injectStyle
:
!
0
,
levels
:
2
,
expandIcon
:
"glyphicon glyphicon-plus"
,
collapseIcon
:
"glyphicon glyphicon-minus"
,
emptyIcon
:
"glyphicon"
,
nodeIcon
:
""
,
selectedIcon
:
""
,
checkedIcon
:
"glyphicon glyphicon-check"
,
uncheckedIcon
:
"glyphicon glyphicon-unchecked"
,
color
:
d
,
backColor
:
d
,
borderColor
:
d
,
onhoverColor
:
"#F5F5F5"
,
selectedColor
:
"#FFFFFF"
,
selectedBackColor
:
"#428bca"
,
searchResultColor
:
"#D9534F"
,
searchResultBackColor
:
d
,
enableLinks
:
!
1
,
highlightSelected
:
!
0
,
highlightSearchResults
:
!
0
,
showBorder
:
!
0
,
showIcon
:
!
0
,
showCheckbox
:
!
1
,
showTags
:
!
1
,
multiSelect
:
!
1
,
onNodeChecked
:
d
,
onNodeCollapsed
:
d
,
onNodeDisabled
:
d
,
onNodeEnabled
:
d
,
onNodeExpanded
:
d
,
onNodeSelected
:
d
,
onNodeUnchecked
:
d
,
onNodeUnselected
:
d
,
onSearchComplete
:
d
,
onSearchCleared
:
d
},
f
.
options
=
{
silent
:
!
1
,
ignoreChildren
:
!
1
},
f
.
searchOptions
=
{
ignoreCase
:
!
0
,
exactMatch
:
!
1
,
revealResults
:
!
0
};
var
g
=
function
(
b
,
c
){
return
this
.
$element
=
a
(
b
),
this
.
elementId
=
b
.
id
,
this
.
styleId
=
this
.
elementId
+
"-style"
,
this
.
init
(
c
),{
options
:
this
.
options
,
init
:
a
.
proxy
(
this
.
init
,
this
),
remove
:
a
.
proxy
(
this
.
remove
,
this
),
getNode
:
a
.
proxy
(
this
.
getNode
,
this
),
getParent
:
a
.
proxy
(
this
.
getParent
,
this
),
getSiblings
:
a
.
proxy
(
this
.
getSiblings
,
this
),
getSelected
:
a
.
proxy
(
this
.
getSelected
,
this
),
getUnselected
:
a
.
proxy
(
this
.
getUnselected
,
this
),
getExpanded
:
a
.
proxy
(
this
.
getExpanded
,
this
),
getCollapsed
:
a
.
proxy
(
this
.
getCollapsed
,
this
),
getChecked
:
a
.
proxy
(
this
.
getChecked
,
this
),
getUnchecked
:
a
.
proxy
(
this
.
getUnchecked
,
this
),
getDisabled
:
a
.
proxy
(
this
.
getDisabled
,
this
),
getEnabled
:
a
.
proxy
(
this
.
getEnabled
,
this
),
selectNode
:
a
.
proxy
(
this
.
selectNode
,
this
),
unselectNode
:
a
.
proxy
(
this
.
unselectNode
,
this
),
toggleNodeSelected
:
a
.
proxy
(
this
.
toggleNodeSelected
,
this
),
collapseAll
:
a
.
proxy
(
this
.
collapseAll
,
this
),
collapseNode
:
a
.
proxy
(
this
.
collapseNode
,
this
),
expandAll
:
a
.
proxy
(
this
.
expandAll
,
this
),
expandNode
:
a
.
proxy
(
this
.
expandNode
,
this
),
toggleNodeExpanded
:
a
.
proxy
(
this
.
toggleNodeExpanded
,
this
),
revealNode
:
a
.
proxy
(
this
.
revealNode
,
this
),
checkAll
:
a
.
proxy
(
this
.
checkAll
,
this
),
checkNode
:
a
.
proxy
(
this
.
checkNode
,
this
),
uncheckAll
:
a
.
proxy
(
this
.
uncheckAll
,
this
),
uncheckNode
:
a
.
proxy
(
this
.
uncheckNode
,
this
),
toggleNodeChecked
:
a
.
proxy
(
this
.
toggleNodeChecked
,
this
),
disableAll
:
a
.
proxy
(
this
.
disableAll
,
this
),
disableNode
:
a
.
proxy
(
this
.
disableNode
,
this
),
enableAll
:
a
.
proxy
(
this
.
enableAll
,
this
),
enableNode
:
a
.
proxy
(
this
.
enableNode
,
this
),
toggleNodeDisabled
:
a
.
proxy
(
this
.
toggleNodeDisabled
,
this
),
search
:
a
.
proxy
(
this
.
search
,
this
),
clearSearch
:
a
.
proxy
(
this
.
clearSearch
,
this
)}};
g
.
prototype
.
init
=
function
(
b
){
this
.
tree
=
[],
this
.
nodes
=
[],
b
.
data
&&
(
"string"
==
typeof
b
.
data
&&
(
b
.
data
=
a
.
parseJSON
(
b
.
data
)),
this
.
tree
=
a
.
extend
(
!
0
,[],
b
.
data
),
delete
b
.
data
),
this
.
options
=
a
.
extend
({},
f
.
settings
,
b
),
this
.
destroy
(),
this
.
subscribeEvents
(),
this
.
setInitialStates
({
nodes
:
this
.
tree
},
0
),
this
.
render
()},
g
.
prototype
.
remove
=
function
(){
this
.
destroy
(),
a
.
removeData
(
this
,
e
),
a
(
"#"
+
this
.
styleId
).
remove
()},
g
.
prototype
.
destroy
=
function
(){
this
.
initialized
&&
(
this
.
$wrapper
.
remove
(),
this
.
$wrapper
=
null
,
this
.
unsubscribeEvents
(),
this
.
initialized
=!
1
)},
g
.
prototype
.
unsubscribeEvents
=
function
(){
this
.
$element
.
off
(
"click"
),
this
.
$element
.
off
(
"nodeChecked"
),
this
.
$element
.
off
(
"nodeCollapsed"
),
this
.
$element
.
off
(
"nodeDisabled"
),
this
.
$element
.
off
(
"nodeEnabled"
),
this
.
$element
.
off
(
"nodeExpanded"
),
this
.
$element
.
off
(
"nodeSelected"
),
this
.
$element
.
off
(
"nodeUnchecked"
),
this
.
$element
.
off
(
"nodeUnselected"
),
this
.
$element
.
off
(
"searchComplete"
),
this
.
$element
.
off
(
"searchCleared"
)},
g
.
prototype
.
subscribeEvents
=
function
(){
this
.
unsubscribeEvents
(),
this
.
$element
.
on
(
"click"
,
a
.
proxy
(
this
.
clickHandler
,
this
)),
"function"
==
typeof
this
.
options
.
onNodeChecked
&&
this
.
$element
.
on
(
"nodeChecked"
,
this
.
options
.
onNodeChecked
),
"function"
==
typeof
this
.
options
.
onNodeCollapsed
&&
this
.
$element
.
on
(
"nodeCollapsed"
,
this
.
options
.
onNodeCollapsed
),
"function"
==
typeof
this
.
options
.
onNodeDisabled
&&
this
.
$element
.
on
(
"nodeDisabled"
,
this
.
options
.
onNodeDisabled
),
"function"
==
typeof
this
.
options
.
onNodeEnabled
&&
this
.
$element
.
on
(
"nodeEnabled"
,
this
.
options
.
onNodeEnabled
),
"function"
==
typeof
this
.
options
.
onNodeExpanded
&&
this
.
$element
.
on
(
"nodeExpanded"
,
this
.
options
.
onNodeExpanded
),
"function"
==
typeof
this
.
options
.
onNodeSelected
&&
this
.
$element
.
on
(
"nodeSelected"
,
this
.
options
.
onNodeSelected
),
"function"
==
typeof
this
.
options
.
onNodeUnchecked
&&
this
.
$element
.
on
(
"nodeUnchecked"
,
this
.
options
.
onNodeUnchecked
),
"function"
==
typeof
this
.
options
.
onNodeUnselected
&&
this
.
$element
.
on
(
"nodeUnselected"
,
this
.
options
.
onNodeUnselected
),
"function"
==
typeof
this
.
options
.
onSearchComplete
&&
this
.
$element
.
on
(
"searchComplete"
,
this
.
options
.
onSearchComplete
),
"function"
==
typeof
this
.
options
.
onSearchCleared
&&
this
.
$element
.
on
(
"searchCleared"
,
this
.
options
.
onSearchCleared
)},
g
.
prototype
.
setInitialStates
=
function
(
b
,
c
){
if
(
b
.
nodes
){
c
+=
1
;
var
d
=
b
,
e
=
this
;
a
.
each
(
b
.
nodes
,
function
(
a
,
b
){
b
.
nodeId
=
e
.
nodes
.
length
,
b
.
parentId
=
d
.
nodeId
,
b
.
hasOwnProperty
(
"selectable"
)
||
(
b
.
selectable
=!
0
),
b
.
state
=
b
.
state
||
{},
b
.
state
.
hasOwnProperty
(
"checked"
)
||
(
b
.
state
.
checked
=!
1
),
b
.
state
.
hasOwnProperty
(
"disabled"
)
||
(
b
.
state
.
disabled
=!
1
),
b
.
state
.
hasOwnProperty
(
"expanded"
)
||
(
!
b
.
state
.
disabled
&&
c
<
e
.
options
.
levels
&&
b
.
nodes
&&
b
.
nodes
.
length
>
0
?
b
.
state
.
expanded
=!
0
:
b
.
state
.
expanded
=!
1
),
b
.
state
.
hasOwnProperty
(
"selected"
)
||
(
b
.
state
.
selected
=!
1
),
e
.
nodes
.
push
(
b
),
b
.
nodes
&&
e
.
setInitialStates
(
b
,
c
)})}},
g
.
prototype
.
clickHandler
=
function
(
b
){
this
.
options
.
enableLinks
||
b
.
preventDefault
();
var
c
=
a
(
b
.
target
),
d
=
this
.
findNode
(
c
);
if
(
d
&&!
d
.
state
.
disabled
){
var
e
=
c
.
attr
(
"class"
)?
c
.
attr
(
"class"
).
split
(
" "
):[];
-
1
!==
e
.
indexOf
(
"expand-icon"
)?(
this
.
toggleExpandedState
(
d
,
f
.
options
),
this
.
render
()):
-
1
!==
e
.
indexOf
(
"check-icon"
)?(
this
.
toggleCheckedState
(
d
,
f
.
options
),
this
.
render
()):(
d
.
selectable
?
this
.
toggleSelectedState
(
d
,
f
.
options
):
this
.
toggleExpandedState
(
d
,
f
.
options
),
this
.
render
())}},
g
.
prototype
.
findNode
=
function
(
a
){
var
b
=
a
.
closest
(
"li.list-group-item"
).
attr
(
"data-nodeid"
),
c
=
this
.
nodes
[
b
];
return
c
||
console
.
log
(
"Error: node does not exist"
),
c
},
g
.
prototype
.
toggleExpandedState
=
function
(
a
,
b
){
a
&&
this
.
setExpandedState
(
a
,
!
a
.
state
.
expanded
,
b
)},
g
.
prototype
.
setExpandedState
=
function
(
b
,
c
,
d
){
c
!==
b
.
state
.
expanded
&&
(
c
&&
b
.
nodes
?(
b
.
state
.
expanded
=!
0
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeExpanded"
,
a
.
extend
(
!
0
,{},
b
))):
c
||
(
b
.
state
.
expanded
=!
1
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeCollapsed"
,
a
.
extend
(
!
0
,{},
b
)),
b
.
nodes
&&!
d
.
ignoreChildren
&&
a
.
each
(
b
.
nodes
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
b
,
!
1
,
d
)},
this
))))},
g
.
prototype
.
toggleSelectedState
=
function
(
a
,
b
){
a
&&
this
.
setSelectedState
(
a
,
!
a
.
state
.
selected
,
b
)},
g
.
prototype
.
setSelectedState
=
function
(
b
,
c
,
d
){
c
!==
b
.
state
.
selected
&&
(
c
?(
this
.
options
.
multiSelect
||
a
.
each
(
this
.
findNodes
(
"true"
,
"g"
,
"state.selected"
),
a
.
proxy
(
function
(
a
,
b
){
this
.
setSelectedState
(
b
,
!
1
,
d
)},
this
)),
b
.
state
.
selected
=!
0
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeSelected"
,
a
.
extend
(
!
0
,{},
b
))):(
b
.
state
.
selected
=!
1
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeUnselected"
,
a
.
extend
(
!
0
,{},
b
))))},
g
.
prototype
.
toggleCheckedState
=
function
(
a
,
b
){
a
&&
this
.
setCheckedState
(
a
,
!
a
.
state
.
checked
,
b
)},
g
.
prototype
.
setCheckedState
=
function
(
b
,
c
,
d
){
c
!==
b
.
state
.
checked
&&
(
c
?(
b
.
state
.
checked
=!
0
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeChecked"
,
a
.
extend
(
!
0
,{},
b
))):(
b
.
state
.
checked
=!
1
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeUnchecked"
,
a
.
extend
(
!
0
,{},
b
))))},
g
.
prototype
.
setDisabledState
=
function
(
b
,
c
,
d
){
c
!==
b
.
state
.
disabled
&&
(
c
?(
b
.
state
.
disabled
=!
0
,
this
.
setExpandedState
(
b
,
!
1
,
d
),
this
.
setSelectedState
(
b
,
!
1
,
d
),
this
.
setCheckedState
(
b
,
!
1
,
d
),
d
.
silent
||
this
.
$element
.
trigger
(
"nodeDisabled"
,
a
.
extend
(
!
0
,{},
b
))):(
b
.
state
.
disabled
=!
1
,
d
.
silent
||
this
.
$element
.
trigger
(
"nodeEnabled"
,
a
.
extend
(
!
0
,{},
b
))))},
g
.
prototype
.
render
=
function
(){
this
.
initialized
||
(
this
.
$element
.
addClass
(
e
),
this
.
$wrapper
=
a
(
this
.
template
.
list
),
this
.
injectStyle
(),
this
.
initialized
=!
0
),
this
.
$element
.
empty
().
append
(
this
.
$wrapper
.
empty
()),
this
.
buildTree
(
this
.
tree
,
0
)},
g
.
prototype
.
buildTree
=
function
(
b
,
c
){
if
(
b
){
c
+=
1
;
var
d
=
this
;
a
.
each
(
b
,
function
(
b
,
e
){
for
(
var
f
=
a
(
d
.
template
.
item
).
addClass
(
"node-"
+
d
.
elementId
).
addClass
(
e
.
state
.
checked
?
"node-checked"
:
""
).
addClass
(
e
.
state
.
disabled
?
"node-disabled"
:
""
).
addClass
(
e
.
state
.
selected
?
"node-selected"
:
""
).
addClass
(
e
.
searchResult
?
"search-result"
:
""
).
attr
(
"data-nodeid"
,
e
.
nodeId
).
attr
(
"style"
,
d
.
buildStyleOverride
(
e
)),
g
=
0
;
c
-
1
>
g
;
g
++
)
f
.
append
(
d
.
template
.
indent
);
var
h
=
[];
if
(
e
.
nodes
?(
h
.
push
(
"expand-icon"
),
h
.
push
(
e
.
state
.
expanded
?
d
.
options
.
collapseIcon
:
d
.
options
.
expandIcon
)):
h
.
push
(
d
.
options
.
emptyIcon
),
f
.
append
(
a
(
d
.
template
.
icon
).
addClass
(
h
.
join
(
" "
))),
d
.
options
.
showIcon
){
var
h
=
[
"node-icon"
];
h
.
push
(
e
.
icon
||
d
.
options
.
nodeIcon
),
e
.
state
.
selected
&&
(
h
.
pop
(),
h
.
push
(
e
.
selectedIcon
||
d
.
options
.
selectedIcon
||
e
.
icon
||
d
.
options
.
nodeIcon
)),
f
.
append
(
a
(
d
.
template
.
icon
).
addClass
(
h
.
join
(
" "
)))}
if
(
d
.
options
.
showCheckbox
){
var
h
=
[
"check-icon"
];
h
.
push
(
e
.
state
.
checked
?
d
.
options
.
checkedIcon
:
d
.
options
.
uncheckedIcon
),
f
.
append
(
a
(
d
.
template
.
icon
).
addClass
(
h
.
join
(
" "
)))}
return
f
.
append
(
d
.
options
.
enableLinks
?
a
(
d
.
template
.
link
).
attr
(
"href"
,
e
.
href
).
append
(
e
.
text
):
e
.
text
),
d
.
options
.
showTags
&&
e
.
tags
&&
a
.
each
(
e
.
tags
,
function
(
b
,
c
){
f
.
append
(
a
(
d
.
template
.
badge
).
append
(
c
))}),
d
.
$wrapper
.
append
(
f
),
e
.
nodes
&&
e
.
state
.
expanded
&&!
e
.
state
.
disabled
?
d
.
buildTree
(
e
.
nodes
,
c
):
void
0
})}},
g
.
prototype
.
buildStyleOverride
=
function
(
a
){
if
(
a
.
state
.
disabled
)
return
""
;
var
b
=
a
.
color
,
c
=
a
.
backColor
;
return
this
.
options
.
highlightSelected
&&
a
.
state
.
selected
&&
(
this
.
options
.
selectedColor
&&
(
b
=
this
.
options
.
selectedColor
),
this
.
options
.
selectedBackColor
&&
(
c
=
this
.
options
.
selectedBackColor
)),
this
.
options
.
highlightSearchResults
&&
a
.
searchResult
&&!
a
.
state
.
disabled
&&
(
this
.
options
.
searchResultColor
&&
(
b
=
this
.
options
.
searchResultColor
),
this
.
options
.
searchResultBackColor
&&
(
c
=
this
.
options
.
searchResultBackColor
)),
"color:"
+
b
+
";background-color:"
+
c
+
";"
},
g
.
prototype
.
injectStyle
=
function
(){
this
.
options
.
injectStyle
&&!
c
.
getElementById
(
this
.
styleId
)
&&
a
(
'<style type="text/css" id="'
+
this
.
styleId
+
'"> '
+
this
.
buildStyle
()
+
" </style>"
).
appendTo
(
"head"
)},
g
.
prototype
.
buildStyle
=
function
(){
var
a
=
".node-"
+
this
.
elementId
+
"{"
;
return
this
.
options
.
color
&&
(
a
+=
"color:"
+
this
.
options
.
color
+
";"
),
this
.
options
.
backColor
&&
(
a
+=
"background-color:"
+
this
.
options
.
backColor
+
";"
),
this
.
options
.
showBorder
?
this
.
options
.
borderColor
&&
(
a
+=
"border:1px solid "
+
this
.
options
.
borderColor
+
";"
):
a
+=
"border:none;"
,
a
+=
"}"
,
this
.
options
.
onhoverColor
&&
(
a
+=
".node-"
+
this
.
elementId
+
":not(.node-disabled):hover{background-color:"
+
this
.
options
.
onhoverColor
+
";}"
),
this
.
css
+
a
},
g
.
prototype
.
template
=
{
list
:
'<ul class="list-group"></ul>'
,
item
:
'<li class="list-group-item"></li>'
,
indent
:
'<span class="indent"></span>'
,
icon
:
'<span class="icon"></span>'
,
link
:
'<a href="#" style="color:inherit;"></a>'
,
badge
:
'<span class="badge"></span>'
},
g
.
prototype
.
css
=
".treeview .list-group-item{cursor:pointer}.treeview span.indent{margin-left:10px;margin-right:10px}.treeview span.icon{width:12px;margin-right:5px}.treeview .node-disabled{color:silver;cursor:not-allowed}"
,
g
.
prototype
.
getNode
=
function
(
a
){
return
this
.
nodes
[
a
]},
g
.
prototype
.
getParent
=
function
(
a
){
var
b
=
this
.
identifyNode
(
a
);
return
this
.
nodes
[
b
.
parentId
]},
g
.
prototype
.
getSiblings
=
function
(
a
){
var
b
=
this
.
identifyNode
(
a
),
c
=
this
.
getParent
(
b
),
d
=
c
?
c
.
nodes
:
this
.
tree
;
return
d
.
filter
(
function
(
a
){
return
a
.
nodeId
!==
b
.
nodeId
})},
g
.
prototype
.
getSelected
=
function
(){
return
this
.
findNodes
(
"true"
,
"g"
,
"state.selected"
)},
g
.
prototype
.
getUnselected
=
function
(){
return
this
.
findNodes
(
"false"
,
"g"
,
"state.selected"
)},
g
.
prototype
.
getExpanded
=
function
(){
return
this
.
findNodes
(
"true"
,
"g"
,
"state.expanded"
)},
g
.
prototype
.
getCollapsed
=
function
(){
return
this
.
findNodes
(
"false"
,
"g"
,
"state.expanded"
)},
g
.
prototype
.
getChecked
=
function
(){
return
this
.
findNodes
(
"true"
,
"g"
,
"state.checked"
)},
g
.
prototype
.
getUnchecked
=
function
(){
return
this
.
findNodes
(
"false"
,
"g"
,
"state.checked"
)},
g
.
prototype
.
getDisabled
=
function
(){
return
this
.
findNodes
(
"true"
,
"g"
,
"state.disabled"
)},
g
.
prototype
.
getEnabled
=
function
(){
return
this
.
findNodes
(
"false"
,
"g"
,
"state.disabled"
)},
g
.
prototype
.
selectNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setSelectedState
(
a
,
!
0
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
unselectNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setSelectedState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
toggleNodeSelected
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
toggleSelectedState
(
a
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
collapseAll
=
function
(
b
){
var
c
=
this
.
findNodes
(
"true"
,
"g"
,
"state.expanded"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
collapseNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
expandAll
=
function
(
b
){
if
(
b
=
a
.
extend
({},
f
.
options
,
b
),
b
&&
b
.
levels
)
this
.
expandLevels
(
this
.
tree
,
b
.
levels
,
b
);
else
{
var
c
=
this
.
findNodes
(
"false"
,
"g"
,
"state.expanded"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
a
,
!
0
,
b
)},
this
))}
this
.
render
()},
g
.
prototype
.
expandNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
a
,
!
0
,
b
),
a
.
nodes
&&
b
&&
b
.
levels
&&
this
.
expandLevels
(
a
.
nodes
,
b
.
levels
-
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
expandLevels
=
function
(
b
,
c
,
d
){
d
=
a
.
extend
({},
f
.
options
,
d
),
a
.
each
(
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setExpandedState
(
b
,
c
>
0
?
!
0
:
!
1
,
d
),
b
.
nodes
&&
this
.
expandLevels
(
b
.
nodes
,
c
-
1
,
d
)},
this
))},
g
.
prototype
.
revealNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
for
(
var
c
=
this
.
getParent
(
a
);
c
;)
this
.
setExpandedState
(
c
,
!
0
,
b
),
c
=
this
.
getParent
(
c
)},
this
)),
this
.
render
()},
g
.
prototype
.
toggleNodeExpanded
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
toggleExpandedState
(
a
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
checkAll
=
function
(
b
){
var
c
=
this
.
findNodes
(
"false"
,
"g"
,
"state.checked"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setCheckedState
(
a
,
!
0
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
checkNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setCheckedState
(
a
,
!
0
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
uncheckAll
=
function
(
b
){
var
c
=
this
.
findNodes
(
"true"
,
"g"
,
"state.checked"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setCheckedState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
uncheckNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setCheckedState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
toggleNodeChecked
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
toggleCheckedState
(
a
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
disableAll
=
function
(
b
){
var
c
=
this
.
findNodes
(
"false"
,
"g"
,
"state.disabled"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setDisabledState
(
a
,
!
0
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
disableNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setDisabledState
(
a
,
!
0
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
enableAll
=
function
(
b
){
var
c
=
this
.
findNodes
(
"true"
,
"g"
,
"state.disabled"
);
this
.
forEachIdentifier
(
c
,
b
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setDisabledState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
enableNode
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setDisabledState
(
a
,
!
1
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
toggleNodeDisabled
=
function
(
b
,
c
){
this
.
forEachIdentifier
(
b
,
c
,
a
.
proxy
(
function
(
a
,
b
){
this
.
setDisabledState
(
a
,
!
a
.
state
.
disabled
,
b
)},
this
)),
this
.
render
()},
g
.
prototype
.
forEachIdentifier
=
function
(
b
,
c
,
d
){
c
=
a
.
extend
({},
f
.
options
,
c
),
b
instanceof
Array
||
(
b
=
[
b
]),
a
.
each
(
b
,
a
.
proxy
(
function
(
a
,
b
){
d
(
this
.
identifyNode
(
b
),
c
)},
this
))},
g
.
prototype
.
identifyNode
=
function
(
a
){
return
"number"
==
typeof
a
?
this
.
nodes
[
a
]:
a
},
g
.
prototype
.
search
=
function
(
b
,
c
){
c
=
a
.
extend
({},
f
.
searchOptions
,
c
),
this
.
clearSearch
({
render
:
!
1
});
var
d
=
[];
if
(
b
&&
b
.
length
>
0
){
c
.
exactMatch
&&
(
b
=
"^"
+
b
+
"$"
);
var
e
=
"g"
;
c
.
ignoreCase
&&
(
e
+=
"i"
),
d
=
this
.
findNodes
(
b
,
e
),
a
.
each
(
d
,
function
(
a
,
b
){
b
.
searchResult
=!
0
})}
return
c
.
revealResults
?
this
.
revealNode
(
d
):
this
.
render
(),
this
.
$element
.
trigger
(
"searchComplete"
,
a
.
extend
(
!
0
,{},
d
)),
d
},
g
.
prototype
.
clearSearch
=
function
(
b
){
b
=
a
.
extend
({},{
render
:
!
0
},
b
);
var
c
=
a
.
each
(
this
.
findNodes
(
"true"
,
"g"
,
"searchResult"
),
function
(
a
,
b
){
b
.
searchResult
=!
1
});
b
.
render
&&
this
.
render
(),
this
.
$element
.
trigger
(
"searchCleared"
,
a
.
extend
(
!
0
,{},
c
))},
g
.
prototype
.
findNodes
=
function
(
b
,
c
,
d
){
c
=
c
||
"g"
,
d
=
d
||
"text"
;
var
e
=
this
;
return
a
.
grep
(
this
.
nodes
,
function
(
a
){
var
f
=
e
.
getNodeValue
(
a
,
d
);
return
"string"
==
typeof
f
?
f
.
match
(
new
RegExp
(
b
,
c
)):
void
0
})},
g
.
prototype
.
getNodeValue
=
function
(
a
,
b
){
var
c
=
b
.
indexOf
(
"."
);
if
(
c
>
0
){
var
e
=
a
[
b
.
substring
(
0
,
c
)],
f
=
b
.
substring
(
c
+
1
,
b
.
length
);
return
this
.
getNodeValue
(
e
,
f
)}
return
a
.
hasOwnProperty
(
b
)?
a
[
b
].
toString
():
d
};
var
h
=
function
(
a
){
b
.
console
&&
b
.
console
.
error
(
a
)};
a
.
fn
[
e
]
=
function
(
b
,
c
){
var
d
;
return
this
.
each
(
function
(){
var
f
=
a
.
data
(
this
,
e
);
"string"
==
typeof
b
?
f
?
a
.
isFunction
(
f
[
b
])
&&
"_"
!==
b
.
charAt
(
0
)?(
c
instanceof
Array
||
(
c
=
[
c
]),
d
=
f
[
b
].
apply
(
f
,
c
)):
h
(
"No such method : "
+
b
):
h
(
"Not initialized, can not call method : "
+
b
):
"boolean"
==
typeof
b
?
d
=
f
:
a
.
data
(
this
,
e
,
new
g
(
this
,
a
.
extend
(
!
0
,{},
b
)))}),
d
||
this
}}(
jQuery
,
window
,
document
);
\ No newline at end of file
src/main/webapp/assets/modular/system/dept/dept.js
View file @
04f292f4
...
@@ -17,10 +17,10 @@ var Dept = {
...
@@ -17,10 +17,10 @@ var Dept = {
Dept
.
initColumn
=
function
()
{
Dept
.
initColumn
=
function
()
{
return
[
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'
i
d'
,
align
:
'center'
,
valign
:
'middle'
,
width
:
'50px'
},
{
title
:
'id'
,
field
:
'
deptI
d'
,
align
:
'center'
,
valign
:
'middle'
,
width
:
'50px'
},
{
title
:
'部门简称'
,
field
:
'simple
n
ame'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'部门简称'
,
field
:
'simple
N
ame'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'部门全称'
,
field
:
'full
n
ame'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'部门全称'
,
field
:
'full
N
ame'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'排序'
,
field
:
'
num
'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'排序'
,
field
:
'
sort
'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
},
{
title
:
'备注'
,
field
:
'description'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
}];
{
title
:
'备注'
,
field
:
'description'
,
align
:
'center'
,
valign
:
'middle'
,
sortable
:
true
}];
};
};
...
@@ -28,8 +28,8 @@ Dept.initColumn = function () {
...
@@ -28,8 +28,8 @@ Dept.initColumn = function () {
* 检查是否选中
* 检查是否选中
*/
*/
Dept
.
check
=
function
()
{
Dept
.
check
=
function
()
{
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapT
reeT
able
(
'getSelections'
);
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapTable
(
'getSelections'
);
if
(
selected
.
length
==
0
)
{
if
(
selected
.
length
==
=
0
)
{
Feng
.
info
(
"请先选中表格中的某一记录!"
);
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
return
false
;
}
else
{
}
else
{
...
@@ -42,7 +42,7 @@ Dept.check = function () {
...
@@ -42,7 +42,7 @@ Dept.check = function () {
* 点击添加部门
* 点击添加部门
*/
*/
Dept
.
openAddDept
=
function
()
{
Dept
.
openAddDept
=
function
()
{
var
i
ndex
=
layer
.
open
({
this
.
layerI
ndex
=
layer
.
open
({
type
:
2
,
type
:
2
,
title
:
'添加部门'
,
title
:
'添加部门'
,
area
:
[
'800px'
,
'420px'
],
//宽高
area
:
[
'800px'
,
'420px'
],
//宽高
...
@@ -50,7 +50,6 @@ Dept.openAddDept = function () {
...
@@ -50,7 +50,6 @@ Dept.openAddDept = function () {
maxmin
:
true
,
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/dept/dept_add'
content
:
Feng
.
ctxPath
+
'/dept/dept_add'
});
});
this
.
layerIndex
=
index
;
};
};
/**
/**
...
@@ -58,15 +57,14 @@ Dept.openAddDept = function () {
...
@@ -58,15 +57,14 @@ Dept.openAddDept = function () {
*/
*/
Dept
.
openDeptDetail
=
function
()
{
Dept
.
openDeptDetail
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
i
ndex
=
layer
.
open
({
this
.
layerI
ndex
=
layer
.
open
({
type
:
2
,
type
:
2
,
title
:
'部门详情'
,
title
:
'部门详情'
,
area
:
[
'800px'
,
'420px'
],
//宽高
area
:
[
'800px'
,
'420px'
],
//宽高
fix
:
false
,
//不固定
fix
:
false
,
//不固定
maxmin
:
true
,
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/dept/dept_update/'
+
Dept
.
seItem
.
i
d
content
:
Feng
.
ctxPath
+
'/dept/dept_update/'
+
Dept
.
seItem
.
deptI
d
});
});
this
.
layerIndex
=
index
;
}
}
};
};
...
@@ -83,7 +81,7 @@ Dept.delete = function () {
...
@@ -83,7 +81,7 @@ Dept.delete = function () {
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
+
data
.
responseJSON
.
message
+
"!"
);
Feng
.
error
(
"删除失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
});
ajax
.
set
(
"deptId"
,
Dept
.
seItem
.
i
d
);
ajax
.
set
(
"deptId"
,
Dept
.
seItem
.
deptI
d
);
ajax
.
start
();
ajax
.
start
();
};
};
...
@@ -101,19 +99,64 @@ Dept.search = function () {
...
@@ -101,19 +99,64 @@ Dept.search = function () {
};
};
$
(
function
()
{
$
(
function
()
{
var
defaultData
=
[
{
text
:
'Parent 1'
,
href
:
'#parent1'
,
tags
:
[
'4'
],
nodes
:
[
{
text
:
'Child 1'
,
href
:
'#child1'
,
tags
:
[
'2'
],
nodes
:
[
{
text
:
'Grandchild 1'
,
href
:
'#grandchild1'
,
tags
:
[
'0'
]
},
{
text
:
'Grandchild 2'
,
href
:
'#grandchild2'
,
tags
:
[
'0'
]
}
]
},
{
text
:
'Child 2'
,
href
:
'#child2'
,
tags
:
[
'0'
]
}
]
},
{
text
:
'Parent 2'
},
{
text
:
'Parent 3'
},
{
text
:
'Parent 4'
}
];
$
(
'#deptTree'
).
treeview
({
selectedBackColor
:
"#03a9f3"
,
onhoverColor
:
"rgba(0, 0, 0, 0.05)"
,
expandIcon
:
'ti-plus'
,
collapseIcon
:
'ti-minus'
,
nodeIcon
:
'fa fa-home'
,
data
:
defaultData
});
Dept
.
app
=
new
Vue
({
Dept
.
app
=
new
Vue
({
el
:
'#deptPage'
,
el
:
'#deptPage'
,
data
:
Dept
.
condition
data
:
Dept
.
condition
});
});
var
defaultColunms
=
Dept
.
initColumn
();
var
defaultColunms
=
Dept
.
initColumn
();
var
table
=
new
BSTreeTable
(
'DeptTable'
,
"/dept/list"
,
defaultColunms
);
var
table
=
new
BSTable
(
"DeptTable"
,
"/dept/list"
,
defaultColunms
);
table
.
setExpandColumn
(
2
);
table
.
setPaginationType
(
"client"
);
table
.
setIdField
(
"id"
);
table
.
setCodeField
(
"id"
);
table
.
setParentCodeField
(
"pid"
);
table
.
setExpandAll
(
true
);
table
.
init
();
Dept
.
table
=
table
.
init
();
Dept
.
table
=
table
.
init
();
});
});
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