traffic以及block界面修复xlsx导出提示错误问题 以及增加total和查询时间导出到xlsx
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/offline-exporting.js"></script>
|
||||
<%-- <script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/themes/grid.js"></script> --%>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting-data.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/standalone.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var starth=$("#beginDateh").val();
|
||||
@@ -197,6 +198,67 @@ function showActionTransChart(rs){
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
(function(H) {
|
||||
H.Chart.prototype.downloadXLS = function() {
|
||||
var start=$("#beginDate").val();
|
||||
var end=$("#endDate").val();
|
||||
var div = document.createElement('div'),
|
||||
xlsxRows = [],
|
||||
xlsxColumns = [];
|
||||
div.style.display = 'none';
|
||||
document.body.appendChild(div);
|
||||
rows = this.getDataRows(true);
|
||||
xlsxRows = H.map(rows.slice(1), function(row) {
|
||||
return H.map(row, function(column) {
|
||||
return {
|
||||
type: typeof column === 'number' ? 'number' : 'string',
|
||||
value: column
|
||||
};
|
||||
});
|
||||
});
|
||||
var a =new Array();
|
||||
a.push({
|
||||
type:'string',
|
||||
value:'Total'
|
||||
})
|
||||
|
||||
if(xlsxRows!=null&&xlsxRows!=undefined&&xlsxRows.length>0){
|
||||
for(var j=0;j<xlsxRows[0].length-1;j++){
|
||||
a.push({
|
||||
type:'number',
|
||||
value:0
|
||||
})
|
||||
}
|
||||
for(var i=1;i<xlsxRows.length;i++){
|
||||
for(var j=1;j<xlsxRows[i].length;j++){
|
||||
a[j].value=a[j].value+xlsxRows[i][j].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
xlsxRows.push(a)
|
||||
|
||||
var b =new Array();
|
||||
b.push({
|
||||
type:'string',
|
||||
value:'searchTime'
|
||||
})
|
||||
b.push({
|
||||
type:"string",
|
||||
value:start+'--'+end
|
||||
})
|
||||
xlsxRows.unshift(b)
|
||||
|
||||
|
||||
|
||||
zipcelx({
|
||||
filename: 'Bolck',
|
||||
sheet: {
|
||||
data: xlsxRows
|
||||
}
|
||||
});
|
||||
};
|
||||
}(Highcharts));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -84,6 +84,7 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/series-label.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/offline-exporting.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/exporting-data.js"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/highcharts/js/standalone.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
loading();
|
||||
@@ -415,7 +416,66 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
|
||||
});
|
||||
|
||||
}
|
||||
(function(H) {
|
||||
H.Chart.prototype.downloadXLS = function() {
|
||||
var start=$("#beginDate").val();
|
||||
var end=$("#endDate").val();
|
||||
var div = document.createElement('div'),
|
||||
xlsxRows = [],
|
||||
xlsxColumns = [];
|
||||
div.style.display = 'none';
|
||||
document.body.appendChild(div);
|
||||
rows = this.getDataRows(true);
|
||||
xlsxRows = H.map(rows.slice(1), function(row) {
|
||||
return H.map(row, function(column) {
|
||||
return {
|
||||
type: typeof column === 'number' ? 'number' : 'string',
|
||||
value: column
|
||||
};
|
||||
});
|
||||
});
|
||||
var a =new Array();
|
||||
a.push({
|
||||
type:'string',
|
||||
value:'Total'
|
||||
})
|
||||
|
||||
if(xlsxRows!=null&&xlsxRows!=undefined&&xlsxRows.length>0){
|
||||
for(var j=0;j<xlsxRows[0].length-1;j++){
|
||||
a.push({
|
||||
type:'number',
|
||||
value:0
|
||||
})
|
||||
}
|
||||
for(var i=1;i<xlsxRows.length;i++){
|
||||
for(var j=1;j<xlsxRows[i].length;j++){
|
||||
a[j].value=a[j].value+xlsxRows[i][j].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
xlsxRows.push(a)
|
||||
|
||||
var b =new Array();
|
||||
b.push({
|
||||
type:'string',
|
||||
value:'searchTime'
|
||||
})
|
||||
b.push({
|
||||
type:"string",
|
||||
value:start+'--'+end
|
||||
})
|
||||
xlsxRows.unshift(b)
|
||||
|
||||
|
||||
|
||||
zipcelx({
|
||||
filename: 'Traffic',
|
||||
sheet: {
|
||||
data: xlsxRows
|
||||
}
|
||||
});
|
||||
};
|
||||
}(Highcharts));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user