223 lines
8.2 KiB
JavaScript
223 lines
8.2 KiB
JavaScript
|
|
// 数据预览
|
|||
|
|
function getDataPreviewData() {
|
|||
|
|
let startTime = '', endTime = '';
|
|||
|
|
if (currentTabId === '2') { // 本年度
|
|||
|
|
let dateArr = getNowYear();
|
|||
|
|
startTime = dateArr[0], endTime = dateArr[1];
|
|||
|
|
} else if (currentTabId === '3') { // 去年
|
|||
|
|
let dateArr = getLastYear();
|
|||
|
|
startTime = dateArr[0], endTime = dateArr[1];
|
|||
|
|
}
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({
|
|||
|
|
startTime: startTime,
|
|||
|
|
endTime: endTime,
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getDataPreviewData';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
setData(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
// 数据预览赋值
|
|||
|
|
function setData(obj) {
|
|||
|
|
$('#proNum').html(obj.proNum);
|
|||
|
|
$('#lyProNum').html(obj.lyProNum);
|
|||
|
|
$('#planNum').html(obj.planNum);
|
|||
|
|
$('#addPlanNum').html(obj.addPlanNum);
|
|||
|
|
$('#carNum').html(obj.carNum);
|
|||
|
|
$('#noDispatchCarNum').html(obj.noDispatchCarNum);
|
|||
|
|
$('#craneNum').html(obj.craneNum);
|
|||
|
|
$('#noDispatchCraneNum').html(obj.noDispatchCraneNum);
|
|||
|
|
$('#payMoney').html(obj.payMoney);
|
|||
|
|
$('#payPlanNum').html(obj.payPlanNum);
|
|||
|
|
$('#estimateMoney').html(obj.estimateMoney);
|
|||
|
|
$('#estimatePlanNum').html(obj.estimatePlanNum);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 用车数量
|
|||
|
|
function getVehiclesUsedNum() {
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getVehiclesUsedNum';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
initOneCharts(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 工程排名
|
|||
|
|
function getProRanking() {
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getProRanking';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
setProRankingData(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
|
|||
|
|
// 工程排名
|
|||
|
|
function setProRankingData(dataList) {
|
|||
|
|
let html = '<div id="pro-ranking-ul-box" class="list_lh"><ul id="pro-ranking-ul">';
|
|||
|
|
if (dataList && dataList.length > 0) {
|
|||
|
|
$.each(dataList, function (index, item) {
|
|||
|
|
index = index + 1;
|
|||
|
|
let backgroundColor = '#ccc', padding = "4px 10px"
|
|||
|
|
if (index === 1) {
|
|||
|
|
backgroundColor = '#ff3232';
|
|||
|
|
} else if (index === 2 || index === 3) {
|
|||
|
|
backgroundColor = '#ff9900';
|
|||
|
|
} else if (index >= 4 && index <= 10) {
|
|||
|
|
backgroundColor = '#3d8fff';
|
|||
|
|
}
|
|||
|
|
if (index >= 10) {
|
|||
|
|
padding = "4px 5px";
|
|||
|
|
}
|
|||
|
|
html += '<li class="layout">' +
|
|||
|
|
'<p><span style="background-color: ' + backgroundColor + ';padding: ' + padding + ';border-radius: 4px;color:#fff;">' + index + '</span></p>' +
|
|||
|
|
'<p>' + item.proName + '</p>' +
|
|||
|
|
'<p>' + item.applyNum + '</p>' +
|
|||
|
|
'<p>' + item.dispatchNum + '</p>' +
|
|||
|
|
'<p>' + item.noDispatchNum + '</p>' +
|
|||
|
|
'</li>';
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
html += '<li class="layout" style="font-size:16px;justify-content: center;">无数据</li>';
|
|||
|
|
}
|
|||
|
|
html += '</ul></div>';
|
|||
|
|
$('#pro-ranking-box').children('#pro-ranking-ul-box').remove();
|
|||
|
|
$('#pro-ranking-title').after(html);
|
|||
|
|
$("#pro-ranking-ul-box").myScroll({
|
|||
|
|
speed: 40, //数值越大,速度越慢
|
|||
|
|
rowHeight: 48 //li的高度
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 供应商统计
|
|||
|
|
function getSupStatistics() {
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getSupStatistics';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
initSupCountData(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
|
|||
|
|
function initSupCountData(dataList) {
|
|||
|
|
let cent = "";
|
|||
|
|
if (dataList.length === 0) {
|
|||
|
|
cent += "<li style='text-align:center;font-size:16px;'>暂无数据</li>";
|
|||
|
|
} else {
|
|||
|
|
cent = setData();
|
|||
|
|
}
|
|||
|
|
$('#sup-ul').empty().append(cent);
|
|||
|
|
element.render();
|
|||
|
|
function setData() {
|
|||
|
|
let html = '';
|
|||
|
|
$.each(dataList, function (idx, l) {
|
|||
|
|
$.each(l.list, function (index, item) {
|
|||
|
|
let img = item.type === 1 ? '../../images/svg/u326.svg' : '../../images/svg/u312.svg';
|
|||
|
|
item.LAY_NUM = index;
|
|||
|
|
html += "<li class='layout'>" +
|
|||
|
|
"<div class='layout' style='justify - content: space - evenly; '>" +
|
|||
|
|
"<img src=" + img + " width='32' height='32'>" +
|
|||
|
|
"<div class='layout' style='flex-direction: column;width: calc(100% - 60px);'>" +
|
|||
|
|
"<p style='font-weight: bold;font-size:16px'>" + item.supName + "</p>" +
|
|||
|
|
"<p style='color:#999;'>合同占比:" + (item.contractRatio) + "% (" + (item.contractMoney) + ")</p>" +
|
|||
|
|
"</div>" +
|
|||
|
|
"</div>" +
|
|||
|
|
"<div>" +
|
|||
|
|
"<p>" + item.leaseNum + "</p>" +
|
|||
|
|
"</div>" +
|
|||
|
|
"<div>" +
|
|||
|
|
"<p>¥ " + (item.leaseMoney) + "</p>" +
|
|||
|
|
"</div>" +
|
|||
|
|
"<div>" + schedule(item) + "</div>" +
|
|||
|
|
"<div class='layout'>" +
|
|||
|
|
"<img src='../../images/time_icon.png'>" +
|
|||
|
|
"<p>" + item.dispatchTime + "</p>" +
|
|||
|
|
"</div>" +
|
|||
|
|
"</li>";
|
|||
|
|
})
|
|||
|
|
html += '<hr>'
|
|||
|
|
});
|
|||
|
|
return html;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 设置进度值
|
|||
|
|
function schedule(d) {
|
|||
|
|
d.progress = parseFloat(d.progress ? d.progress : 0);
|
|||
|
|
d.filter == undefined ? (d.filter = d.LAY_NUM) : d.filter;
|
|||
|
|
d.progress == undefined ? (d.progress = 100) : d.progress;
|
|||
|
|
var color = "layui-bg-orange";
|
|||
|
|
if (d.progress < 100) {
|
|||
|
|
color = "layui-bg-orange";
|
|||
|
|
} else if (d.progress === 100) {
|
|||
|
|
color = "layui-bg-primary";
|
|||
|
|
} else if (d.progress > 100) {
|
|||
|
|
color = "layui-bg-blue";
|
|||
|
|
}
|
|||
|
|
//设置页面进度条
|
|||
|
|
return (
|
|||
|
|
'<div class="layui-progress layui-progress-big" lay-showpercent="true" id="' + d.filter + '" lay-filter="progress' + d.filter + '">' +
|
|||
|
|
'<div class="layui-progress-bar ' + color + '" lay-percent="' + d.progress + '%">' +
|
|||
|
|
"</div></div>"
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 租赁金额(运输车辆)
|
|||
|
|
function getLeaseMoneyByCar() {
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getLeaseMoneyByCar';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
$('#contractCarMoney').html(result.data.contractMoney);
|
|||
|
|
initTwoCharts(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 租赁金额(吊车)
|
|||
|
|
function getLeaseMoneyByCrane() {
|
|||
|
|
let params = {
|
|||
|
|
encryptedData: JSON.stringify({})
|
|||
|
|
};
|
|||
|
|
let url = dataUrl + 'backstage/homeIndex/getLeaseMoneyByCrane';
|
|||
|
|
ajaxRequest(url, "POST", params, true, function () {
|
|||
|
|
}, function (result) {
|
|||
|
|
if (result.code === 200) {
|
|||
|
|
$('#contractCraneMoney').html(result.data.contractMoney);
|
|||
|
|
initThreeCharts(result.data);
|
|||
|
|
}
|
|||
|
|
}, function (xhr, status, error) {
|
|||
|
|
errorFn(xhr, status, error)
|
|||
|
|
}, null);
|
|||
|
|
}
|