// var marquee2 = document.getElementById("marquee2"); // marquee2.start(); // var marquee1 = document.getElementById("marquee1"); // marquee1.start(); $(function() { // 初始化内容 $("#gogogo2").click(function() { $(".tabbbbb1").hide(); $(".tabbbbb2").show(); $("body").attr("id","bg2") }) $("#gogogo").click(function() { $(".tabbbbb2").hide(); $(".tabbbbb1").show(); $("body").attr("id","") }) var url = "/wzzgh-fwdt/healthScore/largeScreen?orgId=" // $.post(url,function(data,status){ var data = { "errorList": [{ "orgtype": "基层", "level": "warning3", "createTime": "2020-08-06", "warntype": null, "name": "温州市眼镜有限公司", "closeTime":"2020-08-19", "id": "c734573b-2e90-43de-8a1b-2acecdd99f9f", "source": "a", "openTime": "2020-08-06", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning3", "createTime": "2020-07-08", "openTime": "2020-07-08", "warntype": null, "name": "温州市龙丰橡胶工业有限公司", "closeTime": "2020-07-19", "id": "26320f33-5fc4-4fdc-8e10-27e2713cb047", "source": "a", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning2", "createTime": "2020-07-10", "warntype": null, "name": "温州市娄桥晓光打火机配件厂", "closeTime": "2020-08-18", "id": "01418d5e-5fd1-4d25-a50d-00bf1486cedf", "source": "a", "openTime": "2020-07-11", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning2", "createTime": "2020-06-13", "warntype": null, "name": "温州市瓯海娄桥化建有限公司", "closeTime": "2020-06-13", "id": "07dbf847-e82e-4e2c-8565-d5667877b80b", "source": "a", "openTime": "2020-06-13", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning1", "createTime": "2020-06-13", "warntype": null, "name": "温州联丰皮塑有限公司", "closeTime": null, "id": "1ca5716f-0dfe-4b7b-829c-74765f80cb3a", "source": "a", "openTime": "2020-07-07", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning1", "createTime": "2020-05-25", "warntype": null, "name": "民政橡胶", "closeTime": null, "id": "52bfbac4-4d2d-4a74-8554-0d637d91e718", "source": "a", "openTime": "2020-07-08", "type": 1, "status": 1 }, { "orgtype": "基层", "level": "warning1", "createTime": "2020-05-21", "warntype": null, "name": "娄桥新丰润滑油加工厂", "closeTime": null, "id": "57fa436a-99a5-450b-bfbe-cad6de1ff01c", "source": "a", "openTime": "2020-07-07", "type": 1, "status": 1 }, ], "topList": [{ h:"钟铮锁业", "score": 92, list: [10, 10, 2, 10, 10, 10, 10, 5, 10, 5, 10 ], "orgName": "浙江钟铮锁业有限公司工会", "top": 1 }, { h:"", "score": 92, list: [10, 10, 2, 10, 10, 10, 10, 5, 10, 5, 10 ], "orgName": "温州立华科技发展有限公司工会", "top": 1 }, { h:"长虹眼镜", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州市瓯海长虹眼镜有限公司工会", "top": 1 }, { h:"康豪鞋材", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州市康豪鞋材有限公司工会", "top": 1 }, { h:"创新新材料", "score": 92, list: [10, 10, 2, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州创新新材料股份有限公司工会", "top": 1 }, { h:"温州伊斯利", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州伊斯利鞋业有限公司工会", "top": 1 }, { h:"城建集团", "score": 92, list: [10, 10, 2, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州城建集团有限公司工会", "top": 1 }, { h:"晓锋五金厂", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州市瓯海娄桥晓锋五金厂工会", "top": 1 }, { h:"朗驰实业", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州朗驰实业有限公司", "top": 1 }, { h:"瑞新集团", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "瑞新集团有限公司", "top": 1 }, { h:"浙江蓝图", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "浙江蓝图包装有限公司", "top": 1 }, { h:"大东集团", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "大东集团有限公司", "top": 1 }, { h:"", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州市进泰鞋业有限公司", "top": 1 }, { h:"", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州海明威光学有限公司", "top": 1 }, { h:"", "score": 91, list: [10, 10, 1, 10, 10, 10, 10, 5, 10, 5, 10, ], "orgName": "温州市瓯海中亨鞋材有限公司", "top": 1 }, { h:"意达石化", "score": 85, list: [10, 9, 1, 10, 10, 10, 10, 5, 10, 5, 5, ], "orgName": "温州市意达石化泵业有限公司", "top": 1 }, { h:"温州鼎圣", "score": 84, list: [9, 9, 1, 10, 10, 10, 10, 5, 10, 5, 5, ], "orgName": "温州鼎圣制鞋机械有限公司", "top": 1 }, { h:"创新住宅", "score": 85, list: [10, 9, 1, 10, 10, 10, 5, 5, 10, 5, 10, ], "orgName": "温州创新住宅预制构件制造有限公司", "top": 1 }, { h:"温州恒驰", "score": 83, list: [9, 8, 1, 10, 10, 10, 5, 5, 10, 5, 10, ], "orgName": "温州市恒驰汽车配件有限公司", "top": 1 }, { h:"三虎动力", "score": 85, list: [10, 9, 1, 10, 10, 10, 5, 5, 10, 5, 10, ], "orgName": "温州三虎动力部件有限公司", "top": 1 }, { h:"物产总公司", "score": 76, list: [10, 10, 1, 10, 10, 10, 10, 5, 0, 5, 5, ], "orgName": "温州市瓯海区物产总公司", "top": 1 }, { h:"娄桥新丰", "score": 65, list: [9, 0, 1, 10, 10, 10, 5, 5, 5, 5, 5, ], "orgName": "娄桥新丰润滑油加工厂", "top": 1 }, { h:"民政橡胶", "score": 69, list: [8, 0, 1, 10, 10, 10, 5, 5, 10, 5, 5, ], "orgName": "民政橡胶", "top": 1 }, { h:"联丰皮塑", "score": 64, list: [9, 9, 1, 10, 10, 0, 10, 5, 0, 5, 5, ], "orgName": "温州联丰皮塑有限公司", "top": 1 }, { h:"娄桥化建", "score": 57, list: [9, 7, 1, 10, 10, 0, 10, 5, 0, 5, 0, ], "orgName": "温州市瓯海娄桥化建有限公司", "top": 1 }, { h:"娄桥晓光", "score": 57, list: [9, 7, 1, 10, 10, 0, 5, 5, 5, 5, 0, ], "orgName": "温州市娄桥晓光打火机配件厂", "top": 1 }, { h:"龙丰橡胶", "score": 39, list: [8, 0, 1, 10, 10, 0, 0, 5, 0, 5, 0, ], "orgName": "温州市龙丰橡胶工业有限公司", "top": 1 }, { h:"瓯海眼镜", "score": 39, list: [8, 0, 1, 10, 10, 0, 0, 5, 0, 5, 0, ], "orgName": "温州市眼镜有限公司", "top": 1 } ], "obj2": { "rows1": [{ "mystatus": 1, "mysum": 5 }, { "mystatus": 2, "mysum": 2 }, { "mystatus": 3, "mysum": 0 }, { "mystatus": 4, "mysum": 6 } ] }, "obj1": { "rows1": [] }, "obj3": { "rows1": [ { "months": "2020-05", "mysum": 0 }, { "months": "2020-06", "mysum": 1 }, { "months": "2020-07", "mysum": 2 }, { "months": "2020-08", "mysum": 1 }, { "months": "2020-09", "mysum": 1 }, { "months": "2020-10", "mysum": 1 }, ], "rows2": [ { "months": "2020-05", "mysum": 6 }, { "months": "2020-06", "mysum": 5 }, { "months": "2020-07", "mysum": 2 }, { "months": "2020-08", "mysum": 2 }, { "months": "2020-09", "mysum": 0 }, { "months": "2020-10", "mysum": 0 }, ] } } createBar13("11", data.obj2, "1") createBar14("11", data.obj3, "1") var topList = data.topList.sort(function(a, b) { return b.score - a.score }) $("#topListNum").html(topList.length); for (var i in topList) { var obj = topList[i]; data.obj1.rows1.push({ score: obj.score }) $("#topListBody").append( $(" " + obj.orgName + " " + obj.score + " ") ); } $(".tabbbbb1 .map-item").click(function(){ var ptext =$(this).find("p").html(); if(ptext=="蓝图二期"){ ptext="浙江蓝图" } var obj = topList.find((item)=>{ if(ptext==item.h){ return true; }else{ return false; } }); for(var i in obj.list){ var numm= obj.list[i] var test =$("#new332 tr:eq("+i+")").find("td").eq(2).html() $("#new332 tr:eq("+i+")").find("td").eq(5).html(numm+"分"==test? ""+numm+"分":""+numm+"分") } $("#myModalLabelqqq").html("所属工会:"+obj.orgName) $("#sumNum").html(obj.score+"分") $("#myModal4").modal("show") }) $("#topListBody tr").click(function(){ var num =$(this).attr("num"); var obj = topList[num]; for(var i in obj.list){ var numm= obj.list[i] var test =$("#new332 tr:eq("+i+")").find("td").eq(2).html() $("#new332 tr:eq("+i+")").find("td").eq(5).html(numm+"分"==test? ""+numm+"分":""+numm+"分") } $("#myModalLabelqqq").html("所属工会:"+obj.orgName) $("#sumNum").html(obj.score+"分") $("#myModal4").modal("show") }) function createBar6(data) { var dom = document.getElementById("container6"); var myChart = echarts.init(dom); var list=data.sort(function(a,b){ return a.list[i]-b.list[i] }) var names=list.map(function(item){ return item.orgName }) var values=list.map(function(item){ return item.list[i] }) var values2=[]; var map = new Map(); for(var i1 in values){ var k=values[i1]; var obj=map.get(k); if(obj){ obj.value+=1; }else{ obj={ name:k+"分", value:1 } values2.push(obj); } map.set(k,obj); } var values2=values2.sort(function(a,b){ return b.value-a.value }) myChart.setOption({ label: { alignTo: 'edge', formatter: '{b}\n{d}%', minMargin: 5, edgeDistance: 10, lineHeight: 15, rich: { time: { fontSize: 10, color: '#999' } } }, darkMode:true, textStyle:{ color:"#FFFFFF" }, tooltip: { trigger: 'item', axisPointer: { type: 'shadow' }, formatter: function(params){ console.log(params) if(params.seriesIndex==0){ return params.name + '
' + '共有'+params.value+'个工会
占比'+params.percent+ '%' } if(params.seriesIndex==1){ return params.data +"分" } } }, grid: [ { width: '50%', top: '1%', left: '3%', right: '4%', bottom: '3%', containLabel: true }, { top: 100, width: '50%', bottom: 10, left: 800, containLabel: true } ], xAxis: { type: 'value', boundaryGap: [0, 0.01] }, yAxis: { type: 'category', data: names }, series: [{ name: 'a', type: 'pie', radius: '55%', data:values2, center: ['75%','50%'], },{ name: '数据', type: 'bar', data:values, itemStyle: { normal: { color: function(params) { //var colorList =colors; return "#4175c2";//colorList[params.dataIndex] }, }, } }] }); } createBar11("11", data.obj1, "1") // // 工会名称 // 100分 // 99.80分 // var errorList = data.errorList; $("#errorListNum").html(errorList.length); var map = new Map(); map.set("warning3", "红色预警"); map.set("warning2", "橙色预警"); map.set("warning1", "黄色预警"); map.set(1, "基础型"); map.set(2, "提升型"); map.set(3, "即知即改型"); map.set(4, "企业生产经营情况"); for (var i in errorList) { var obj = errorList[i]; var date = obj.createTime $("#errorListBody").append( $(" " + obj.name + " " + map.get(obj.level) + " " + map.get(obj.type) + " " + date+ " ") ); } createBar(data.obj1.rows1.length, 103 - data.obj1.rows1.length, "已关联工会", "container", data.obj1.rows1 .length + "/" + 103); createBar(8, 2, "预警&处置", "container4", "7/2"); $("#errorListBody tr").click(function(){ var num =$(this).attr("num"); var obj = errorList[num]; $("#myModalLabelwwww").html("所属工会:"+obj.name) $(".warning3").hide() $(".warning2").hide() $(".warning1").hide() var sz=[ { w1:" 13:51",w2:" 15:23",w3:" 08:12", }, { w1:" 10:25",w2:" 13:42",w3:" 08:38", }, { w1:" 09:31",w2:" 11:07",w3:" 09:59", }, { w1:" 10:31",w2:" 11:21",w3:" 14:39", }, ]; var w1=sz[parseInt(num)%4].w1 var w2=sz[parseInt(num)%4].w2 var w3=sz[parseInt(num)%4].w3 if(obj.level=="warning3"){ $(".ob1").text("分数低于40分"); $(".ob2").text("红色预警"); $(".warning3").show() } if(obj.level=="warning2"){ $(".ob1").text("分数低于60分"); $(".ob2").text("橙色预警"); $(".warning2").show() } if(obj.level=="warning1"){ $(".ob1").text("分数低于70分"); $(".ob2").text("黄色预警"); $(".warning1").show() } $("#createTime").text(obj.createTime+w1); $(".ob3").text(obj.createTime +w1); $("#openTime").text(obj.openTime+w2); $("#closeTime").text(obj.closeTime+w3); $("#myModal3").modal("show"); }) // // 工会名称 // 黄色预警 // 基础型 // 2021-08-15 // // }); function createBar(a, b, title, id, t2) { var dom = document.getElementById(id); var myChart = echarts.init(dom); myChart.setOption({ color: ["#00a1fa", "#004668"], series: [{ // name: this.title, type: 'pie', selectedMode: 'single', radius: ['100%', '90%'], // 将0改成50%,修改圆的内径 clockwise: false, label: { normal: { position: 'inner', show: false } }, data: [{ value: a, name: '使用' }, { value: b, name: '未使用' } ] }], graphic: { // 添加原生图形元素组件 elements: [{ type: 'text', // 组件类型 left: 'center', //定位 top: '34%', // 定位 style: { // 样式 text: title, //文字 fontSize: 13, //文字大小 textAlign: 'center', //定位 width: 30, height: 30, fill: '#FFFFFF' // 字体颜色 } }, { type: 'text', left: 'center', top: '52%', style: { text: t2, fontSize: 16, textAlign: 'center', width: 30, height: 25, fill: '#00a1fa' } } ] } }); } function createBar13(title, data, clickEvent) { var dom = document.getElementById("container2"); var myChart = echarts.init(dom); var arr1 = 0; var arr2 = 0; var arr3 = 0; var arr4 = 0; for (var i in data.rows1) { var mystatus = data.rows1[i].mystatus; if (mystatus == 1) { arr1 = data.rows1[i].mysum; } else if (mystatus == 2) { arr2 = data.rows1[i].mysum; } else if (mystatus == 3) { arr3 = data.rows1[i].mysum; } else if (mystatus == 4) { arr4 = data.rows1[i].mysum; } } var option = { tooltip: { trigger: 'item', formatter: '{b}预警共{c}个' //这是关键,在需要的地方加上就行了 }, color: ['#37A2DA', '#3BBF03', '#FFCB01', '#FF6200', '#FF2525'], textStyle:{ color:"#FFFFFF" }, xAxis: { type: 'category', data: ["未处置", "处置中", "已处置", "已关闭"] }, yAxis: { type: 'value' }, series: [{ name: '未处置', type: 'bar', showBackground: true, backgroundStyle: { color: 'rgba(180, 180, 180, 0.2)' }, data: [arr1, arr2, arr3, arr4], itemStyle: { normal: { //好,这里就是重头戏了,定义一个list,然后根据所以取得不同的值,这样就实现了, color: function(params) { // build a color map as your need. var colorList = ['#FF6200', '#FFCB01', '#3BBF03', '#aaa']; return colorList[params.dataIndex] }, //以下为是否显示,显示位置和显示格式的设置了 label: { show: true, position: 'top', // formatter: '{c}' formatter: '{b}\n{c}' } } }, //设置柱的宽度,要是数据太少,柱子太宽不美观~ // barWidth:70, }] }; myChart.setOption(option); myChart.on('click', function(params) { //console.log(params) }); } function createBar14(title, data, clickEvent) { var dom = document.getElementById("container3"); var myChart = echarts.init(dom); var map = new Map(); var names = []; for (var i in data.rows1) { var item = data.rows1[i] if (map.has(item.months)) { } else { names.push(item.months) map.set(item.months, [0, 0]); } map.get(item.months)[0] = item.mysum; } for (var i in data.rows2) { var item = data.rows2[i] if (map.has(item.months)) { } else { names.push(item.months) map.set(item.months, [0, 0]); } map.get(item.months)[1] = item.mysum; } var data1 = []; var data2 = []; var series = []; names.sort() for (var i in names) { var name = names[i]; var sz = map.get(name) data1.push(sz[0]) data2.push(sz[1]) } series.push({ name: "产生", type: 'line', data: data2, }); series.push({ name: "关闭", type: 'line', data: data1, }); var option = { tooltip: { trigger: 'item', formatter: '{a}{c}个预警' //这是关键,在需要的地方加上就行了 }, color: ['#37A2DA', '#3BBF03', '#FFCB01', '#FF6200', '#FF2525'], textStyle:{ color:"#FFFFFF" }, xAxis: { type: 'category', data: names }, yAxis: {}, series: series }; //console.log(option) myChart.setOption(option); myChart.on('click', function(params) { //console.log(params) }); } function uniq(array) { var temp = []; var index = []; var l = array.length; for (var i = 0; i < l; i++) { for (var j = i + 1; j < l; j++) { if (array[i] === array[j]) { i++; j = i; } } temp.push(array[i]); index.push(i); } return temp; } function createBar11(title, data, type) { var x = 0; var map = new Map(); var dom = document.getElementById("container1"); var myChart = echarts.init(dom); var mydata = []; var mydata1 = []; var mydata2 = []; var innum = 0; var avgnum = 0; var colors = [] if (type == "1") { colors = ['#37A2DA', '#3BBF03', '#FFCB01', '#FF6200', '#FF2525'] var arr1 = new Array(); var arr2 = new Array(); var arr3 = new Array(); var arr4 = new Array(); var arr5 = new Array(); for (var i in data.rows1) { var score = data.rows1[i].score; if (score >= 91) { arr1.push(score); } else if (score >= 70) { arr2.push(score); } else if (score >= 60) { arr3.push(score); } else if (score >= 40) { arr4.push(score); } else if (score >= 0) { arr5.push(score); } avgnum = avgnum + Number(score); } mydata = [{ value: arr1.length, name: '优秀 100-91' }, { value: arr2.length, name: '健康 90-70' }, { value: arr3.length, name: '黄色预警 69-60' }, { value: arr4.length, name: '橙色预警 59-40' }, { value: arr5.length, name: '红色预警 39-0' } ]; } for (var i in mydata) { var mod = mydata[i] mydata1.push(mod.name); mydata2.push(mod.value); if (mod.name.length > 10) { x = -5; } } if (type == "2" || type == "1") { avgnum = avgnum / data.rows1.length; var arr = []; for (var i in data.rows1) { var score = data.rows1[i].score; arr.push(Number(score)) } arr = uniq(arr); if (arr.length % 2 == 0) { innum = arr[arr.length / 2] + arr[arr.length / 2 - 1]; innum = innum / 2; } if (arr.length % 2 == 1) { innum = arr[(arr.length - 1) / 2]; } title = title + "\n平均数:" + avgnum.toFixed(2) + "\n中位数:" + innum.toFixed(2) $("#num1").html(avgnum.toFixed(2)) $("#num2").html(innum.toFixed(2)) } var option = { color: colors, label: { alignTo: 'edge', formatter: '{b}\n{d}%', minMargin: 5, edgeDistance: 10, lineHeight: 15, rich: { time: { fontSize: 10, color: '#999' } } }, title: { text: '', subtext: '', left: 'center' }, tooltip: { trigger: 'item', formatter: function(params) { console.log(params) if (params.seriesIndex == 0) { return params.name + '
' + '共有' + params.value + '个工会
占比' + params .percent + '%' } if (params.seriesIndex == 1) { return params.name + '
' + '共有' + params.value + '个工会' } } }, legend: { orient: 'vertical', left:"right", textStyle: { color: '#FFFFFF' }, }, series: [{ // name: 'a', type: 'pie', radius: '50%', data: mydata, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', //shadowColor: 'rgba(53, 230, 0, 0.5)' } } }, ] } myChart.setOption(option); myChart.on('click', function(params) { //console.log(params) }); } var speed = 100; function getMy(str) { return document.getElementById(str) } var demo = getMy("topListContent"); var demo4 = getMy("topListBody"); var ttt = 0; function Marquee1() { if (demo.offsetHeight < demo4.offsetHeight) { } ttt = ttt + 2; $("#topListContent").scrollTop(ttt) if (demo4.offsetHeight - demo.offsetHeight + 80 < ttt) { console.log(demo.offsetTop + "--a---" + demo.offsetHeight + "c" + ttt) console.log(demo4.offsetTop + "---b--" + demo4.offsetHeight + "ddd " + demo4.clientHeight) $("#topListContent").scrollTop(0) ttt = 0; } } var MyMar1 = setInterval(Marquee1, speed) //设置定时器 //鼠标移上时清除定时器达到滚动停止的目的 demo.onmouseover = function() { clearInterval(MyMar1) } //鼠标移开时重设定时器 demo.onmouseout = function() { ttt = $("#topListContent").scrollTop() MyMar1 = setInterval(Marquee1, speed) } var demok = getMy("errorListContent"); var demok4 = getMy("errorListBody"); var ttt2 = 0; function Marquee2() { ttt2 = ttt2 + 2; $("#errorListContent").scrollTop(ttt2) if (demok4.offsetHeight - demok.offsetHeight + 80 < ttt2) { $("#errorListContent").scrollTop(0) ttt2 = 0; } } var MyMar2 = setInterval(Marquee2, speed) //设置定时器 //鼠标移上时清除定时器达到滚动停止的目的 demok.onmouseover = function() { clearInterval(MyMar2) } //鼠标移开时重设定时器 demok.onmouseout = function() { ttt2 = $("#errorListContent").scrollTop() MyMar2 = setInterval(Marquee2, speed) } //--> var i=0; $("#myModal2Btn").click(function(){ $("#myModal2").modal("show") i=3; createBar6(topList); }) $("#myModalLabelTable tr").click(function(){ var num =$(this).attr("num"); console.log(num) $(".bgindex").removeClass("bgindex") $(this).addClass("bgindex"); if(num){ i=num; createBar6(topList); } }) });