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
7f1f8d6a
Commit
7f1f8d6a
authored
Jun 16, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户管理增加表单验证
parent
91e3a1bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
4 deletions
+68
-4
src/main/webapp/WEB-INF/view/system/user/user_add.html
+1
-1
src/main/webapp/WEB-INF/view/system/user/user_edit.html
+1
-1
src/main/webapp/static/modular/system/user/user_info.js
+66
-2
No files found.
src/main/webapp/WEB-INF/view/system/user/user_add.html
View file @
7f1f8d6a
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<div
class=
"form-horizontal"
id=
"userInfoForm"
>
<input
type=
"hidden"
id=
"id"
value=
""
>
...
...
src/main/webapp/WEB-INF/view/system/user/user_edit.html
View file @
7f1f8d6a
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<div
class=
"form-horizontal"
id=
"userInfoForm"
>
<input
type=
"hidden"
id=
"id"
value=
"${user.id}"
>
<input
type=
"hidden"
id=
"sexValue"
value=
"${user.sex}"
>
...
...
src/main/webapp/static/modular/system/user/user_info.js
View file @
7f1f8d6a
...
...
@@ -2,7 +2,52 @@
* 用户详情对话框(可用于添加和修改对话框)
*/
var
UserInfoDlg
=
{
userInfoData
:
{}
userInfoData
:
{},
validateFields
:
{
account
:
{
validators
:
{
notEmpty
:
{
message
:
'账户不能为空'
}
}
},
name
:
{
validators
:
{
notEmpty
:
{
message
:
'姓名不能为空'
}
}
},
citySel
:
{
validators
:
{
notEmpty
:
{
message
:
'部门不能为空'
}
}
},
password
:
{
validators
:
{
notEmpty
:
{
message
:
'密码不能为空'
},
identical
:
{
field
:
'rePassword'
,
message
:
'两次密码不一致'
},
}
},
rePassword
:
{
validators
:
{
notEmpty
:
{
message
:
'密码不能为空'
},
identical
:
{
field
:
'password'
,
message
:
'两次密码不一致'
},
}
}
}
};
/**
...
...
@@ -115,6 +160,15 @@ UserInfoDlg.validatePwd = function () {
};
/**
* 验证数据是否为空
*/
UserInfoDlg
.
validate
=
function
()
{
$
(
'#userInfoForm'
).
data
(
"bootstrapValidator"
).
resetForm
();
$
(
'#userInfoForm'
).
bootstrapValidator
(
'validate'
);
return
$
(
"#userInfoForm"
).
data
(
'bootstrapValidator'
).
isValid
();
};
/**
* 提交添加用户
*/
UserInfoDlg
.
addSubmit
=
function
()
{
...
...
@@ -122,6 +176,10 @@ UserInfoDlg.addSubmit = function () {
this
.
clearData
();
this
.
collectData
();
if
(
!
this
.
validate
())
{
return
;
}
if
(
!
this
.
validatePwd
())
{
Feng
.
error
(
"两次密码输入不一致"
);
return
;
...
...
@@ -147,10 +205,14 @@ UserInfoDlg.editSubmit = function () {
this
.
clearData
();
this
.
collectData
();
if
(
!
this
.
validate
())
{
return
;
}
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/edit"
,
function
(
data
)
{
Feng
.
success
(
"修改成功!"
);
if
(
window
.
parent
.
MgrUser
!=
undefined
)
{
if
(
window
.
parent
.
MgrUser
!=
undefined
)
{
window
.
parent
.
MgrUser
.
table
.
refresh
();
UserInfoDlg
.
close
();
}
...
...
@@ -185,6 +247,8 @@ function onBodyDown(event) {
}
$
(
function
()
{
Feng
.
initValidator
(
"userInfoForm"
,
UserInfoDlg
.
validateFields
);
var
ztree
=
new
$ZTree
(
"treeDemo"
,
"/dept/tree"
);
ztree
.
bindOnClick
(
UserInfoDlg
.
onClickDept
);
ztree
.
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