logInfo.html
4.56 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>日志查询</title>
<link href="../css/frame.css" rel="stylesheet" />
<link href="../scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
<style type="text/css">
.title {
width: 70px;
text-align: right;
padding-right: 5px;
}
.content {
width: 120px;
text-align: left;
padding-left: 5px;
}
</style>
</head>
<body class="easyui-layout">
<div data-options="region:'north',border:false,split:false" style="height: 45px;padding:8px;">
<table>
<tr>
<td class="title">开始时间:</td>
<td class="content">
<input id="beginTime" type="text" name="beginTime" value="1-1" class="Wdate" readonly="true" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'endTime\')}',minDate:'#F{$dp.$D(\'endTime\',{d:-7})}'})" style="width: 100px;" />
</td>
<td class="title">
结束时间:
</td>
<td class="content">
<input id="endTime" type="text" name="endTime" value="12-31" class="Wdate" readonly="true" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'beginTime\')}',maxDate:'#F{$dp.$D(\'beginTime\',{d:7})}'})" style="width: 100px;" />
</td>
<td>
<a id="btnExport" class="settingBtn" data-options="iconCls: 'icon-export'" style="width:100px;margin-right:3px">导出</a>
</td>
</tr>
</table>
</div>
<script src="../scripts/easyui/jquery.min.js"></script>
<script src="../scripts/easyui/jquery.easyui.min.js"></script>
<script src="../scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
<script src="../scripts/utilities.js"></script>
<script src="../scripts/My97DatePicker/WdatePicker.js"></script>
<script src="../scripts/dateTimeExtension.js"></script>
<script type="text/javascript">
$().ready(function () {
//获取最新的日期
var now = new Date();
var yestoday = new Date(now - 86400000);
$("#beginTime").val(yestoday.format("yyyy-MM-dd"));
$("#endTime").val(now.format("yyyy-MM-dd"));
$("#btnExport").click(exportLog);
});
//导出日志
function exportLog() {
var beginTime = $("#beginTime").val();
var endTime = $("#endTime").val();
if (!beginTime || !endTime) {
$.messager.alert("提示", "请选择开始时间及结束时间!", "warning");
return;
}else if (beginTime > endTime) {
$.messager.alert("提示", "开始时间不能大开结束时间!", "warning");
return;
}
//
var beginTimeParts = beginTime.split("-");
var endTimeParts = endTime.split("-");
var url = "/do/trafficController/downloadLog";
//显示假的进度条
$.messager.progress({
title: "导出",
msg: "导出中,请稍候...",
text: "",
interval:1000
});
$.ajax({
type: "GET",
url: url,
data: {
startYear: beginTimeParts[0],
startMonth: beginTimeParts[1],
startDay: beginTimeParts[2],
endYear: endTimeParts[0],
endMonth: endTimeParts[1],
endDay : endTimeParts[2]
},
dataType: "json",
error: function(jqXHR, textStatus, error) {
$.messager.progress("close");
$.messager.alert("出错", "请求出错,信息: "+error, "error");
},
success: function (data, textStatus, jqXHR) {
$.messager.progress("close");
//下载日志文件
if (data.error == 1) {
//alert(data.feedback.Msg);
var fileUrl = "/do/trafficController/downloadFile?FilePath=" + data.feedback.FilePath;
downloadByIframe(fileUrl);
} else {
$.messager.alert("出错", data.feedback.Msg, "info");
}
}
});
}
</script>
</body>
</html>