2019-03-01
//页面初始化
mui.plusReady(function(){
//智慧安监读取项目信息
EngineeringInfo()
});
//$(document).ready(function(){
// EngineeringInfo()
//});
//var url = ApiRequest.getApiHost('jiangsu')
//智慧安监读取项目信息
function EngineeringInfo(){
// var url=ApiRequest.getApiHost('jiangsu') + 'safety/GetEngineeringCoordinates';
// mui.ajax(ApiRequest.getApiHost('jiangsu') + 'safety/GetAirData?query=' + e.target.title,
var url = ApiRequest.getApiHost('jiangsu')+'safety/GetEngineeringCoordinates';
console.log(url)
mui.ajax(url,{
async :'false',
dataType:'json',//服务器返回json格式数据
type:'get',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
headers:{'Content-Type':'application/json'},
success:function(res){
console.log(res)
if(res.code==0){
// var jsonstr = "[]"; //定义一个数组形式的JSON字符串
// var items = eval('(' + jsonstr + ')'); //转换为JSON
// console.log("加载项目信息====" + JSON.stringify(res));
// document.getElementById("cardcontent1").innerText = res.count;
//
//
// for (var i=0;i<res.data.length;i++ ) {
// var datas=res.data[i]
//
// html+="<div class='tupian>"
// html+="<img class='tupiansize' src='../../images/leftdi.png'/>"
//
// html+="</div>"
// html +="<div class='prointroduce' id='xiangmuxinxi'>";
// html +="<p class='proword1' id='sitename'>" + datas.ProjectName + "</p>";
// html +="<p class='proword' id='siteaddress'>" + datas.ProjectAddress + "</p>";
// html +="<p class='proword' id='sitestarttime'>" + datas.ProjectStartDateTimne+ "</p>";
// html +="<p class='proword' id='siteendtime'>" + datas.ProjectEndDateTimne + "</p>";
// html +="</div>"
var html="";
for(var i=0;i<res.data.length;i++){
// var datas=res.data[i]
html+="<div>";
html+="<div class='tupian'>";
html+="<img class='tupiansize' src='../../images/leftdi.png'/>";
html+="</div>";
html +="<div class='prointroduce'>";
html +="<p class='proword1' id='sitename'>" + res.data[i].ProjectName + "</p>";
html +="<p class='proword2' id='siteaddress'>" + res.data[i].ProjectAddress + "</p>";
html +="<p class='proword3' id='sitestarttime'>" + res.data[i].ProjectStartDateTimne+ "</p>";
html +="<p class='proword4' id='siteendtime'>" + res.data[i].ProjectEndDateTimne + "</p>";
html +="</div>";
html +="</div>";
// var datas = res.count;
// var data= res.data[i]
//
// if( res.data.length > 0) {
// var datas1 = res.data[i].ProjectName;
// var data2 = res.data[i].ProjectAddress;
// var data3=res.data[i].ProjectStartDateTimne;
// var data4=res.data[i].ProjectEndDateTimne;
// (".proword2").html(data2);
// (".proword4").html(data4);
// }
}
$(".contentbox").html(html);
}else {
mui.toast('加载工程数据失败,网络异常');
}
},
error:function(xhr,type,errorThrown){
mui.toast('加载工程数据失败,网络异常');
console.log(res)
}
})
}
// * 加载项目信息
// * param:参数
// * */
//function loadProjectInfo(param) {
// var url = ApiRequest.getApiHost('jiangsu') + 'safety/GetEngineeringCoordinates';
// if(param == "search") {
// var value = document.getElementById('searchkanban').value;
// url = ApiRequest.getApiHost('jiangsu') + 'safety/GetEngineeringCoordinates?site=' + value;
// }
// console.log(url);
// mui.ajax(url, {
// type: 'get',
// dataType: 'json', //服务器返回json格式数据
// timeout: 10000,
// success: function(res) {
// console.log("加载工程数据====" + JSON.stringify(res));
// if(res.code == 0) {
// }
// else {
// mui.toast('加载工程数据失败,网络异常');
// }
// },
// error: function(xhr, type, errorThrown) {
// mui.toast('加载工程数据失败,网络异常');
// }
// });
//}