waterInner.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /*
  2. 水系统打印页面echarts配置 及打印
  3. */
  4. // 数据离散率挖掘1
  5. (function() {
  6. var sortData = [{
  7. data: [
  8. [30, 35, 36, 40, 120, 230, 210, 120, 213, 180, 200, 180, 79, 191, 324, 200, 180, 79, 82, 64, 43, 60, 19, 82, 64, 43, 60, 19, 34],
  9. [123, 175, 112, 197, 121, 67, 98, 21, 43, 64, 76, 38, 24, 52, 26, 27, 30, 35, 36, 40, 120, 230, 210, 120, 213, 180, 200, 180, 79, 191, 324, ],
  10. [400, 64, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79, 9, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79, 82, 64, 79, 82, 64, 4]
  11. ]
  12. }, ];
  13. var xData = function() {
  14. var data = [];
  15. for (var i = 1; i < 31; i++) {
  16. data.push(i);
  17. }
  18. return data;
  19. }();
  20. // 1. 实例化对象
  21. var myChart = echarts.init(document.querySelector("#divergenceChart1"));
  22. // 2.指定配置
  23. var option = {
  24. color: [{
  25. colorStops: [{
  26. offset: 0,
  27. color: '#F9860C' // 0% 处的颜色
  28. }, {
  29. offset: 1,
  30. color: '#fff' // 100% 处的颜色
  31. }],
  32. },
  33. {
  34. colorStops: [{
  35. offset: 0,
  36. color: '#07E1F1' // 0% 处的颜色
  37. }, {
  38. offset: 1,
  39. color: '#0456CB' // 100% 处的颜色
  40. }],
  41. },
  42. {
  43. colorStops: [{
  44. offset: 0,
  45. color: '#11F90C' // 0% 处的颜色
  46. }, {
  47. offset: 1,
  48. color: '#3FC713' // 100% 处的颜色
  49. }],
  50. }
  51. ],
  52. tooltip: {
  53. trigger: "axis",
  54. textStyle: {
  55. align: 'left' //图例左对齐
  56. },
  57. backgroundColor: '#12DFE0',
  58. formatter: '{a0}: {c0}<br />{a1}: {c1}<br />{a2}: {c2}<br />时间:2021年3月{b}日'
  59. },
  60. legend: {
  61. // 如果series 对象有name 值,则 legend可以不用写data
  62. itemGap: 20,
  63. itemHeight: 2,
  64. itemWidth: 15,
  65. icon: 'rect',
  66. textStyle: {
  67. color: "#aaa"
  68. },
  69. top: "bottom",
  70. },
  71. grid: {
  72. top: "0%",
  73. left: "1%",
  74. right: "1%",
  75. bottom: "15%",
  76. show: true, // 显示边框
  77. borderWidth: '0', //去除边框
  78. containLabel: true // 包含刻度文字在内
  79. },
  80. xAxis: {
  81. type: "category",
  82. boundaryGap: false,
  83. data: xData,
  84. axisTick: {
  85. show: false // 去除刻度线
  86. },
  87. axisLabel: {
  88. color: "#AADDFF" // 文本颜色
  89. },
  90. axisLine: {
  91. lineStyle: {
  92. color: 'rgba(255,255,255,.3)'
  93. }
  94. },
  95. splitNumber: 8,
  96. splitLine: {
  97. show: false
  98. },
  99. splitArea: {
  100. show: true,
  101. areaStyle: {
  102. color: ["rgba(250,250,250,0.05)", "rgba(250,250,250,0.0)"]
  103. }
  104. }
  105. },
  106. yAxis: {
  107. splitNumber: 8,
  108. type: "value",
  109. axisTick: {
  110. show: false // 去除刻度线
  111. },
  112. axisLabel: {
  113. show: false // 去除文本
  114. },
  115. axisLine: {
  116. show: false // 去除轴线
  117. },
  118. splitLine: {
  119. lineStyle: {
  120. color: "#012f4a", // 分割线颜色
  121. opacity: .2
  122. }
  123. }
  124. },
  125. series: [{
  126. symbol: "none",
  127. name: "方差",
  128. type: "line",
  129. data: sortData[0].data[0]
  130. },
  131. {
  132. symbol: "none",
  133. name: "标准差",
  134. type: "line",
  135. data: sortData[0].data[1]
  136. }, {
  137. symbol: "none",
  138. name: "平均值",
  139. type: "line",
  140. data: sortData[0].data[2]
  141. }
  142. ]
  143. };
  144. myChart.setOption(option);
  145. //echarts赋值到src
  146. var img1 = document.getElementById('divergenceChart1_img');
  147. setTimeout(function() {
  148. img1.src = myChart.getDataURL();
  149. }, 1000)
  150. })();
  151. // 渗漏隐患排查1
  152. (function() {
  153. // 基于准备好的dom,初始化echarts实例
  154. var myChart = echarts.init(document.querySelector("#hiddenCheckChart1"));
  155. var xData = ['三到四层', '四到五层', '七到八层', '三到四层', '四到五层', '七到八层', '八到九层', '九到十层', '三到四层', '四到五层', '七到八层', '八到九层', '九到十层', '三到四层', '四到五层', '七到八层', '八到九层'];
  156. var option = {
  157. backgroundColor: 'transparent',
  158. color: ['rgba(0,150,255,.5)', 'rgba(255,156,0,.5)'],
  159. tooltip: {
  160. //提示框组件
  161. trigger: 'axis',
  162. formatter: function(params) {
  163. var relVal = params[0].name;
  164. for (var i = 0, l = params.length; i < l; i++) {
  165. relVal += '<br/>';
  166. relVal += '<span style="display:inline-block;margin-right:5px;border-radius:2px;width:9px;height:9px;background-color:' + params[i].color + '"></span>';
  167. relVal += params[i].seriesName + ' : ' + params[i].value;
  168. }
  169. return relVal;
  170. },
  171. axisPointer: {
  172. type: 'shadow',
  173. },
  174. textStyle: {
  175. fontStyle: 'normal',
  176. fontFamily: '微软雅黑',
  177. fontSize: 12,
  178. },
  179. },
  180. grid: {
  181. left: '0',
  182. right: '0',
  183. bottom: '40',
  184. top: '0',
  185. containLabel: true,
  186. },
  187. legend: {
  188. // 如果series 对象有name 值,则 legend可以不用写data
  189. itemGap: 20,
  190. itemHeight: 2,
  191. itemWidth: 15,
  192. icon: 'rect',
  193. textStyle: {
  194. color: "#AAA"
  195. },
  196. top: "bottom",
  197. },
  198. xAxis: [{
  199. type: 'category',
  200. // boundaryGap: true,//坐标轴两边留白
  201. data: xData,
  202. axisLabel: {
  203. interval: 0,
  204. rotate: 340,
  205. // formatter: function(val) {
  206. // return val.split("").join("\n");
  207. // }, //横轴信息文字竖直显示
  208. textStyle: {
  209. color: '#AAA',
  210. fontStyle: 'normal',
  211. fontFamily: '微软雅黑',
  212. fontSize: 12,
  213. },
  214. },
  215. axisTick: {
  216. //坐标轴刻度相关设置。
  217. show: false,
  218. },
  219. axisLine: {
  220. //坐标轴轴线相关设置
  221. },
  222. splitLine: {
  223. //坐标轴在 grid 区域中的分隔线。
  224. show: false,
  225. },
  226. }, ],
  227. yAxis: [{
  228. type: 'value',
  229. axisLabel: false,
  230. axisLine: {
  231. show: false,
  232. },
  233. axisTick: {
  234. show: false,
  235. },
  236. splitLine: {
  237. show: true,
  238. lineStyle: {
  239. color: "#012f4a", // 分割线颜色
  240. opacity: .2
  241. }
  242. },
  243. boundaryGap: ['0', '10%'],
  244. }],
  245. series: [{
  246. name: '正常',
  247. type: 'bar',
  248. data: [400, 180, 40, 30, 31, 400, 180, 40, 30, 31, 400, 180, 40, 30, 31, 400, 180, 40, 30, 31, 400, 180, 40, 30, 31],
  249. barMaxWidth: '11',
  250. itemStyle: {
  251. borderColor: "#0096FF",
  252. },
  253. barGap: '50%',
  254. },
  255. {
  256. name: '实际',
  257. type: 'bar',
  258. data: [500, 200, 50, 60, 36, 500, 200, 50, 60, 36, 500, 200, 50, 60, 36, 500, 200, 50, 60, 36, 500, 200, 50, 60, 36],
  259. barMaxWidth: '11',
  260. itemStyle: {
  261. borderColor: "#FF9C00",
  262. },
  263. },
  264. ],
  265. };
  266. myChart.setOption(option);
  267. //echarts赋值到src
  268. var img1 = document.getElementById('hiddenCheckChart1_img');
  269. setTimeout(function() {
  270. img1.src = myChart.getDataURL();
  271. }, 1000)
  272. })();
  273. // 跨设备数据关联1
  274. (function() {
  275. var sortData = [{
  276. sortName: "喷淋末端与水泵启停关联",
  277. data: [
  278. // 两个数组是因为有两条线
  279. [24, 52, 60, 70, 80, 30, 95, 36, 40, 120, 230, 210, 120, 213, 180, 200, 180, 79, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79, 82, 64, 43, 60, 19, 34],
  280. [40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 70, 80, 75, 70, 65, 60, 55, 50, 45, 40, ]
  281. ]
  282. }];
  283. var xData = function() {
  284. var data = [];
  285. for (var i = 1; i < 31; i++) {
  286. data.push(i);
  287. }
  288. return data;
  289. }();
  290. // 1. 实例化对象
  291. var myChart = echarts.init(document.querySelector("#deviceLinkChart1"));
  292. // 2.指定配置
  293. var option = {
  294. color: ["#FF9C00", "#0096FF"], // 通过这个color修改两条线的颜色
  295. tooltip: {
  296. trigger: "axis",
  297. textStyle: {
  298. align: 'left' //图例左对齐
  299. },
  300. },
  301. legend: {
  302. // 如果series 对象有name 值,则 legend可以不用写data
  303. itemGap: 20,
  304. itemHeight: 2,
  305. itemWidth: 15,
  306. icon: 'rect',
  307. textStyle: {
  308. color: "#aaa"
  309. },
  310. top: "bottom",
  311. },
  312. grid: {
  313. top: "0%",
  314. left: "1%",
  315. right: "1%",
  316. bottom: "15%",
  317. show: true, // 显示边框
  318. borderWidth: '0', //去除边框
  319. containLabel: true // 包含刻度文字在内
  320. },
  321. xAxis: {
  322. type: "category",
  323. boundaryGap: false,
  324. data: xData,
  325. axisTick: {
  326. show: false // 去除刻度线
  327. },
  328. axisLabel: {
  329. color: "#AADDFF" // 文本颜色
  330. },
  331. axisLine: {
  332. show: false // 去除轴线
  333. }
  334. },
  335. yAxis: {
  336. type: "value",
  337. axisTick: {
  338. show: false // 去除刻度线
  339. },
  340. axisLabel: {
  341. show: false // 去除文本
  342. },
  343. axisLine: {
  344. show: false // 去除轴线
  345. },
  346. lineStyle: {
  347. color: "#012f4a", // 分割线颜色
  348. opacity: .2
  349. }
  350. },
  351. series: [{
  352. symbol: "none",
  353. name: "水泵启动",
  354. type: "line",
  355. smooth: true, // true 可以让我们的折线显示带有弧度
  356. areaStyle: {
  357. normal: {
  358. color: new echarts.graphic.LinearGradient(
  359. 0,
  360. 0,
  361. 0,
  362. 1, [{
  363. offset: 0,
  364. color: "rgba(255,156,0, 0.4)"
  365. },
  366. {
  367. offset: 0.8,
  368. color: "rgba(255,156,0, 0.3)"
  369. }
  370. ],
  371. false
  372. ),
  373. shadowColor: "rgba(0, 0, 0, 0.1)"
  374. }
  375. },
  376. data: sortData[0].data[0]
  377. },
  378. {
  379. symbol: "none",
  380. name: "水泵停止",
  381. type: "line",
  382. smooth: true,
  383. areaStyle: {
  384. normal: {
  385. color: new echarts.graphic.LinearGradient(
  386. 0,
  387. 0,
  388. 0,
  389. 1, [{
  390. offset: 0,
  391. color: "rgba(0,150,255,0.5)"
  392. },
  393. {
  394. offset: 0.8,
  395. color: "rgba(0,150,255, 0.1)"
  396. }
  397. ],
  398. false
  399. ),
  400. shadowColor: "rgba(0, 0, 0, 0.1)"
  401. }
  402. },
  403. data: sortData[0].data[1]
  404. }
  405. ]
  406. };
  407. myChart.setOption(option);
  408. var img1 = document.getElementById('deviceLinkChart1_img');
  409. setTimeout(function() {
  410. img1.src = myChart.getDataURL();
  411. }, 1000)
  412. })();
  413. // 跨设备数据关联2
  414. (function() {
  415. var sortData = [{
  416. sortName: "试验消火栓与屋顶水箱液位关联",
  417. data: [
  418. // 两个数组是因为有两条线
  419. [123, 175, 112, 197, 121, 67, 98, 21, 43, 64, 76, 38, 24, 52, 26, 27, 30, 35, 36, 40, 120, 230, 210, 120, 213, 180, 200, 180, 79, 191, 324, ],
  420. [143, 131, 165, 123, 178, 21, 82, 64, 43, 60, 19, 34, 40, 64, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79, 9, 191, 324, 290, 330, 310, 213, 180, ]
  421. ]
  422. }];
  423. var xData = function() {
  424. var data = [];
  425. for (var i = 1; i < 31; i++) {
  426. data.push(i);
  427. }
  428. return data;
  429. }();
  430. // 1. 实例化对象
  431. var myChart = echarts.init(document.querySelector("#deviceLinkChart2"));
  432. // 2.指定配置
  433. var option = {
  434. color: ["#FF9C00", "#0096FF"], // 通过这个color修改两条线的颜色
  435. tooltip: {
  436. trigger: "axis",
  437. textStyle: {
  438. align: 'left' //图例左对齐
  439. },
  440. },
  441. legend: {
  442. // 如果series 对象有name 值,则 legend可以不用写data
  443. itemGap: 20,
  444. itemHeight: 2,
  445. itemWidth: 15,
  446. icon: 'rect',
  447. textStyle: {
  448. color: "#aaa"
  449. },
  450. top: "bottom",
  451. },
  452. grid: {
  453. top: "0%",
  454. left: "1%",
  455. right: "1%",
  456. bottom: "15%",
  457. show: true, // 显示边框
  458. borderWidth: '0', //去除边框
  459. containLabel: true // 包含刻度文字在内
  460. },
  461. xAxis: {
  462. type: "category",
  463. boundaryGap: false,
  464. data: xData,
  465. axisTick: {
  466. show: false // 去除刻度线
  467. },
  468. axisLabel: {
  469. color: "#AADDFF" // 文本颜色
  470. },
  471. axisLine: {
  472. show: false // 去除轴线
  473. }
  474. },
  475. yAxis: {
  476. type: "value",
  477. axisTick: {
  478. show: false // 去除刻度线
  479. },
  480. axisLabel: {
  481. show: false // 去除文本
  482. },
  483. axisLine: {
  484. show: false // 去除轴线
  485. },
  486. splitLine: {
  487. lineStyle: {
  488. color: "#012f4a", // 分割线颜色
  489. opacity: .2
  490. }
  491. }
  492. },
  493. series: [{
  494. symbol: "none",
  495. name: "水泵启动",
  496. type: "line",
  497. smooth: true, // true 可以让我们的折线显示带有弧度
  498. areaStyle: {
  499. normal: {
  500. color: new echarts.graphic.LinearGradient(
  501. 0,
  502. 0,
  503. 0,
  504. 1, [{
  505. offset: 0,
  506. color: "rgba(255,156,0, 0.4)"
  507. },
  508. {
  509. offset: 0.8,
  510. color: "rgba(255,156,0, 0.3)"
  511. }
  512. ],
  513. false
  514. ),
  515. shadowColor: "rgba(0, 0, 0, 0.1)"
  516. }
  517. },
  518. data: sortData[0].data[0]
  519. },
  520. {
  521. symbol: "none",
  522. name: "水泵停止",
  523. type: "line",
  524. smooth: true,
  525. areaStyle: {
  526. normal: {
  527. color: new echarts.graphic.LinearGradient(
  528. 0,
  529. 0,
  530. 0,
  531. 1, [{
  532. offset: 0,
  533. color: "rgba(0,150,255,0.5)"
  534. },
  535. {
  536. offset: 0.8,
  537. color: "rgba(0,150,255, 0.1)"
  538. }
  539. ],
  540. false
  541. ),
  542. shadowColor: "rgba(0, 0, 0, 0.1)"
  543. }
  544. },
  545. data: sortData[0].data[1]
  546. }
  547. ]
  548. };
  549. myChart.setOption(option);
  550. var img1 = document.getElementById('deviceLinkChart2_img');
  551. setTimeout(function() {
  552. img1.src = myChart.getDataURL();
  553. }, 1000)
  554. })();
  555. // 数据波动关联
  556. (function() {
  557. var sortData = [{
  558. data: [
  559. [30, 70, 100, 120, 130, 190, 200, 230, 120, 100, 90, 80, 59, 30],
  560. ]
  561. }];
  562. var xData = ['一到二层', '二到三层', '三到四层', '四到五层', '五到六层', '六到七层', '七到八层', '八到九层', '九到十层', '十到十一层', '十一到十二层', '十二到十三层']
  563. // 1. 实例化对象
  564. var myChart = echarts.init(document.querySelector("#dataChangeChart1"));
  565. // 2.指定配置
  566. var option = {
  567. color: ["#FE92B3"], // 通过这个color修改三条线的颜色
  568. tooltip: {
  569. trigger: "axis",
  570. textStyle: {
  571. align: 'left' //图例左对齐
  572. },
  573. // backgroundColor: '#12DFE0',
  574. // formatter: '{a0}: {c0}<br />{b}'
  575. },
  576. legend: false,
  577. grid: {
  578. top: "0%",
  579. left: "1%",
  580. right: "1%",
  581. bottom: "1%",
  582. show: true, // 显示边框
  583. borderWidth: '0', //去除边框
  584. containLabel: true, // 不包含刻度文字在内
  585. },
  586. xAxis: {
  587. type: "category",
  588. boundaryGap: false,
  589. data: xData,
  590. axisTick: {
  591. show: false // 去除刻度线
  592. },
  593. axisLabel: {
  594. color: "#AADDFF", // 文本颜色
  595. interval: 0,
  596. rotate: 340,
  597. // formatter: function(val) {
  598. // return val.split("").join("\n");
  599. // }, //横轴信息文字竖直显示
  600. },
  601. axisLine: {
  602. show: false // 去除轴线
  603. }
  604. },
  605. yAxis: {
  606. splitNumber: 8,
  607. type: "value",
  608. axisTick: {
  609. show: false // 去除刻度线
  610. },
  611. axisLabel: {
  612. show: false // 去除文本
  613. },
  614. axisLine: {
  615. show: false // 去除轴线
  616. },
  617. splitLine: {
  618. lineStyle: {
  619. color: "#012f4a", // 分割线颜色
  620. opacity: .2
  621. }
  622. }
  623. },
  624. series: [{
  625. symbol: "none",
  626. name: "异常水压值",
  627. type: "line",
  628. smooth: true,
  629. areaStyle: {
  630. normal: {
  631. color: new echarts.graphic.LinearGradient(
  632. 0,
  633. 0,
  634. 0,
  635. 1, [{
  636. offset: 0,
  637. color: "rgba(255,147,180,.6)"
  638. },
  639. {
  640. offset: 0.8,
  641. color: "rgba(255,147,180, 0.4)"
  642. }
  643. ],
  644. false
  645. ),
  646. }
  647. },
  648. data: sortData[0].data[0]
  649. }]
  650. };
  651. myChart.setOption(option);
  652. var img1 = document.getElementById('dataChangeChart1_img');
  653. setTimeout(function() {
  654. img1.src = myChart.getDataURL();
  655. }, 1000)
  656. })();
  657. // 打印
  658. (function() {
  659. $("#btnPrint").click(function() {
  660. print_detail()
  661. });
  662. var print_detail = function() {
  663. //打印前echarts图表转换成图片 start
  664. $('#divergenceChart1_img').show()
  665. $('#divergenceChart1').hide()
  666. $('#hiddenCheckChart1_img').show()
  667. $('#hiddenCheckChart1').hide()
  668. $('#deviceLinkChart1_img,#deviceLinkChart2_img').show()
  669. $('#deviceLinkChart1,#deviceLinkChart2').hide()
  670. $('#dataChangeChart1_img').show()
  671. $('#dataChangeChart1').hide()
  672. // end
  673. var div1_label1 = document.getElementById('printArea').innerHTML;
  674. var hkey_key;
  675. var hkey_root = 'HKEY_CURRENT_USER';
  676. var hkey_path = '\\Software\\Micorsoft\\Internet Explorer\\PageSetup\\';
  677. var print_win = window.open('打印窗口', '_blank');
  678. var div = document.createElement('div');
  679. div.setAttribute('width', '100%');
  680. div.setAttribute('height', '100%');
  681. var div_print = document.createElement('div');
  682. div_print.setAttribute('style', 'width:595px;height:842px;padding:50px 20px;margin:0px auto 0px auto');
  683. div_print.innerHTML = div1_label1;
  684. div.appendChild(div_print);
  685. print_win.document.write(div.innerHTML);
  686. print_win.document.close();
  687. try {
  688. var RegWsh = new ActiveXObject('WScript.Shell');
  689. hkey_key = 'header';
  690. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  691. hkey_key = 'footer';
  692. RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
  693. } catch (e) {}
  694. print_win.print();
  695. print_win.close();
  696. }
  697. })()