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
ea7a3616
Commit
ea7a3616
authored
Apr 26, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加字典管理
parent
a4db626d
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
521 additions
and
29 deletions
+521
-29
src/main/java/com/stylefeng/guns/modular/system/controller/DictController.java
+121
-0
src/main/java/com/stylefeng/guns/modular/system/dao/DictDao.java
+10
-1
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DictDao.xml
+9
-0
src/main/webapp/WEB-INF/view/system/dict/dict.html
+32
-0
src/main/webapp/WEB-INF/view/system/dict/dict_add.html
+42
-0
src/main/webapp/WEB-INF/view/system/dict/dict_edit.html
+43
-0
src/main/webapp/static/modular/system/dept/dept.js
+1
-1
src/main/webapp/static/modular/system/dept/dept_info.js
+24
-27
src/main/webapp/static/modular/system/dict/dict.js
+100
-0
src/main/webapp/static/modular/system/dict/dict_info.js
+139
-0
No files found.
src/main/java/com/stylefeng/guns/modular/system/controller/DictController.java
0 → 100644
View file @
ea7a3616
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.controller.BaseController
;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BussinessException
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.DictDao
;
import
com.stylefeng.guns.persistence.dao.DictMapper
;
import
com.stylefeng.guns.persistence.model.Dict
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 字典控制器
*
* @author fengshuonan
* @Date 2017年4月26日 12:55:31
*/
@Controller
@RequestMapping
(
"/dict"
)
public
class
DictController
extends
BaseController
{
private
String
PREFIX
=
"/system/dict/"
;
@Resource
DictDao
dictDao
;
@Resource
DictMapper
dictMapper
;
/**
* 跳转到字典管理首页
*/
@RequestMapping
(
""
)
public
String
index
()
{
return
PREFIX
+
"dict.html"
;
}
/**
* 跳转到添加字典
*/
@RequestMapping
(
"/dict_add"
)
public
String
deptAdd
()
{
return
PREFIX
+
"dict_add.html"
;
}
/**
* 跳转到修改字典
*/
@RequestMapping
(
"/dict_edit/{dictId}"
)
public
String
deptUpdate
(
@PathVariable
Integer
dictId
,
Model
model
)
{
Dict
dict
=
dictMapper
.
selectById
(
dictId
);
model
.
addAttribute
(
dict
);
return
PREFIX
+
"dict_edit.html"
;
}
/**
* 新增字典
*/
@BussinessLog
(
"添加字典记录"
)
@RequestMapping
(
value
=
"/add"
)
@ResponseBody
public
Object
add
(
Dict
dict
)
{
if
(
ToolUtil
.
isOneEmpty
(
dict
,
dict
.
getName
()))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
return
this
.
dictMapper
.
insert
(
dict
);
}
/**
* 获取所有字典列表
*/
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
String
condition
)
{
List
<
Map
<
String
,
Object
>>
list
=
this
.
dictDao
.
list
(
condition
);
return
list
;
}
/**
* 字典详情
*/
@RequestMapping
(
value
=
"/detail/{dictId}"
)
@ResponseBody
public
Object
detail
(
@PathVariable
(
"dictId"
)
Integer
dictId
)
{
return
dictMapper
.
selectById
(
dictId
);
}
/**
* 修改字典
*/
@BussinessLog
(
"修改字典"
)
@RequestMapping
(
value
=
"/update"
)
@ResponseBody
public
Object
update
(
Dict
dict
)
{
if
(
ToolUtil
.
isEmpty
(
dict
)
||
dict
.
getId
()
==
null
)
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
dictMapper
.
updateById
(
dict
);
return
super
.
SUCCESS_TIP
;
}
/**
* 删除字典记录
*/
@BussinessLog
(
value
=
"删除字典记录"
,
key
=
"dictId"
)
@RequestMapping
(
value
=
"/delete/{dictId}"
)
@ResponseBody
public
Object
delete
(
@PathVariable
(
"dictId"
)
Integer
dictId
)
{
dictMapper
.
deleteById
(
dictId
);
return
SUCCESS_TIP
;
}
}
src/main/java/com/stylefeng/guns/modular/system/dao/DictDao.java
View file @
ea7a3616
...
@@ -4,9 +4,10 @@ import com.stylefeng.guns.persistence.model.Dict;
...
@@ -4,9 +4,10 @@ import com.stylefeng.guns.persistence.model.Dict;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
*
常量
的dao
*
字典
的dao
*
*
* @author fengshuonan
* @author fengshuonan
* @date 2017年2月13日 下午11:10:24
* @date 2017年2月13日 下午11:10:24
...
@@ -21,4 +22,12 @@ public interface DictDao {
...
@@ -21,4 +22,12 @@ public interface DictDao {
* @date 2017年2月13日 下午11:11:28
* @date 2017年2月13日 下午11:11:28
*/
*/
List
<
Dict
>
selectByCode
(
@Param
(
"code"
)
String
code
);
List
<
Dict
>
selectByCode
(
@Param
(
"code"
)
String
code
);
/**
* 查询字典列表
*
* @author fengshuonan
* @Date 2017/4/26 13:04
*/
List
<
Map
<
String
,
Object
>>
list
(
@Param
(
"condition"
)
String
conditiion
);
}
}
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DictDao.xml
View file @
ea7a3616
...
@@ -13,4 +13,12 @@
...
@@ -13,4 +13,12 @@
where code = #{code}
where code = #{code}
</select>
</select>
<select
id=
"list"
resultType=
"map"
>
select * from _dict
<if
test=
"condition != null and condition != ''"
>
where name like CONCAT('%',#{condition},'%') or num like CONCAT('%',#{condition},'%')
</if>
order by code ASC
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/webapp/WEB-INF/view/system/dict/dict.html
0 → 100644
View file @
ea7a3616
@layout("/common/_container.html"){
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
部门管理
</h5>
</div>
<div
class=
"ibox-content"
>
<div
class=
"row row-lg"
>
<div
class=
"col-sm-12"
>
<div
class=
"row"
>
<div
class=
"col-sm-3"
>
<
#
NameCon
id=
"condition"
name=
"名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"Dict.search()"
/>
</div>
</div>
<div
class=
"hidden-xs"
id=
"DictTableToolbar"
role=
"group"
>
<
#
button
name=
"添加"
icon=
"fa-plus"
clickFun=
"Dict.openAddDept()"
/>
<
#
button
name=
"修改"
icon=
"fa-plus"
clickFun=
"Dict.openDeptDetail()"
space=
"true"
/>
<
#
button
name=
"删除"
icon=
"fa-plus"
clickFun=
"Dict.delete()"
space=
"true"
/>
</div>
<
#
table
id=
"DictTable"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/dict/dict.js"
></script>
@}
src/main/webapp/WEB-INF/view/system/dict/dict_add.html
0 → 100644
View file @
ea7a3616
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<input
type=
"hidden"
id=
"id"
value=
""
>
<div
class=
"row"
>
<div
class=
"col-sm-6 b-r"
>
<
#
input
id=
"simplename"
name=
"部门名称"
underline=
"true"
/>
<
#
input
id=
"fullname"
name=
"部门全称"
underline=
"true"
/>
<
#
input
id=
"tips"
name=
"备注"
underline=
"true"
/>
</div>
<div
class=
"col-sm-6"
>
<
#
input
id=
"num"
name=
"排序"
underline=
"true"
/>
<
#
input
id=
"pName"
name=
"上级部门"
readonly=
"readonly"
hidden=
"pid"
clickFun=
"DeptInfoDlg.showDeptSelectTree(); return false;"
style=
"background-color: #ffffff !important;"
/>
</div>
</div>
<!-- 父级部门的选择框 -->
<div
id=
"parentDeptMenu"
class=
"menuContent"
style=
"display: none; position: absolute; z-index: 200;"
>
<ul
id=
"parentDeptMenuTree"
class=
"ztree tree-box"
style=
"width: 245px !important;"
></ul>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"DeptInfoDlg.addSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"DeptInfoDlg.close()"
/>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/dict/dict_info.js"
></script>
@}
src/main/webapp/WEB-INF/view/system/dict/dict_edit.html
0 → 100644
View file @
ea7a3616
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<input
type=
"hidden"
id=
"id"
value=
"${dept.id}"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 b-r"
>
<
#
input
id=
"simplename"
name=
"部门名称"
underline=
"true"
value=
"${dept.simplename}"
/>
<
#
input
id=
"fullname"
name=
"部门全称"
underline=
"true"
value=
"${dept.fullname}"
/>
<
#
input
id=
"tips"
name=
"备注"
underline=
"true"
value=
"${dept.tips}"
/>
</div>
<div
class=
"col-sm-6"
>
<
#
input
id=
"num"
name=
"排序"
underline=
"true"
value=
"${dept.num}"
/>
<
#
input
id=
"pName"
name=
"上级部门"
readonly=
"readonly"
hidden=
"pid"
hiddenValue=
"${dept.pid}"
value=
"${pName}"
clickFun=
"DeptInfoDlg.showDeptSelectTree(); return false;"
style=
"background-color: #ffffff !important;"
/>
</div>
</div>
<!-- 父级部门的选择框 -->
<div
id=
"parentDeptMenu"
class=
"menuContent"
style=
"display: none; position: absolute; z-index: 200;"
>
<ul
id=
"parentDeptMenuTree"
class=
"ztree tree-box"
style=
"width: 245px !important;"
></ul>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"DeptInfoDlg.editSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"DeptInfoDlg.close()"
/>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/dict/dict_info.js"
></script>
@}
src/main/webapp/static/modular/system/dept/dept.js
View file @
ea7a3616
...
@@ -84,7 +84,7 @@ Dept.delete = function () {
...
@@ -84,7 +84,7 @@ Dept.delete = function () {
};
};
/**
/**
* 查询
日志
列表
* 查询
部门
列表
*/
*/
Dept
.
search
=
function
()
{
Dept
.
search
=
function
()
{
var
queryData
=
{};
var
queryData
=
{};
...
...
src/main/webapp/static/modular/system/dept/dept_info.js
View file @
ea7a3616
/**
/**
* 初始化
部门
详情对话框
* 初始化
字典
详情对话框
*/
*/
var
D
ep
tInfoDlg
=
{
var
D
ic
tInfoDlg
=
{
d
ep
tInfoData
:
{}
d
ic
tInfoData
:
{}
};
};
/**
/**
* 清除数据
* 清除数据
*/
*/
D
ep
tInfoDlg
.
clearData
=
function
()
{
D
ic
tInfoDlg
.
clearData
=
function
()
{
this
.
d
ep
tInfoData
=
{};
this
.
d
ic
tInfoData
=
{};
}
}
/**
/**
...
@@ -18,8 +18,8 @@ DeptInfoDlg.clearData = function() {
...
@@ -18,8 +18,8 @@ DeptInfoDlg.clearData = function() {
* @param key 数据的名称
* @param key 数据的名称
* @param val 数据的具体值
* @param val 数据的具体值
*/
*/
D
ep
tInfoDlg
.
set
=
function
(
key
,
val
)
{
D
ic
tInfoDlg
.
set
=
function
(
key
,
val
)
{
this
.
d
ep
tInfoData
[
key
]
=
(
typeof
value
==
"undefined"
)
?
$
(
"#"
+
key
).
val
()
:
value
;
this
.
d
ic
tInfoData
[
key
]
=
(
typeof
value
==
"undefined"
)
?
$
(
"#"
+
key
).
val
()
:
value
;
return
this
;
return
this
;
}
}
...
@@ -29,15 +29,15 @@ DeptInfoDlg.set = function(key, val) {
...
@@ -29,15 +29,15 @@ DeptInfoDlg.set = function(key, val) {
* @param key 数据的名称
* @param key 数据的名称
* @param val 数据的具体值
* @param val 数据的具体值
*/
*/
D
ep
tInfoDlg
.
get
=
function
(
key
)
{
D
ic
tInfoDlg
.
get
=
function
(
key
)
{
return
$
(
"#"
+
key
).
val
();
return
$
(
"#"
+
key
).
val
();
}
}
/**
/**
* 关闭此对话框
* 关闭此对话框
*/
*/
D
ep
tInfoDlg
.
close
=
function
()
{
D
ic
tInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
D
ep
t
.
layerIndex
);
parent
.
layer
.
close
(
window
.
parent
.
D
ic
t
.
layerIndex
);
}
}
/**
/**
...
@@ -48,7 +48,7 @@ DeptInfoDlg.close = function() {
...
@@ -48,7 +48,7 @@ DeptInfoDlg.close = function() {
* @param treeNode
* @param treeNode
* @returns
* @returns
*/
*/
D
ep
tInfoDlg
.
onClickDept
=
function
(
e
,
treeId
,
treeNode
)
{
D
ic
tInfoDlg
.
onClickDept
=
function
(
e
,
treeId
,
treeNode
)
{
$
(
"#pName"
).
attr
(
"value"
,
instance
.
getSelectedVal
());
$
(
"#pName"
).
attr
(
"value"
,
instance
.
getSelectedVal
());
$
(
"#pid"
).
attr
(
"value"
,
treeNode
.
id
);
$
(
"#pid"
).
attr
(
"value"
,
treeNode
.
id
);
}
}
...
@@ -58,7 +58,7 @@ DeptInfoDlg.onClickDept = function(e, treeId, treeNode) {
...
@@ -58,7 +58,7 @@ DeptInfoDlg.onClickDept = function(e, treeId, treeNode) {
*
*
* @returns
* @returns
*/
*/
D
ep
tInfoDlg
.
showDeptSelectTree
=
function
()
{
D
ic
tInfoDlg
.
showDeptSelectTree
=
function
()
{
var
pName
=
$
(
"#pName"
);
var
pName
=
$
(
"#pName"
);
var
pNameOffset
=
$
(
"#pName"
).
offset
();
var
pNameOffset
=
$
(
"#pName"
).
offset
();
$
(
"#parentDeptMenu"
).
css
({
$
(
"#parentDeptMenu"
).
css
({
...
@@ -72,7 +72,7 @@ DeptInfoDlg.showDeptSelectTree = function() {
...
@@ -72,7 +72,7 @@ DeptInfoDlg.showDeptSelectTree = function() {
/**
/**
* 隐藏部门选择的树
* 隐藏部门选择的树
*/
*/
D
ep
tInfoDlg
.
hideDeptSelectTree
=
function
()
{
D
ic
tInfoDlg
.
hideDeptSelectTree
=
function
()
{
$
(
"#parentDeptMenu"
).
fadeOut
(
"fast"
);
$
(
"#parentDeptMenu"
).
fadeOut
(
"fast"
);
$
(
"body"
).
unbind
(
"mousedown"
,
onBodyDown
);
// mousedown当鼠标按下就可以触发,不用弹起
$
(
"body"
).
unbind
(
"mousedown"
,
onBodyDown
);
// mousedown当鼠标按下就可以触发,不用弹起
}
}
...
@@ -80,60 +80,57 @@ DeptInfoDlg.hideDeptSelectTree = function() {
...
@@ -80,60 +80,57 @@ DeptInfoDlg.hideDeptSelectTree = function() {
/**
/**
* 收集数据
* 收集数据
*/
*/
D
ep
tInfoDlg
.
collectData
=
function
()
{
D
ic
tInfoDlg
.
collectData
=
function
()
{
this
.
set
(
'id'
).
set
(
'simplename'
).
set
(
'fullname'
).
set
(
'tips'
).
set
(
'num'
).
set
(
'pid'
);
this
.
set
(
'id'
).
set
(
'simplename'
).
set
(
'fullname'
).
set
(
'tips'
).
set
(
'num'
).
set
(
'pid'
);
}
}
/**
/**
* 提交添加部门
* 提交添加部门
*/
*/
D
ep
tInfoDlg
.
addSubmit
=
function
()
{
D
ic
tInfoDlg
.
addSubmit
=
function
()
{
this
.
clearData
();
this
.
clearData
();
this
.
collectData
();
this
.
collectData
();
//提交信息
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/d
ep
t/add"
,
function
(
data
){
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/d
ic
t/add"
,
function
(
data
){
Feng
.
success
(
"添加成功!"
);
Feng
.
success
(
"添加成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
window
.
parent
.
Dept
.
table
.
refresh
();
D
ep
tInfoDlg
.
close
();
D
ic
tInfoDlg
.
close
();
},
function
(
data
){
},
function
(
data
){
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
});
ajax
.
set
(
this
.
d
ep
tInfoData
);
ajax
.
set
(
this
.
d
ic
tInfoData
);
ajax
.
start
();
ajax
.
start
();
}
}
/**
/**
* 提交修改
* 提交修改
*/
*/
D
ep
tInfoDlg
.
editSubmit
=
function
()
{
D
ic
tInfoDlg
.
editSubmit
=
function
()
{
this
.
clearData
();
this
.
clearData
();
this
.
collectData
();
this
.
collectData
();
//提交信息
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/d
ep
t/update"
,
function
(
data
){
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/d
ic
t/update"
,
function
(
data
){
Feng
.
success
(
"修改成功!"
);
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
window
.
parent
.
Dept
.
table
.
refresh
();
D
ep
tInfoDlg
.
close
();
D
ic
tInfoDlg
.
close
();
},
function
(
data
){
},
function
(
data
){
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
});
ajax
.
set
(
this
.
d
ep
tInfoData
);
ajax
.
set
(
this
.
d
ic
tInfoData
);
ajax
.
start
();
ajax
.
start
();
}
}
function
onBodyDown
(
event
)
{
function
onBodyDown
(
event
)
{
if
(
!
(
event
.
target
.
id
==
"menuBtn"
||
event
.
target
.
id
==
"parentDeptMenu"
||
$
(
if
(
!
(
event
.
target
.
id
==
"menuBtn"
||
event
.
target
.
id
==
"parentDeptMenu"
||
$
(
event
.
target
).
parents
(
"#parentDeptMenu"
).
length
>
0
))
{
event
.
target
).
parents
(
"#parentDeptMenu"
).
length
>
0
))
{
D
ep
tInfoDlg
.
hideDeptSelectTree
();
D
ic
tInfoDlg
.
hideDeptSelectTree
();
}
}
}
}
$
(
function
()
{
$
(
function
()
{
var
ztree
=
new
$ZTree
(
"parentDeptMenuTree"
,
"/dept/tree"
);
ztree
.
bindOnClick
(
DeptInfoDlg
.
onClickDept
);
ztree
.
init
();
instance
=
ztree
;
});
});
src/main/webapp/static/modular/system/dict/dict.js
0 → 100644
View file @
ea7a3616
/**
* 字典管理初始化
*/
var
Dict
=
{
id
:
"DictTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
Dict
.
initColumn
=
function
()
{
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'id'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'编号'
,
field
:
'code'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'值'
,
field
:
'num'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'父id'
,
field
:
'pid'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'名称'
,
field
:
'name'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'备注'
,
field
:
'tips'
,
align
:
'center'
,
valign
:
'middle'
}];
};
/**
* 检查是否选中
*/
Dict
.
check
=
function
()
{
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapTable
(
'getSelections'
);
if
(
selected
.
length
==
0
){
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
}
else
{
Dict
.
seItem
=
selected
[
0
];
return
true
;
}
};
/**
* 点击添加字典
*/
Dict
.
openAddDict
=
function
()
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'添加字典'
,
area
:
[
'800px'
,
'420px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/dict/dict_add'
});
this
.
layerIndex
=
index
;
};
/**
* 打开查看字典详情
*/
Dict
.
openDictDetail
=
function
()
{
if
(
this
.
check
())
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'字典详情'
,
area
:
[
'800px'
,
'420px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/dict/dict_edit/'
+
Dict
.
seItem
.
id
});
this
.
layerIndex
=
index
;
}
};
/**
* 删除字典
*/
Dict
.
delete
=
function
()
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dict/delete/"
+
this
.
seItem
.
id
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Dict
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
});
ajax
.
start
();
}
};
/**
* 查询字典列表
*/
Dict
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'condition'
]
=
$
(
"#condition"
).
val
();
Dict
.
table
.
refresh
({
query
:
queryData
});
};
$
(
function
()
{
var
defaultColunms
=
Dict
.
initColumn
();
var
table
=
new
BSTable
(
Dict
.
id
,
"/dict/list"
,
defaultColunms
);
table
.
setPaginationType
(
"client"
);
Dict
.
table
=
table
.
init
();
});
src/main/webapp/static/modular/system/dict/dict_info.js
0 → 100644
View file @
ea7a3616
/**
* 初始化部门详情对话框
*/
var
DeptInfoDlg
=
{
deptInfoData
:
{}
};
/**
* 清除数据
*/
DeptInfoDlg
.
clearData
=
function
()
{
this
.
deptInfoData
=
{};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg
.
set
=
function
(
key
,
val
)
{
this
.
deptInfoData
[
key
]
=
(
typeof
value
==
"undefined"
)
?
$
(
"#"
+
key
).
val
()
:
value
;
return
this
;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg
.
get
=
function
(
key
)
{
return
$
(
"#"
+
key
).
val
();
}
/**
* 关闭此对话框
*/
DeptInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
Dept
.
layerIndex
);
}
/**
* 点击部门ztree列表的选项时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
DeptInfoDlg
.
onClickDept
=
function
(
e
,
treeId
,
treeNode
)
{
$
(
"#pName"
).
attr
(
"value"
,
instance
.
getSelectedVal
());
$
(
"#pid"
).
attr
(
"value"
,
treeNode
.
id
);
}
/**
* 显示部门选择的树
*
* @returns
*/
DeptInfoDlg
.
showDeptSelectTree
=
function
()
{
var
pName
=
$
(
"#pName"
);
var
pNameOffset
=
$
(
"#pName"
).
offset
();
$
(
"#parentDeptMenu"
).
css
({
left
:
pNameOffset
.
left
+
"px"
,
top
:
pNameOffset
.
top
+
pName
.
outerHeight
()
+
"px"
}).
slideDown
(
"fast"
);
$
(
"body"
).
bind
(
"mousedown"
,
onBodyDown
);
}
/**
* 隐藏部门选择的树
*/
DeptInfoDlg
.
hideDeptSelectTree
=
function
()
{
$
(
"#parentDeptMenu"
).
fadeOut
(
"fast"
);
$
(
"body"
).
unbind
(
"mousedown"
,
onBodyDown
);
// mousedown当鼠标按下就可以触发,不用弹起
}
/**
* 收集数据
*/
DeptInfoDlg
.
collectData
=
function
()
{
this
.
set
(
'id'
).
set
(
'simplename'
).
set
(
'fullname'
).
set
(
'tips'
).
set
(
'num'
).
set
(
'pid'
);
}
/**
* 提交添加部门
*/
DeptInfoDlg
.
addSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/add"
,
function
(
data
){
Feng
.
success
(
"添加成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
DeptInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
deptInfoData
);
ajax
.
start
();
}
/**
* 提交修改
*/
DeptInfoDlg
.
editSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/update"
,
function
(
data
){
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
DeptInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
deptInfoData
);
ajax
.
start
();
}
function
onBodyDown
(
event
)
{
if
(
!
(
event
.
target
.
id
==
"menuBtn"
||
event
.
target
.
id
==
"parentDeptMenu"
||
$
(
event
.
target
).
parents
(
"#parentDeptMenu"
).
length
>
0
))
{
DeptInfoDlg
.
hideDeptSelectTree
();
}
}
$
(
function
()
{
var
ztree
=
new
$ZTree
(
"parentDeptMenuTree"
,
"/dept/tree"
);
ztree
.
bindOnClick
(
DeptInfoDlg
.
onClickDept
);
ztree
.
init
();
instance
=
ztree
;
});
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