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
441
442
443
444
445
446
447
448
449
450
451
452
453
<%--
Created by IntelliJ IDEA.
User: m01
Date: 2018/5/8 0008
Time: 下午 3:46
To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>全网监控智能分析平台</title>
<link href="${ctx}/static/nvd3/nv.d3.css" rel="stylesheet" type="text/css"/>
<script src="${ctx}/static/nvd3/lib/d3.v3.js"></script>
<script src="${ctx}/static/nvd3/nv.d3.js"></script>
<style>h3 {
font-size: 15px;
}</style>
</head>
<body>
<div>
<div class="container">
<ol class="breadcrumb">
<li><a href="${ctx}/index">首页</a></li>
<li>监控运营</li>
<li class="active">定制分析</li>
</ol>
</div>
</div>
<div id="main-container main-tab-container">
<div id="content" class="container" overflow-y:scroll>
<div class="tab-bar-bt">
<ul class="nav nav-tabs">
<li><a id="a_profile" href="${ctx}/MonitorOperation/WorkingOrderAnalysis">协查单统计</a></li>
<li><a id="b_profile" href="${ctx}/MonitorOperation/WorkingOrderReasult">协查单明细</a></li>
<li class="active"><a id="a_home" href="#home" data-toggle="tab">定制分析</a></li>
</ul>
</div>
<div class="section" overflow-y:scroll>
<div class="tab-content" overflow-y:scroll>
<!-- -------------------------------------------------------------- 协查单查询结果页面 -------------- ------------------------------------------------ -->
<div class="tab-pane fade in active" id="profile" overflow-y:scroll>
<div class="row" overflow-y:scroll>
<div id="slidePushMenus2" class="cbp-spmenu-push" overflow-y:scroll>
<div class="slideMenu" id="cbp-spmenu-s2" overflow-y:scroll>
<div class="form" overflow-y:scroll>
<tags:GZFX_CustomAnalyis_Time/>
<tags:GZFX_CustomAnalyis_Province/>
<tags:GZFX_CustomAnalyis_Datasource/>
<tags:GZFX_CustomAnalyis_Chinnel/>
<tags:GZFX_CustomAnalyis_Business/>
<tags:GZFX_CustomAnalyis_Kpi/>
<%--<tags:GZFX_CustomAnalyis_IsAnalyised/>--%>
<button id="submit" class="btn btn-primary">提交</button>
<button id="reset" class="btn btn-warning">重置</button>
</div>
</div>
<div class="main col-xs-12">
<div id="mainm2" class="mainm"></div>
<div class="content clearfix">
<div class="block clearfix">
<button id="showLeftPush2" class="menu-trigger btn btn-default"
onclick="toggleMenu('slidePushMenus2')">
<span class="glyphicon glyphicon-list"></span>
</button>
<div class="slide-menu-tags">
<span id="timz_span" class="label label-info"
data-placement="bottom"></span>
<span id="province_span" class="label label-info"
data-placement="bottom"></span>
<span id="kpi_span" class="label label-info"
data-placement="bottom"></span>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="table-header">
<div class='form-inline'>
定制分析列表
<a href="#" id="getdownloadPic_id" class=""
style="float:right;color: rgb(212, 106, 64);"> <span
class="glyphicon glyphicon-download-alt"></span> <span
class="glyphicon-class">导出图片</span>
</a>
<a href="#" id="getdownloadData_id" class=""
style="float:right"> <span
class="glyphicon glyphicon-download-alt"></span> <span
class="glyphicon-class">导出数据 </span>
</a>
</div>
</div>
<br>
<div id='tupian' class="content clearfix">
<%-- <div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
<br>
<div class='text-center'><input type="checkbox" name="isSelected"
style="margin: auto;">下载
</div>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
<br>
<div class='text-center '><input type="checkbox" name="isSelected"
style="margin: auto;">下载
</div>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
1
<br>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
sada
1
<br>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
<div class='col-xs-6'>
<img src='/image/meimei.jpg' alt='这是一个小美女1'>
</div>
sada
1
<br>--%>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<form action="#" method="get" id="listForm"></form>
<form id="export" action="#" method="post">
<input type="hidden" id="imagesrc" name="imagesrc" value="">
</form>
<input type="hidden" id="xcdJsonId" value='${xcdWorkingOrderInfoJson}'>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="${ctx}/static/js/dygraph-combined2.js"></script>
<script type="text/javascript" src="${ctx}/static/js/dygraph-extra.js"></script>
<script type="text/javascript">
$(document).ready(function() {
initBusiness();//业务
initKpi();//指标
$("#businessList_div").empty();//清空 业务
$("#allBusiness").prop("checked",false);//取消选择 ‘全选’
$("#kpiList_div").empty();//清空
$("#allKpi_div").prop("checked",false);//取消全选
})
</script>
<script type="text/javascript">
$("#submit").on('click', function () {
//获取用户的选择
var timz = getStatsPeriodString();//选择的时间
var provinces = getSelectedProvinces();//勾选的省份
var provinceName = getSelectedProvinceName();//勾选的省份名字
var kpis = getSelectedKpi();//勾选的指标
var kpisName = getSelectedKpiName();//勾选的指标名字
var kpisNameStr = kpisName.join('-');
if (timz === "") {
alert("时间必选");
return;
}
if (typeof(provinces) == "undefined" || provinces.length === 0) {
alert("省份必选");
return;
}
if (kpis.length === 0) {
alert("指标必选");
return;
}
//请求
timz=getPeriodStats();
var timzStr = timz.join('&');
var provinceStr = provinces;
var kpiStr = kpis.join('-');
var url = "${ctx}/MonitorOperation/CustomAnalysis/submit/"
+ timzStr + "/" + provinceStr + "/" + kpiStr;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
timeout: 10000,
cache: false,
error: solveError,
success: usepicData
});
function solveError(XMLHttpRequest, textStatus, errorThrown) {//处理ajax 异常情况
toggleMenu('slidePushMenus2');//隐藏筛选项
// 状态码
console.log(XMLHttpRequest.status);
// 状态
console.log(XMLHttpRequest.readyState);
// 错误信息
console.log(textStatus);
}
function usepicData(data) {//处理返回的数据
toggleMenu('slidePushMenus2');//隐藏筛选项
showSpanData();//显示标签栏的数据
showReturnData(data);//处理返回数据
}
function showReturnData(data) {
var json = eval(data);
var allContent = "";
$.each(json, function (index) {
var picUrl = json[index].picUrl;
var dataUrl = json[index].dataUrl;
var div_col_xs_6 = "<div class='col-xs-6'>";
div_col_xs_6 = div_col_xs_6 + "<img style='width: 100%;' src='" + picUrl + "' alt='" + dataUrl + "'>";
div_col_xs_6 = div_col_xs_6 + "<br>";
div_col_xs_6 = div_col_xs_6 + "<div class='text-center '>";
div_col_xs_6 = div_col_xs_6 + "<input type='checkbox' name='downloadData' style='margin: auto;' picUrl='" + picUrl + "' dataUrl='" + dataUrl + "'>下载";
div_col_xs_6 = div_col_xs_6 + "</div>";
div_col_xs_6 = div_col_xs_6 + "</div>";
allContent = allContent + div_col_xs_6;
});
$("#tupian").empty();
// console.log(allContent);
$("#tupian").append(allContent);
}
function showSpanData() {//显示标签栏的数据
$("#timz_span")
.text('时间')
.append($("<span class='badge'></span>").text(timz.length))
.attr('data-original-title', timzStr).tooltip();
$("#province_span")
.text('省份')
.append($("<span class='badge'></span>").text('1'))
.attr('data-original-title', provinceName).tooltip();
$("#kpi_span")
.text('指标')
.append($("<span class='badge'></span>").text(kpis.length))
.attr('data-original-title', kpisNameStr).tooltip();
}
});
$('#reset').on('click', function () {//重置
initDateStats();//时间
initProvince();//省份
initChannel();//渠道
initDataSource();//数据来源
initBusiness();//业务
initKpi();//指标
// initReport();//定制分析
});
function getDateStr() {
var d = new Date();
var year = d.getFullYear();
var month = change(d.getMonth() + 1);
var day = change(d.getDate());
var hour = change(d.getHours());
var minute = change(d.getMinutes());
var second = change(d.getSeconds());
var time = year + '_' + month + '_' + day + '_' + hour + '_' + minute + '_' + second;
return time;
}
function change(t) {
if (t < 10) {
return "0" + t;
} else {
return t;
}
}
function getdownloadDataSelectedArray(){
var downloadDataSelectedArray = new Array();
var downloadDataCheckbox=document.getElementsByName("downloadData");
var downloadDataCheckboxlen=downloadDataCheckbox.length;
for (var iii=0;iii<downloadDataCheckbox.length;iii++){
if(downloadDataCheckbox[iii].checked){
var dataUrl =downloadDataCheckbox[iii].getAttribute('dataUrl');
var picUrl =downloadDataCheckbox[iii].getAttribute('picUrl');
dataUrl = dataUrl.replace(/\//g, '|');
var ind = picUrl.lastIndexOf("/");
picUrl = picUrl.substr(ind + 1);
// console.log("dataUrl == "+dataUrl);
// console.log("picUrl =="+picUrl);
downloadDataSelectedArray.push(picUrl + "_" + dataUrl);
}
}
return downloadDataSelectedArray;
}
function randomString(len) {
len = len || 32;
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
var maxPos = $chars.length;
var pwd = '';
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function downloadExcel(excelName,downloadDataSelectedStr){
// $(e).attr('href', '/MonitorOperation/CustomAnalysis/downloadData/' + excelName + "/" + downloadDataSelectedStr);
// console.log('/MonitorOperation/CustomAnalysis/downloadData/' + excelName + "/" + downloadDataSelectedStr);
// $(e).click();
/*var id=randomString();
var a=$('<a id="'+id+'" href="'+'/MonitorOperation/CustomAnalysis/downloadData1/' + excelName + "/" + downloadDataSelectedStr+'">');
a.get(0).click();*/
var listForm=$("#export");
//alert("${ctx}/MonitorOperation/CustomAnalysis/downloadData1?excelName="+excelName+"&fileStr="+downloadDataSelectedStr);
listForm.attr("action","${ctx}/MonitorOperation/CustomAnalysis/downloadData1?excelName="+excelName+"&fileStr="+downloadDataSelectedStr);
listForm.submit();
listForm.attr("action","#");
return false;//阻止页面跳转
}
$('#getdownloadData_id').on('click', function () {//下载数据
var excelName = "定制分析数据_" + getDateStr() + ".xls";
// console.log("---+++---");
var arrAAA=getdownloadDataSelectedArray();
// console.log("arr.length "+arrAAA.length);
if (arrAAA.length === 0) {
alert('没有选择');
return;
}
var downloadDataSelectedStr = arrAAA.join("@");
// alert("downloadDataSelectedStr = "+downloadDataSelectedStr);
// alert("downloadDataSelectedStr = "+downloadDataSelectedStr);
var excelName = excelName;
// console.log("&&&&&&");
downloadExcel(excelName,downloadDataSelectedStr);
// console.log("&&&&&&-+++--");
/* $(this).attr('href', '/MonitorOperation/CustomAnalysis/downloadData/' + excelName + "/" + downloadDataSelectedStr);
// console.log('/MonitorOperation/CustomAnalysis/downloadData/' + excelName + "/" + downloadDataSelectedStr);
$(this).click();
return false;//阻止页面跳转*/
});
$("#getdownloadPic_id").on('click', function () {
// console.log(")))");
$('input[name="downloadData"]:checked').each(function (i) {
var picUrl = $(this).attr('picUrl');
var ind = picUrl.lastIndexOf("/");
// console.log("ind " + ind);
var download = i + "_" + picUrl.substr(ind + 1);
// console.log("download " + download);
var link = document.createElement('a');
link.setAttribute("download", download);
link.href = picUrl;
link.click();
// console.log("00000 " + picUrl);
sleep(1500);
// console.log("00000 ");
});
});
function cancelselectbusinessandkpi(){
$("#businessList_div").empty();//清空 业务
$("#allBusiness").prop("checked",false);//取消选择 ‘全选’
$("#kpiList_div").empty();//清空
$("#allKpi_div").prop("checked",false);//取消全选
}
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
</script>
</body>
</html>