var loader = { get: function (url, data = null, scb) { let reqData = { params: null } if (data) { let convertData = [] Object.keys(data).forEach(item => { convertData.push(`${item}=${data[item]}`) }) reqData.params = encryptCBC(convertData.join('&')) } $.ajax({ url: commonUrl + url, type: 'get', headers: { "authorization": sessionStorage.getItem("zhgd_token") }, data: reqData.params ? reqData : '', success: scb, success: function (event, xhr, settings, data){ event=modifyResponseData(event); scb(event, xhr, settings, data); } }); } } let gtList = []; var terrainMap; let element, layer, table; // 选中标段工程 let checkBidCode = null; layui.use(['form', 'layer', 'element', 'table'], function () { element = layui.element; layer = layui.layer; table = layui.table; form = layui.form; //地形切换 form.on('switch(terrain)', function (data) { if (this.checked) { $('#echarts-map').css('display', 'none'); $('#map').css('display', 'block'); $('#multiselect').css('display', 'none'); $('.bid-pro-select').removeAttr('style') initMap() loadBidPro(); } else { $('#echarts-map').css('display', 'block'); $('#map').css('display', 'none'); $('#multiselect').removeAttr('style') $('.bid-pro-select').css('display', 'none'); } }); // 工程统计 initEngineeringStatistic() // 施工质量排名 initQualityRanking() // 环境监控 initEnvironmentAnalysis() // 设备状态 initDeviceStatus() // 安徽省地图 initMainMap() initRiskData() // 工程安全隐患分析 initSafetyAnalysis() // 工人效率分析 initEfficiencyAnalysis() // 资源利用及能源使用 initResourceRate() // 告警提醒 initAlarmReminder() // 标段工程下拉选监听 form.on('select(bidPro)', function (data) { let value = data.value; let valueArr = value.split('@'); loadBidProTower(valueArr[0], valueArr[1]); }); $("#quality-ranking-table").niceScroll({ cursorborder: "", cursorcolor: "#c0c4cc", boxzoom: true }); $("#alarm-reminder-table").niceScroll({ cursorborder: "", cursorcolor: "#c0c4cc", boxzoom: true }); }); $('#indexIframe').attr('src', './views/main.html'); let mainMapPointList = [], mapPointList = [], weatherList = [], showWeatherList = []; // $.getJSON('../config/risk.json', function (data) { // // console.log(data) // mainMapPointList = data // }) let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; const tooltip = { show: true, trigger: 'axis', axisPointer: { type: 'shadow' }, backgroundColor: 'rgba(75, 79, 82, 0.80)', //设置背景颜色 textStyle: { color: fontColor, fontFamily: fontFamily }, borderColor: "rgba(255,255,255, .5)", }; /** * 左侧 */ // 工程统计 function initEngineeringStatistic() { const url = 'screen/largeScreen/scIndex/proStatusStatistics' loader.get(url, null, function (res) { if (res.code === 200) { const { djNum, zjNum, allNum, tcNum, tgNum } = res.data $('#engineering-statistic-item-1').text(djNum) $('#engineering-statistic-item-2').text(zjNum) $('#engineering-statistic-item-3').text(allNum) $('#engineering-statistic-item-4').text(tcNum) $('#engineering-statistic-item-5').text(tgNum) } else if (res.code === 401) { loginout(1); } else { console.error('工程统计:' + res.msg); } }) } // 施工质量排名 function initQualityRanking() { const url = 'screen/largeScreen/scIndex/constrQuality' loader.get(url, null, function (res) { if (res.code === 200) { res.data.forEach((item, index) => { const { bidName, teamName, teamLeader, score } = item var newRow = `
无数据
工程名称:' + points[i].proName + '
' + '杆塔名称:' + points[i].place + '
' + '经度:' + points[i].lat + '
' + '维度:' + points[i].lng + '
'; //创建label图层 points[i].place var label = new BMap.Label(title, { position: point }); marker.addEventListener("mouseover", function () { terrainMap.addOverlay(label); }); marker.addEventListener("mouseout", function () { terrainMap.removeOverlay(label); }); })(); } //将所有点连线,连线图层polyline var line = []; for (var i = 0; i < points.length; i++) { console.log(points[i].lng, points[i].lat) line.push(new BMap.Point(points[i].lat, points[i].lng)); } line.push(new BMap.Point(points[0].lat, points[0].lng)); console.log(line, 'line') console.log(line) var polyline = new BMap.Polyline(line, { strokeColor: '#00aa00', strokeWeight: 2, strokeOpacity: 1 }); terrainMap.addOverlay(polyline); terrainMap.centerAndZoom(line[0], 10); //设置中心点和缩放层级 } function createMap() { terrainMap = new BMap.Map("map", {}); terrainMap.centerAndZoom('合肥', 8); madeBoundary(); //加载区域图 addMapControl(); // 添加自定义控件 setMapEvent(); //地图控件设置 $('#allMap').css({ 'zIndex': 999, 'backgroundColor': 'transparent' }); } //设置区域图 start function madeBoundary() { let datas = new Array("安徽省-"); var bdary = new BMap.Boundary(); for (var i = 0; i < datas.length; i++) { getBoundary(datas[i], bdary); } } function getBoundary(data, bdary) { data = data.split("-"); bdary.get(data[0], function (rs) { //获取行政区域 var count = rs.boundaries.length; //行政区域的点有多少个 var pointArray = []; for (var i = 0; i < count; i++) { var ply = new BMap.Polygon(rs.boundaries[i], { strokeWeight: 3, strokeColor: "#1066FC", fillOpacity: 1, fillColor: data[1] }); //建立多边形覆盖物 terrainMap.addOverlay(ply); //添加覆盖物 } }); } //向地图添加控件start function addMapControl() { var mystyleJson = [{ "featureType": "road", "elementType": "all", "stylers": { "lightness": 20 } }, { "featureType": "railway", "elementType": "all", "stylers": { "visibility": "off" } }, { "featureType": "local", "elementType": "labels", "stylers": { "visibility": "off" } }, { "featureType": "water", "elementType": "all", "stylers": { "color": "#d1e5ff" } }, { "featureType": "highway", "elementType": "labels", "stylers": {} } ]; terrainMap.setMapStyle({ styleJson: mystyleJson }); } //地图设置start function setMapEvent() { terrainMap.enableScrollWheelZoom(); terrainMap.enableKeyboard(); terrainMap.enableDragging(); terrainMap.enableDoubleClickZoom(); } /** * 右侧 */ // 工程安全隐患分析 function initSafetyAnalysis() { const url = 'screen/largeScreen/scIndex/potentialSafetyHazard' loader.get(url, null, function (res) { let xLabel = [] let dataValue = [] let dataValue1 = [] if(res.code === 200){ res.data.forEach(item => { const { orgName, planNum, dangerNum } = item xLabel.push(orgName) dataValue.push(planNum) dataValue1.push(dangerNum) }) }else if(res.code === 401){ loginout(1); }else { console.error("工程安全隐患分析:"+res.msg); } let option = { backgroundColor: 'transparent', tooltip, dataZoom: [{ type: "slider", realtime: true, startValue: 0, endValue: 4, height: 3, fillerColor: "#08A0A3", // 滚动条颜色 borderColor: "#08A0A3", handleSize: 0, // 两边手柄尺寸 showDetail: false, // 拖拽时是否展示滚动条两侧的文字 top: "90%", left: '2%', right: '3%', moveHandleStyle: { color: "#08A0A3", }, }, { type: "inside", // 支持内部鼠标滚动平移 startValue: 0, endValue: 4, zoomOnMouseWheel: false, // 关闭滚轮缩放 moveOnMouseWheel: true, // 开启滚轮平移 moveOnMouseMove: true, // 鼠标移动能触发数据窗口平移 }], legend: { show: true, top: '15%', right: '2%', itemWidth: 20, // 图例标记的图形宽度。 // itemGap: 20, // 图例每项之间的间隔。 itemHeight: 10, // 图例标记的图形高度。 textStyle: { color: '#fff', fontSize: 14, padding: [0, 8, 0, 8] } }, grid: { top: '25%', left: '8%', right: '3%', bottom: '20%', }, xAxis: [ { type: 'category', boundaryGap: true, axisLine: { show: true, lineStyle: { color: '#5A6E71', }, }, axisLabel: { //坐标轴刻度标签的相关设置 textStyle: { color: fontColor, fontSize: fontSize, fontFamily: fontFamily }, interval: 0, formatter: function (params) { var val = ""; // 超过四个字隐藏 if (params.length > 8) { val = params.substr(0, 6) + '...'; return val; } else { return params; } } }, splitLine: { show: false, lineStyle: { color: '#233653', }, }, axisTick: { show: false, }, data: xLabel, }, ], yAxis: [ { name: "", nameTextStyle: { color: fontColor, fontSize: fontSize, padding: [0, 60, 0, 0], fontFamily: fontFamily }, // minInterval: 1, type: 'value', splitLine: { show: true, lineStyle: { color: '#25393B', type: 'dashed' }, }, axisLine: { show: false, lineStyle: { color: '#008de7', }, }, axisLabel: { show: true, textStyle: { color: fontColor, fontSize: fontSize, fontFamily: fontFamily } }, axisTick: { show: false, }, }, ], series: [ { name: '周计划数', type: 'line', symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆 showSymbol: false, smooth: true, lineStyle: { normal: { width: 3, color: '#1ED6FF', // 线条颜色 }, }, itemStyle: { normal: { color: '#1ED6FF',//拐点颜色 label: { show: true, //开启显示 color: fontColor, fontFamily: fontFamily, position: 'top', //在上方显示 formatter: function (res) { if (res.value) { return res.value } else { return 0 } }, }, }, }, symbolSize: 8, //设定实心点的大小 areaStyle: { normal: { //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。 color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#1ED6FF30', }, { offset: 0.6, color: '#1ED6FF20', }, { offset: 1, color: '#1ED6FF10', }, ], false ), }, }, data: dataValue, }, { name: '隐患数', type: 'line', symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆 showSymbol: false, smooth: true, lineStyle: { normal: { width: 3, color: '#FE533C', // 线条颜色 }, }, itemStyle: { normal: { color: '#FE533C',//拐点颜色 // borderColor: '#fff600',//拐点边框颜色 // borderWidth: 13//拐点边框大小 label: { show: true, //开启显示 color: fontColor, fontFamily: fontFamily, position: 'top', //在上方显示 formatter: function (res) { if (res.value) { return res.value } else { return 0 } }, }, }, }, symbolSize: 8, //设定实心点的大小 areaStyle: { normal: { //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: '#FE533C30', }, { offset: 0.6, color: '#FE533C20', }, { offset: 1, color: '#ffba0010', }, ], false ), }, }, data: dataValue1, } ] } let safetyAnalysis = echarts.init(document.getElementById('safety-analysis')); safetyAnalysis.setOption(option, true); window.addEventListener("resize", function () { safetyAnalysis.resize(); }); }) } // 工人效率分析 function initEfficiencyAnalysis() { let xLabel = [] let data = [] const url = 'screen/largeScreen/scIndex/efficiencyAnalysis' loader.get(url, null, function (res) { if(res.code === 200){ res.data.forEach(item => { const { proName, value } = item xLabel.push(proName) data.push(value) }) }else if(res.code === 401){ loginout(1); }else{ console.error("工人效率分析:" + res.msg); } let option = { tooltip, dataZoom: [{ type: "slider", realtime: true, startValue: 0, endValue: 3, height: 3, fillerColor: "#08A0A3", // 滚动条颜色 borderColor: "#08A0A3", handleSize: 0, // 两边手柄尺寸 showDetail: false, // 拖拽时是否展示滚动条两侧的文字 top: "90%", left: '2%', right: '3%', moveHandleStyle: { color: "#08A0A3", }, }, { type: "inside", // 支持内部鼠标滚动平移 startValue: 0, endValue: 3, zoomOnMouseWheel: false, // 关闭滚轮缩放 moveOnMouseWheel: true, // 开启滚轮平移 moveOnMouseMove: true, // 鼠标移动能触发数据窗口平移 }], grid: { top: '25%', left: '8%', right: '3%', bottom: '25%', }, legend: { data: ['进度'], show: true, top: '15%', right: '2%', icon: 'circle', itemWidth: 10, itemHeight: 10, itemGap: 20, textStyle: { color: '#fff', fontSize: 14, padding: [0, 8, 0, 8] } }, xAxis: [ { type: 'category', boundaryGap: true, axisLine: { show: true, lineStyle: { color: '#5A6E71', }, }, axisLabel: { //坐标轴刻度标签的相关设置 textStyle: { color: fontColor, fontSize: fontSize, fontFamily: fontFamily }, interval: 0, formatter: function (params) { var val = ""; // 超过四个字隐藏 if (params.length > 8) { val = params.substr(0, 6) + '...'; return val; } else { return params; } } }, splitLine: { show: false, lineStyle: { color: '#233653', }, }, axisTick: { show: false, }, data: xLabel, } ], yAxis: [ { name: "", nameTextStyle: { color: fontColor, fontSize: fontSize, padding: [0, 60, 0, 0], fontFamily: fontFamily }, type: 'value', splitLine: { show: true, lineStyle: { color: '#25393B', type: 'dashed' }, }, axisLine: { show: false, lineStyle: { color: '#008de7', }, }, axisLabel: { show: true, textStyle: { color: fontColor, fontSize: fontSize, fontFamily: fontFamily } }, axisTick: { show: false, }, } ], series: [ { name: '进度', type: 'bar', barWidth: 20, itemStyle: { color: '#59E1FF', }, tooltip: { valueFormatter: function (value) { return value; } }, data: data }, ] }; let deviceAnalysis = echarts.init(document.getElementById('efficiency-analysis')); deviceAnalysis.setOption(option, true); window.addEventListener("resize", function () { deviceAnalysis.resize(); }); option && deviceAnalysis.setOption(option); }) } // 资源利用 function initResourceRate() { const url = 'screen/largeScreen/scIndex/resourceUse' let element = document.getElementsByClassName('resource-rate-item') const config = [ { dataTitle: '人员利用率', dataNum: 50, dataNumColor: 'rgba(251,221,45,0.8)', dashboardBgc: 'rgba(254,249,209,0.2)', dashboardColor: 'rgba(251,221,45,0.8)', isRate:true }, { dataTitle: '设备使用率', dataNum: 25, dataNumColor: 'rgba(1,194,255,0.8)', dashboardBgc: 'rgba(45,153,139,0.2)', dashboardColor: 'rgba(1,194,255,0.8)', isRate:true }, { dataTitle: '能源使用率', dataNum: 15, dataNumColor: 'rgba(1,255,193,0.8)', dashboardBgc: 'rgba(45,153,139,0.2)', dashboardColor: 'rgba(1,255,193,0.8)', isRate:false }, ] loader.get(url, null, function (res) { const { personnelRate, deviceRate, energyValue } = res.data config[0].dataNum = personnelRate config[1].dataNum = deviceRate config[2].dataNum = energyValue for (let i = 0; i < element.length; i++) { let option = getResourceChartOption(config[i]) let resourceRate = echarts.init(element[i]); resourceRate.setOption(option, true); window.addEventListener("resize", function () { resourceRate.resize(); }); option && resourceRate.setOption(option); } }) } function getResourceChartOption(config) { const { dataTitle, dataNum, dataNumColor, dashboardBgc, dashboardColor } = config let option = { series: [ { type: 'gauge', startAngle: 180, endAngle: 0, min: 0, max: 100, splitNumber: 10, radius: '80%', // 仪表盘大小 center: ['50%', '75%'], colorBy: 'value', itemStyle: { color: dashboardColor, shadowColor: dashboardBgc, shadowBlur: 10, shadowOffsetX: 2, shadowOffsetY: 2, }, progress: { show: true, roundCap: false, width: 10 }, pointer: { show: false }, axisLine: { lineStyle: { width: 10, color: [[1, dashboardBgc]] } }, axisTick: { show: false, }, splitLine: { show: false, }, axisLabel: { show: false, }, title: { show: true, color: '#fff', fontSize: 14 }, detail: { borderColor: '#999', borderWidth: 0, width: '60%', lineHeight: 40, height: 40, borderRadius: 0, offsetCenter: [0, '-25%'], valueAnimation: true, formatter: function (value) { if(config.isRate){ return '{value|' + value + '}{unit|%}'; }else{ return '{value|' + value + '}'; } }, rich: { value: { fontSize: 20, color: dataNumColor }, unit: { fontSize: 15, color: dataNumColor, } } }, data: [ { value: dataNum, name: dataTitle, } ] } ] }; return option } // 告警提醒 function initAlarmReminder() { const url = 'screen/largeScreen/scIndex/alarmReminder' loader.get(url, null, function (res) { if(res.code === 200){ res.data.forEach((item, index) => { const { proName, warningContent } = item var newRow = `无数据