list.jsp
19.8 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<%@ 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 rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
<link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
<link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
</head>
<body>
<div class="container">
<div data-options="closable:true">
<table id="dg" style="width:100%;" title="<spring:message code="manifest.list"/>"
data-options="
rownumbers:true,
singleSelect:false,
autoRowHeight:false,
pagination:true,
fitColumns:true,
striped:true,
collapsible:true,
toolbar:'#tb',
pageSize:10">
<thead>
<tr>
<th field="." formatter="editFormat"><spring:message code="opt.edit" /></th>
<th field="loginaccount"><spring:message code="manifest.loginaccount"/></th>
<%--货代信息--%>
<th field="agentCode"><spring:message code="manifest.agentCode"/></th>
<th field="waybillnomaster" sortable="true"><spring:message code="manifest.bill.number"/></th>
<th field="customscode"><spring:message code="manifest.customs"/></th>
<th field="flightno" formatter="appendCarrier"><spring:message code="manifest.flight.number"/></th>
<th field="flightdate" formatter="formatFlightDate"><spring:message code="manifest.flight.date"/></th>
<th field="originatingstation"><spring:message code="manifest.starting.point"/></th>
<th field="destinationstation"><spring:message code="manifest.destination"/></th>
<th field="preparetotalpiece"><spring:message code="manifest.number.of.fittings"/></th>
<th field="preparetotalweight"><spring:message code="manifest.pre.weight"/></th>
<th field="response_text" formatter="checkResponseText" width="80"><spring:message code="manifest.response_text" /></th>
<th field=".." formatter="operatorFormat" width="60"><spring:message code="opt.operator" /></th>
</tr>
</thead>
</table>
<div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
<form id="searchForm">
<table class="search_form_table">
<spring:message code="manifest.bill.number"/>:<input id="manifnum" type="text" name="search_LIKE_waybillnomaster" style="width:166px;height:35px;line-height:35px;">
<spring:message code="manifest.flight.number"/>:<input class="easyui-textbox" type="text" name="search_LIKE_flightno" style="width:166px;height:35px;line-height:35px;">
<%--航班日期:<input class="easyui-textbox" type="date" name="search_LIKE_flightdate" style="width:166px;height:35px;line-height:35px;">--%>
<a href="javascript:doSearch()" class="easyui-linkbutton" iconCls="icon-search" data-options="selected:true"><spring:message code="opt.search" /></a>
<a href="javascript:editRow()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>
<%--<a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a> --%>
<a href="javascript:excelUpload()" class="easyui-linkbutton" style="background:#0EA14E;color:#FFF;border: 1px solid #18A197;"><spring:message code="manifest.excel"/></a>
<a href="<%=basePath %>resource/excel/excel.xls" class="easyui-linkbutton" style="background:#0EA14E;color:#FFF;border: 1px solid #18A197;">模板下载</a>
</table>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
<!--弹出层引入的JS-->
<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
<script type="text/javascript">
function formatFlightDate(value, row, index){
return row.flightdate.split(" ")[0];
}
function appendCarrier(value, row, index) {
return row.flightno;
}
function checkResponseText(value, row, index) {
var res = '';
if(value){
var start_yupei = value.indexOf("41301");
var start_yundi = value.indexOf("45201");
if(start_yupei>-1||start_yundi>-1){
// 成功
res = '<span style="color:green;">'+value+'</span>';
}else{
// 未通过或者未回执
var start_exception_ = value.indexOf("分单");
var start_exception_ = value.indexOf("主单");
if(start_exception_>-1||start_exception_>-1){
//没有回执
res = '<span style="color:black;">'+value+'</span>';
}else{
res = '<span style="color:red;">'+value+'</span>';
}
}
}
return res;
}
$(function(){
function getPageNumber(){
var pageNumber = window.localStorage.getItem("pageNumber");
if(typeof(pageNumber) != "undefined")
{
try{
var pattern = /^\d+$/g; //判断是否是数字
//console.log(pageNumber.search(pattern));
if(pageNumber.search(pattern) >= 0)
{
var num = parseInt(pageNumber);
return num;
}
return 1;
}
catch(e){
return 1;
}
}
return 1;
}
//console.log(getPageNumber());
$('#dg').datagrid({
url:'<%=basePath %>manifest/grid.json',
//queryParams:$("#searchForm").serializeJson(),
pageNumber:getPageNumber(),
view: detailview,
detailFormatter:function(index,row){
return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
},
onExpandRow: function(index,row){
console.log("expand row index:"+index);
$('#ddv-'+index).datagrid({
url:'<%=basePath %>manifest/sub/grid.json?mawbId='+row.id,
fitColumns:true,
singleSelect:true,
loadMsg:'正在加载……',
height:'auto',
autoRowHeight:"true",
columns:[[
{field:'.',title:'<spring:message code="opt.name"/>',formatter:editHbillFormat},
{field:'waybillnosecondary',title:'<spring:message code="manifest.odd.number"/>'},
{field:'originatingstation',title:'<spring:message code="manifest.starting.point"/>'},
{field:'destinationstation',title:'<spring:message code="manifest.destination"/>'},
{field:'preparepiece',title:'<spring:message code="manifest.number.of.fittings"/>'},
{field:'prepareweight',title:'<spring:message code="manifest.pre.weight"/>'},
{field:'response_text',width:160,title:'<spring:message code="manifest.response_text"/>',
formatter:function(value, row, index){
var res = '';
if(value){
var start_yupei = value.indexOf("41301");
var start_yundi = value.indexOf("45201");
if(start_yupei>-1||start_yundi>-1){
// 成功
res = '<span style="color:green;">'+value+'</span>';
}else{
// 未通过或者未回执
var start_exception_1 = value.indexOf("分单");
var start_exception_2 = value.indexOf("主单");
if(start_exception_1>-1||start_exception_2>-1){
//没有回执
res = '<span style="color:black;">'+value+'</span>';
}else{
res = '<span style="color:red;">'+value+'</span>';
}
}
}
return res;
}
},
{field:'..', title:'<spring:message code="opt.operator" />', formatter:preoperatorFormat, width:40}
]],
onResize:function(){
$('#dg').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
$('#dg').datagrid('resize');
}
});
$('#dg').datagrid('fixDetailRowHeight',index);
}
});
});
function editFormat(val,row,index){
var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="editRow('+row.id+')"><i class="iconfont"></i></a>'
html += '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" onclick="makeHawb('+row.id+')"><i class="iconfont"></i><spring:message code="manifest.new.sheet"/></a>';
return html;
}
//分单撤销按钮
function preoperatorFormat(val, row, index){
var html = "<a href='javascript:void(0)' onclick='prebackout("+row.id+")' style='text-decoration:none;color:blue;'><spring:message code='opt.backout' /></a>";
html+="<a href='javascript:void(0)' onclick='openSubReceipt(\""+row.waybillnomaster+"\",\""+row.waybillnosecondary+"\")' style='text-decoration:none;color:blue;margin-left:20px;'><spring:message code='opt.open.receipt'/></a>";
return html;
}
function prebackout(id){
if(typeof(id) == "undefined")
return;
layer.confirm("确定要撤销吗?", function(flag){
layer.close(flag);
$.ajax({
url:"<%=basePath %>/manifest/prebackout",
data:{
id:id
},
success:function(data){
if(data.status == 200)
layer.alert("撤销请求已发送!");
else
layer.alert("撤销请求发送失败!");
}
});
});
}
//主单撤销按钮
function operatorFormat(val, row, index){
<%--var html = "<a href='javascript:void(0)' onclick='backout("+row.id+")' style='text-decoration:none;color:blue;'><spring:message code='opt.backout'/></a>";--%>
var html ="<a href='javascript:void(0)' onclick='openReceipt(\""+row.waybillnomaster+"\")' style='text-decoration:none;color:blue;margin-left:20px;'><spring:message code='opt.open.receipt'/></a>";
html+="<a href='javascript:void(0)' onclick='security(\""+row.waybillnomaster+"\")' style='text-decoration:none;color:blue;margin-left:20px;'>添加安检申报</a>"
return html;
}
function backout(id){
if(typeof(id) == "undefined")
return;
layer.confirm("确定要撤销吗?", function(flag){
layer.close(flag);
//提交到后台,发送一个撤销报文
$.ajax({
url:"<%=basePath %>/manifest/backout",
data:{
id:id
},
success:function(data){
if(data.status == 200)
layer.alert("撤销请求已发送!");
else
layer.alert("撤销请求发送失败!");
}
});
});
}
//查看分单回执
function openSubReceipt(waybill_no,subno){
if(typeof(waybill_no) == "undefined")
return;
if(typeof(subno) == "undefined")
return;
seeReceipt(waybill_no,subno,false);
}
//查看主单回执
function openReceipt(waybill_no){
if(typeof(waybill_no) == "undefined")
return;
seeReceipt(waybill_no,"",true);
}
function seeReceipt(waybill_no,sub_waybill_no,isMain){
layui.use('layer', function(){
var layer = layui.layer;
var api="<%=basePath%>receipt/seeReceipt";
var params = "waybill_no="+waybill_no;
if(!isMain){
params+="&sub_waybill_no="+sub_waybill_no;
}
var viewUrl = api+"?"+params;
parent.layer.open({
type: 2,
title: "<spring:message code='opt.open.receipt'/>",
shadeClose: true,
shade: 0.8,
area: ['80%', '60%'],
content: viewUrl
});
});
}
//制分单
function makeHawb(id){
window.location.href="<%=basePath %>manifest/subedit?mawbId="+id;
}
//分单编辑
function editHbillRow(id){
window.location.href="<%=basePath %>manifest/subedit?id="+id;
}
function editHbillFormat(val,row,index){
var html='<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" onclick="editHbillRow('+row.id+')"><i class="iconfont"></i></a>';
// html += '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:red;" onclick="delHbillRow('+row.id+','+row.mawbId+','+index+')"><i class="iconfont"></i></a>';
return html;
}
function editRow(id){
var page = $("#dg").datagrid("getPager").data("pagination").options;
window.localStorage.setItem("pageNumber", page.pageNumber);
if(id==undefined){
window.location.href='<%=basePath %>manifest/edit?id=';
}else{
window.location.href='<%=basePath %>manifest/edit?id='+id;
}
}
function doSearch(){
$('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
$('#dg').datagrid("reload");
}
function getIds() {
var ids = [];
var rows = $("#dg").datagrid('getChecked');
$.each(rows,function(key,v){
ids.push(v.id);
});
return ids;
}
//分单删除
function delHbillRow(id,mawbId,index){
$.post("<%=basePath %>manifest/subdelete",{id:id},function(data){
if(data.status == 200) {
$('#ddv-'+index).datagrid({
url:'<%=basePath %>manifest/sub/grid.json?mawbId='+id,
queryParams:$("#searchForm").serializeJson(),
fitColumns:true,
singleSelect:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'.',title:'<spring:message code="opt.name"/>',formatter:editHbillFormat,width:80},
{field:'hawbNo',title:'<spring:message code="bill.hawbNo"/>',width:100},
{field:'totalPieces',title:'<spring:message code="bill.pieces"/>',width:100},
{field:'grossWeight',title:'<spring:message code="bill.weightcharge"/>',width:100},
{field:'productname',title:'<spring:message code="bill.productname"/>',width:100},
{field:'departureStation',title:'<spring:message code="bill.orilocation"/>',width:100},
{field:'destinationStation',title:'<spring:message code="bill.destination"/>',width:100},
]],
onResize:function(){
$('#dg').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
setTimeout(function(){
$('#dg').datagrid('fixDetailRowHeight',index);
},0);
}
//onClickRow: editHbillRow
})
layer.open({content:"<spring:message code="opt.success"/>"});
}else{
layer.open({content:"<spring:message code="opt.delfailed"/>!"});
}
},"json");
}
function doDelete(){
var rows = $("#dg").datagrid('getChecked');
if(rows.length==0){
layer.open({content:"<spring:message code="opt.selectone" />"});
return false;
}
layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
$.post("<%=basePath %>manifest/delete",{ids:getIds().join(",")},function(data){
if(data.status == 200) {
layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
window.location.href="<%=basePath %>manifest/list";
})
}else{
layer.open({content:"<spring:message code="opt.delfailed" />!"});
}
},"json");
});
}
$("#manifnum").keyup(function(){
var leng = $("#manifnum").val().length;
if (leng == 3)
{
$("#manifnum").val( $("#manifnum").val()+"-")
}
})
//导入excel文件
function excelUpload() {
// iframe层
layer.open({
type : 2,
title : '导入excel文件',
maxmin : true,
shadeClose : false, // 点击遮罩关闭层
area : [ '450px', '300px' ],
content : '<%=basePath %>manifest/excelView'
});
}
//添加安检申报
function security(waybill){
layer.open({
type : 2,
title : '添加安检申报',
maxmin : true,
shadeClose : false, // 点击遮罩关闭层
area : [ '80%', '65%' ],
content : '<%=basePath %>declaration/securityView?waybill='+waybill
});
}
</script>
</body>
</html>