CompanyData.vue 18 KB

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