visual.js 20 KB

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