初始化项目
This commit is contained in:
76
pqs9000/src/main/webapp/jspJS/area/steadystattable.js
Normal file
76
pqs9000/src/main/webapp/jspJS/area/steadystattable.js
Normal file
@@ -0,0 +1,76 @@
|
||||
function getSteadystatTable(guid, time, timetype, type) { // timetype:0-day 1-month
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/pqs9000/area/getdetailed",
|
||||
data: {
|
||||
guid: guid,
|
||||
time: time,
|
||||
type: type,
|
||||
timetype: timetype
|
||||
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
initTable(data.body);
|
||||
} else {
|
||||
initTable([]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initTable(data) {
|
||||
var tableData = "";
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].totalCount > 0) {
|
||||
tableData += '["' + data[i].gdName + '","'
|
||||
+ data[i].bdName + '","' + data[i].pointName + '","' + data[i].time + '","' + data[i].listResult.substring(0, data[i].listResult.lastIndexOf(',')) + '"],';
|
||||
}
|
||||
}
|
||||
|
||||
tableData = tableData.substring(0, tableData.lastIndexOf(','));
|
||||
tableData = eval('[' + tableData + ']');
|
||||
|
||||
var $height = $("body").height() * 0.85;
|
||||
|
||||
var oTable = $("#tableId")
|
||||
.dataTable({
|
||||
scrollX: true,
|
||||
data: tableData,
|
||||
autoWidth: true,
|
||||
lengthChange: false,
|
||||
paging: false,
|
||||
bDestroy: true,
|
||||
info: false,
|
||||
ordering: true,
|
||||
sDom: '"top"i',
|
||||
scrollY: $height,
|
||||
language: {
|
||||
url: '/pqs9000/json/chine.json'
|
||||
},
|
||||
createdRow: function (row, data, dataIndex) {
|
||||
$(row).children('td').eq(4).attr('style', 'text-align: left;')
|
||||
},
|
||||
});
|
||||
|
||||
new $.fn.dataTable.Buttons(oTable.api(), {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
title: '稳态越限详细列表'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
modifyCss(oTable.api());
|
||||
}
|
||||
|
||||
function modifyCss(dataTable) {
|
||||
dataTable.buttons().container().css("float", "right");
|
||||
dataTable.buttons().container().css("top", "10px");
|
||||
dataTable.buttons().container().find("a").prepend("<i class='glyphicon glyphicon-share'></i>");
|
||||
dataTable.buttons().container().appendTo('.header');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user