hzinfo_edit.jsp
6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<%@ 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">
<input type="hidden" id="id" name="id" value="${entity.id}">
<table class="kv-table">
<tbody>
<tr>
<td class="kv-label">简称</td>
<td class="kv-content">
<input id="forshort" name="for_short" type="text" value="${entity.for_short}" required/>
</td>
</tr>
<tr>
<td class="kv-label">全称</td>
<td class="kv-content">
<input id="fullname" name="full_name" type="text" value="${entity.full_name}" required/>
</td>
</tr>
<tr>
<td class="kv-label">货主类型</td>
<td class="kv-content">
<div class="date">
<label>
<input id="one" name="the_shipper_type" type="checkbox" ${1 eq entity.the_shipper_type?"checked":""} value="1">发货人
</label>
<label>
<input id="two" name="the_shipper_type" type="checkbox" ${2 eq entity.the_shipper_type?"checked":""} value="2">订舱代理
</label>
<label>
<input id="three" name="the_shipper_type" type="checkbox" ${3 eq entity.the_shipper_type?"checked":""} value="3">操作代理
</label>
</div>
</td>
</tr>
<tr>
<td class="kv-label">联系人</td>
<td class="kv-content">
<input id="contacts" name="contacts" type="text" value="${entity.contacts}" required/>
</td>
</tr>
<tr>
<td class="kv-label">电话</td>
<td class="kv-content">
<input id="phone" name="phone" type="text" value="${entity.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>
</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();
}
});
$(function () {
$("#form").find("input[type=checkbox]").bind("click", function () {
//当前checkbox是否选中
if (this.checked){
//除当前的checkbox其他不选中
$("#form").find("input[type=checkbox]").not(this).attr("checked", false);
}
})
})
var selectFals = false;
function submit(){
var chboxValue=[];
var checkBox = $("input[id=one],input[id=two],input[id=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/update",data,function(data){
if(data.status==200){
layer.confirm("修改成功!",{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>