var uid = $("#3dnzNxplgTiHaddR",top.window.document).val(); var companyId = ''; var Home = { id: "VersionTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1, businessType:null,//存储企业信息 }; /** * 点击添加信息 */ Home.openNetCarInfo = function (e) { var id = e.getExtData()[0]; var index = layer.open({ type: 2, title: '详细数据', area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/home/openNetCarInfo?id=' + id, }); this.layerIndex = index; }; Home.onlineDriver = function (e) { var id = e.getExtData()[0]; var index = layer.open({ type: 2, title: '在线司机', area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/home/showOnlineDriver', }); this.layerIndex = index; }; $(function () { var first = $('.breadcrumb').children('li:first').children('a'); first.css({ 'color': '#AB2626' }) var className = first.attr('class'); $('.content').hide(); $('#' + className + 'Div').show(); $('.breadcrumb').find('a').on('click', function () { $('.breadcrumb').children('li').each(function () { $(this).children('a').removeAttr('style'); }) $(this).css({ 'color': '#AB2626' }); var className = $(this).attr('class'); $('.content').hide(); $('#' + className + "Div").show(); switch (className) { case "statistics": getData(); break; case "map": var companyId = $('#branchOffice1').val(); if(null != companyId && '' != companyId){ Home.webSocketClient(companyId); }else{ Home.webSocketClient(null); } break; case "order": Home.getAllOrder(); break; } }) laydate.render({ elem: '#addDate', //指定元素 format: 'yyyy-MM-dd',//日期格式 value: new Date(),//默认值 zIndex: 99999999,//层叠顺序 trigger: 'click', done: function(value, date, endDate){ getData(); console.log(value); //得到日期生成的值,如:2017-08-18 } }); laydate.render({ elem: '#rangeDate', //指定元素 format: 'yyyy-MM-dd',//日期格式 range: true, value: '',//默认值 zIndex: 99999999,//层叠顺序 trigger: 'click', done: function(value, date, endDate){ getData(); console.log(value); //得到日期生成的值,如:2017-08-18 } }); getData(); getCompanyByUid(); setInterval(function () { Home.webSocketClient(null); }, 60000 * 5); setInterval(function () { Home.getAllOrder(); }, 60000 * 5); }); let map; let markers = []; let map2; let markers2 = []; function initMap() { // The location of Uluru const uluru = { lat: 5.668430499999999, lng: -0.060339 }; // The map, centered at Uluru map = new google.maps.Map(document.getElementById("map"), { zoom: 8, center: uluru, }); // The map, centered at Uluru map2 = new google.maps.Map(document.getElementById("map1"), { zoom: 7, center: uluru, }); } window.initMap = initMap; function getCompanyByUid() { $.ajax({ url: Feng.ctxPath + "/home/getCompanyInfoByUserId", type: 'POST', success: function (res) { var str = ''; for(var i in res){ str += '' } $('#branchOffice').html(str); $('#branchOffice1').html(str); } }); } function getData() { var branchOffice = $('#branchOffice').val(); var addDate = $('#addDate').val(); var date = $('#rangeDate').val(); var data = new FormData(); if(null != branchOffice && '' != branchOffice){ data.append("companyId", branchOffice); } if(null != addDate && '' != addDate){ data.append("addDate", addDate); } if(null != date && date != ''){ data.append("start", date.split(' - ')[0]); data.append("end", date.split(' - ')[1]); } $.ajax({ url: Feng.ctxPath + "/home/getSumData", type: 'POST', contentType: false, processData: false, data: data, success: function (res) { var operationStatus = res.operationStatus; var operationSum = res.operationSum; var operationGrow = res.operationGrow; var operationTrend = res.operationTrend; $('#newPassengerInfo').text(operationStatus.passengerInfo == null ? 0 : operationStatus.passengerInfo); $('#newNetcardriver').text(operationStatus.netcardriver == null ? 0 : operationStatus.netcardriver); $('#orderDetail1').text(operationStatus.orderDetail1 == null ? 0 : operationStatus.orderDetail1); $('#orderDetail2').text(operationStatus.orderDetail2 == null ? 0 : operationStatus.orderDetail2); $('#orderDetail3').text(operationStatus.orderDetail3 == null ? 0 : operationStatus.orderDetail3); $('#orderDetail4').text(operationStatus.orderDetail4 == null ? 0 : operationStatus.orderDetail4); $('#orderDetail5').text(operationStatus.orderDetail5 == null ? 0 : operationStatus.orderDetail5); $('#passengerInfoSum').text(operationSum.passengerInfoSum == null ? 0 : operationSum.passengerInfoSum); $('#netcarDriverSum').text(operationSum.netcarDriverSum == null ? 0 : operationSum.netcarDriverSum); $('#netCarSum').text(operationSum.netCarSum == null ? 0 : operationSum.netCarSum); $('#orderDetailSum').text(operationSum.orderDetailSum == null ? 0 : operationSum.orderDetailSum); $('#paiceSum').text(operationSum.paiceSum == null ? 0 : operationSum.paiceSum); $('#paySum').text(operationSum.paySum == null ? 0 : operationSum.paySum); $('#passengerInfoSum1').text(operationGrow.passengerInfoSum == null ? 0 : operationGrow.passengerInfoSum); $('#netcarDriverSum1').text(operationGrow.netcarDriverSum == null ? 0 : operationGrow.netcarDriverSum); $('#orderDetail11').text(operationGrow.orderDetail1 == null ? 0 : operationGrow.orderDetail1); $('#orderDetail21').text(operationGrow.orderDetail2 == null ? 0 : operationGrow.orderDetail2); $('#orderDetail31').text(operationGrow.orderDetail3 == null ? 0 : operationGrow.orderDetail3); $('#orderDetail41').text(operationGrow.orderDetail4 == null ? 0 : operationGrow.orderDetail4); $('#orderDetail51').text(operationGrow.orderDetail5 == null ? 0 : operationGrow.orderDetail5); $('#paySum1').text(operationGrow.paySum == null ? 0 : operationGrow.paySum); $('#paiceSum1').text(operationGrow.paiceSum == null ? 0 : operationGrow.paiceSum); $('#orderDetailSum1').sparkline(operationTrend.orderDetailSum, { lineColor:'green', width: '100%', height: '33px' }); $('#passengerInfoSum2').sparkline(operationTrend.passengerInfoSum, { lineColor:'green', width: '100%', height: '33px' }); $('#orderDetail12').sparkline(operationTrend.orderDetail1, { lineColor:'green', width: '100%', height: '33px' }); $('#orderDetail22').sparkline(operationTrend.orderDetail2, { lineColor:'green', width: '100%', height: '33px' }); $('#orderDetail32').sparkline(operationTrend.orderDetail3, { lineColor:'green', width: '100%', height: '33px' }); $('#orderDetail42').sparkline(operationTrend.orderDetail4, { lineColor:'green', width: '100%', height: '33px' }); $('#orderDetail52').sparkline(operationTrend.orderDetail5, { lineColor:'green', width: '100%', height: '33px' }); } }); } function clearMarkers() { for (let i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers = []; } function clearMarkers1() { for (let i = 0; i < markers2.length; i++) { markers2[i].setMap(null); } markers2 = []; } Home.webSocketClient = function (companyId) { $.ajax({ url: Feng.ctxPath + '/home/getDriverPosition', type: 'POST', data: { companyId: companyId }, success: function (res) { clearMarkers(); var data1 = res.driver1; var data2 = res.driver2; var order = res.order; var d = ''; for(var i in data1){ var driver = data1[i].driver; var driverId = driver.id; d += '
起点:' + zhuanche[i].startAddress + '
终点:' + zhuanche[i].endAddress + '
' + '下单时间:' + new Date(zhuanche[i].travelTime) + '
' + ''; } zc += '