monthReport.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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("./index.html");
  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. let items = '';
  151. items = ` <tr>
  152. <td>${waterAlarm.count}</td>
  153. <td>${waterAlarm.sum} </td>
  154. <td>${waterAlarm.count- waterAlarm.sum} </td>
  155. <td>${waterAlarm.count?(waterAlarm.sum/waterAlarm.count)*100:0}% </td>
  156. </tr>`
  157. $('#water_statistics').html(items);
  158. (function() {
  159. var myChart = echarts.init(document.querySelector("#waterChart1"));
  160. var option = {
  161. tooltip: {
  162. trigger: "axis",
  163. },
  164. legend: {
  165. data: ["水系统"],
  166. bottom: "0",
  167. textStyle: {
  168. color: "#0184d5",
  169. fontSize: "12",
  170. },
  171. },
  172. grid: {
  173. left: "10",
  174. right: "10",
  175. top: "30",
  176. bottom: "30",
  177. containLabel: true,
  178. },
  179. xAxis: [{
  180. type: "category",
  181. boundaryGap: false,
  182. data: waterAlarm.day_list,
  183. // 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"],
  184. axisLabel: {
  185. textStyle: {
  186. color: "rgba(255, 255, 255, .3)",
  187. fontSize: 12,
  188. },
  189. axisLine: {
  190. lineStyle: {
  191. color: "rgba(255, 255, 255, .1)",
  192. },
  193. },
  194. },
  195. }, ],
  196. yAxis: [{
  197. type: "value",
  198. // 去除刻度线
  199. axisTick: {
  200. show: false,
  201. },
  202. // y轴的线颜色
  203. axisLine: {
  204. lineStyle: {
  205. color: "#444",
  206. opacity: .3
  207. },
  208. },
  209. // 文字的颜色
  210. axisLabel: {
  211. textStyle: {
  212. color: "rgba(255, 255, 255, .6)",
  213. fontSize: 12,
  214. },
  215. },
  216. // 修改分割线的颜色
  217. splitLine: {
  218. lineStyle: {
  219. color: "#aaa", // 分割线颜色
  220. opacity: .5
  221. }
  222. },
  223. }, ],
  224. series: [{
  225. name: "水系统",
  226. type: "line",
  227. smooth: true,
  228. // 单独修改当前线条的样式
  229. lineStyle: {
  230. color: "#0184d5",
  231. width: 2,
  232. },
  233. areaStyle: {
  234. // 渐变色,只需要复制即可
  235. color: new echarts.graphic.LinearGradient(
  236. 0,
  237. 0,
  238. 0,
  239. 1, [{
  240. offset: 0,
  241. color: "rgba(1, 132, 213, 0.4)", // 渐变色的起始颜色
  242. },
  243. {
  244. offset: 0.8,
  245. color: "rgba(1, 132, 213, 0.1)", // 渐变线的结束颜色
  246. },
  247. ],
  248. false
  249. ),
  250. // 影子效果
  251. shadowColor: "rgba(0, 0, 0, 0.1)",
  252. },
  253. // 设置拐点形状
  254. symbol: "circle",
  255. // 拐点大小
  256. symbolSize: 8,
  257. // 刚开始时不显示拐点,鼠标经过才显示
  258. showSymbol: false,
  259. // 设置拐点颜色以及边框
  260. itemStyle: {
  261. color: "#0184d5",
  262. borderColor: "rgba(221, 220, 107, .1)",
  263. borderWidth: 12,
  264. },
  265. data: waterAlarm.count_list
  266. // 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, ]
  267. }],
  268. };
  269. myChart.setOption(option);
  270. //echarts赋值到src
  271. var img1 = document.getElementById('waterChart1_img');
  272. setTimeout(function() {
  273. img1.src = myChart.getDataURL();
  274. }, 1200)
  275. })();
  276. })();
  277. // 告警处理火系统
  278. (function() {
  279. var fireAlarm = JSON.parse(deviceStatistic.fireAlarm);
  280. fireAlarm = fireAlarm.RESULT[0];
  281. let items = '';
  282. items = ` <tr>
  283. <td>${ fireAlarm.count}</td>
  284. <td>${ fireAlarm.sum} </td>
  285. <td>${ fireAlarm.count- fireAlarm.sum} </td>
  286. <td>${ fireAlarm.count? (fireAlarm.sum/ fireAlarm.count)*100:0}% </td>
  287. </tr>`
  288. $('#fire_statistics').html(items);
  289. (function() {
  290. var myChart = echarts.init(document.querySelector("#fireChart1"));
  291. var option = {
  292. tooltip: {
  293. trigger: "axis",
  294. },
  295. legend: {
  296. data: ["火系统"],
  297. bottom: "0",
  298. textStyle: {
  299. color: "#ed3f35",
  300. fontSize: "12",
  301. },
  302. },
  303. grid: {
  304. left: "10",
  305. right: "10",
  306. top: "30",
  307. bottom: "30",
  308. containLabel: true,
  309. },
  310. xAxis: [{
  311. type: "category",
  312. boundaryGap: false,
  313. data: fireAlarm.day_list,
  314. // 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"],
  315. axisLabel: {
  316. textStyle: {
  317. color: "rgba(255, 255, 255, .3)",
  318. fontSize: 12,
  319. },
  320. axisLine: {
  321. lineStyle: {
  322. color: "red",
  323. },
  324. },
  325. },
  326. }, ],
  327. yAxis: [{
  328. type: "value",
  329. // 去除刻度线
  330. axisTick: {
  331. show: false,
  332. },
  333. // y轴的线颜色
  334. axisLine: {
  335. lineStyle: {
  336. color: "#444",
  337. opacity: .3
  338. },
  339. },
  340. // 文字的颜色
  341. axisLabel: {
  342. textStyle: {
  343. color: "rgba(255, 255, 255, .6)",
  344. fontSize: 12,
  345. },
  346. },
  347. // 修改分割线的颜色
  348. splitLine: {
  349. lineStyle: {
  350. color: "#aaa", // 分割线颜色
  351. opacity: .5
  352. }
  353. },
  354. }, ],
  355. series: [{
  356. name: "火系统",
  357. type: "line",
  358. smooth: true,
  359. // 单独修改当前线条的样式
  360. lineStyle: {
  361. color: "#ed3f35",
  362. width: 2,
  363. },
  364. areaStyle: {
  365. // 渐变色,只需要复制即可
  366. color: new echarts.graphic.LinearGradient(
  367. 0,
  368. 0,
  369. 0,
  370. 1, [{
  371. offset: 0,
  372. color: "rgba(237,63,53, 0.4)", // 渐变色的起始颜色
  373. },
  374. {
  375. offset: 0.8,
  376. color: "rgba(237,63,53, 0.1)", // 渐变线的结束颜色
  377. },
  378. ],
  379. false
  380. ),
  381. // 影子效果
  382. shadowColor: "rgba(0, 0, 0, 0.1)",
  383. },
  384. // 设置拐点形状
  385. symbol: "circle",
  386. // 拐点大小
  387. symbolSize: 8,
  388. // 刚开始时不显示拐点,鼠标经过才显示
  389. showSymbol: false,
  390. // 设置拐点颜色以及边框
  391. itemStyle: {
  392. color: "#ed3f35",
  393. borderColor: "rgba(221, 220, 107, .1)",
  394. borderWidth: 12,
  395. },
  396. data: fireAlarm.count_list
  397. // 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, ],
  398. }, ],
  399. };
  400. myChart.setOption(option);
  401. //echarts赋值到src
  402. var img1 = document.getElementById('fireChart1_img');
  403. setTimeout(function() {
  404. img1.src = myChart.getDataURL();
  405. }, 1200)
  406. })();
  407. })();
  408. // 设备离线水系统
  409. (function() {
  410. var waterDeviceOnly = JSON.parse(deviceOnly.waterDeviceOnly);
  411. waterDeviceOnly = waterDeviceOnly.RESULT[0];
  412. let items = '';
  413. items = ` <tr>
  414. <td>${ waterDeviceOnly.count}</td>
  415. <td>${ waterDeviceOnly.sum} </td>
  416. <td>${ waterDeviceOnly.count- waterDeviceOnly.sum} </td>
  417. <td>${ waterDeviceOnly.count? (waterDeviceOnly.sum/ waterDeviceOnly.count)*100:0}% </td>
  418. </tr>`
  419. $('#waterDeviceOnly').html(items);
  420. (function() {
  421. var myChart = echarts.init(document.querySelector("#waterOnlyChart"));
  422. var option = {
  423. tooltip: {
  424. trigger: "axis",
  425. },
  426. legend: {
  427. data: ["水系统"],
  428. bottom: "0",
  429. textStyle: {
  430. color: "#0184d5",
  431. fontSize: "12",
  432. },
  433. },
  434. grid: {
  435. left: "10",
  436. right: "10",
  437. top: "30",
  438. bottom: "30",
  439. containLabel: true,
  440. },
  441. xAxis: [{
  442. type: "category",
  443. boundaryGap: false,
  444. data: waterDeviceOnly.day_list,
  445. // 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"],
  446. axisLabel: {
  447. textStyle: {
  448. color: "rgba(255, 255, 255, .3)",
  449. fontSize: 12,
  450. },
  451. axisLine: {
  452. lineStyle: {
  453. color: "red",
  454. },
  455. },
  456. },
  457. }, ],
  458. yAxis: [{
  459. type: "value",
  460. // 去除刻度线
  461. axisTick: {
  462. show: false,
  463. },
  464. // y轴的线颜色
  465. axisLine: {
  466. lineStyle: {
  467. color: "#444",
  468. opacity: .3
  469. },
  470. },
  471. // 文字的颜色
  472. axisLabel: {
  473. textStyle: {
  474. color: "rgba(255, 255, 255, .6)",
  475. fontSize: 12,
  476. },
  477. },
  478. // 修改分割线的颜色
  479. splitLine: {
  480. lineStyle: {
  481. color: "#aaa", // 分割线颜色
  482. opacity: .5
  483. }
  484. },
  485. }, ],
  486. series: [{
  487. name: "水系统",
  488. type: "line",
  489. smooth: true,
  490. // 单独修改当前线条的样式
  491. lineStyle: {
  492. color: "#0184d5",
  493. width: 2,
  494. },
  495. areaStyle: {
  496. // 渐变色,只需要复制即可
  497. color: new echarts.graphic.LinearGradient(
  498. 0,
  499. 0,
  500. 0,
  501. 1, [{
  502. offset: 0,
  503. color: "rgba(1, 132, 213, 0.4)", // 渐变色的起始颜色
  504. },
  505. {
  506. offset: 0.8,
  507. color: "rgba(1, 132, 213, 0.1)", // 渐变线的结束颜色
  508. },
  509. ],
  510. false
  511. ),
  512. // 影子效果
  513. shadowColor: "rgba(0, 0, 0, 0.1)",
  514. },
  515. // 设置拐点形状
  516. symbol: "circle",
  517. // 拐点大小
  518. symbolSize: 8,
  519. // 刚开始时不显示拐点,鼠标经过才显示
  520. showSymbol: false,
  521. // 设置拐点颜色以及边框
  522. itemStyle: {
  523. color: "#0184d5",
  524. borderColor: "rgba(221, 220, 107, .1)",
  525. borderWidth: 12,
  526. },
  527. data: waterDeviceOnly.count_list,
  528. // 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]
  529. }],
  530. };
  531. myChart.setOption(option);
  532. //echarts赋值到src
  533. var img1 = document.getElementById('waterOnlyChart_img');
  534. setTimeout(function() {
  535. img1.src = myChart.getDataURL();
  536. }, 1200)
  537. })();
  538. })();
  539. // 设备离线火系统
  540. (function() {
  541. var fireOnly = JSON.parse(deviceOnly.fireOnly);
  542. fireOnly = fireOnly.RESULT[0];
  543. let items = '';
  544. items = ` <tr>
  545. <td>${ fireOnly.count}</td>
  546. <td>${ fireOnly.sum} </td>
  547. <td>${ fireOnly.count- fireOnly.sum} </td>
  548. <td>${ fireOnly.count? (fireOnly.sum/ fireOnly.count)*100:0}% </td>
  549. </tr>`
  550. $('#fireOnly').html(items);
  551. (function() {
  552. var myChart = echarts.init(document.querySelector("#fireOnlyChart"));
  553. var option = {
  554. tooltip: {
  555. trigger: "axis",
  556. },
  557. legend: {
  558. data: ["火系统"],
  559. bottom: "0",
  560. textStyle: {
  561. color: "#ed3f35",
  562. fontSize: "12",
  563. },
  564. },
  565. grid: {
  566. left: "10",
  567. right: "10",
  568. top: "30",
  569. bottom: "30",
  570. containLabel: true,
  571. },
  572. xAxis: [{
  573. type: "category",
  574. boundaryGap: false,
  575. data: fireOnly.day_list,
  576. // 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"],
  577. axisLabel: {
  578. textStyle: {
  579. color: "rgba(255, 255, 255, .3)",
  580. fontSize: 12,
  581. },
  582. axisLine: {
  583. lineStyle: {
  584. color: "red",
  585. },
  586. },
  587. },
  588. }, ],
  589. yAxis: [{
  590. type: "value",
  591. // 去除刻度线
  592. axisTick: {
  593. show: false,
  594. },
  595. // y轴的线颜色
  596. axisLine: {
  597. lineStyle: {
  598. color: "#444",
  599. opacity: .3
  600. },
  601. },
  602. // 文字的颜色
  603. axisLabel: {
  604. textStyle: {
  605. color: "rgba(255, 255, 255, .6)",
  606. fontSize: 12,
  607. },
  608. },
  609. // 修改分割线的颜色
  610. splitLine: {
  611. lineStyle: {
  612. color: "#aaa", // 分割线颜色
  613. opacity: .5
  614. }
  615. },
  616. }, ],
  617. series: [{
  618. name: "火系统",
  619. type: "line",
  620. smooth: true,
  621. // 单独修改当前线条的样式
  622. lineStyle: {
  623. color: "#ed3f35",
  624. width: 2,
  625. },
  626. areaStyle: {
  627. // 渐变色,只需要复制即可
  628. color: new echarts.graphic.LinearGradient(
  629. 0,
  630. 0,
  631. 0,
  632. 1, [{
  633. offset: 0,
  634. color: "rgba(237,63,53, 0.4)", // 渐变色的起始颜色
  635. },
  636. {
  637. offset: 0.8,
  638. color: "rgba(237,63,53, 0.1)", // 渐变线的结束颜色
  639. },
  640. ],
  641. false
  642. ),
  643. // 影子效果
  644. shadowColor: "rgba(0, 0, 0, 0.1)",
  645. },
  646. // 设置拐点形状
  647. symbol: "circle",
  648. // 拐点大小
  649. symbolSize: 8,
  650. // 刚开始时不显示拐点,鼠标经过才显示
  651. showSymbol: false,
  652. // 设置拐点颜色以及边框
  653. itemStyle: {
  654. color: "#ed3f35",
  655. borderColor: "rgba(221, 220, 107, .1)",
  656. borderWidth: 12,
  657. },
  658. data: fireOnly.count_list,
  659. // 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, ],
  660. }, ],
  661. };
  662. myChart.setOption(option);
  663. //echarts赋值到src
  664. var img1 = document.getElementById('fireOnlyChart_img');
  665. setTimeout(function() {
  666. img1.src = myChart.getDataURL();
  667. }, 1200)
  668. })();
  669. })();
  670. // 设备离线烟感
  671. (function() {
  672. var smokeOnly = JSON.parse(deviceOnly.smokeOnly);
  673. smokeOnly = smokeOnly.RESULT[0];
  674. let items = '';
  675. items = ` <tr>
  676. <td>${ smokeOnly.count}</td>
  677. <td>${ smokeOnly.sum} </td>
  678. <td>${ smokeOnly.count- smokeOnly.sum} </td>
  679. <td>${ smokeOnly.count? (smokeOnly.sum/ smokeOnly.count)*100:0}% </td>
  680. </tr>`
  681. $('#smokeOnly').html(items);
  682. (function() {
  683. var myChart = echarts.init(document.querySelector("#smokeOnlyChart"));
  684. var option = {
  685. tooltip: {
  686. trigger: "axis",
  687. },
  688. legend: {
  689. data: ["烟感"],
  690. bottom: "0",
  691. textStyle: {
  692. color: "#F4A460",
  693. fontSize: "12",
  694. },
  695. },
  696. grid: {
  697. left: "10",
  698. right: "10",
  699. top: "30",
  700. bottom: "30",
  701. containLabel: true,
  702. },
  703. xAxis: [{
  704. type: "category",
  705. boundaryGap: false,
  706. data: smokeOnly.day_list,
  707. // 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"],
  708. axisLabel: {
  709. textStyle: {
  710. color: "rgba(255, 255, 255, .3)",
  711. fontSize: 12,
  712. },
  713. axisLine: {
  714. lineStyle: {
  715. color: "red",
  716. },
  717. },
  718. },
  719. }, ],
  720. yAxis: [{
  721. type: "value",
  722. // 去除刻度线
  723. axisTick: {
  724. show: false,
  725. },
  726. // y轴的线颜色
  727. axisLine: {
  728. lineStyle: {
  729. color: "#444",
  730. opacity: .3
  731. },
  732. },
  733. // 文字的颜色
  734. axisLabel: {
  735. textStyle: {
  736. color: "rgba(255, 255, 255, .6)",
  737. fontSize: 12,
  738. },
  739. },
  740. // 修改分割线的颜色
  741. splitLine: {
  742. lineStyle: {
  743. color: "#aaa", // 分割线颜色
  744. opacity: .5
  745. }
  746. },
  747. }, ],
  748. series: [{
  749. name: "烟感",
  750. type: "line",
  751. smooth: true,
  752. // 单独修改当前线条的样式
  753. lineStyle: {
  754. color: "#F4A460",
  755. width: 2,
  756. },
  757. areaStyle: {
  758. // 渐变色,只需要复制即可
  759. color: new echarts.graphic.LinearGradient(
  760. 0,
  761. 0,
  762. 0,
  763. 1, [{
  764. offset: 0,
  765. color: "rgba(244,164,96, 0.4)", // 渐变色的起始颜色
  766. },
  767. {
  768. offset: 0.8,
  769. color: "rgba(244,164,96, 0.1)", // 渐变线的结束颜色
  770. },
  771. ],
  772. false
  773. ),
  774. // 影子效果
  775. shadowColor: "rgba(0, 0, 0, 0.1)",
  776. },
  777. // 设置拐点形状
  778. symbol: "circle",
  779. // 拐点大小
  780. symbolSize: 8,
  781. // 刚开始时不显示拐点,鼠标经过才显示
  782. showSymbol: false,
  783. // 设置拐点颜色以及边框
  784. itemStyle: {
  785. color: "#F4A460",
  786. borderColor: "rgba(221, 220, 107, .1)",
  787. borderWidth: 12,
  788. },
  789. data: smokeOnly.count_list,
  790. // 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, ],
  791. }, ],
  792. };
  793. myChart.setOption(option);
  794. //echarts赋值到src
  795. var img1 = document.getElementById('smokeOnlyChart_img');
  796. setTimeout(function() {
  797. img1.src = myChart.getDataURL();
  798. }, 1200)
  799. })();
  800. })();
  801. //关闭弹框
  802. $('.clsBtn,.cancel').click(function() {
  803. window.open("./index.html");
  804. })
  805. }
  806. })
  807. })
  808. }, function(errorMsg) {
  809. alert("异常错误!");
  810. });
  811. });
  812. // 打印
  813. (function() {
  814. $("#btnPrint").click(function() {
  815. print_detail()
  816. });
  817. var print_detail = function() {
  818. //打印前echarts图表转换成图片 start
  819. $('#waterChart1_img,#fireChart1_img,#waterOnlyChart_img,#fireOnlyChart_img,#smokeOnlyChart_img').show()
  820. $('waterChart1,#fireChart1,#waterOnlyChart,#fireOnlyChart,#smokeOnlyChart').hide()
  821. // end
  822. var div1_label1 = document.getElementById('printArea').innerHTML;
  823. var hkey_key;
  824. var hkey_root = 'HKEY_CURRENT_USER';
  825. var hkey_path = '\\Software\\Micorsoft\\Internet Explorer\\PageSetup\\';
  826. var print_win = window.open('打印窗口', '_blank');
  827. var div = document.createElement('div');
  828. div.setAttribute('width', '100%');
  829. div.setAttribute('height', '100%');
  830. var div_print = document.createElement('div');
  831. div_print.setAttribute('style', 'width:595px;height:842px;padding:50px 20px;margin:0px auto 0px auto');
  832. div_print.innerHTML = div1_label1;
  833. div.appendChild(div_print);
  834. print_win.document.write(div.innerHTML);
  835. print_win.document.close();
  836. try {
  837. var RegWsh = new ActiveXObject('WScript.Shell');
  838. hkey_key = 'header';
  839. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  840. hkey_key = 'footer';
  841. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  842. } catch (e) {}
  843. print_win.print();
  844. print_win.close();
  845. }
  846. })()