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
61f1562f
Commit
61f1562f
authored
Jun 16, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单管理增加表单验证
parent
d4cf3ae3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
src/main/webapp/WEB-INF/view/system/menu/menu_add.html
+1
-1
src/main/webapp/WEB-INF/view/system/menu/menu_edit.html
+1
-1
src/main/webapp/static/modular/system/menu/menu_info.js
+55
-2
No files found.
src/main/webapp/WEB-INF/view/system/menu/menu_add.html
View file @
61f1562f
@layout("/common/_container.html"){
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<div
class=
"form-horizontal"
id=
"menuInfoForm"
>
<input
type=
"hidden"
id=
"id"
value=
""
>
<input
type=
"hidden"
id=
"id"
value=
""
>
...
...
src/main/webapp/WEB-INF/view/system/menu/menu_edit.html
View file @
61f1562f
@layout("/common/_container.html"){
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<div
class=
"form-horizontal"
id=
"menuInfoForm"
>
<input
type=
"hidden"
id=
"id"
value=
"${menu.id}"
>
<input
type=
"hidden"
id=
"id"
value=
"${menu.id}"
>
<input
type=
"hidden"
id=
"ismenuValue"
value=
"${menu.ismenu}"
>
<input
type=
"hidden"
id=
"ismenuValue"
value=
"${menu.ismenu}"
>
...
...
src/main/webapp/static/modular/system/menu/menu_info.js
View file @
61f1562f
...
@@ -3,7 +3,37 @@
...
@@ -3,7 +3,37 @@
*/
*/
var
MenuInfoDlg
=
{
var
MenuInfoDlg
=
{
menuInfoData
:
{},
menuInfoData
:
{},
ztreeInstance
:
null
ztreeInstance
:
null
,
validateFields
:
{
name
:
{
validators
:
{
notEmpty
:
{
message
:
'菜单名称不能为空'
}
}
},
code
:
{
validators
:
{
notEmpty
:
{
message
:
'菜单编号不能为空'
}
}
},
pcodeName
:
{
validators
:
{
notEmpty
:
{
message
:
'父菜单不能为空'
}
}
},
url
:
{
validators
:
{
notEmpty
:
{
message
:
'请求地址不能为空'
}
}
}
}
};
};
/**
/**
...
@@ -49,6 +79,15 @@ MenuInfoDlg.collectData = function () {
...
@@ -49,6 +79,15 @@ MenuInfoDlg.collectData = function () {
}
}
/**
/**
* 验证数据是否为空
*/
MenuInfoDlg
.
validate
=
function
()
{
$
(
'#menuInfoForm'
).
data
(
"bootstrapValidator"
).
resetForm
();
$
(
'#menuInfoForm'
).
bootstrapValidator
(
'validate'
);
return
$
(
"#menuInfoForm"
).
data
(
'bootstrapValidator'
).
isValid
();
}
/**
* 提交添加用户
* 提交添加用户
*/
*/
MenuInfoDlg
.
addSubmit
=
function
()
{
MenuInfoDlg
.
addSubmit
=
function
()
{
...
@@ -56,6 +95,10 @@ MenuInfoDlg.addSubmit = function () {
...
@@ -56,6 +95,10 @@ MenuInfoDlg.addSubmit = function () {
this
.
clearData
();
this
.
clearData
();
this
.
collectData
();
this
.
collectData
();
if
(
!
this
.
validate
())
{
return
;
}
//提交信息
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/add"
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/add"
,
function
(
data
)
{
Feng
.
success
(
"添加成功!"
);
Feng
.
success
(
"添加成功!"
);
...
@@ -76,6 +119,10 @@ MenuInfoDlg.editSubmit = function () {
...
@@ -76,6 +119,10 @@ MenuInfoDlg.editSubmit = function () {
this
.
clearData
();
this
.
clearData
();
this
.
collectData
();
this
.
collectData
();
if
(
!
this
.
validate
())
{
return
;
}
//提交信息
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/edit"
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/edit"
,
function
(
data
)
{
Feng
.
success
(
"修改成功!"
);
Feng
.
success
(
"修改成功!"
);
...
@@ -105,11 +152,17 @@ MenuInfoDlg.showMenuSelectTree = function () {
...
@@ -105,11 +152,17 @@ MenuInfoDlg.showMenuSelectTree = function () {
};
};
$
(
function
()
{
$
(
function
()
{
Feng
.
initValidator
(
"menuInfoForm"
,
MenuInfoDlg
.
validateFields
);
var
ztree
=
new
$ZTree
(
"pcodeTree"
,
"/menu/selectMenuTreeList"
);
var
ztree
=
new
$ZTree
(
"pcodeTree"
,
"/menu/selectMenuTreeList"
);
ztree
.
bindOnClick
(
MenuInfoDlg
.
onClickDept
);
ztree
.
bindOnClick
(
MenuInfoDlg
.
onClickDept
);
ztree
.
init
();
ztree
.
init
();
MenuInfoDlg
.
ztreeInstance
=
ztree
;
MenuInfoDlg
.
ztreeInstance
=
ztree
;
//初始化是否是菜单
//初始化是否是菜单
$
(
"#ismenu"
).
val
(
$
(
"#ismenuValue"
).
val
());
if
(
$
(
"#ismenuValue"
).
val
()
==
undefined
){
$
(
"#ismenu"
).
val
(
0
);
}
else
{
$
(
"#ismenu"
).
val
(
$
(
"#ismenuValue"
).
val
());
}
});
});
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