// 数据预览 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 = '
'; $('#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 += "
  • 暂无数据
  • "; } 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 += "
  • " + "
    " + "" + "
    " + "

    " + item.supName + "

    " + "

    合同占比:" + (item.contractRatio) + "% (" + (item.contractMoney) + ")

    " + "
    " + "
    " + "
    " + "

    " + item.leaseNum + "

    " + "
    " + "
    " + "

    ¥ " + (item.leaseMoney) + "

    " + "
    " + "
    " + schedule(item) + "
    " + "
    " + "" + "

    " + item.dispatchTime + "

    " + "
    " + "
  • "; }) html += '
    ' }); 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 ( '
    ' + '
    ' + "
    " ); } } } // 租赁金额(运输车辆) 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); }