ah_jjzhgd_webscreen/js/pages/index/indexAjax.js

233 lines
8.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 工程简介 */
function loadProBrief(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProDetails?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data.data);
} else if (result.code === 500) {
console.error('工程简介:' + result.msg);
setData(null);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
setData(null);
}, aqEnnable);
// 项目简介赋值
function setData(data) {
let proBrief = '暂无简介', html = '';
let proImgList = [];
if (data) {
proBrief = data.proBrief ? data.proBrief : '暂无简介'
proImgList = data.fileData;
}
if (proImgList && proImgList.length > 0) {
$.each(proImgList, function (index, item) {
html += '<div><img src="' + item.base64Url + '"></div>'
})
} else {
html += '<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-1.jpg"></div>'
}
$('#img-carousel').empty().append(html);
$('#pro-desc p').html(proBrief);
// 渲染 - 图片轮播
carousel.render({
elem: '#ID-carousel-demo-image',
width: '900px',
height: '360px',
interval: 3000
});
}
}
/* 实时监测 */
function loadRealMonitor(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProJcData?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('实时监测' + result.msg);
setData(null);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
setData(null);
}, aqEnnable);
/* 实时检测赋值 */
function setData(data) {
console.log(data)
if (data && data.length > 0) {
$("#real-time-monitor").empty();
$.each(data, function (index, item) {
let div=" <div class=\"layout monitor-data\"> <p><span id=\"wd\">"
+item.val+"</span><span>"+item.unit+"</span></p><p>"+item.modelName+"</p>"+
" <div id='logo' class=\"monitor-icon\"></div>";
$("#real-time-monitor").append(div);
// if (item.modelName === '温度') {
// $('#wd').html(item.val ? item.val : 0);
// } else if (item.modelName === '湿度') {
// $('#sd').html(item.val ? item.val : 0);
// } else if (item.modelName === '噪声') {
// $('#zs').html(item.val ? item.val : 0);
// } else if (item.modelName === '光照') {
// $('#gz').html(item.val ? item.val : 0);
// } else if (item.modelName === 'pm2') {
// $('#pm2').html(item.val ? item.val : 0);
// } else if (item.modelName === 'pm10') {
// $('#pm10').html(item.val ? item.val : 0);
// }
})
}
}
}
/* 项目风险 */
function loadProRisk(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProRisk?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('项目风险' + result.msg);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
/* 项目风险赋值 */
function setData(data) {
initEchartsOne(data.day, data.week, data.warn);
}
}
/* 项目进度 */
function loadProProgress(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProcess?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('项目进度:' + result.msg);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
/* 项目进度赋值 */
function setData(data) {
if (data) {
$('#planStartTime').html(data.planStartTime);
$('#planEndTime').html(data.planEndTime);
initEchartsTwo(data.value2, data.value);
}
}
}
/* 项目成本 */
function loadProCost(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProMoney?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('项目成本:' + result.msg);
setData(null);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
function setData(data) {
if (data) {
let nameList = data.time && data.time.length > 0 ? data.time : [];
let valueList = data.cost && data.cost.length > 0 ? data.cost : [];
initEchartsThree(nameList, valueList,parseFloat(data.proCost.replace('万','')));
}else{
initEchartsThree([], [],0);
}
}
}
/* 项目进度 */
function loadProSchedule(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProSchedule?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
console.log(result);
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('项目进度:' + result.msg);
setData(null);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
function setData(data) {
if (data) {
$('#planStartTime').html(data.planStartTime);
$('#palnTcTime').html(data.palnTcTime);
$('#bidProgress').html(data.bidProgress);
$('#signProgress').html(data.signProgress);
$('#proProgress').html(data.proProgress);
}
}
}
/* 项目风险 */
function loadProRisk2(montageParam) {
const url = commonUrl + 'screen/largeScreen/xcIndex/getProRiskNum?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
console.log(result);
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('项目风险:' + result.msg);
setData(null);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
function setData(data) {
if (data) {
$('#twoRiskNum').html(data.twoRiskNum);
$('#threeRiskNum').html(data.threeRiskNum);
$('#fourRiskNum').html(data.fourRiskNum);
$('#fiveRiskNum').html(data.fiveRiskNum);
$('#totalRiskNum').html(data.twoRiskNum + data.threeRiskNum + data.fourRiskNum + data.fiveRiskNum);
$('#twoClassNum').html(data.twoClassNum);
$('#threeClassNum').html(data.threeClassNum);
$('#fourClassNum').html(data.fourClassNum);
$('#fiveClassNum').html(data.fiveClassNum);
$('#totalClassNum').html(data.twoClassNum + data.threeClassNum + data.fourClassNum + data.fiveClassNum);
$('#weekDates').html(""+data.weekDate + "");
let today = new Date();
let formatter = new Intl.DateTimeFormat('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' });
let formattedDate = formatter.format(today);
console.log(formattedDate);
$("#today").html(""+formattedDate.replaceAll("/","-")+ "");
}
}
}