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
d9be71bd
Commit
d9be71bd
authored
Apr 28, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加字典页面完成
parent
d6f144d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
144 deletions
+132
-144
src/main/java/com/stylefeng/guns/persistence/model/User.java
+7
-3
src/main/webapp/WEB-INF/view/system/dict/dict.html
+2
-2
src/main/webapp/WEB-INF/view/system/dict/dict_add.html
+33
-25
src/main/webapp/static/js/common/Feng.js
+11
-6
src/main/webapp/static/modular/system/dict/dict_info.js
+79
-108
No files found.
src/main/java/com/stylefeng/guns/persistence/model/User.java
View file @
d9be71bd
package
com
.
stylefeng
.
guns
.
persistence
.
model
;
package
com
.
stylefeng
.
guns
.
persistence
.
model
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* <p>
* <p>
...
@@ -26,6 +28,8 @@ public class User extends Model<User> {
...
@@ -26,6 +28,8 @@ public class User extends Model<User> {
private
String
password
;
private
String
password
;
private
String
salt
;
private
String
salt
;
private
String
name
;
private
String
name
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
birthday
;
private
Date
birthday
;
private
Integer
sex
;
private
Integer
sex
;
private
String
email
;
private
String
email
;
...
...
src/main/webapp/WEB-INF/view/system/dict/dict.html
View file @
d9be71bd
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
</div>
</div>
</div>
</div>
<div
class=
"hidden-xs"
id=
"DictTableToolbar"
role=
"group"
>
<div
class=
"hidden-xs"
id=
"DictTableToolbar"
role=
"group"
>
<
#
button
name=
"添加"
icon=
"fa-plus"
clickFun=
"Dict.openAddD
ep
t()"
/>
<
#
button
name=
"添加"
icon=
"fa-plus"
clickFun=
"Dict.openAddD
ic
t()"
/>
<
#
button
name=
"修改"
icon=
"fa-plus"
clickFun=
"Dict.openD
ep
tDetail()"
space=
"true"
/>
<
#
button
name=
"修改"
icon=
"fa-plus"
clickFun=
"Dict.openD
ic
tDetail()"
space=
"true"
/>
<
#
button
name=
"删除"
icon=
"fa-plus"
clickFun=
"Dict.delete()"
space=
"true"
/>
<
#
button
name=
"删除"
icon=
"fa-plus"
clickFun=
"Dict.delete()"
space=
"true"
/>
</div>
</div>
<
#
table
id=
"DictTable"
/>
<
#
table
id=
"DictTable"
/>
...
...
src/main/webapp/WEB-INF/view/system/dict/dict_add.html
View file @
d9be71bd
...
@@ -6,37 +6,44 @@
...
@@ -6,37 +6,44 @@
<input
type=
"hidden"
id=
"id"
value=
""
>
<input
type=
"hidden"
id=
"id"
value=
""
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 b-r"
>
<div
class=
"col-sm-12"
id=
"itemsArea"
>
<
#
input
id=
"simplename"
name=
"部门名称"
underline=
"true"
/>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
字典名称
</label>
<div
class=
"col-sm-2"
>
<input
class=
"form-control"
id=
"dictName"
type=
"text"
>
</div>
<div
class=
"col-sm-2"
>
<
#
button
btnCss=
"info"
name=
"增加"
icon=
"fa-plus"
clickFun=
"DictInfoDlg.addItem()"
/>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<
#
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>
</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=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"D
ep
tInfoDlg.addSubmit()"
/>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"D
ic
tInfoDlg.addSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"D
ep
tInfoDlg.close()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"D
ic
tInfoDlg.close()"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/dict/dict_info.js"
></script>
<script
type=
"text/template"
id=
"itemTemplate"
>
@}
<
div
class
=
"form-group"
name
=
"dictItem"
id
=
"dictItem"
>
<
label
class
=
"col-sm-2 control-label"
>
值
<
/label
>
<
div
class
=
"col-sm-2"
>
<
input
class
=
"form-control"
type
=
"text"
name
=
"itemNum"
>
<
/div
>
<
label
class
=
"col-sm-2 control-label"
style
=
"width: 8%;"
>
名称
<
/label
>
<
div
class
=
"col-sm-2"
>
<
input
class
=
"form-control"
type
=
"text"
name
=
"itemName"
>
<
/div
>
<
div
class
=
"col-sm-4"
>
<
#
button
btnCss
=
"danger"
name
=
"删除"
id
=
"cancel"
icon
=
"fa-remove"
clickFun
=
"DictInfoDlg.deleteItem(event)"
/>
<
/div
>
<
/div
>
</script>
<script
src=
"${ctxPath}/static/modular/system/dict/dict_info.js"
></script>
@}
\ No newline at end of file
src/main/webapp/static/js/common/Feng.js
View file @
d9be71bd
...
@@ -5,13 +5,13 @@ var Feng = {
...
@@ -5,13 +5,13 @@ var Feng = {
this
.
ctxPath
=
ctx
;
this
.
ctxPath
=
ctx
;
}
}
},
},
confirm
:
function
(
tip
,
ensure
)
{
//询问框
confirm
:
function
(
tip
,
ensure
)
{
//询问框
parent
.
layer
.
confirm
(
tip
,
{
parent
.
layer
.
confirm
(
tip
,
{
btn
:
[
'确定'
,
'取消'
]
btn
:
[
'确定'
,
'取消'
]
},
function
(
index
)
{
},
function
(
index
)
{
ensure
();
ensure
();
parent
.
layer
.
close
(
index
);
parent
.
layer
.
close
(
index
);
},
function
(
index
)
{
},
function
(
index
)
{
parent
.
layer
.
close
(
index
);
parent
.
layer
.
close
(
index
);
});
});
},
},
...
@@ -38,10 +38,10 @@ var Feng = {
...
@@ -38,10 +38,10 @@ var Feng = {
display
=
info
;
display
=
info
;
}
else
{
}
else
{
if
(
info
instanceof
Array
)
{
if
(
info
instanceof
Array
)
{
for
(
var
x
in
info
)
{
for
(
var
x
in
info
)
{
display
=
display
+
info
[
x
]
+
"<br/>"
;
display
=
display
+
info
[
x
]
+
"<br/>"
;
}
}
}
else
{
}
else
{
display
=
info
;
display
=
info
;
}
}
}
}
...
@@ -101,5 +101,10 @@ var Feng = {
...
@@ -101,5 +101,10 @@ var Feng = {
ids
+=
","
+
nodes
[
i
].
id
;
ids
+=
","
+
nodes
[
i
].
id
;
}
}
return
ids
.
substring
(
1
);
return
ids
.
substring
(
1
);
},
eventParseObject
:
function
(
event
)
{
//获取点击事件的源对象
event
=
event
?
event
:
window
.
event
;
var
obj
=
event
.
srcElement
?
event
.
srcElement
:
event
.
target
;
return
$
(
obj
);
}
}
};
};
src/main/webapp/static/modular/system/dict/dict_info.js
View file @
d9be71bd
/**
/**
* 初始化
部门
详情对话框
* 初始化
字典
详情对话框
*/
*/
var
DeptInfoDlg
=
{
var
DictInfoDlg
=
{
deptInfoData
:
{}
count
:
0
,
dictName
:
''
,
//字典的名称
mutiString
:
''
,
//拼接字符串内容(拼接字典条目)
itemTemplate
:
$
(
"#itemTemplate"
).
html
()
};
};
/**
/**
*
清除数据
*
item获取新的id
*/
*/
DeptInfoDlg
.
clearData
=
function
()
{
DictInfoDlg
.
newId
=
function
()
{
this
.
deptInfoData
=
{};
this
.
count
=
this
.
count
+
1
;
}
return
"dictItem"
+
this
.
count
;
};
/**
* 设置对话框中的数据
*
* @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
();
}
/**
/**
* 关闭此对话框
* 关闭此对话框
*/
*/
D
eptInfoDlg
.
close
=
function
()
{
D
ictInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
Dep
t
.
layerIndex
);
parent
.
layer
.
close
(
window
.
parent
.
Dic
t
.
layerIndex
);
}
}
;
/**
/**
* 点击部门ztree列表的选项时
* 添加条目
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
*/
D
eptInfoDlg
.
onClickDept
=
function
(
e
,
treeId
,
treeNode
)
{
D
ictInfoDlg
.
addItem
=
function
(
)
{
$
(
"#pName"
).
attr
(
"value"
,
instance
.
getSelectedVal
()
);
$
(
"#itemsArea"
).
append
(
this
.
itemTemplate
);
$
(
"#pid"
).
attr
(
"value"
,
treeNode
.
id
);
$
(
"#dictItem"
).
attr
(
"id"
,
this
.
newId
()
);
}
}
;
/**
/**
* 显示部门选择的树
* 删除item
*
* @returns
*/
*/
DeptInfoDlg
.
showDeptSelectTree
=
function
()
{
DictInfoDlg
.
deleteItem
=
function
(
event
)
{
var
pName
=
$
(
"#pName"
);
var
obj
=
Feng
.
eventParseObject
(
event
);
var
pNameOffset
=
$
(
"#pName"
).
offset
();
obj
.
parent
().
parent
().
remove
();
$
(
"#parentDeptMenu"
).
css
({
};
left
:
pNameOffset
.
left
+
"px"
,
top
:
pNameOffset
.
top
+
pName
.
outerHeight
()
+
"px"
}).
slideDown
(
"fast"
);
$
(
"body"
).
bind
(
"mousedown"
,
onBodyDown
);
}
/**
/**
*
隐藏部门选择的树
*
清除为空的item Dom
*/
*/
DeptInfoDlg
.
hideDeptSelectTree
=
function
()
{
DictInfoDlg
.
clearNullDom
=
function
(){
$
(
"#parentDeptMenu"
).
fadeOut
(
"fast"
);
$
(
"[name='dictItem']"
).
each
(
function
(){
$
(
"body"
).
unbind
(
"mousedown"
,
onBodyDown
);
// mousedown当鼠标按下就可以触发,不用弹起
var
num
=
$
(
this
).
find
(
"[name='itemNum']"
).
val
();
}
var
name
=
$
(
this
).
find
(
"[name='itemName']"
).
val
();
if
(
num
==
''
||
name
==
''
){
$
(
this
).
remove
();
}
});
};
/**
/**
* 收集数据
* 收集
添加字典的
数据
*/
*/
DeptInfoDlg
.
collectData
=
function
()
{
DictInfoDlg
.
collectData
=
function
()
{
this
.
set
(
'id'
).
set
(
'simplename'
).
set
(
'fullname'
).
set
(
'tips'
).
set
(
'num'
).
set
(
'pid'
);
this
.
clearNullDom
();
}
var
mutiString
=
""
;
$
(
"[name='dictItem']"
).
each
(
function
(){
var
num
=
$
(
this
).
find
(
"[name='itemNum']"
).
val
();
var
name
=
$
(
this
).
find
(
"[name='itemName']"
).
val
();
mutiString
=
mutiString
+
(
num
+
":"
+
name
+
";"
);
});
this
.
dictName
=
$
(
"#dictName"
).
val
();
this
.
mutiString
=
mutiString
;
};
/**
/**
* 提交添加
部门
* 提交添加
字典
*/
*/
DeptInfoDlg
.
addSubmit
=
function
()
{
DictInfoDlg
.
addSubmit
=
function
()
{
this
.
collectData
();
this
.
clearData
();
//提交信息
this
.
collectData
();
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dict/add"
,
function
(
data
)
{
Feng
.
success
(
"添加成功!"
);
//提交信息
window
.
parent
.
Dict
.
table
.
refresh
();
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/add"
,
function
(
data
){
DictInfoDlg
.
close
();
Feng
.
success
(
"添加成功!"
);
},
function
(
data
)
{
window
.
parent
.
Dept
.
table
.
refresh
();
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
DeptInfoDlg
.
close
();
});
},
function
(
data
){
ajax
.
set
(
'dictName'
,
this
.
dictName
);
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
ajax
.
set
(
'dictValues'
,
this
.
mutiString
);
});
ajax
.
start
();
ajax
.
set
(
this
.
deptInfoData
);
};
ajax
.
start
();
}
/**
/**
* 提交修改
* 提交修改
*/
*/
DeptInfoDlg
.
editSubmit
=
function
()
{
DictInfoDlg
.
editSubmit
=
function
()
{
this
.
collectData
();
this
.
clearData
();
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dict/update"
,
function
(
data
)
{
this
.
collectData
();
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
//提交信息
DictInfoDlg
.
close
();
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/update"
,
function
(
data
){
},
function
(
data
)
{
Feng
.
success
(
"修改成功!"
);
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
});
DeptInfoDlg
.
close
();
ajax
.
set
(
this
.
dictInfoData
);
},
function
(
data
){
ajax
.
start
();
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
()
{
$
(
function
()
{
var
ztree
=
new
$ZTree
(
"parentDeptMenuTree"
,
"/dept/tree"
);
var
ztree
=
new
$ZTree
(
"parentDeptMenuTree"
,
"/dept/tree"
);
ztree
.
bindOnClick
(
Dep
tInfoDlg
.
onClickDept
);
ztree
.
bindOnClick
(
Dic
tInfoDlg
.
onClickDept
);
ztree
.
init
();
ztree
.
init
();
instance
=
ztree
;
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