重构代码:使用Longbow.Validate代替JQuery.Validate

This commit is contained in:
Argo-MacBookPro 2018-07-19 18:12:48 +08:00
parent 1ab7cdefc6
commit fc0ba6fde9
7 changed files with 9 additions and 45 deletions

View File

@ -53,24 +53,24 @@
<h4 class="modal-title" id="myModalLabel">字典编辑窗口</h4> <h4 class="modal-title" id="myModalLabel">字典编辑窗口</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="dataForm" name="dataForm" role="form"> <form class="form-horizontal" role="form">
<input type="text" class="form-control hidden" id="dictID" data-default-val="0" /> <input type="text" class="form-control hidden" id="dictID" data-default-val="0" />
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="dictCate">字典标签</label> <label class="control-label col-sm-2" for="dictCate">字典标签</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" id="dictCate" placeholder="不可为空50字以内" maxlength="50" /> <input type="text" class="form-control" id="dictCate" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="dictName">字典名称</label> <label class="control-label col-sm-2" for="dictName">字典名称</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" id="dictName" placeholder="不可为空50字以内" maxlength="50" /> <input type="text" class="form-control" id="dictName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" for="dictCode">字典代码</label> <label class="control-label col-sm-2" for="dictCode">字典代码</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" id="dictCode" placeholder="不可为空50字以内" maxlength="50" /> <input type="text" class="form-control" id="dictCode" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -45,11 +45,11 @@
<h4 class="modal-title" id="myModalLabel">部门编辑窗口</h4> <h4 class="modal-title" id="myModalLabel">部门编辑窗口</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-inline" id="dataForm" name="dataForm" role="form"> <form class="form-inline" role="form">
<div class="row"> <div class="row">
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="groupName">部门名称</label> <label class="control-label" for="groupName">部门名称</label>
<input type="text" class="form-control" id="groupName" name="groupName" placeholder="不可为空50字以内" maxlength="50" /> <input type="text" class="form-control" id="groupName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<input type="text" class="form-control hidden" id="groupID" data-default-val="0" /> <input type="text" class="form-control hidden" id="groupID" data-default-val="0" />

View File

@ -103,7 +103,7 @@
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="order">菜单序号</label> <label class="control-label" for="order">菜单序号</label>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" data-valid="true" /> <input type="text" class="form-control digits" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" data-valid="true" />
<span class="input-group-btn"> <span class="input-group-btn">
<button data-method="clear" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button> <button data-method="clear" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button>
<button id="btnMenuOrder" class="btn btn-default" type="button"><i class="fa fa-list-ol"></i>调整</button> <button id="btnMenuOrder" class="btn btn-default" type="button"><i class="fa fa-list-ol"></i>调整</button>

View File

@ -55,11 +55,11 @@
<h4 class="modal-title" id="myModalLabel">角色编辑窗口</h4> <h4 class="modal-title" id="myModalLabel">角色编辑窗口</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-inline" id="dataForm" role="form"> <form class="form-inline" role="form">
<div class="row"> <div class="row">
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label class="control-label" for="roleName">角色名称</label> <label class="control-label" for="roleName">角色名称</label>
<input type="text" class="form-control" id="roleName" placeholder="不可为空50字以内" maxlength="50" /> <input type="text" class="form-control" id="roleName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div> </div>
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<input type="text" class="form-control hidden" id="roleID" data-default-val="0" /> <input type="text" class="form-control hidden" id="roleID" data-default-val="0" />

View File

@ -27,26 +27,6 @@
] ]
}); });
// validate
$('#dataForm').autoValidate({
dictCate: {
required: true,
maxlength: 50
},
dictName: {
required: true,
maxlength: 50
},
dictCode: {
required: true,
maxlength: 50
},
dictDefine: {
required: false,
maxlength: 50
}
});
// autocomplete // autocomplete
$.bc({ $.bc({
url: "api/Category", swal: false, method: 'get', url: "api/Category", swal: false, method: 'get',

View File

@ -84,12 +84,4 @@
{ title: "部门描述", field: "Description", sortable: false } { title: "部门描述", field: "Description", sortable: false }
] ]
}); });
// validate
$('#dataForm').autoValidate({
groupName: {
required: true,
maxlength: 50
}
});
}); });

View File

@ -128,14 +128,6 @@
] ]
}); });
// validate
$('#dataForm').autoValidate({
roleName: {
required: true,
maxlength: 50
}
});
$nestMenu.nestMenu(function () { $nestMenu.nestMenu(function () {
$nestMenuInput = $nestMenu.find('div.dd3-content'); $nestMenuInput = $nestMenu.find('div.dd3-content');
$nestMenuInput.on('click', ':checkbox', function () { $nestMenuInput.on('click', ':checkbox', function () {