Index1.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <style lang="scss">
  2. .index{
  3. .content{
  4. background: #151932;
  5. color:#fff;
  6. padding:0 20px;
  7. position: relative;
  8. .max,.min{
  9. position: absolute;
  10. top: 40px;
  11. right: 20px;
  12. cursor: pointer;
  13. z-index: 999;
  14. }
  15. .min{
  16. display: none;
  17. }
  18. }
  19. #fixed{
  20. position: fixed;
  21. width: 100%;
  22. height: 100vh;
  23. left: 0;
  24. top: 0;
  25. z-index: 99999;
  26. overflow: auto;
  27. .all{
  28. top: 80px!important;
  29. }
  30. .max{
  31. display: none;
  32. }
  33. .min{
  34. display: inline-block;
  35. }
  36. }
  37. .title{
  38. text-align: center;
  39. margin-bottom: 30px;
  40. position: relative;
  41. span{
  42. position: absolute;
  43. top: 10px;
  44. width: 80%;
  45. text-align: center;
  46. left: 0;
  47. right: 0;
  48. margin: auto;
  49. font-size: 25px;
  50. line-height: 70px;
  51. }
  52. }
  53. .datas{
  54. // margin-bottom: 60px;
  55. display: flex;
  56. li{
  57. list-style: none;
  58. padding-right: 20px;
  59. vertical-align: top;
  60. .li{
  61. background: rgba(39, 51, 76, 0.64);
  62. margin-bottom: 30px;
  63. padding: 20px;
  64. position: relative;
  65. &::before{
  66. content: url(../images/bk.png);
  67. position: absolute;
  68. right:0;
  69. top:-5px;
  70. transform: rotate(90deg);
  71. }
  72. &::after{
  73. content: url(../images/bk.png);
  74. position: absolute;
  75. right:0;
  76. bottom:-5px;
  77. transform: rotate(180deg);
  78. }
  79. .top{
  80. position: absolute;
  81. left:0;
  82. top:0;
  83. }
  84. .bottom{
  85. position: absolute;
  86. left:0;
  87. bottom:0;
  88. transform: rotate(-90deg);
  89. }
  90. .all{
  91. font-size: 48px;
  92. color: #fff;
  93. position: absolute;
  94. left: 0;
  95. right: 0;
  96. top: 75px;
  97. margin: auto;
  98. width: 100px;
  99. text-align: center;
  100. z-index: 999;
  101. span{
  102. color: #D2D9E3;
  103. font-size: 12px;
  104. display: block;
  105. }
  106. }
  107. }
  108. h4{
  109. margin-bottom: 20px;
  110. color:#fff;
  111. }
  112. .count{
  113. margin-bottom: 40px;
  114. margin-top: 27px;
  115. span{
  116. padding: 0 10px;
  117. display: inline-block;
  118. width: 160px;
  119. height: 28px;
  120. font-size: 14px;
  121. line-height: 28px;
  122. padding-left: 40px;
  123. margin-bottom: 20px;
  124. margin-right: 60px;
  125. }
  126. .span1{
  127. background: url(../images/hy.png);
  128. }
  129. .span2{
  130. background: url(../images/qy.png);
  131. }
  132. .span3{
  133. background: url(../images/fxd.png);
  134. }
  135. .span4{
  136. background: url(../images/gkrw.png);
  137. margin-right: 0;
  138. }
  139. }
  140. table{
  141. width: 100%;
  142. thead td{
  143. font-size: 16px;
  144. }
  145. td{
  146. font-size: 14px;
  147. padding: 5px;
  148. color:#D2D9E3;
  149. line-height: 25px;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. </style>
  156. <template>
  157. <section class="index">
  158. <div class="content" :id="fullscreen">
  159. <img @click="max" class="max" src="../images/max.png" alt="">
  160. <img @click="min" class="min" src="../images/min.png" alt="">
  161. <h1 class="title">
  162. <img height="90px" width="100%" src="../images/bg_2.jpg" alt="">
  163. <span>{{info.realname}}可视化系统</span>
  164. </h1>
  165. <ul class="datas">
  166. <li style="width:30%;">
  167. <div class="li">
  168. <img class="top" src="../images/bk.png" alt="">
  169. <h4>安全风险实时统计</h4>
  170. <div style="position:relative;">
  171. <p class="all">
  172. 32 <span>总风险(起)</span>
  173. </p>
  174. <div id="chart1" style="width: 100%;height:230px;"></div>
  175. </div>
  176. <div id="chart2" style="width: 100%;height:250px;"></div>
  177. <img class="bottom" src="../images/bk.png" alt="">
  178. </div>
  179. <div class="li">
  180. <img class="top" src="../images/bk.png" alt="">
  181. <h4>安全隐患实时统计</h4>
  182. <div style="position:relative;">
  183. <p class="all" style="top:75px;">
  184. 24 <span>总隐患数(起)</span>
  185. </p>
  186. <div id="chart3" style="width: 100%;height:250px;"></div>
  187. </div>
  188. <img class="bottom" src="../images/bk.png" alt="">
  189. </div>
  190. </li>
  191. <li style="width:40%">
  192. <div class="li">
  193. <img class="top" src="../images/bk.png" alt="">
  194. <h4>系统实时监测</h4>
  195. <p class="count">
  196. <span class="span3">风险点5个</span>
  197. <span class="span4">管控任务5个</span>
  198. </p>
  199. <h4>风险点任务</h4>
  200. <div id="chart4" style="width: 100%;height:310px;"></div>
  201. <br><br>
  202. <h4>风险点任务</h4>
  203. <div id="chart5" style="width: 100%;height:310px;"></div>
  204. <img class="bottom" src="../images/bk.png" alt="">
  205. </div>
  206. </li>
  207. <li style="width:30%;padding:0;">
  208. <div class="li">
  209. <img class="top" src="../images/bk.png" alt="">
  210. <h4>最新告警</h4>
  211. <table cellpadding='0' cellspacing='0'>
  212. <!-- <thead><td>序号</td><td>企业名称</td><td>告警次数</td></thead> -->
  213. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  214. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  215. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  216. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  217. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  218. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  219. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  220. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  221. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  222. <tr><td>加油区</td><td>加油机损坏</td><td>2020-07-08 12:11:20</td></tr>
  223. </table>
  224. <img class="bottom" src="../images/bk.png" alt="">
  225. </div>
  226. <div class="li">
  227. <img class="top" src="../images/bk.png" alt="">
  228. <h4>风险点告警TOP5</h4>
  229. <div id="chart6" style="width: 100%;height:378px;"></div>
  230. <img class="bottom" src="../images/bk.png" alt="">
  231. </div>
  232. </li>
  233. </ul>
  234. </div>
  235. </section>
  236. </template>
  237. <script>
  238. import echarts from 'echarts';
  239. export default {
  240. data(){
  241. return{
  242. fullscreen:'',
  243. info:{}
  244. }
  245. },
  246. methods:{
  247. getData(){
  248. // 基于准备好的dom,初始化echarts实例
  249. var myChart1 = this.$echarts.init(document.getElementById('chart1'),'dark');
  250. var myChart2 = this.$echarts.init(document.getElementById('chart2'),'dark');
  251. var myChart3 = this.$echarts.init(document.getElementById('chart3'),'dark');
  252. var myChart4 = this.$echarts.init(document.getElementById('chart4'),'dark');
  253. var myChart5 = this.$echarts.init(document.getElementById('chart5'),'dark');
  254. var myChart6 = this.$echarts.init(document.getElementById('chart6'),'dark');
  255. this.myChart1=myChart1;
  256. this.myChart2=myChart2;
  257. this.myChart3=myChart3;
  258. this.myChart4=myChart4;
  259. this.myChart5=myChart5;
  260. this.myChart6=myChart6;
  261. // 指定图表的配置项和数据
  262. let color=['#dc402c','#ee5930','#fcd865','#3074b5']
  263. var option1 = {
  264. backgroundColor:'rgba(0,0,0,0)',
  265. color:color,
  266. tooltip: {formatter: '{b}: {c} ({d}%)'},
  267. legend: {
  268. y:'bottom',
  269. itemWidth:8,
  270. itemHeight:8,
  271. textStyle:{
  272. color:'#8C8C8C',
  273. },
  274. data:['重大风险', '较大风险','一般风险','低风险']
  275. },
  276. series: [{
  277. type: 'pie',
  278. radius: ['55%', '60%'],
  279. label: {
  280. normal: {
  281. show: false
  282. },
  283. },
  284. data: [
  285. {value: 100,name:'重大风险'},
  286. {value: 200,name:'较大风险'},
  287. {value: 50,name:'一般风险'},
  288. {value: 200,name:'低风险'},
  289. ]
  290. }]
  291. };
  292. var option2 = {
  293. backgroundColor:'rgba(0,0,0,0)',
  294. // color:['#3398dc'],
  295. tooltip: {formatter: '{b}: {c}'},
  296. grid: {
  297. left: '1%',
  298. right: '1%',
  299. bottom: '20px',
  300. // top:'50px',
  301. containLabel: true
  302. },
  303. xAxis: {
  304. data: ['重大风险', '较大风险','一般风险','低风险'],
  305. },
  306. yAxis: {
  307. axisLine:{
  308. show:false
  309. },
  310. splitLine:{
  311. show:true,
  312. lineStyle:{
  313. type:'solid',
  314. color:'#414B66'
  315. }
  316. },
  317. },
  318. series: [{
  319. type: 'bar',
  320. barWidth: 20,
  321. data: [
  322. {
  323. value:20,
  324. itemStyle:{
  325. color:color[0]
  326. }
  327. },{
  328. value:60,
  329. itemStyle:{
  330. color:color[1]
  331. }
  332. },{
  333. value:120,
  334. itemStyle:{
  335. color:color[2]
  336. }
  337. },{
  338. value:204,
  339. itemStyle:{
  340. color:color[3]
  341. }
  342. },
  343. ],
  344. }]
  345. };
  346. var option3 = {
  347. backgroundColor:'rgba(0,0,0,0)',
  348. title: {
  349. text: ''
  350. },
  351. color:['#dc402c','#fcd865'],
  352. tooltip: {formatter: '{b}: {c} ({d}%)'},
  353. legend: {
  354. y:'bottom',
  355. itemWidth:8,
  356. itemHeight:8,
  357. data:['重大风险','一般风险']
  358. },
  359. series: [{
  360. type: 'pie',
  361. radius: ['55%', '60%'],
  362. label: {
  363. normal: {
  364. show: false
  365. },
  366. },
  367. data: [
  368. {value: 3,name:'重大风险'},
  369. {value: 10,name:'一般风险'},
  370. ]
  371. }]
  372. };
  373. var option4 = {
  374. backgroundColor:'rgba(0,0,0,0)',
  375. // color:['#3398dc'],
  376. tooltip: {formatter: '{b}: {c}'},
  377. grid: {
  378. left: '1%',
  379. right: '1%',
  380. bottom: '20px',
  381. top:'20px',
  382. containLabel: true
  383. },
  384. xAxis: {
  385. data: ['加油区', '加油区1','加油区2','加油区3','加油区4','加油区5'],
  386. },
  387. yAxis: {
  388. axisLine:{
  389. show:false
  390. },
  391. splitLine:{
  392. show:true,
  393. lineStyle:{
  394. type:'solid',
  395. color:'#414B66'
  396. }
  397. },
  398. },
  399. series: [{
  400. type: 'bar',
  401. barWidth: 20,
  402. data: [5, 20, 36, 10,70,100],
  403. itemStyle: {
  404. color: new echarts.graphic.LinearGradient(
  405. 0, 0, 0, 1,
  406. [
  407. {offset: 0, color: '#7AF7FF'},
  408. {offset: 1, color: '#3687FF'}
  409. ]
  410. )
  411. },
  412. }]
  413. };
  414. let day=[],data=[];
  415. for(let i=1;i<25;i++){
  416. day.push(i)
  417. data.push(Math.ceil(Math.random()*50+20))
  418. }
  419. var option5 = {
  420. backgroundColor:'rgba(0,0,0,0)',
  421. // color:['#3398dc'],
  422. tooltip: {formatter: '{b}: {c}'},
  423. grid: {
  424. left: '1%',
  425. right: '1%',
  426. bottom: '20px',
  427. top:'20px',
  428. containLabel: true
  429. },
  430. xAxis: {
  431. data: day,
  432. },
  433. yAxis: {
  434. axisLine:{
  435. show:false
  436. },
  437. splitLine:{
  438. show:true,
  439. lineStyle:{
  440. type:'solid',
  441. color:'#414B66'
  442. }
  443. },
  444. },
  445. series: [{
  446. type: 'line',
  447. smooth: 0.6,
  448. data: data,
  449. areaStyle: {},
  450. itemStyle: {
  451. color: new echarts.graphic.LinearGradient(
  452. 0, 0, 0, 1,
  453. [
  454. {offset: 0, color: '#7AF7FF'},
  455. {offset: 1, color: '#3687FF'}
  456. ]
  457. )
  458. },
  459. }]
  460. };
  461. var option6 = {
  462. backgroundColor:'rgba(0,0,0,0)',
  463. color:['#3398dc'],
  464. tooltip: {formatter: '{b}: {c}'},
  465. legend: {
  466. y:'bottom',
  467. x:'left',
  468. itemWidth:8,
  469. itemHeight:8,
  470. textStyle:{
  471. color:'#8C8C8C',
  472. },
  473. data:['风险点', '管控任务']
  474. },
  475. grid: {
  476. left: '1%',
  477. right: '1%',
  478. bottom: '10px',
  479. top:'10px',
  480. containLabel: true
  481. },
  482. yAxis: {
  483. data: ['加油区1', '加油区2','加油区3','加油区4','加油区5'],
  484. },
  485. xAxis: {
  486. show:false
  487. },
  488. series: [
  489. {
  490. name: '风险点',
  491. type: 'bar',
  492. barWidth:10,
  493. data: [320, 332, 301, 334,690],
  494. itemStyle: {
  495. color: new echarts.graphic.LinearGradient(
  496. 0, 0, 0, 1,
  497. [
  498. {offset: 0, color: '#FFEE7F'},
  499. {offset: 1, color: '#E8B35F'}
  500. ]
  501. )
  502. },
  503. },
  504. {
  505. name: '管控任务',
  506. type: 'bar',
  507. barWidth:10,
  508. data: [30, 132, 201, 34,270],
  509. itemStyle: {
  510. color: new echarts.graphic.LinearGradient(
  511. 0, 0, 0, 1,
  512. [
  513. {offset: 0, color: '#7AF7FF'},
  514. {offset: 1, color: '#3687FF'}
  515. ]
  516. )
  517. },
  518. },
  519. ]
  520. };
  521. // 使用刚指定的配置项和数据显示图表。
  522. myChart1.setOption(option1);
  523. myChart2.setOption(option2);
  524. myChart3.setOption(option3);
  525. myChart4.setOption(option4);
  526. myChart5.setOption(option5);
  527. myChart6.setOption(option6);
  528. window.addEventListener("resize", () => {
  529. myChart1.resize();
  530. myChart2.resize();
  531. myChart3.resize();
  532. myChart4.resize();
  533. myChart5.resize();
  534. myChart6.resize();
  535. })
  536. },
  537. reload(){
  538. this.myChart1.resize();
  539. this.myChart2.resize();
  540. this.myChart3.resize();
  541. this.myChart4.resize();
  542. this.myChart5.resize();
  543. this.myChart6.resize();
  544. },
  545. max(){
  546. this.fullscreen='fixed';
  547. let _this=this;
  548. setTimeout(() => {
  549. _this.reload()
  550. }, 200)
  551. },
  552. min(){
  553. this.fullscreen='';
  554. let _this=this;
  555. setTimeout(() => {
  556. _this.reload()
  557. }, 200)
  558. }
  559. },
  560. mounted(){
  561. this.getData()
  562. },
  563. created(){
  564. this.$api.getInfo().then(res=>{
  565. this.info=res.data.data
  566. })
  567. }
  568. }
  569. </script>