优化管理模块页面的校验

This commit is contained in:
季圣华
2020-06-07 22:37:44 +08:00
parent 1c74faab7c
commit 6f039191bb
9 changed files with 50 additions and 26 deletions

View File

@@ -52,18 +52,18 @@
</div> </div>
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table> <table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
</div> </div>
<div id="supplierDlg" class="easyui-dialog" style="width:580px;padding:10px 20px" <div id="supplierDlg" class="easyui-dialog" style="padding:10px 40px" fit="true"
closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true"> closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true">
<form id="supplierFM"> <form id="supplierFM">
<table> <table>
<tr> <tr>
<td style="width: 80px;height: 20px">名称</td> <td style="width: 120px;height: 20px">名称</td>
<td style="width: 180px;padding:5px"> <td style="width: 250px;padding:5px">
<input name="supplier" id="supplier" class="easyui-textbox" <input name="supplier" id="supplier" class="easyui-textbox"
data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/> data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/>
</td> </td>
<td style="width: 60px;height: 20px">联系人</td> <td style="width: 120px;height: 20px">联系人</td>
<td style="width:180px;padding:5px;"> <td style="width:250px;padding:5px;">
<input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/> <input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/>
</td> </td>
</tr> </tr>
@@ -134,13 +134,13 @@
<tr> <tr>
<td>地址</td> <td>地址</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<input name="address" id="address" class="easyui-textbox" style="width: 401px;"/> <input name="address" id="address" class="easyui-textbox" style="width: 530px;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>备注</td> <td>备注</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<input name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 401px;height: 40px;"/> <input name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 530px;height: 40px;"/>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -457,11 +457,14 @@
//保存信息 //保存信息
$("#saveDepot").off("click").on("click", function () { $("#saveDepot").off("click").on("click", function () {
var infoObj = $("#depotFM").serializeObject(); if(!$('#depotFM').form('validate')){
infoObj.type = 0; return;
}
if (checkDepotName()) { if (checkDepotName()) {
return; return;
} }
var infoObj = $("#depotFM").serializeObject();
infoObj.type = 0;
$.ajax({ $.ajax({
url: url, url: url,
type: "post", type: "post",

View File

@@ -353,13 +353,16 @@
//保存收支项目 //保存收支项目
$("#saveInOutItem").off("click").on("click", function () { $("#saveInOutItem").off("click").on("click", function () {
if (checkInOutItemName()) { if(!$('#inOutItemFM').form('validate')){
return; return;
} }
if (!$("#type").val()) { if (!$("#type").val()) {
$.messager.alert('提示', '请选择类型!', 'warning'); $.messager.alert('提示', '请选择类型!', 'warning');
return; return;
} }
if (checkInOutItemName()) {
return;
}
$.ajax({ $.ajax({
url: url, url: url,
type: "post", type: "post",

View File

@@ -52,18 +52,18 @@
</div> </div>
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table> <table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
</div> </div>
<div id="supplierDlg" class="easyui-dialog" style="width:600px;padding:10px 20px" <div id="supplierDlg" class="easyui-dialog" style="padding:10px 40px" fit="true"
closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true"> closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true">
<form id="supplierFM"> <form id="supplierFM">
<table> <table>
<tr> <tr>
<td style="width: 80px;height: 20px">名称</td> <td style="width: 120px;height: 20px">名称</td>
<td style="width: 180px;padding:5px"> <td style="width: 250px;padding:5px">
<input name="supplier" id="supplier" class="easyui-textbox" <input name="supplier" id="supplier" class="easyui-textbox"
data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/> data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/>
</td> </td>
<td style="width: 60px;height: 20px">联系人</td> <td style="width: 120px;height: 20px">联系人</td>
<td style="width:180px;padding:5px;"> <td style="width:250px;padding:5px;">
<input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/> <input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/>
</td> </td>
</tr> </tr>
@@ -116,7 +116,7 @@
<td style="padding:5px"> <td style="padding:5px">
<input name="taxNum" id="taxNum" class="easyui-textbox" style="width: 160px;"/> <input name="taxNum" id="taxNum" class="easyui-textbox" style="width: 160px;"/>
</td> </td>
<td>税率</td> <td>税率(%)</td>
<td style="padding:5px"> <td style="padding:5px">
<input name="taxRate" id="taxRate" class="easyui-textbox" style="width: 160px;"/> <input name="taxRate" id="taxRate" class="easyui-textbox" style="width: 160px;"/>
</td> </td>
@@ -134,13 +134,13 @@
<tr> <tr>
<td>地址</td> <td>地址</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<input name="address" id="address" class="easyui-textbox" style="width: 401px;"/> <input name="address" id="address" class="easyui-textbox" style="width: 530px;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>备注</td> <td>备注</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<textarea name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 401px;height: 40px;"></textarea> <textarea name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 530px;height: 40px;"></textarea>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -272,6 +272,9 @@
//保存信息 //保存信息
$("#saveRole").off("click").on("click", function () { $("#saveRole").off("click").on("click", function () {
if(!$('#roleFM').form('validate')){
return;
}
if (checkRoleName()) { if (checkRoleName()) {
return; return;
} }

View File

@@ -52,18 +52,18 @@
</div> </div>
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table> <table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
</div> </div>
<div id="supplierDlg" class="easyui-dialog" style="width:580px;padding:10px 20px" <div id="supplierDlg" class="easyui-dialog" style="padding:10px 40px" fit="true"
closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true"> closed="true" buttons="#dlg-buttons" modal="true" collapsible="false" closable="true">
<form id="supplierFM"> <form id="supplierFM">
<table> <table>
<tr> <tr>
<td style="width: 80px;height: 20px">名称</td> <td style="width: 120px;height: 20px">名称</td>
<td style="width: 180px;padding:5px"> <td style="width: 250px;padding:5px">
<input name="supplier" id="supplier" class="easyui-textbox" <input name="supplier" id="supplier" class="easyui-textbox"
data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/> data-options="required:true,validType:'length[2,30]'" style="width: 160px;"/>
</td> </td>
<td style="width: 60px;height: 20px">联系人</td> <td style="width: 120px;height: 20px">联系人</td>
<td style="width:180px;padding:5px;"> <td style="width:250px;padding:5px;">
<input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/> <input name="contacts" id="contacts" class="easyui-textbox" style="width: 160px;"/>
</td> </td>
</tr> </tr>
@@ -134,13 +134,13 @@
<tr> <tr>
<td>地址</td> <td>地址</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<input name="address" id="address" class="easyui-textbox" style="width: 401px;"/> <input name="address" id="address" class="easyui-textbox" style="width: 530px;"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>备注</td> <td>备注</td>
<td style="padding:5px" colspan="3"> <td style="padding:5px" colspan="3">
<input name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 401px;height: 40px;"/> <input name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 530px;height: 40px;"/>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -345,6 +345,9 @@
//保存信息 //保存信息
$("#savePerson").off("click").on("click", function () { $("#savePerson").off("click").on("click", function () {
if(!$('#personFM').form('validate')){
return;
}
if (!$("#Type").val()) { if (!$("#Type").val()) {
$.messager.alert('提示', '请选择类型!', 'warning'); $.messager.alert('提示', '请选择类型!', 'warning');
return; return;

View File

@@ -65,7 +65,7 @@ public class RoleComponent implements ICommonQuery {
@Override @Override
public int checkIsNameExist(Long id, String name)throws Exception { public int checkIsNameExist(Long id, String name)throws Exception {
return 0; return roleService.checkIsNameExist(id, name);
} }
} }

View File

@@ -136,6 +136,18 @@ public class RoleService {
return result; return result;
} }
public int checkIsNameExist(Long id, String name) throws Exception{
RoleExample example = new RoleExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Role> list =null;
try{
list=roleMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
public List<Role> findUserRole()throws Exception{ public List<Role> findUserRole()throws Exception{
RoleExample example = new RoleExample(); RoleExample example = new RoleExample();
example.setOrderByClause("Id"); example.setOrderByClause("Id");