| | |
| | | var nowClientWidth = document.documentElement.clientWidth; // 当前视口宽度 |
| | | var pieVarietyChart = null; // 品种饼状图 -- 粮食 |
| | | var pieTypeChart = null; // 性质饼状图 -- 粮食 |
| | | var pieLevelChart = null; // 等级饼状图 -- 粮食 |
| | | var pieYearChart = null; // 年份饼状图 -- 粮食 |
| | | var pieAreaChart = null; // 区域饼状图 -- 粮食 |
| | | var hisVarietyChart = null; // 品种柱状图 |
| | | var deptAreaAllList = null; // 所有库区列表信息 |
| | | var deptAreaList = null; // 存放切换库区列表信息 |
| | | var companyList = null; // 公司信息 |
| | | var deptCode = null; // 当前闪烁地区的编码 |
| | | var timer1; // 库区定时 |
| | | var index1 = 0; // 库区切换下标 |
| | | var timer2; // 粮食数量定时 |
| | | var index2 = 0; // 粮食数量切换下标 |
| | | var number2 = 2;// 粮食数量切换总数量 |
| | | var timer3; // 储量饼图定时 |
| | | var index3 = 0; // 储量饼图切换下标 |
| | | var number3 = 2;// 储量饼图切换总数量 |
| | | |
| | | var deptList = null; // 所有库区列表信息 |
| | | var snapList = null; // 当前闪烁地区的编码 |
| | | var deptListMap = {}; |
| | | var timer; // 库区定时 |
| | | var deptNum = 0; //库区切换下标 |
| | | var mapChart = null; |
| | | var geoMap = [{name: '伊犁哈萨克自治州', value: [81.317946, 43.92186]}]; //默认点位 |
| | | var map = chinaMapOutline; //默认加载全国地图 |
| | | |
| | | $(function () { |
| | | // 初始化页面 |
| | | init(); |
| | | |
| | | // 初始化WebSocket |
| | | initWS(companyId,"screen",null,null); |
| | | // initWS(companyId,bizType, bizTag, userId); |
| | | }); |
| | | |
| | | // 初始化页面 |
| | | function init() { |
| | | // 适应屏幕大小 |
| | | initScrollbar(); |
| | | // 时间 |
| | | initTime(); |
| | | |
| | | // 初始化图表 |
| | | initChart(); |
| | | initDicSlogan(); |
| | | |
| | | //初始化地图 |
| | | initMap(); |
| | | |
| | | // 时间 |
| | | initTime(); |
| | | |
| | | if (deptAllList) { |
| | | for (var i = 0; i < deptAllList.length; i++) { |
| | | deptListMap[deptAllList[i].id] = deptAllList[i].kqmc; |
| | | } |
| | | } |
| | | |
| | | //初始化标语 |
| | | initDicSlogan(); |
| | | |
| | | //加载指定地区地图 |
| | | renderMapPoints("乌鲁木齐市,克拉玛依市,吐鲁番市,哈密市,昌吉回族自治州,博尔塔拉蒙古自治州,巴音郭楞蒙古自治州,阿克苏地区,克孜勒苏柯尔克孜自治州,喀什地区,和田地区,伊犁哈萨克自治州,塔城地区,阿勒泰地区"); |
| | | // 请求库区信息 |
| | | // ajaxDeptArea(); |
| | | // 获取公司信息 |
| | | // ajaxCompany(); |
| | | // 请求粮食数量统计信息 |
| | | // ajaxFoodNum(); |
| | | // 请求获取库区动态信息 |
| | | // ajaxMsg(); |
| | | |
| | | //统计相关数量信息,包含库点及粮食数量 |
| | | ajaxFoodNum(); |
| | | |
| | | //请求监管库区信息 |
| | | ajaxDeptList(); |
| | | |
| | | //请求抓拍跟踪信息 |
| | | ajaxSnapList(); |
| | | |
| | | clearInterval(timer); |
| | | timing(); |
| | | } |
| | | |
| | | // socket信息返回處理 |
| | | function socketOnMessage(pocket) { |
| | | //console.log(pocket); |
| | | if (pocket.bizId == "slogan") { |
| | | if (pocket.bizId === "slogan") { |
| | | var data = pocket.data; |
| | | dicSlogan = data; |
| | | initDicSlogan(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 请求获取库区相关信息 |
| | | */ |
| | | function ajaxSnapList() { |
| | | snapList = null; |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "/group/index-snap-list", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify({ |
| | | "companyId": companyId, |
| | | "deptId": deptId |
| | | }), |
| | | success: function (result) { |
| | | if (result.code == "0000") { |
| | | snapList = result.data; |
| | | renderSnap(); |
| | | } |
| | | }, |
| | | error: function (error) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function renderSnap() { |
| | | var html = ''; |
| | | if (snapList != null && snapList.length > 0) { |
| | | $.each(snapList, function (index, item) { |
| | | html += '<li style="float: left; width: 246px;">'; |
| | | html += '<div class="item">'; |
| | | html += '<div class="pic">'; |
| | | html += '<img src="'+item.imgName+'" alt="">'; |
| | | html += '</div><div class="tit">'+item.snapTime+'</div>'; |
| | | html += '<div class="tit" style="white-space: nowrap;">'+deptListMap[item.deptId]+'</div>'; |
| | | html += '</div></li>'; |
| | | }) |
| | | }else { |
| | | $.each(deptAllList, function (index, item) { |
| | | html += '<li style="float: left; width: 246px;">'; |
| | | html += '<div class="item">'; |
| | | html += '<div class="pic">'; |
| | | html += '<img src="/img/img-fail.jpg" alt="">'; |
| | | html += '</div><div class="tit">近期暂无抓拍图</div>'; |
| | | html += '<div class="tit" style="white-space: nowrap;">'+item.kqmc+'</div>'; |
| | | html += '</div></li>'; |
| | | }) |
| | | } |
| | | $("#snapList").html(html); |
| | | |
| | | //抓拍跟踪滚动 |
| | | jQuery(".block2").slide({ mainCell: ".bd ul", autoPage: true, effect: "topLoop", autoPlay: true, vis: 4 }); |
| | | jQuery(".follow").slide({ mainCell: ".bd ul", autoPlay: true, effect: "leftMarquee", vis: 5, interTime: 40 }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 库区定时切换 |
| | | */ |
| | | function timing() { |
| | | timer = setInterval(function() { |
| | | if(deptNum === deptList.length){ |
| | | deptNum = 0; |
| | | } |
| | | |
| | | renderDeptInfo(); |
| | | deptNum += 1; |
| | | }, 5000); |
| | | } |
| | | |
| | | //加载库区地图位置 |
| | |
| | | geoMap = []; |
| | | for (var j = 0; j < names.length; j++) { |
| | | for (var i = 0; i < all.length; i++) { |
| | | if(all[i].properties.name == names[j]){ |
| | | if(all[i].properties.name === names[j]){ |
| | | map.features.push(all[i]); |
| | | if(all[i].properties.name == "伊犁哈萨克自治州"){ |
| | | // if(all[i].properties.name === "伊犁哈萨克自治州"){ |
| | | geoMap.push({ |
| | | name: all[i].properties.centerName, |
| | | value: [all[i].properties.center[0], all[i].properties.center[1], 12] |
| | | }); |
| | | } |
| | | renderMap(); |
| | | // } |
| | | // renderMap(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取公司信息 |
| | | * 更新AI动态分析 |
| | | * @param data |
| | | */ |
| | | function ajaxCompany() { |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../visual/index-company", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify({ |
| | | "companyId": companyId |
| | | }), |
| | | success: function (result) { |
| | | if (result.code == "0000") { |
| | | companyList = result.data; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 请求获取动态信息 |
| | | */ |
| | | function ajaxMsg() { |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../visual/index-info", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify({ |
| | | "companyId": companyId |
| | | }), |
| | | success: function (result) { |
| | | if (result.code == "0000") { |
| | | renderMsg(result.data); |
| | | } |
| | | }, |
| | | error: function (error) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 更新动态信息 |
| | | function renderMsg(data) { |
| | | function renderMsg() { |
| | | var html = ''; |
| | | var flag = false; |
| | | var num1 = ''; |
| | | var num7 = ''; |
| | | if (data != null && data.length > 0) { |
| | | $.each(data, function (index, item) { |
| | | var deptAreaId = item.deptAreaId; |
| | | var flag = false; |
| | | if (deptList != null && deptList.length > 0) { |
| | | $.each(deptList, function (index, item) { |
| | | if(item.dailyTotal === 0){ |
| | | num1 = '当日一切正常'; |
| | | }else{ |
| | |
| | | num7 = '近七天数量'+ item.warnNum7 + '个'; |
| | | } |
| | | html += '<div class="panel-content-body-tr">'; |
| | | if (item.level && item.level === "01") { |
| | | if (item.warnNum7 > 10) { |
| | | flag = true; |
| | | // html += '<img src="../../static/images/visual/l1.png" style="width:10%; height:85%;" alt="">'; |
| | | html += '<span class="body-item sp" style="color: #bc2032;" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>'; |
| | | html += '<span class="body-item sp" style="color: #bc2032;flex: 1.5;">' + item.deptName + '</span>'; |
| | | html += '<span class="body-item sp" style="color: #bc2032;">' + num1 + '</span>'; |
| | | html += '<span class="body-item sp" style="color: #bc2032;">' + num7 + '</span>'; |
| | | // html += '<span class="body-item" style="color: #bc2032; flex: 0.3;">' + item.createTime + '</span>'; |
| | | } else if (item.level && item.level === "02") { |
| | | } else if (item.warnNum7 > 1 && item.warnNum7 < 10) { |
| | | flag = true; |
| | | // html += '<img src="../../static/images/visual/l2.png" style="width:10%; height:85%;" alt="">'; |
| | | html += '<span class="body-item sp" style="color: #f37b3d;" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>'; |
| | | html += '<span class="body-item sp" style="color: #f37b3d;flex: 1.5;">' + item.deptName + '</span>'; |
| | | html += '<span class="body-item sp" style="color: #f37b3d;">' + num1+ '</span>'; |
| | | html += '<span class="body-item sp" style="color: #f37b3d;">' + num7 + '</span>'; |
| | | // html += '<span class="body-item" style="color: #f37b3d; flex: 0.3;">' + item.createTime + '</span>'; |
| | | } else if (item.level && item.level === "03"){ |
| | | flag = true; |
| | | // html += '<img src="../../static/images/visual/l3.png" style="width:10%; height:85%;" alt="">'; |
| | | html += '<span class="body-item sp" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>'; |
| | | html += '<span class="body-item sp">' + num1 + '</span>'; |
| | | html += '<span class="body-item sp">' + num7 + '</span>'; |
| | | // html += '<span class="body-item" style="flex: 0.3;">' + item.createTime + '</span>'; |
| | | }else { |
| | | flag = true; |
| | | // html += '<img src="../../static/images/visual/l3.png" style="width:10%; height:85%;" alt="">'; |
| | | html += '<span class="body-item sp" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>'; |
| | | html += '<span class="body-item sp" style="flex: 1.5;">' + item.deptName + '</span>'; |
| | | html += '<span class="body-item sp">' + num1 + '</span>'; |
| | | html += '<span class="body-item sp">' + num7 + '</span>'; |
| | | // html += '<span class="body-item" style="flex: 0.3;">' + item.createTime + '</span>'; |
| | | } |
| | | html += '</div>'; |
| | | }) |
| | | } else { |
| | | if (deptAreaList != null && deptAreaList.length > 0) { |
| | | $.each(deptAreaList, function (index, item) { |
| | | html += '<div class="panel-content-body-tr">'; |
| | | html += '<span class="body-item sp">' + item.name + '</span>'; |
| | | html += '<span class="body-item sp">' + '当日分析一切正常' + '</span>'; |
| | | html += '<span class="body-item" style="flex: 0.3;">' + formatDate('mm/dd', new Date()) + '</span>'; |
| | | html += '</div>'; |
| | | }); |
| | | } |
| | | } |
| | | $("#panel-title").html('监管动态信息 <i class="dot"></i>'); |
| | | if(flag){ |
| | | $("#panel-title").html('库区AI事件信息 <i class="dot"></i>'); |
| | | } |
| | | $("#inventoryInfo").html(html); |
| | | } |
| | | |
| | | /** |
| | | * 跳转至后台预警页面 |
| | | * @param deptAreaId |
| | | */ |
| | | function toAiHome(deptAreaId) { |
| | | var url = "../home?t=WarnInfo&deptAreaId="+deptAreaId; |
| | | window.parent.open(url, "_self"); |
| | | } |
| | | |
| | | /** |
| | | * 请求获取库区相关信息 |
| | | */ |
| | | function ajaxDeptArea() { |
| | | // $.ajax({ |
| | | // type: "POST", |
| | | // url: "../../visual/index-dept-area", |
| | | // dataType: "json", |
| | | // contentType: "application/json;charset=UTF-8", |
| | | // data: JSON.stringify({ |
| | | // "companyId": companyId |
| | | // }), |
| | | // success: function (result) { |
| | | // if (result.code == "0000") { |
| | | // deptAreaAllList = result.data; |
| | | // getChangeDeptArea(null); |
| | | // } |
| | | // }, |
| | | // error: function (error) { |
| | | // |
| | | // } |
| | | // }); |
| | | function ajaxDeptList() { |
| | | deptList = null; |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "/group/index-dept-list", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify({ |
| | | "companyId": companyId |
| | | }), |
| | | success: function (result) { |
| | | if (result.code == "0000") { |
| | | deptList = result.data; |
| | | renderDeptInfo(); |
| | | renderMsg(); |
| | | } |
| | | }, |
| | | error: function (error) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 渲染库区信息 |
| | | */ |
| | | function renderDeptInfo() { |
| | | if (deptList == null || deptList.length <= 0) { |
| | | return; |
| | | } |
| | | |
| | | $("#county").html(deptList[deptNum].county); |
| | | $("#deptName").html(deptList[deptNum].deptName); |
| | | $("#inNum").html(deptList[deptNum].inNum); |
| | | $("#outNum").html(deptList[deptNum].outNum); |
| | | $("#depotNumber").html(deptList[deptNum].depotNumber); |
| | | $("#depotBankNumber").html(deptList[deptNum].depotBankNumber); |
| | | $("#storageNum").html(deptList[deptNum].storageNum); |
| | | |
| | | //加载库区地图 |
| | | geoMap = updateDeptMap(); |
| | |
| | | $.each(deptList, function(index, item) { |
| | | var val = []; |
| | | var name = ''; |
| | | // if(index == deptNum){ |
| | | // name = item.name; |
| | | // val = [item.lon, item.lat, 17]; |
| | | // }else { |
| | | if(index === deptNum){ |
| | | name = item.deptName; |
| | | val = [item.jd, item.wd, 17]; |
| | | }else { |
| | | val = [item.jd, item.wd, 8]; |
| | | // } |
| | | } |
| | | points.push({ |
| | | name: name, |
| | | value: val |
| | |
| | | return points; |
| | | } |
| | | |
| | | /* ---------- 获取要切换库区的数据信息 ---------- */ |
| | | function getChangeDeptArea(id) { |
| | | deptAreaList = []; |
| | | index1 = 0; |
| | | clearInterval(timer1); |
| | | |
| | | if (id) { |
| | | if (id === "511400") { |
| | | deptAreaList = deptAreaAllList; |
| | | } else { |
| | | if (deptAreaAllList != null && deptAreaAllList.length > 0) { |
| | | $.each(deptAreaAllList, function (index, item) { |
| | | if (id.length > 6 && id == item.deptCompany) { |
| | | deptAreaList.push(item); |
| | | } |
| | | if (id.length == 6 && id == item.deptCounty) { |
| | | deptAreaList.push(item); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | deptAreaList = deptAreaAllList; |
| | | } |
| | | |
| | | deptAreaSwitch(); |
| | | } |
| | | |
| | | /* ---------- 库区定时切换 ---------- */ |
| | | function deptAreaSwitch() { |
| | | timer1 = setInterval(function () { |
| | | if (index1 == deptAreaList.length) { |
| | | index1 = 0; |
| | | } |
| | | |
| | | renderDeptArea(); |
| | | |
| | | index1 += 1; |
| | | |
| | | }, 3000); |
| | | } |
| | | |
| | | // 更新库区信息 |
| | | function renderDeptArea() { |
| | | |
| | | if (deptAreaList == null || deptAreaList.length <= 0) { |
| | | return; |
| | | } |
| | | |
| | | $("#cityAndCounty").html(deptAreaList[index1].deptCityName + "-" + deptAreaList[index1].deptCountyName); |
| | | $("#deptAreaName").html(deptAreaList[index1].name); |
| | | $("#depotNum").html(deptAreaList[index1].depotNum == null ? "0" : deptAreaList[index1].depotNum); |
| | | $("#depotOilNum").html(deptAreaList[index1].depotOilNum == null ? "0" : deptAreaList[index1].depotOilNum); |
| | | |
| | | if (deptAreaList[index1].storageStr.length > 9 |
| | | || deptAreaList[index1].oilStorageStr.length > 9 |
| | | || deptAreaList[index1].areaStr.length > 9) { |
| | | $("#foodNum").css("font-size", "28px"); |
| | | $("#oilNum").css("font-size", "28px"); |
| | | $("#area").css("font-size", "28px"); |
| | | } else if(deptAreaList[index1].storageStr.length > 5 |
| | | || deptAreaList[index1].oilStorageStr.length > 5 |
| | | || deptAreaList[index1].areaStr.length > 5){ |
| | | $("#foodNum").css("font-size", "30px"); |
| | | $("#oilNum").css("font-size", "30px"); |
| | | $("#area").css("font-size", "30px"); |
| | | } else { |
| | | $("#foodNum").css("font-size", "46px"); |
| | | $("#oilNum").css("font-size", "46px"); |
| | | $("#area").css("font-size", "46px"); |
| | | } |
| | | $("#foodNum").html(deptAreaList[index1].storageStr); |
| | | $("#oilNum").html(deptAreaList[index1].oilStorageStr); |
| | | $("#area").html(deptAreaList[index1].areaStr); |
| | | |
| | | if (deptCode) { |
| | | $("#" + deptCode).removeClass("kuqu-h"); |
| | | } |
| | | deptCode = deptAreaList[index1].deptCounty; |
| | | $("#" + deptCode).addClass("kuqu-h"); |
| | | } |
| | | |
| | | /** |
| | | * 请求获取相关数量信息 |
| | | * 请求获取统计数量信息 |
| | | */ |
| | | function ajaxFoodNum() { |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../visual/index-food-number", |
| | | url: "/group/index-num", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify({ |
| | | "companyId": companyId |
| | | }), |
| | | success: function (result) { |
| | | if (result.code == "0000") { |
| | | if (result.code === "0000") { |
| | | var data = result.data; |
| | | renderFoodNum(data); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | // 更新库区信息 |
| | | /** |
| | | * 渲染统计数量信息 |
| | | * @param data |
| | | */ |
| | | function renderFoodNum(data) { |
| | | |
| | | if (!data) { |
| | |
| | | |
| | | /*----- 监管库点信息 -----*/ |
| | | $("#companyNum").html(data.companyNum); |
| | | $("#deptAreaNum").html(data.deptAreaNum); |
| | | $("#depotSum").html(data.depotNum); |
| | | $("#deptNum").html(data.deptNum); |
| | | $("#depotNum").html(data.depotNum); |
| | | $("#depotBankNum").html(data.depotBankNum); |
| | | |
| | | /*----- 监管数量信息 -----*/ |
| | | if (data.foodSum.length > 8 || data.oilSum.length > 8) { |
| | | if (data.foodSum.length > 8 || data.packFoodSum.length > 8) { |
| | | $("#foodSum").css("font-size", "32px"); |
| | | $("#oilSum").css("font-size", "32px"); |
| | | $("#packFoodSum").css("font-size", "32px"); |
| | | } |
| | | $("#foodSum").html(data.foodSum); |
| | | $("#oilSum").html(data.oilSum); |
| | | |
| | | if (data.goodsFoodSum.length > 8 || data.goodsOilSum.length > 8) { |
| | | $("#goodsFoodSum").css("font-size", "32px"); |
| | | $("#goodsOilSum").css("font-size", "32px"); |
| | | } |
| | | $("#goodsFoodSum").html(data.goodsFoodSum); |
| | | $("#goodsOilSum").html(data.goodsOilSum); |
| | | |
| | | $("#packFoodSum").html(data.packFoodSum); |
| | | |
| | | /*----- 分品种柱状图 -----*/ |
| | | if (data.xaxis.length > 0 && data.seriesData.length > 0) { |
| | |
| | | hisFoodVariety.chart.setOption(hisFoodVariety.option, true); |
| | | hisVarietyChart = hisFoodVariety; |
| | | } |
| | | |
| | | /*----- 饼图 -----*/ |
| | | // 品种 -- 粮食 |
| | | if (data.varietyChartPie.length > 0) { |
| | | var varietyChart = pieVarietyChart; |
| | | varietyChart.option.series[0].data = data.varietyChartPie; |
| | | varietyChart.chart.setOption(varietyChart.option, true); |
| | | pieVarietyChart = varietyChart; |
| | | } |
| | | // 性质 -- 粮食 |
| | | if (data.typeChartPie.length > 0) { |
| | | var typeChart = pieTypeChart; |
| | | typeChart.option.series[0].data = data.typeChartPie; |
| | | typeChart.chart.setOption(typeChart.option, true); |
| | | pieTypeChart = typeChart; |
| | | } |
| | | // 等级 -- 粮食 |
| | | if (data.levelChartPie.length > 0) { |
| | | var levelChart = pieLevelChart; |
| | | levelChart.option.series[0].data = data.levelChartPie; |
| | | levelChart.chart.setOption(levelChart.option, true); |
| | | pieLevelChart = levelChart; |
| | | } |
| | | // 年份 -- 粮食 |
| | | if (data.yearChartPie.length > 0) { |
| | | var yearChart = pieYearChart; |
| | | yearChart.option.series[0].data = data.yearChartPie; |
| | | yearChart.chart.setOption(yearChart.option, true); |
| | | pieYearChart = yearChart; |
| | | } |
| | | // 区域 -- 粮食 |
| | | if (data.areaChartPie.length > 0) { |
| | | var areaChart = pieAreaChart; |
| | | areaChart.option.series[0].data = data.areaChartPie; |
| | | areaChart.chart.setOption(areaChart.option, true); |
| | | pieAreaChart = areaChart; |
| | | } |
| | | |
| | | // 粮食监管数量切换 |
| | | foodNumSwitch(); |
| | | // 粮食饼图切换 |
| | | pieChartSwitch(); |
| | | } |
| | | |
| | | /* ---------- 粮食数量监管切换 ---------- */ |
| | | function foodNumSwitch() { |
| | | $(".lb-body .right-topInfo-jg").eq(0).show().siblings().hide(); |
| | | StartLunbo(); |
| | | |
| | | $(".lb-tab").hover(function () { |
| | | clearInterval(timer2); |
| | | index2 = $(this).index(); |
| | | ShowPicTab(); |
| | | }, function () { |
| | | StartLunbo(); |
| | | }); |
| | | |
| | | $(".lb-btn1").click(function () { |
| | | clearInterval(timer2); |
| | | index2--; |
| | | if (index2 == -1) { |
| | | index2 = number2 - 1; |
| | | } |
| | | |
| | | ShowPicTab(); |
| | | StartLunbo(); |
| | | }); |
| | | |
| | | $(".lb-btn2").click(function () { |
| | | clearInterval(timer2); |
| | | index2++; |
| | | if (index2 == number2) { |
| | | index2 = 0; |
| | | } |
| | | ShowPicTab(); |
| | | StartLunbo(); |
| | | }); |
| | | } |
| | | |
| | | function ShowPicTab() { |
| | | if (index2 === 0) { |
| | | $("#foodNumTitle").html("储备粮油"); |
| | | } else if (index2 === 1) { |
| | | $("#foodNumTitle").html("商品粮油"); |
| | | } |
| | | // else if (index2 === 2) { |
| | | // $("#foodNumTitle").html("小包装粮油"); |
| | | // } |
| | | $(".lb-body .right-topInfo-jg").eq(index2).fadeIn(300).siblings().fadeOut(300); |
| | | $(".lb-tab").eq(index2).addClass("bg").siblings().removeClass("bg"); |
| | | } |
| | | |
| | | function StartLunbo() { |
| | | timer2 = setInterval(function () { |
| | | index2++; |
| | | if (index2 >= number2) { |
| | | index2 = 0; |
| | | } |
| | | ShowPicTab(); |
| | | }, 3000); |
| | | } |
| | | |
| | | /* ---------- 粮食饼图切换 ---------- */ |
| | | function pieChartSwitch() { |
| | | $(".tubiao-Carousel .stats-chart-box").eq(0).show().siblings().hide(); |
| | | StartCarousel(); |
| | | |
| | | $(".carousel-tab").hover(function () { |
| | | clearInterval(timer3); |
| | | index3 = $(this).index(); |
| | | ShowTubiao(); |
| | | |
| | | }, function () { |
| | | StartCarousel(); |
| | | }); |
| | | |
| | | $(".carousel-btn1").click(function () { |
| | | clearInterval(timer3); |
| | | index3--; |
| | | if (index3 == -1) { |
| | | index3 = number3 - 1; |
| | | } |
| | | |
| | | ShowTubiao(); |
| | | StartCarousel(); |
| | | }); |
| | | |
| | | $(".carousel-btn2").click(function () { |
| | | clearInterval(timer3); |
| | | index3++; |
| | | if (index3 == number3) { |
| | | index3 = 0; |
| | | } |
| | | ShowTubiao(); |
| | | StartCarousel(); |
| | | }); |
| | | } |
| | | |
| | | function ShowTubiao() { |
| | | if (index3 === 0) { |
| | | $("#pieCharTitle").html("粮食数量统计(吨)"); |
| | | } else if (index3 === 1) { |
| | | $("#pieCharTitle").html("油脂数量统计(吨)"); |
| | | } |
| | | $(".tubiao-Carousel .stats-chart-box").eq(index3).fadeIn(300).siblings().fadeOut(300); |
| | | $(".carousel-tab").eq(index3).addClass("bg").siblings().removeClass("bg"); |
| | | } |
| | | |
| | | function StartCarousel() { |
| | | timer3 = setInterval(function () { |
| | | index3++; |
| | | if (index3 >= number3) { |
| | | index3 = 0; |
| | | } |
| | | ShowTubiao(); |
| | | }, 3000); |
| | | } |
| | | |
| | | // 刷新时间 |
| | |
| | | * 初始化屏幕大小 |
| | | */ |
| | | function initScrollbar() { |
| | | |
| | | if (pieVarietyChart) { |
| | | pieVarietyChart.resize(); |
| | | } |
| | | |
| | | if (pieTypeChart) { |
| | | pieTypeChart.resize(); |
| | | } |
| | | |
| | | if (pieLevelChart) { |
| | | pieLevelChart.resize(); |
| | | } |
| | | |
| | | if (pieYearChart) { |
| | | pieYearChart.resize(); |
| | | } |
| | | |
| | | if (pieAreaChart) { |
| | | pieAreaChart.resize(); |
| | | } |
| | | |
| | | if (hisVarietyChart) { |
| | | hisVarietyChart.resize(); |
| | |
| | | return document.getElementById('inventoryInfo').clientHeight > document.getElementById('inventoryInfoBox').clientHeight; |
| | | } |
| | | |
| | | // 初始化图表 |
| | | /** |
| | | * 初始化图表 |
| | | */ |
| | | function initChart() { |
| | | |
| | | /* 库存图表加载 */ |
| | | allInventoryChartLoad( |
| | | ['小麦', '玉米', '稻谷', '成品粮', '成品油', '其他'], |
| | | [1000, 1200, 1500, 1300, 1100, 1600] |
| | | ); |
| | | |
| | | /* 品种 - 粮食 */ |
| | | pieChartLoad( |
| | | [ |
| | | {value: 0, name: '稻谷'}, |
| | | {value: 0, name: '玉米'}, |
| | | {value: 0, name: '小麦'} |
| | | ], |
| | | 'pieVarietyChart' |
| | | ); |
| | | /* 性质 - 粮食 */ |
| | | pieChartLoad( |
| | | [ |
| | | {value: 0, name: '省级储备'}, |
| | | {value: 0, name: '市级储备'}, |
| | | {value: 0, name: '县级储备'} |
| | | ], |
| | | 'pieTypeChart' |
| | | ); |
| | | /* 等级 - 粮食 */ |
| | | pieChartLoad( |
| | | [ |
| | | {value: 0, name: '一等'}, |
| | | {value: 0, name: '二等'}, |
| | | {value: 0, name: '三等'}, |
| | | {value: 0, name: '四等'}, |
| | | {value: 0, name: '五等'}, |
| | | {value: 0, name: '等外'} |
| | | ], |
| | | 'pieLevelChart' |
| | | ); |
| | | /* 年份 - 粮食 */ |
| | | pieChartLoad( |
| | | [ |
| | | {value: 0, name: '2019'}, |
| | | {value: 0, name: '2020'}, |
| | | {value: 0, name: '2021'}, |
| | | {value: 0, name: '2022'}, |
| | | {value: 0, name: '2023'} |
| | | |
| | | ], |
| | | 'pieYearChart' |
| | | ); |
| | | /* 地域 - 粮食 */ |
| | | pieChartLoad( |
| | | [ |
| | | {value: 0, name: '2019'}, |
| | | {value: 0, name: '2020'}, |
| | | {value: 0, name: '2021'}, |
| | | {value: 0, name: '2022'}, |
| | | {value: 0, name: '2023'} |
| | | ], 'pieAreaChart' |
| | | ); |
| | | } |
| | | |
| | |
| | | }; |
| | | myChart.setOption(options); |
| | | hisVarietyChart = {"chart": myChart, "option": options}; |
| | | } |
| | | |
| | | /** |
| | | * 饼图加载 |
| | | * |
| | | * @param obj |
| | | * @param id |
| | | */ |
| | | function pieChartLoad(data, id) { |
| | | var dom = document.getElementById(id); |
| | | var pieChart = echarts.init(dom); |
| | | |
| | | var option = { |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | bottom: 10, |
| | | right: 10, |
| | | left: 10, |
| | | textStyle: { |
| | | color: '#fff', |
| | | fontSize: 12 |
| | | }, |
| | | itemWidth: 8, |
| | | itemHeight: 8, |
| | | icon: "circle", |
| | | // 使用回调函数 |
| | | formatter:function(name) { |
| | | |
| | | var than = option.series[0].data; |
| | | var total = 0; |
| | | var tarValue; |
| | | for (var i = 0, l = than.length; i < l; i++) { |
| | | total += Number(than[i].value); |
| | | if (than[i].name == name) { |
| | | tarValue = Number(than[i].value); |
| | | } |
| | | } |
| | | var p = 0.0; |
| | | if(total > 0){ |
| | | p = (tarValue / total) * 100; |
| | | } |
| | | return name + " " + " " + p.toFixed(2) + "%"; |
| | | } |
| | | }, |
| | | |
| | | color: ['#26a2cf', '#d36b37', '#d49327', '#2d6be9', '#36b994', '#bc2032', '#d3614f'], |
| | | series: [ |
| | | { |
| | | name: '', |
| | | type: 'pie', |
| | | radius: ['20%', '50%'], |
| | | center: ['center', '30%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: 10, |
| | | borderColor: '#041636', |
| | | borderWidth: 8, |
| | | }, |
| | | label: { |
| | | show: false, |
| | | color: '#fff', |
| | | formatter: '{b}\n{d}%', |
| | | fontSize: nowSize(16), |
| | | lineHeight: nowSize(25), |
| | | }, |
| | | labelLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | cap: 'round', |
| | | } |
| | | }, |
| | | data: data |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | pieChart.setOption(option); |
| | | |
| | | if (id === 'pieVarietyChart') { |
| | | pieVarietyChart = {"chart": pieChart, "option": option}; |
| | | } else if (id === 'pieTypeChart') { |
| | | pieTypeChart = {"chart": pieChart, "option": option}; |
| | | } else if (id === 'pieLevelChart') { |
| | | pieLevelChart = {"chart": pieChart, "option": option}; |
| | | } else if (id === 'pieYearChart') { |
| | | pieYearChart = {"chart": pieChart, "option": option}; |
| | | } else if (id === 'pieAreaChart') { |
| | | pieAreaChart = {"chart": pieChart, "option": option}; |
| | | } |
| | | } |
| | | |
| | | /** |