$(function() {
// 先通过ajax获取数据,然后再传给datagrid
var access_token = GetAccessToken();
$.ajax({
method : 'GET',
url : '',
async : false,
dataType : 'json',
beforeSend : function(xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);
},
success : function(data) {
for ( var machine in data) {
var row_data = {
'unid' : data[machine].unid,
'machine_name' : data[machine].name,
'machine_type' : data[machine].type,
'num_recoder' : data[machine].unid,
'work_state' : data[machine].online,
'update_time' : data[machine].date,
'moment' : data[machine].torque,
'load' : data[machine].capa,
'height' : data[machine].hook_height,
'range' : data[machine].radius,
'angle' : data[machine].angle,
'wind_speed' : data[machine].wind_velocity,
'dip_angle' : data[machine].obliquity,
'alarm_info' : data[machine].content
};
$('#dg_machine_list').datagrid('appendRow', row_data);
}
},
error : function() {
alert('error');
}
});
});
阅读(3945) | 评论(0) | 转发(0) |