hzinfo_add.jsp 6.4 KB
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
    <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
	<link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
	<link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
    <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
    <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
    <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
    <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
    <!-- validate 验证中英文 -->
    <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
</head>
<body>
	<div class="container">
		
		<div class="content">
		        <form class="from-control" id="form">
                      <table class="kv-table">
                          <tbody>
                          <tr>
                              <td class="kv-label">简称</td>
                              <td class="kv-content">
                                  <input id="forshort" name="forshort" type="text" required/>
                              </td>
                          </tr>
                          <tr>
                              <td class="kv-label">全称</td>
                              <td class="kv-content">
                                  <input  id="fullname" name="fullname" type="text" required/>
                              </td>
                          </tr>
                          <tr>
                              <td class="kv-label">货主类型</td>
                              <td class="kv-content">
                                  <div class="date">
                                      <label>
                                          <input id="one" name="one" type="checkbox" value="111" checked>发货人
                                      </label>
                                      <label>
                                          <input id="two" name="two" type="checkbox" value="222">订舱代理
                                      </label>
                                      <label>
                                          <input id="three" name="three" type="checkbox" value="333">操作代理
                                      </label>
                                  </div>
                              </td>
                          </tr>
                          <tr>
                              <td class="kv-label">联系人</td>
                              <td class="kv-content"><input type="text" id="contacts" name="contacts" required></td>
                          </tr>
                          <tr>
                              <td class="kv-label">电话</td>
                              <td class="kv-content"><input type="text" id="phone" name="phone" required></td>
                          </tr>

                          <tr>
                              <td colspan="6">
                                  <div class="opt-buttons" style="padding-top:20px;">
                                      <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
                                          <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
                                      </button>
                                      <%--<button type="button" class="easyui-linkbutton l-btn l-btn-small" onclick="window.location.href='<%=basePath%>system/user/list'">--%>
                                          <%--<span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.cancel"/></span></span>--%>
                                      <%--</button>--%>
                                  </div>
                              </td>
                          </tr>
                          </tbody>
                      </table>
               </form>
		</div>
	</div>
	<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
    <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
    <script src="<%=basePath %>resource/js/tools.js"></script>
	<script type="text/javascript">
        $("#form").validate({
            submitHandler:function(form){
                submit();
            }
        });

        var selectFals = false;
	    function submit(){
	        var chboxValue=[];
	        var checkBox = $("input[name=one],input[name=two],input[name=three]");
	        for (var i=0; i<checkBox.length; i++){
	            if (checkBox[i].checked){
                    selectFals = true;
                }
            }

            if (selectFals == true){
                var data = $("#form").serialize();
                $.post("<%=basePath%>hzinfo/save",data,function(data){
                    if(data.status==200){
                        layer.confirm("<spring:message code="opt.savesuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
                            var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
                            parent.layer.close(index);
                            window.parent.location.reload();
                        })
                    }else if(data.status == 201){
                        layer.open({content:"该简称和货主类型已存在!"});
                    }else {
                        layer.open({content:"网络异常!"});
                    }
                })
            }else {
	            alert("货主类型至少选择一项");
	            return false;
            }
	    }
	</script>
</body> 
</html>