monthReport.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. // 筛选弹框
  2. var layer = layui.layer;
  3. var layerCreateIndex = '';
  4. var layerCreateIndex2 = '';
  5. layui.use('layer', function() {
  6. layerCreateIndex = layer.open({
  7. type: 1,
  8. title: false,
  9. closeBtn: 0,
  10. // shadeClose: true,
  11. skin: 'yourclass',
  12. area: [
  13. '380px', '300px'
  14. ],
  15. content: $(".reportOut"),
  16. success: function() {
  17. $('.clsBtn,.cancel').click(function() {
  18. layer.close(layerCreateIndex);
  19. //关闭弹框
  20. window.open(`${BASEURL}view/mainframe.jsp`);
  21. })
  22. }
  23. })
  24. })
  25. //时间日期选择
  26. layui.use([
  27. 'form', 'layedit', 'laydate'
  28. ], function() {});
  29. layui.use('laydate', function() {
  30. var laydate = layui.laydate;
  31. // 开始日期
  32. var insStart = laydate.render({
  33. elem: '#startTime',
  34. trigger: 'click',
  35. value: '2021-04-01',
  36. isInitValue: true,
  37. done: function(value, date) { // 更新结束日期的最小日期
  38. insEnd.config.min = lay.extend({}, date, {
  39. month: date.month - 1
  40. });
  41. // 自动弹出结束日期的选择器
  42. insEnd.config.elem[0].focus();
  43. }
  44. });
  45. // 结束日期
  46. var insEnd = laydate.render({
  47. elem: '#endTime',
  48. trigger: 'click',
  49. value: '2021-04-30',
  50. done: function(value, date) { // 更新开始日期的最大日期
  51. insStart.config.max = lay.extend({}, date, {
  52. month: date.month - 1
  53. });
  54. }
  55. });
  56. });
  57. // 单位下拉 ajax请求
  58. getNameList()
  59. function getNameList() {
  60. ajaxRequest(DEVICE_TYPE_COMPANYLIST, "POST", {}, function(result) {
  61. let data = result.RESULT;
  62. let items = '';
  63. data.forEach(function(item, key) {
  64. items += `<option value=''>请选择</option><option value="${
  65. item.owner_id
  66. }">${
  67. item.owner_name
  68. }</option>`
  69. })
  70. $('#getNameList').html(items);
  71. }, function(errorMsg) {
  72. alert("请求数据失败!");
  73. })
  74. }
  75. /* 筛选提交发送请求 */
  76. $('#nextStep').click(function() {
  77. var startTimes = $('#startTime').val();
  78. var endTimes = $('#endTime').val();
  79. //获取表单的值 并转换成对象
  80. let allParam = serializeArrayToObj($("#reportOutForm").serializeArray());
  81. //验证数据是否为空
  82. let res = validParamIsEmpty(allParam, {
  83. "startTime": "请选择开始日期",
  84. "endTime": "请选择结束日期",
  85. "companyId": "请选择建筑物",
  86. });
  87. if (res.code == -1) {
  88. alert(res.msg);
  89. return;
  90. }
  91. //验证通过 请求ajax
  92. ajaxRequest(MONTH_REPORT, "POST", allParam, function(result) {
  93. // layer.close(layerCreateIndex);
  94. $('#reportOutForm')[0].reset();
  95. layui.use('layer', function() {
  96. layerCreateIndex2 = layer.open({
  97. type: 1,
  98. title: false,
  99. closeBtn: 0,
  100. skin: 'yourclass',
  101. area: [
  102. '700px', '700px'
  103. ],
  104. content: $(".reportContentOut"),
  105. success: function() {
  106. var data = result.data;
  107. var companyInfo = data.companyInfo; //单位信息
  108. var deviceStatistic = data.deviceStatistic; //告警处理
  109. var deviceOnly = data.deviceOnly; //设备离线情况统计
  110. //大标题和时间动态赋值
  111. (function() {
  112. $('#companyName').html(companyInfo.ownerName);
  113. $('#staticTime').text(`${startTimes}日 到 ${endTimes}日`);
  114. })();
  115. //单位信息
  116. (function() {
  117. let items = '';
  118. items = ` <tr>
  119. <td>${companyInfo.ownerName}</td>
  120. <td>${companyInfo.ownerAddress} </td>
  121. </tr>`
  122. $('#companyData').html(items);
  123. $('#staticTime').html()
  124. })();
  125. //设备类型统计信息
  126. (function() {
  127. var typeList = data.typeList.deviceType;
  128. let items = '';
  129. let items2 = ''
  130. typeList.forEach(function(item, key) {
  131. items += ` <tr>
  132. <td>${item.TypeName} </td>
  133. <td>${item.Num}</td>
  134. <td>${item.TransmissionModel}</td>
  135. <td>${item.Business}</td>
  136. </tr>`
  137. })
  138. items2 = ` <tr>
  139. <td>统计总数</td>
  140. <td>${data.typeList.deviceNum} </td>
  141. <td ></td>
  142. <td ></td>
  143. </tr>`
  144. $('#typeList').html(items + items2);
  145. })();
  146. // 告警处理水系统
  147. (function() {
  148. var waterAlarm = JSON.parse(deviceStatistic.waterAlarm);
  149. waterAlarm = waterAlarm.RESULT[0];
  150. var waterAlarmRate = waterAlarm.count ? (waterAlarm.sum / waterAlarm.count) * 100 : 100;
  151. if (waterAlarmRate == 100) {
  152. $('.waterSummary').html(` 目前数据反应:统计时段内水系统告警报告数量:<span>${waterAlarm.count}</span>条。报告数量良好。<br> 提示:消防水设备状态良好,需要保持。`)
  153. } else {
  154. $('.waterSummary').html(` 目前数据反应:统计时段内水系统告警报告数量:<span>${waterAlarm.count}</span>条。报告数量良好。<br> 提示:有一定的火系统隐患或存在系统故障,需要排查。`)
  155. }
  156. let items = '';
  157. items = ` <tr>
  158. <td>${waterAlarm.count}</td>
  159. <td>${waterAlarm.sum} </td>
  160. <td>${waterAlarm.count- waterAlarm.sum} </td>
  161. <td>${waterAlarmRate}% </td>
  162. </tr>`
  163. $('#water_statistics').html(items);
  164. (function() {
  165. var myChart = echarts.init(document.querySelector("#waterChart1"));
  166. var option = {
  167. tooltip: {
  168. trigger: "axis",
  169. },
  170. legend: {
  171. data: ["水系统"],
  172. bottom: "0",
  173. textStyle: {
  174. color: "#0184d5",
  175. fontSize: "12",
  176. },
  177. },
  178. grid: {
  179. left: "10",
  180. right: "10",
  181. top: "30",
  182. bottom: "30",
  183. containLabel: true,
  184. },
  185. xAxis: [{
  186. type: "category",
  187. boundaryGap: false,
  188. data: waterAlarm.day_list,
  189. // data: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26", "28", "29", "30"],
  190. axisLabel: {
  191. textStyle: {
  192. color: "rgba(255, 255, 255, .3)",
  193. fontSize: 12,
  194. },
  195. axisLine: {
  196. lineStyle: {
  197. color: "rgba(255, 255, 255, .1)",
  198. },
  199. },
  200. },
  201. }, ],
  202. yAxis: [{
  203. type: "value",
  204. // 去除刻度线
  205. axisTick: {
  206. show: false,
  207. },
  208. // y轴的线颜色
  209. axisLine: {
  210. lineStyle: {
  211. color: "#444",
  212. opacity: .3
  213. },
  214. },
  215. // 文字的颜色
  216. axisLabel: {
  217. textStyle: {
  218. color: "rgba(255, 255, 255, .6)",
  219. fontSize: 12,
  220. },
  221. },
  222. // 修改分割线的颜色
  223. splitLine: {
  224. lineStyle: {
  225. color: "#aaa", // 分割线颜色
  226. opacity: .5
  227. }
  228. },
  229. }, ],
  230. series: [{
  231. name: "水系统",
  232. type: "line",
  233. smooth: true,
  234. // 单独修改当前线条的样式
  235. lineStyle: {
  236. color: "#0184d5",
  237. width: 2,
  238. },
  239. areaStyle: {
  240. // 渐变色,只需要复制即可
  241. color: new echarts.graphic.LinearGradient(
  242. 0,
  243. 0,
  244. 0,
  245. 1, [{
  246. offset: 0,
  247. color: "rgba(1, 132, 213, 0.4)", // 渐变色的起始颜色
  248. },
  249. {
  250. offset: 0.8,
  251. color: "rgba(1, 132, 213, 0.1)", // 渐变线的结束颜色
  252. },
  253. ],
  254. false
  255. ),
  256. // 影子效果
  257. shadowColor: "rgba(0, 0, 0, 0.1)",
  258. },
  259. // 设置拐点形状
  260. symbol: "circle",
  261. // 拐点大小
  262. symbolSize: 8,
  263. // 刚开始时不显示拐点,鼠标经过才显示
  264. showSymbol: false,
  265. // 设置拐点颜色以及边框
  266. itemStyle: {
  267. color: "#0184d5",
  268. borderColor: "rgba(221, 220, 107, .1)",
  269. borderWidth: 12,
  270. },
  271. data: waterAlarm.count_list
  272. // data: [30, 40, 30, 40, 30, 40, 30, 60, 20, 40, 30, 40, 30, 40, 30, 40, 30, 60, 20, 40, 30, 40, 30, 40, 30, 40, 20, 50, 40, 30, 40, 20, 50, 40, 30, ]
  273. }],
  274. };
  275. myChart.setOption(option);
  276. //echarts赋值到src
  277. var img1 = document.getElementById('waterChart1_img');
  278. setTimeout(function() {
  279. img1.src = myChart.getDataURL();
  280. }, 1200)
  281. })();
  282. })();
  283. // 告警处理火系统
  284. (function() {
  285. var fireAlarm = JSON.parse(deviceStatistic.fireAlarm);
  286. fireAlarm = fireAlarm.RESULT[0];
  287. $('#fireCount').html(fireAlarm.count)
  288. var fireAlarmRate = fireAlarm.count ? (fireAlarm.sum / fireAlarm.count) * 100 : 100;
  289. if (fireAlarmRate == 100) {
  290. $('.fireSummary').html(` 目前数据反应:火系统告警报告数量:<span>${fireAlarm.count}</span>条。报告数量良好。<br> 提示:消防火设备状态良好,需要保持 。`)
  291. } else {
  292. $('.fireSummary').html(` 目前数据反应:火系统告警报告数量:<span>${fireAlarm.count}</span>条。报告数量良好。<br> 提示:提示:有一定的火系统隐患或存在系统故障,需要排查。`)
  293. }
  294. let items = '';
  295. items = ` <tr>
  296. <td>${ fireAlarm.count}</td>
  297. <td>${ fireAlarm.sum} </td>
  298. <td>${ fireAlarm.count- fireAlarm.sum} </td>
  299. <td>${ fireAlarmRate}% </td>
  300. </tr>`
  301. $('#fire_statistics').html(items);
  302. (function() {
  303. var myChart = echarts.init(document.querySelector("#fireChart1"));
  304. var option = {
  305. tooltip: {
  306. trigger: "axis",
  307. },
  308. legend: {
  309. data: ["火系统"],
  310. bottom: "0",
  311. textStyle: {
  312. color: "#ed3f35",
  313. fontSize: "12",
  314. },
  315. },
  316. grid: {
  317. left: "10",
  318. right: "10",
  319. top: "30",
  320. bottom: "30",
  321. containLabel: true,
  322. },
  323. xAxis: [{
  324. type: "category",
  325. boundaryGap: false,
  326. data: fireAlarm.day_list,
  327. // data: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26", "28", "29", "30"],
  328. axisLabel: {
  329. textStyle: {
  330. color: "rgba(255, 255, 255, .3)",
  331. fontSize: 12,
  332. },
  333. axisLine: {
  334. lineStyle: {
  335. color: "red",
  336. },
  337. },
  338. },
  339. }, ],
  340. yAxis: [{
  341. type: "value",
  342. // 去除刻度线
  343. axisTick: {
  344. show: false,
  345. },
  346. // y轴的线颜色
  347. axisLine: {
  348. lineStyle: {
  349. color: "#444",
  350. opacity: .3
  351. },
  352. },
  353. // 文字的颜色
  354. axisLabel: {
  355. textStyle: {
  356. color: "rgba(255, 255, 255, .6)",
  357. fontSize: 12,
  358. },
  359. },
  360. // 修改分割线的颜色
  361. splitLine: {
  362. lineStyle: {
  363. color: "#aaa", // 分割线颜色
  364. opacity: .5
  365. }
  366. },
  367. }, ],
  368. series: [{
  369. name: "火系统",
  370. type: "line",
  371. smooth: true,
  372. // 单独修改当前线条的样式
  373. lineStyle: {
  374. color: "#ed3f35",
  375. width: 2,
  376. },
  377. areaStyle: {
  378. // 渐变色,只需要复制即可
  379. color: new echarts.graphic.LinearGradient(
  380. 0,
  381. 0,
  382. 0,
  383. 1, [{
  384. offset: 0,
  385. color: "rgba(237,63,53, 0.4)", // 渐变色的起始颜色
  386. },
  387. {
  388. offset: 0.8,
  389. color: "rgba(237,63,53, 0.1)", // 渐变线的结束颜色
  390. },
  391. ],
  392. false
  393. ),
  394. // 影子效果
  395. shadowColor: "rgba(0, 0, 0, 0.1)",
  396. },
  397. // 设置拐点形状
  398. symbol: "circle",
  399. // 拐点大小
  400. symbolSize: 8,
  401. // 刚开始时不显示拐点,鼠标经过才显示
  402. showSymbol: false,
  403. // 设置拐点颜色以及边框
  404. itemStyle: {
  405. color: "#ed3f35",
  406. borderColor: "rgba(221, 220, 107, .1)",
  407. borderWidth: 12,
  408. },
  409. data: fireAlarm.count_list
  410. // data: [130, 10, 20, 40, 30, 40, 80, 60, 20, 40, 90, 40, 20, 140, 30, 40, 130, 20, 20, 40, 80, 70, 30, 40, 30, 120, 20, 99, 50, 20, ],
  411. }, ],
  412. };
  413. myChart.setOption(option);
  414. //echarts赋值到src
  415. var img1 = document.getElementById('fireChart1_img');
  416. setTimeout(function() {
  417. img1.src = myChart.getDataURL();
  418. }, 1200)
  419. })();
  420. })();
  421. // 设备离线水系统
  422. (function() {
  423. var waterDeviceOnly = JSON.parse(deviceOnly.waterDeviceOnly);
  424. waterDeviceOnly = waterDeviceOnly.RESULT[0];
  425. var waterOnlyRate = waterDeviceOnly.count ? (waterDeviceOnly.sum / waterDeviceOnly.count) * 100 : 100;
  426. if (waterOnlyRate == 100) {
  427. $('.waterOnlySummary').html(` 目前数据反应:统计时段内水系统告警报告数量:<span>${waterDeviceOnly.count}</span>条。报告数量良好。<br> 提示:数据接收情况稳定,需要保持。`)
  428. } else {
  429. $('.waterOnlySummary').html(` 目前数据反应:统计时段内水系统告警报告数量:<span>${waterDeviceOnly.count}</span>条。报告数量良好。<br> 提示:有一定的水系统隐患或存在系统故障,需要排查。`)
  430. }
  431. let items = '';
  432. items = ` <tr>
  433. <td>${ waterDeviceOnly.count}</td>
  434. <td>${ waterDeviceOnly.sum} </td>
  435. <td>${ waterDeviceOnly.count- waterDeviceOnly.sum} </td>
  436. <td>${ waterOnlyRate}% </td>
  437. </tr>`
  438. $('#waterDeviceOnly').html(items);
  439. (function() {
  440. var myChart = echarts.init(document.querySelector("#waterOnlyChart"));
  441. var option = {
  442. tooltip: {
  443. trigger: "axis",
  444. },
  445. legend: {
  446. data: ["水系统"],
  447. bottom: "0",
  448. textStyle: {
  449. color: "#0184d5",
  450. fontSize: "12",
  451. },
  452. },
  453. grid: {
  454. left: "10",
  455. right: "10",
  456. top: "30",
  457. bottom: "30",
  458. containLabel: true,
  459. },
  460. xAxis: [{
  461. type: "category",
  462. boundaryGap: false,
  463. data: waterDeviceOnly.day_list,
  464. // data: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26", "28", "29", "30"],
  465. axisLabel: {
  466. textStyle: {
  467. color: "rgba(255, 255, 255, .3)",
  468. fontSize: 12,
  469. },
  470. axisLine: {
  471. lineStyle: {
  472. color: "red",
  473. },
  474. },
  475. },
  476. }, ],
  477. yAxis: [{
  478. type: "value",
  479. // 去除刻度线
  480. axisTick: {
  481. show: false,
  482. },
  483. // y轴的线颜色
  484. axisLine: {
  485. lineStyle: {
  486. color: "#444",
  487. opacity: .3
  488. },
  489. },
  490. // 文字的颜色
  491. axisLabel: {
  492. textStyle: {
  493. color: "rgba(255, 255, 255, .6)",
  494. fontSize: 12,
  495. },
  496. },
  497. // 修改分割线的颜色
  498. splitLine: {
  499. lineStyle: {
  500. color: "#aaa", // 分割线颜色
  501. opacity: .5
  502. }
  503. },
  504. }, ],
  505. series: [{
  506. name: "水系统",
  507. type: "line",
  508. smooth: true,
  509. // 单独修改当前线条的样式
  510. lineStyle: {
  511. color: "#0184d5",
  512. width: 2,
  513. },
  514. areaStyle: {
  515. // 渐变色,只需要复制即可
  516. color: new echarts.graphic.LinearGradient(
  517. 0,
  518. 0,
  519. 0,
  520. 1, [{
  521. offset: 0,
  522. color: "rgba(1, 132, 213, 0.4)", // 渐变色的起始颜色
  523. },
  524. {
  525. offset: 0.8,
  526. color: "rgba(1, 132, 213, 0.1)", // 渐变线的结束颜色
  527. },
  528. ],
  529. false
  530. ),
  531. // 影子效果
  532. shadowColor: "rgba(0, 0, 0, 0.1)",
  533. },
  534. // 设置拐点形状
  535. symbol: "circle",
  536. // 拐点大小
  537. symbolSize: 8,
  538. // 刚开始时不显示拐点,鼠标经过才显示
  539. showSymbol: false,
  540. // 设置拐点颜色以及边框
  541. itemStyle: {
  542. color: "#0184d5",
  543. borderColor: "rgba(221, 220, 107, .1)",
  544. borderWidth: 12,
  545. },
  546. data: waterDeviceOnly.count_list,
  547. // data: [30, 40, 30, 40, 30, 40, 30, 60, 20, 40, 30, 40, 30, 40, 30, 40, 30, 60, 20, 40, 30, 40, 30, 40, 30, 40, 20, 50, 40, 30]
  548. }],
  549. };
  550. myChart.setOption(option);
  551. //echarts赋值到src
  552. var img1 = document.getElementById('waterOnlyChart_img');
  553. setTimeout(function() {
  554. img1.src = myChart.getDataURL();
  555. }, 1200)
  556. })();
  557. })();
  558. // 设备离线火系统
  559. (function() {
  560. var fireOnly = JSON.parse(deviceOnly.fireOnly);
  561. fireOnly = fireOnly.RESULT[0];
  562. $('#fireOnlyCount').html(fireOnly.count);
  563. var fireOnlyRate = fireOnly.count ? (fireOnly.sum / fireOnly.count) * 100 : 100;
  564. if (fireOnlyRate == 100) {
  565. $('.fireOnlySummary').html(` 目前数据反应:统计时段内火系统告警报告数量:<span>${fireOnlyRate}</span>条。报告数量良好。<br> 提示:数据接收情况稳定,需要保持。`)
  566. } else {
  567. $('.fireOnlySummary').html(` 目前数据反应:统计时段内火系统告警报告数量:<span>${fireOnlyRate}</span>条。报告数量良好。<br> 提示:有一定的火系统隐患或存在系统故障,需要排查。`)
  568. }
  569. let items = '';
  570. items = ` <tr>
  571. <td>${ fireOnly.count}</td>
  572. <td>${ fireOnly.sum} </td>
  573. <td>${ fireOnly.count- fireOnly.sum} </td>
  574. <td>${fireOnlyRate}% </td>
  575. </tr>`
  576. $('#fireOnly').html(items);
  577. (function() {
  578. var myChart = echarts.init(document.querySelector("#fireOnlyChart"));
  579. var option = {
  580. tooltip: {
  581. trigger: "axis",
  582. },
  583. legend: {
  584. data: ["火系统"],
  585. bottom: "0",
  586. textStyle: {
  587. color: "#ed3f35",
  588. fontSize: "12",
  589. },
  590. },
  591. grid: {
  592. left: "10",
  593. right: "10",
  594. top: "30",
  595. bottom: "30",
  596. containLabel: true,
  597. },
  598. xAxis: [{
  599. type: "category",
  600. boundaryGap: false,
  601. data: fireOnly.day_list,
  602. // data: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26", "28", "29", "30"],
  603. axisLabel: {
  604. textStyle: {
  605. color: "rgba(255, 255, 255, .3)",
  606. fontSize: 12,
  607. },
  608. axisLine: {
  609. lineStyle: {
  610. color: "red",
  611. },
  612. },
  613. },
  614. }, ],
  615. yAxis: [{
  616. type: "value",
  617. // 去除刻度线
  618. axisTick: {
  619. show: false,
  620. },
  621. // y轴的线颜色
  622. axisLine: {
  623. lineStyle: {
  624. color: "#444",
  625. opacity: .3
  626. },
  627. },
  628. // 文字的颜色
  629. axisLabel: {
  630. textStyle: {
  631. color: "rgba(255, 255, 255, .6)",
  632. fontSize: 12,
  633. },
  634. },
  635. // 修改分割线的颜色
  636. splitLine: {
  637. lineStyle: {
  638. color: "#aaa", // 分割线颜色
  639. opacity: .5
  640. }
  641. },
  642. }, ],
  643. series: [{
  644. name: "火系统",
  645. type: "line",
  646. smooth: true,
  647. // 单独修改当前线条的样式
  648. lineStyle: {
  649. color: "#ed3f35",
  650. width: 2,
  651. },
  652. areaStyle: {
  653. // 渐变色,只需要复制即可
  654. color: new echarts.graphic.LinearGradient(
  655. 0,
  656. 0,
  657. 0,
  658. 1, [{
  659. offset: 0,
  660. color: "rgba(237,63,53, 0.4)", // 渐变色的起始颜色
  661. },
  662. {
  663. offset: 0.8,
  664. color: "rgba(237,63,53, 0.1)", // 渐变线的结束颜色
  665. },
  666. ],
  667. false
  668. ),
  669. // 影子效果
  670. shadowColor: "rgba(0, 0, 0, 0.1)",
  671. },
  672. // 设置拐点形状
  673. symbol: "circle",
  674. // 拐点大小
  675. symbolSize: 8,
  676. // 刚开始时不显示拐点,鼠标经过才显示
  677. showSymbol: false,
  678. // 设置拐点颜色以及边框
  679. itemStyle: {
  680. color: "#ed3f35",
  681. borderColor: "rgba(221, 220, 107, .1)",
  682. borderWidth: 12,
  683. },
  684. data: fireOnly.count_list,
  685. // data: [130, 10, 20, 40, 30, 40, 80, 60, 20, 40, 90, 40, 20, 140, 30, 40, 130, 20, 20, 40, 80, 70, 30, 40, 30, 120, 20, 99, 50, 20, ],
  686. }, ],
  687. };
  688. myChart.setOption(option);
  689. //echarts赋值到src
  690. var img1 = document.getElementById('fireOnlyChart_img');
  691. setTimeout(function() {
  692. img1.src = myChart.getDataURL();
  693. }, 1200)
  694. })();
  695. })();
  696. // 设备离线烟感
  697. (function() {
  698. var smokeOnly = JSON.parse(deviceOnly.smokeOnly);
  699. smokeOnly = smokeOnly.RESULT[0];
  700. $('#somkeOnlyCount').html(smokeOnly.count);
  701. var smokeOnlyRate = smokeOnly.count ? (smokeOnly.sum / smokeOnly.count) * 100 : 100;
  702. if (smokeOnlyRate == 100) {
  703. $('.smokeOnlySummary').html(` 目前数据反应:统计时段内烟感告警报告数量:<span>${smokeOnly.count}</span>条。报告数量良好。<br> 提示:数据接收情况稳定,需要保持。`)
  704. } else {
  705. $('.smokeOnlySummary').html(` 目前数据反应:统计时段内烟感告警报告数量:<span>${smokeOnly.count}</span>条。报告数量良好。<br> 提示:有一定的烟感隐患或存在系统故障,需要排查。`)
  706. }
  707. let items = '';
  708. items = ` <tr>
  709. <td>${ smokeOnly.count}</td>
  710. <td>${ smokeOnly.sum} </td>
  711. <td>${ smokeOnly.count- smokeOnly.sum} </td>
  712. <td>${ smokeOnlyRate}% </td>
  713. </tr>`
  714. $('#smokeOnly').html(items);
  715. (function() {
  716. var myChart = echarts.init(document.querySelector("#smokeOnlyChart"));
  717. var option = {
  718. tooltip: {
  719. trigger: "axis",
  720. },
  721. legend: {
  722. data: ["烟感"],
  723. bottom: "0",
  724. textStyle: {
  725. color: "#F4A460",
  726. fontSize: "12",
  727. },
  728. },
  729. grid: {
  730. left: "10",
  731. right: "10",
  732. top: "30",
  733. bottom: "30",
  734. containLabel: true,
  735. },
  736. xAxis: [{
  737. type: "category",
  738. boundaryGap: false,
  739. data: smokeOnly.day_list,
  740. // data: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "26", "28", "29", "30"],
  741. axisLabel: {
  742. textStyle: {
  743. color: "rgba(255, 255, 255, .3)",
  744. fontSize: 12,
  745. },
  746. axisLine: {
  747. lineStyle: {
  748. color: "red",
  749. },
  750. },
  751. },
  752. }, ],
  753. yAxis: [{
  754. type: "value",
  755. // 去除刻度线
  756. axisTick: {
  757. show: false,
  758. },
  759. // y轴的线颜色
  760. axisLine: {
  761. lineStyle: {
  762. color: "#444",
  763. opacity: .3
  764. },
  765. },
  766. // 文字的颜色
  767. axisLabel: {
  768. textStyle: {
  769. color: "rgba(255, 255, 255, .6)",
  770. fontSize: 12,
  771. },
  772. },
  773. // 修改分割线的颜色
  774. splitLine: {
  775. lineStyle: {
  776. color: "#aaa", // 分割线颜色
  777. opacity: .5
  778. }
  779. },
  780. }, ],
  781. series: [{
  782. name: "烟感",
  783. type: "line",
  784. smooth: true,
  785. // 单独修改当前线条的样式
  786. lineStyle: {
  787. color: "#F4A460",
  788. width: 2,
  789. },
  790. areaStyle: {
  791. // 渐变色,只需要复制即可
  792. color: new echarts.graphic.LinearGradient(
  793. 0,
  794. 0,
  795. 0,
  796. 1, [{
  797. offset: 0,
  798. color: "rgba(244,164,96, 0.4)", // 渐变色的起始颜色
  799. },
  800. {
  801. offset: 0.8,
  802. color: "rgba(244,164,96, 0.1)", // 渐变线的结束颜色
  803. },
  804. ],
  805. false
  806. ),
  807. // 影子效果
  808. shadowColor: "rgba(0, 0, 0, 0.1)",
  809. },
  810. // 设置拐点形状
  811. symbol: "circle",
  812. // 拐点大小
  813. symbolSize: 8,
  814. // 刚开始时不显示拐点,鼠标经过才显示
  815. showSymbol: false,
  816. // 设置拐点颜色以及边框
  817. itemStyle: {
  818. color: "#F4A460",
  819. borderColor: "rgba(221, 220, 107, .1)",
  820. borderWidth: 12,
  821. },
  822. data: smokeOnly.count_list,
  823. // data: [130, 10, 20, 40, 30, 40, 80, 60, 20, 40, 90, 40, 20, 140, 30, 40, 130, 20, 20, 40, 80, 70, 30, 40, 30, 120, 20, 99, 50, 20, ],
  824. }, ],
  825. };
  826. myChart.setOption(option);
  827. //echarts赋值到src
  828. var img1 = document.getElementById('smokeOnlyChart_img');
  829. setTimeout(function() {
  830. img1.src = myChart.getDataURL();
  831. }, 1200)
  832. })();
  833. })();
  834. //关闭弹框
  835. $('.clsBtn,.cancel').click(function() {
  836. window.open(`${BASEURL}view/mainframe.jsp`);
  837. })
  838. }
  839. })
  840. })
  841. }, function(errorMsg) {
  842. alert("异常错误!");
  843. });
  844. });
  845. // 打印
  846. (function() {
  847. $("#btnPrint").click(function() {
  848. print_detail()
  849. });
  850. var print_detail = function() {
  851. //打印前echarts图表转换成图片 start
  852. $('#waterChart1_img,#fireChart1_img,#waterOnlyChart_img,#fireOnlyChart_img,#smokeOnlyChart_img').show()
  853. $('#waterChart1,#fireChart1,#waterOnlyChart,#fireOnlyChart,#smokeOnlyChart').hide()
  854. // end
  855. var div1_label1 = document.getElementById('printArea').innerHTML;
  856. var hkey_key;
  857. var hkey_root = 'HKEY_CURRENT_USER';
  858. var hkey_path = '\\Software\\Micorsoft\\Internet Explorer\\PageSetup\\';
  859. var print_win = window.open('打印窗口', '_blank');
  860. var div = document.createElement('div');
  861. div.setAttribute('width', '100%');
  862. div.setAttribute('height', '100%');
  863. var div_print = document.createElement('div');
  864. div_print.setAttribute('style', 'width:595px;height:842px;padding:50px 20px;margin:0px auto 0px auto');
  865. div_print.innerHTML = div1_label1;
  866. div.appendChild(div_print);
  867. print_win.document.write(div.innerHTML);
  868. print_win.document.close();
  869. try {
  870. var RegWsh = new ActiveXObject('WScript.Shell');
  871. hkey_key = 'header';
  872. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  873. hkey_key = 'footer';
  874. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  875. } catch (e) {}
  876. print_win.print();
  877. print_win.close();
  878. }
  879. })()