visual.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. $(window).on("load",function () {
  2. $(".loading").fadeOut()
  3. $('[data-toggle="datepicker"]').datepicker({language: 'zh-CN'});
  4. })
  5. var map, layer, markerlayer, marker,
  6. url = "http://111.42.156.47:806/iserver/services/map-dili/rest/maps/dili@dili";
  7. var sT = "";
  8. var eT = "";
  9. var fyT = "";
  10. var fyres = null;
  11. var res = null;
  12. var markerList = [];
  13. var mesList = [];
  14. var layer01 = null;
  15. var layer01 = null;
  16. $(function () {
  17. var oTime = new Date();
  18. console.log(changeDate(oTime));
  19. $("#dateend").val(changeDate(oTime));
  20. $("#datefy").val(changeDate(oTime));
  21. $("#datestart").val(changeDate(addDate(oTime, -2)));
  22. init();
  23. })
  24. function init() {
  25. map = new SuperMap.Map("map", {
  26. controls: [
  27. new SuperMap.Control.Zoom(),
  28. new SuperMap.Control.Navigation()
  29. ]
  30. });
  31. layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, { transparent: true });
  32. layer01 = new SuperMap.Layer.Vector("KML1", {
  33. strategies: [new SuperMap.Strategy.Fixed()],
  34. protocol: new SuperMap.Protocol.HTTP({
  35. url: "kml/1.kml", //"data/sichuang.kml",
  36. format: new SuperMap.Format.KML({
  37. extractStyles: true,
  38. extractAttributes: true,
  39. internalProjection: new SuperMap.Projection("EPSG:4326"), //所在地图的坐标系
  40. maxDepth: 2 //要解析外部链接文件时此值必须大于1
  41. })
  42. })
  43. });
  44. layer02 = new SuperMap.Layer.Vector("KML2", {
  45. strategies: [new SuperMap.Strategy.Fixed()],
  46. protocol: new SuperMap.Protocol.HTTP({
  47. url: "kml/2.kml", //"data/sichuang.kml",
  48. format: new SuperMap.Format.KML({
  49. extractStyles: true,
  50. extractAttributes: true,
  51. internalProjection: new SuperMap.Projection("EPSG:4326"), //所在地图的坐标系
  52. maxDepth: 2 //要解析外部链接文件时此值必须大于1
  53. })
  54. })
  55. });
  56. markerlayer = new SuperMap.Layer.Markers("markerLayer");
  57. layer.events.on({ "layerInitialized": addLayer });
  58. searchjindu();
  59. searchfangyi();
  60. }
  61. function addLayer() {
  62. map.addLayers([layer, markerlayer, layer01, layer02]);
  63. //显示地图范围
  64. map.setCenter(new SuperMap.LonLat(126.37, 46.05), 1);
  65. }
  66. function searchfangyi() {
  67. if (fyT != $("#datefy").val()) {
  68. fyT = $("#datefy").val();
  69. var datajs = { datefy: $("#datefy").val() };
  70. $.ajax({
  71. url: "https://www.hmedi02.net:802/qiangxian/platform/qiangxianxinxi/qiangxianxinxi/dataFangyi",
  72. type: "GET",
  73. async: false,
  74. contentType: "application/json;charset=utf-8",
  75. data: datajs,
  76. success: function (result) {
  77. fyres = result;
  78. if ($("#biaoduan").val() == "合计") {
  79. echarts_1(result.zhengchangAll, result.yichangAll);
  80. } else if ($("#biaoduan").val() == "一标段") {
  81. echarts_1(result.zhengchang1, result.yichang1);
  82. } else if ($("#biaoduan").val() == "二标段") {
  83. echarts_1(result.zhengchang2, result.yichang2);
  84. }
  85. },
  86. error: function (e) {
  87. console.log(e.status);
  88. console.log(e.responseText);
  89. }
  90. });
  91. } else {
  92. if ($("#biaoduan").val() == "合计") {
  93. echarts_1(fyres.zhengchangAll, fyres.yichangAll);
  94. } else if ($("#biaoduan").val() == "一标段") {
  95. echarts_1(fyres.zhengchang1, fyres.yichang1);
  96. } else if ($("#biaoduan").val() == "二标段") {
  97. echarts_1(fyres.zhengchang2, fyres.yichang2);
  98. }
  99. }
  100. }
  101. function searchjindu() {
  102. if (sT != $("#datestart").val() || eT != $("#dateend").val()) {
  103. if (markerList.length > 0) {
  104. for (var i = 0; i < markerList.length; i++) {
  105. markerlayer.removeMarker(markerList[i]);
  106. }
  107. markerList = [];
  108. }
  109. sT = $("#datestart").val();
  110. eT = $("#dateend").val();
  111. var datajs = { datestart: $("#datestart").val(), dateend: $("#dateend").val() };
  112. $.ajax({
  113. url: "https://www.hmedi02.net:802/qiangxian/platform/qiangxianxinxi/qiangxianxinxi/dataDaping",
  114. type: "GET",
  115. async: false,
  116. contentType: "application/json;charset=utf-8",
  117. data: datajs,
  118. success: function (result) {
  119. console.log(result);
  120. res = result;
  121. mesList = result.mapList;
  122. echarts_2(result.mapList);
  123. if ($("#biaoduan").val() == "合计") {
  124. echarts_3(result.xZhou, result.zuoyerenAll, result.zuoyecheAll, result.icecarAll, result.watercarAll, result.jinduAll);
  125. table1(result.table, result.table2);
  126. echarts_5(result.xZhou, result.fangyirenAll);
  127. } else if ($("#biaoduan").val() == "一标段") {
  128. echarts_3(result.xZhou, result.zuoyeren1, result.zuoyeche1, result.icecar1, result.watercar1, result.jindu1);
  129. table1(result.table, result.table2);
  130. echarts_5(result.xZhou, result.fangyiren1);
  131. } else if ($("#biaoduan").val() == "二标段") {
  132. echarts_3(result.xZhou, result.zuoyeren2, result.zuoyeche2, result.icecar2, result.watercar2, result.jindu2);
  133. table1(result.table, result.table2);
  134. echarts_5(result.xZhou, result.fangyiren2);
  135. }
  136. },
  137. error: function (e) {
  138. console.log(e.status);
  139. console.log(e.responseText);
  140. }
  141. });
  142. } else {
  143. if ($("#biaoduan").val() == "合计") {
  144. echarts_3(res.xZhou, res.zuoyerenAll, res.zuoyecheAll, res.icecarAll, res.watercarAll, res.jinduAll);
  145. table1(res.table, res.table2);
  146. echarts_5(res.xZhou, res.fangyirenAll);
  147. } else if ($("#biaoduan").val() == "一标段") {
  148. echarts_3(res.xZhou, res.zuoyeren1, res.zuoyeche1, res.icecar1, res.watercar1, res.jindu1);
  149. table1(res.table, res.table2);
  150. echarts_5(res.xZhou, res.fangyiren1);
  151. } else if ($("#biaoduan").val() == "二标段") {
  152. echarts_3(res.xZhou, res.zuoyeren2, res.zuoyeche2, res.icecar2, res.watercar2, res.jindu2);
  153. table1(res.table, res.table2);
  154. echarts_5(res.xZhou, res.fangyiren2);
  155. }
  156. }
  157. }
  158. function addDate(date, days) {
  159. var d = new Date(date);
  160. d.setDate(d.getDate() + days);
  161. return d;
  162. }
  163. function changeDate(dateT) {
  164. var year = dateT.getFullYear(); //获取完整的年份(4位,1970-????)
  165. var month = dateT.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  166. var day = dateT.getDate(); //获取当前日(1-31)
  167. if (month < 10) {
  168. month = "0" + month;
  169. }
  170. if (day < 10) {
  171. day = "0" + day;
  172. }
  173. var dateString = year + "-" + month + "-" + day;
  174. return dateString
  175. }
  176. function echarts_1(zc, yc) {
  177. var myChart = echarts.init(document.getElementById('echart1'));
  178. var datajs = [
  179. { value: zc, name: '体温正常' },
  180. { value: yc, name: '体温异常' },
  181. ]
  182. var option = {
  183. color: ['#2ef4ab', '#ffe074'],
  184. tooltip: {
  185. trigger: 'item',
  186. formatter: "{b} : {c} 人 ({d}%)"
  187. },
  188. legend: {
  189. bottom: '3%',
  190. itemGap: 10,
  191. icon: 'circle',
  192. textStyle: {
  193. color: 'rgba(255,255,255,.6)',
  194. fontSize: 12
  195. },
  196. data: ['体温正常', '体温异常']
  197. },
  198. calculable: true,
  199. series: [
  200. {
  201. name: ' ',
  202. type: 'pie',
  203. radius: [30, 50],
  204. center: ['50%', '40%'],
  205. //roseType: 'radius',
  206. label: {
  207. normal: {
  208. show: true
  209. },
  210. emphasis: {
  211. show: true
  212. }
  213. },
  214. lableLine: {
  215. normal: {
  216. show: true
  217. },
  218. emphasis: {
  219. show: true
  220. }
  221. },
  222. data: datajs
  223. },
  224. ]
  225. };
  226. myChart.setOption(option);
  227. window.addEventListener("resize", function () {
  228. myChart.resize();
  229. });
  230. }
  231. function echarts_2(mList) {
  232. if (mList.length > 0) {
  233. for (var i = 0; i < mList.length; i++) {
  234. var size = new SuperMap.Size(44, 33);
  235. var offset = new SuperMap.Pixel(-(size.w / 2), -size.h);
  236. var icon = new SuperMap.Icon('images/marker.png', size, offset);
  237. marker = new SuperMap.Marker(new SuperMap.LonLat(mList[i].longitude2, mList[i].latitude2), icon);
  238. marker.events.on({
  239. "id": mList[i].id,
  240. "click": openInfoWin,
  241. "scope": marker
  242. });
  243. markerList.push(marker);
  244. }
  245. for (var i = 0; i < markerList.length; i++) {
  246. markerlayer.addMarker(markerList[i]);
  247. }
  248. }
  249. }
  250. function openInfoWin() {
  251. var marker = this;
  252. var lonlat = marker.getLonLat();
  253. console.log(lonlat.lon);
  254. console.log(lonlat.lat);
  255. for (var i = 0; i < mesList.length; i++) {
  256. console.log(mesList[i]);
  257. if (ec(lonlat.lon, mesList[i].longitude2, lonlat.lat, mesList[i].latitude2)) {
  258. $("#sbrq").html(mesList[i].addtime);
  259. $("#fkrs").html(mesList[i].fangyiren);
  260. $("#yctw").html(mesList[i].yichangren);
  261. $("#zyrs").html(mesList[i].zuoyeren);
  262. $("#zycs").html(mesList[i].zuoyeche);
  263. $("#ybcc").html(mesList[i].icecar);
  264. $("#xwcc").html(mesList[i].watercar);
  265. $("#wcl").html(mesList[i].jindu);
  266. $("#bcsm").html(mesList[i].remark2);
  267. $("#sfyc").html(mesList[i].shifouyichang);
  268. $("#ycqk").html(mesList[i].yichangxinxi);
  269. if (mesList[i].fujianid == "") {
  270. $("#xczp").html("暂无现场照片");
  271. } else {
  272. $("#xczp").html("<button style=\"height:24px;width:100px;color: #000000\" data-toggle=\"modal\" data-target=\"#myModal\">查看现场照片</button>");
  273. var tList = mesList[i].fujianid.split(";");
  274. var imgHtml = "";
  275. for (var j = 0; j < tList.length; j++) {
  276. if (tList != "") {
  277. imgHtml += "<img src='" + tList[j] + "' /></br>";
  278. }
  279. }
  280. $("#myModalLabel").html(imgHtml);
  281. }
  282. if (mesList[i].yichangfujian == "") {
  283. $("#yczp").html("暂无异常照片");
  284. } else {
  285. $("#yczp").html("<button style=\"height:24px;width:100px;color: #000000\" data-toggle=\"modal\" data-target=\"#myModal2\">查看异常照片</button>");
  286. var tList = mesList[i].yichangfujian.split(";");
  287. var imgHtml = "";
  288. for (var j = 0; j < tList.length; j++) {
  289. if (tList != "") {
  290. imgHtml += "<img src='" + tList[j] + "' /></br>";
  291. }
  292. }
  293. $("#myModalLabel2").html(imgHtml);
  294. }
  295. return;
  296. }
  297. }
  298. }
  299. function ec(lon1, lon2, lat1, lat2) {
  300. var l1 = left(lon1 + " ", 14);
  301. var l2 = left(lon2 + " ", 14);
  302. var l3 = left(lat1 + " ", 14);
  303. var l4 = left(lat2 + " ", 14);
  304. if (l1 == l2 && l3 == l4) {
  305. return true;
  306. }
  307. return false;
  308. }
  309. function left(mainStr, lngLen) {
  310. if (lngLen > 0) { return mainStr.substring(0, lngLen) }
  311. else { return null }
  312. }
  313. function echarts_3(dtLisT, zyrList, zycList, ybcList, xwcList, jdList) {
  314. var myChart = echarts.init(document.getElementById('echart3'));
  315. var option = {
  316. legend: {
  317. left: 'center',
  318. textStyle: {
  319. color: "rgba(255, 255, 255, 1)"
  320. }
  321. },
  322. color: ['#1921ff', '#01c3dd', '#008198', '#2ef4ab', '#ffe074'],
  323. textStyle: {
  324. color: 'rgba(255, 255, 255, 1)'
  325. },
  326. tooltip: {
  327. textStyle: {
  328. align: 'left'
  329. },
  330. trigger: 'axis',
  331. formatter: "{b0} " + $("#biaoduan").val() + ":</br>{a0} : {c0} 人</br>{a1} : {c1} 辆</br>{a2} : {c2} 次</br>{a3} : {c3} 次</br>{a4} : {c4} 平方米"
  332. },
  333. dataZoom: {
  334. start: 0,
  335. end: 100,
  336. bottom: 0,
  337. fillerColor: 'rgba(33,114,176,0.2)',
  338. textStyle: {
  339. color: 'rgba(255,255,255,.7)'
  340. },
  341. borderColor: {
  342. color: 'rgba(33,114,176,0.2)'
  343. },
  344. handleStyle: {
  345. color: {
  346. type: 'linear',
  347. x: 0,
  348. y: 0,
  349. x2: 0,
  350. y2: 1,
  351. colorStops: [{
  352. offset: 0, color: '#fbf320'
  353. }, {
  354. offset: 1, color: '#00b4e3'
  355. }],
  356. global: false
  357. }
  358. }
  359. },
  360. grid: {
  361. left: '3%',
  362. right: '5%',
  363. top: '8%',
  364. bottom: '5%',
  365. containLabel: true
  366. },
  367. xAxis: [
  368. {
  369. type: 'category',
  370. axisTick: { show: false },
  371. boundaryGap: false,
  372. axisLabel: {
  373. textStyle: {
  374. color: 'rgba(33,114,176,0.7)',
  375. fontSize: '12'
  376. },
  377. lineStyle: {
  378. color: 'rgba(33,114,176,0.2)',
  379. }
  380. },
  381. data: dtLisT
  382. }
  383. ],
  384. yAxis: {
  385. type: 'value',
  386. axisLabel: {
  387. textStyle: {
  388. color: 'rgba(33,114,176,0.7)',
  389. fontSize: '10',
  390. }
  391. },
  392. axisLine: {
  393. lineStyle: {
  394. color: 'rgba(33,114,176,0.2)',
  395. }
  396. },
  397. splitLine: {
  398. lineStyle: {
  399. color: 'rgba(33,114,176,0.2)',
  400. }
  401. },
  402. },
  403. series: [
  404. {
  405. name: '作业人数',
  406. lineStyle: {
  407. color: '#1921ff',
  408. },
  409. type: 'line',
  410. areaStyle: {
  411. normal: {
  412. type: 'default',
  413. color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
  414. offset: 0,
  415. color: 'rgba(129,197,255,.6)'
  416. }, {
  417. offset: 1,
  418. color: 'rgba(129,197,255,.0)'
  419. }], false)
  420. }
  421. },
  422. smooth: true,
  423. itemStyle: {
  424. normal: { areaStyle: { type: 'default' } }
  425. },
  426. label: {
  427. show: true,
  428. position: 'top'
  429. },
  430. data: zyrList
  431. },
  432. {
  433. name: '作业车数',
  434. lineStyle: {
  435. color: '#01c3dd',
  436. },
  437. type: 'line',
  438. areaStyle: {
  439. normal: {
  440. type: 'default',
  441. color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
  442. offset: 0,
  443. color: 'rgba(129,197,255,.6)'
  444. }, {
  445. offset: 1,
  446. color: 'rgba(129,197,255,.0)'
  447. }], false)
  448. }
  449. },
  450. smooth: true,
  451. itemStyle: {
  452. normal: { areaStyle: { type: 'default' } }
  453. },
  454. label: {
  455. show: true,
  456. position: 'top'
  457. },
  458. data: zycList
  459. },
  460. {
  461. name: '运冰车次',
  462. lineStyle: {
  463. color: '#008198',
  464. },
  465. type: 'line',
  466. areaStyle: {
  467. normal: {
  468. type: 'default',
  469. color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
  470. offset: 0,
  471. color: 'rgba(129,197,255,.6)'
  472. }, {
  473. offset: 1,
  474. color: 'rgba(129,197,255,.0)'
  475. }], false)
  476. }
  477. },
  478. smooth: true,
  479. itemStyle: {
  480. normal: { areaStyle: { type: 'default' } }
  481. },
  482. label: {
  483. show: true,
  484. position: 'top'
  485. },
  486. data: ybcList
  487. },
  488. {
  489. name: '吸污车次',
  490. lineStyle: {
  491. color: '#2ef4ab',
  492. },
  493. type: 'line',
  494. areaStyle: {
  495. normal: {
  496. type: 'default',
  497. color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
  498. offset: 0,
  499. color: 'rgba(129,197,255,.6)'
  500. }, {
  501. offset: 1,
  502. color: 'rgba(129,197,255,.0)'
  503. }], false)
  504. }
  505. },
  506. smooth: true,
  507. itemStyle: {
  508. normal: { areaStyle: { type: 'default' } }
  509. },
  510. label: {
  511. show: true,
  512. position: 'top'
  513. },
  514. data: xwcList
  515. },
  516. {
  517. name: '完成量',
  518. lineStyle: {
  519. color: '#ffe074',
  520. },
  521. type: 'line',
  522. areaStyle: {
  523. normal: {
  524. type: 'default',
  525. color: new echarts.graphic.LinearGradient(0, 0, 0, 0.8, [{
  526. offset: 0,
  527. color: 'rgba(129,197,255,.6)'
  528. }, {
  529. offset: 1,
  530. color: 'rgba(129,197,255,.0)'
  531. }], false)
  532. }
  533. },
  534. smooth: true,
  535. itemStyle: {
  536. normal: { areaStyle: { type: 'default' } }
  537. },
  538. label: {
  539. show: true,
  540. position: 'top'
  541. },
  542. data: jdList
  543. }
  544. ]
  545. };
  546. myChart.setOption(option);
  547. window.addEventListener("resize", function () {
  548. myChart.resize();
  549. });
  550. }
  551. function echarts_5(dtLisT, fkrList) {
  552. var myChart = echarts.init(document.getElementById('echart5'));
  553. var option = {
  554. color: ['#ffe074'],
  555. textStyle: {
  556. color: 'rgba(255, 255, 255, 1)'
  557. },
  558. tooltip: {
  559. textStyle: {
  560. align: 'left'
  561. },
  562. trigger: 'axis',
  563. formatter: "{b} " + $("#biaoduan").val() + ":</br>{a} : {c} 人"
  564. },
  565. xAxis: {
  566. type: 'category',
  567. data: dtLisT
  568. },
  569. yAxis: {
  570. type: 'value'
  571. },
  572. series: [{
  573. name: "防疫人数",
  574. data: fkrList,
  575. type: 'bar'
  576. }]
  577. };
  578. myChart.setOption(option);
  579. window.addEventListener("resize", function () {
  580. myChart.resize();
  581. });
  582. }
  583. function table1(t1, t2) {
  584. $("#td1").html(t1[0]);
  585. $("#td2").html(t1[1]);
  586. $("#td3").html(t1[2]);
  587. $("#td4").html(t1[3]);
  588. $("#td5").html(t1[4]);
  589. $("#td6").html(t1[5]);
  590. $("#td7").html(t1[6]);
  591. $("#td8").html(t1[7]);
  592. $("#td9").html(t1[8]);
  593. $("#td10").html(t1[9]);
  594. $("#td11").html(t1[10]);
  595. $("#td12").html(t1[11]);
  596. $("#td13").html(t1[12]);
  597. $("#td14").html(t1[13]);
  598. $("#td15").html(t1[14]);
  599. $("#td16").html(t1[15]);
  600. $("#td17").html(t1[16]);
  601. $("#td18").html(t1[17]);
  602. $("#td19").html(t1[18]);
  603. $("#td20").html(t1[19]);
  604. $("#td21").html(t1[20]);
  605. $("#td22").html(t1[21]);
  606. $("#td23").html(t1[22]);
  607. $("#td24").html(t1[23]);
  608. $("#td25").html(t2[0]);
  609. $("#td26").html(t2[1]);
  610. $("#td27").html(t2[2]);
  611. }