GovermentData.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. <style lang="scss">
  2. .goverdata{
  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: 15px;
  44. width: 80%;
  45. text-align: center;
  46. left: 0;
  47. right: 0;
  48. margin: auto;
  49. font-size: 22px;
  50. line-height: inherit;
  51. font-weight:300;
  52. }
  53. }
  54. .datas{
  55. // margin-bottom: 60px;
  56. display: flex;
  57. &>li{
  58. list-style: none;
  59. padding-right: 30px;
  60. vertical-align: top;
  61. .li{
  62. background: rgba(39, 51, 76, 0.64);
  63. cursor: pointer;
  64. margin-bottom: 30px;
  65. padding: 20px;
  66. position: relative;
  67. &::before{
  68. content: url(../images/bk.png);
  69. position: absolute;
  70. right:0;
  71. top:-5px;
  72. transform: rotate(90deg);
  73. }
  74. &::after{
  75. content: url(../images/bk.png);
  76. position: absolute;
  77. right:0;
  78. bottom:-5px;
  79. transform: rotate(180deg);
  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: 80px;
  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. }
  110. h4{
  111. margin-bottom: 20px;
  112. color:#fff;
  113. }
  114. .count{
  115. margin-bottom: 50px;
  116. margin-top: 27px;
  117. span{
  118. padding: 0 10px;
  119. display: inline-block;
  120. width: 160px;
  121. height: 28px;
  122. font-size: 14px;
  123. line-height: 28px;
  124. padding-left: 40px;
  125. margin-bottom: 20px;
  126. margin-right: 60px;
  127. cursor: pointer;
  128. }
  129. .span1{
  130. background: url(../images/hy.png);
  131. }
  132. .span2{
  133. background: url(../images/qy.png);
  134. margin-right: 0;
  135. }
  136. .span3{
  137. background: url(../images/fxd.png);
  138. }
  139. .span4{
  140. background: url(../images/gkrw.png);
  141. margin-right: 0;
  142. }
  143. }
  144. table{
  145. width: 100%;
  146. thead td{
  147. font-size: 16px;
  148. }
  149. td{
  150. font-size: 14px;
  151. padding: 5px;
  152. color:#D2D9E3;
  153. line-height: 25px;
  154. }
  155. }
  156. }
  157. }
  158. .company_top{
  159. li{
  160. list-style: none;
  161. color: #D2D9E3;
  162. line-height: 25px;
  163. font-size: 14px;
  164. display: flex;
  165. vertical-align: middle;
  166. span{
  167. display: block;
  168. // width: 8%;
  169. text-align: center;
  170. min-width: 34px;
  171. line-height: 38px;
  172. img{
  173. position: relative;
  174. top:5px;
  175. // left:3px;
  176. }
  177. }
  178. .second{
  179. width: 58%;
  180. padding:0 5px;
  181. overflow: hidden;
  182. text-overflow: ellipsis;
  183. white-space: nowrap;
  184. // text-align: left;
  185. // padding-left: 10px;
  186. }
  187. }
  188. .thead{
  189. font-size: 16px;
  190. }
  191. .outer_div{
  192. height: 190px;
  193. overflow: hidden;
  194. .inner_div{
  195. position: relative;
  196. animation:move 15s infinite linear;
  197. margin-top:190px;
  198. }
  199. .inner_div:hover{
  200. animation-play-state: paused;
  201. }
  202. .inner_div li:hover{
  203. cursor: pointer;
  204. }
  205. }
  206. @keyframes move {
  207. 0%{
  208. transform: translateY(0);
  209. }
  210. 100%{
  211. transform: translateY(-266px);
  212. }
  213. }
  214. }
  215. .tc{
  216. position: fixed;
  217. width: calc(100vw - 290px);
  218. top:100px;
  219. left: 250px;
  220. // right: 0;
  221. // margin: auto;
  222. padding: 10px;
  223. background: rgba(39, 51, 76, 1);
  224. z-index: 999;
  225. text-align: right;
  226. i{
  227. cursor: pointer;
  228. }
  229. }
  230. }
  231. </style>
  232. <template>
  233. <section class="index goverdata">
  234. <div class="content" :id="fullscreen">
  235. <img @click="max" class="max" src="../images/max.png" alt="">
  236. <img @click="min" class="min" src="../images/min.png" alt="">
  237. <h1 class="title">
  238. <img height="90px" width="100%" src="../images/bg_1.jpg" alt="">
  239. <span>{{info.name}}<br>可视化系统</span>
  240. </h1>
  241. <ul class="datas">
  242. <li style="width:30%;">
  243. <div class="li">
  244. <img class="top" src="../images/bk.png" alt="">
  245. <h4>安全风险实时统计</h4>
  246. <div style="position:relative;">
  247. <p class="all">
  248. {{count}} <span>总风险(起)</span>
  249. </p>
  250. <div id="chart1" style="width: 100%;height:250px;"></div>
  251. </div>
  252. <div id="chart2" style="width: 100%;height:330px;"></div>
  253. <img class="bottom" src="../images/bk.png" alt="">
  254. </div>
  255. <div class="li">
  256. <img class="top" src="../images/bk.png" alt="">
  257. <h4>安全隐患实时统计</h4>
  258. <div style="position:relative;">
  259. <p class="all" style="top:95px;" v-if='data.yh_data'>
  260. {{data.yh_data[0].value+data.yh_data[1].value}}
  261. <span>总隐患数(起)</span>
  262. </p>
  263. <div id="chart3" style="width: 100%;height:285px;"></div>
  264. </div>
  265. <img class="bottom" src="../images/bk.png" alt="">
  266. </div>
  267. </li>
  268. <li style="width:45%">
  269. <div class="li">
  270. <img class="top" src="../images/bk.png" alt="">
  271. <h4>实时监测</h4>
  272. <p class="count">
  273. <span class="span1">行业 {{data.industry_count}} 个</span>
  274. <span class="span2" @click='goTo("/company")'>企业 {{data.enterprise_count}} 个</span><br>
  275. <span class="span3" @click='goTo("/danger")'>风险点 {{data.riskpoint_count}} 个</span>
  276. <span class="span4" @click='goTo("/dangertask")'>管控任务 {{data.monittask_count}} 个</span><br>
  277. </p>
  278. <h4>行业风险统计</h4>
  279. <div id="chart4" @click="zindex1=9999" style="width: 100%;height:330px;"></div>
  280. <br><br>
  281. <h4>行业隐患统计</h4>
  282. <div id="chart5" @click="zindex2=9999" style="width: 100%;height:320px;"></div>
  283. <img class="bottom" src="../images/bk.png" alt="">
  284. </div>
  285. </li>
  286. <li style="width:25%;padding:0;">
  287. <div class="li">
  288. <img class="top" src="../images/bk.png" alt="">
  289. <h4>企业告警TOP5</h4>
  290. <ol class="company_top">
  291. <li class="thead"><span>序号</span><span class="second">企业名称</span><span>告警次数</span></li>
  292. <div class="outer_div">
  293. <div class="inner_div">
  294. <li @click="goTo('/warning')" v-for="(item,index) in data.enterprise_warning_top5" :key="index">
  295. <span v-if="index==0"><img src="../images/1.png" alt=""></span>
  296. <span v-if="index==1"><img src="../images/2.png" alt=""></span>
  297. <span v-if="index==2"><img src="../images/3.png" alt=""></span>
  298. <span v-if="index>2">{{index+1}}</span>
  299. <span class="second">{{item.enterprise_name}}</span>
  300. <span>{{item.value}}</span>
  301. </li>
  302. <!-- <li v-for="(item,index) in data.enterprise_warning_top5" :key="index+'_'+index">
  303. <span v-if="index==0"><img src="../images/1.png" alt=""></span>
  304. <span v-if="index==1"><img src="../images/2.png" alt=""></span>
  305. <span v-if="index==2"><img src="../images/3.png" alt=""></span>
  306. <span v-if="index>2">{{index+1}}</span>
  307. <span class="second">{{item.enterprise_name}}</span>
  308. <span>{{item.value}}</span>
  309. </li> -->
  310. </div>
  311. </div>
  312. </ol>
  313. <img class="bottom" src="../images/bk.png" alt="">
  314. </div>
  315. <div class="li">
  316. <img class="top" src="../images/bk.png" alt="">
  317. <h4>风险企业TOP5</h4>
  318. <div id="chart6" style="width: 100%;height:300px;"></div>
  319. <img class="bottom" src="../images/bk.png" alt="">
  320. </div>
  321. <div class="li">
  322. <img class="top" src="../images/bk.png" alt="">
  323. <h4>隐患企业TOP5</h4>
  324. <div id="chart7" style="width: 100%;height:230px;"></div>
  325. <img class="bottom" src="../images/bk.png" alt="">
  326. </div>
  327. </li>
  328. </ul>
  329. <div class="tc" :style="'z-index:'+zindex1">
  330. <i class="el-icon-close" @click="zindex1=-1"></i>
  331. <div id="chart8" style="width: 100%;height:500px;"></div>
  332. </div>
  333. <div class="tc" :style="'z-index:'+zindex2">
  334. <i class="el-icon-close" @click="zindex2=-1"></i>
  335. <div id="chart9" style="width: 100%;height:500px;"></div>
  336. </div>
  337. </div>
  338. </section>
  339. </template>
  340. <script>
  341. import echarts from 'echarts';
  342. export default {
  343. data(){
  344. return{
  345. zindex1:-1,
  346. zindex2:-1,
  347. fullscreen:'',
  348. info:{},
  349. data:{},
  350. count:0
  351. }
  352. },
  353. methods:{
  354. getData(){
  355. this.$api.getChartData({type:'zf'}).then(res=>{
  356. this.data=res.data.data
  357. var data=res.data.data;
  358. let count=0;
  359. for(let i=0;i<data.risk_data.length;i++){
  360. count+=data.risk_data[i].value
  361. }
  362. this.count=count;
  363. //行业风险
  364. let fx_data=[],fx_data_more=[],fx_name=[];
  365. for(let j=0;j<data.industry_fx_data[0].data.length;j++){
  366. fx_name.push(data.industry_fx_data[0].data[j].name)
  367. }
  368. for(let i=0;i<data.industry_fx_data.length;i++){
  369. let _data=data.industry_fx_data[i].data,array=[];
  370. for(let j=0;j<_data.length;j++){
  371. array.push(_data[j].value)
  372. }
  373. fx_data.push({
  374. type: 'bar',
  375. stack:'风险',
  376. barWidth:20,
  377. data: array,
  378. name:data.industry_fx_data[i].name
  379. })
  380. }
  381. for(let i=0;i<data.industry_fx_data_more.length;i++){
  382. let _data=data.industry_fx_data_more[i].data,array=[];
  383. for(let j=0;j<_data.length;j++){
  384. array.push(_data[j].value)
  385. }
  386. fx_data_more.push({
  387. type: 'bar',
  388. stack:'风险',
  389. barWidth:20,
  390. data: array,
  391. name:data.industry_fx_data_more[i].name
  392. })
  393. }
  394. //行业隐患
  395. let yh_data=[],yh_data_more=[],yh_name=[];
  396. for(let j=0;j<data.industry_yh_data[0].data.length;j++){
  397. yh_name.push(data.industry_yh_data[0].data[j].name)
  398. }
  399. for(let i=0;i<data.industry_yh_data.length;i++){
  400. let _data=data.industry_yh_data[i].data,array=[];
  401. for(let j=0;j<_data.length;j++){
  402. array.push(_data[j].value)
  403. }
  404. yh_data.push({
  405. type: 'bar',
  406. stack:'隐患',
  407. barWidth:20,
  408. data: array,
  409. name:data.industry_yh_data[i].name
  410. })
  411. }
  412. for(let i=0;i<data.industry_yh_data_more.length;i++){
  413. let _data=data.industry_yh_data_more[i].data,array=[];
  414. for(let j=0;j<_data.length;j++){
  415. array.push(_data[j].value)
  416. }
  417. yh_data_more.push({
  418. type: 'bar',
  419. stack:'隐患',
  420. barWidth:20,
  421. data: array,
  422. name:data.industry_yh_data[i].name
  423. })
  424. }
  425. // 基于准备好的dom,初始化echarts实例
  426. var myChart1 = this.$echarts.init(document.getElementById('chart1'),'dark');
  427. var myChart2 = this.$echarts.init(document.getElementById('chart2'),'dark');
  428. var myChart3 = this.$echarts.init(document.getElementById('chart3'),'dark');
  429. var myChart4 = this.$echarts.init(document.getElementById('chart4'),'dark');
  430. var myChart5 = this.$echarts.init(document.getElementById('chart5'),'dark');
  431. var myChart6 = this.$echarts.init(document.getElementById('chart6'),'dark');
  432. var myChart7 = this.$echarts.init(document.getElementById('chart7'),'dark');
  433. var myChart8 = this.$echarts.init(document.getElementById('chart8'),'dark');
  434. var myChart9 = this.$echarts.init(document.getElementById('chart9'),'dark');
  435. this.myChart1=myChart1;
  436. this.myChart2=myChart2;
  437. this.myChart3=myChart3;
  438. this.myChart4=myChart4;
  439. this.myChart5=myChart5;
  440. this.myChart6=myChart6;
  441. this.myChart7=myChart7;
  442. // 指定图表的配置项和数据
  443. let color=['#dc402c','#ee5930','#fcd865','#3074b5']
  444. var option1 = {
  445. backgroundColor:'rgba(0,0,0,0)',
  446. color:color,
  447. tooltip: {formatter: '{b}: {c} ({d}%)'},
  448. legend: {
  449. y:'bottom',
  450. itemWidth:8,
  451. itemHeight:8,
  452. textStyle:{
  453. color:'#8C8C8C',
  454. },
  455. data:['重大风险', '较大风险','一般风险','低风险']
  456. },
  457. series: [{
  458. type: 'pie',
  459. radius: ['55%', '60%'],
  460. label: {
  461. normal: {
  462. show: false
  463. },
  464. },
  465. data: data.risk_data
  466. }]
  467. };
  468. var option2 = {
  469. backgroundColor:'rgba(0,0,0,0)',
  470. color:color,
  471. tooltip: {formatter: '{b}: {c}'},
  472. grid: {
  473. left: '1%',
  474. right: '1%',
  475. bottom: '30px',
  476. // top:'50px',
  477. containLabel: true
  478. },
  479. xAxis: {
  480. data: ['重大风险', '较大风险','一般风险','低风险'],
  481. },
  482. yAxis: {
  483. axisLine:{
  484. show:false
  485. },
  486. splitLine:{
  487. show:true,
  488. lineStyle:{
  489. type:'solid',
  490. color:'#414B66'
  491. }
  492. },
  493. },
  494. series: [{
  495. type: 'bar',
  496. barWidth: 20,
  497. data: [
  498. {
  499. value:data.risk_data[0].value,
  500. itemStyle:{
  501. color:color[0]
  502. }
  503. },{
  504. value:data.risk_data[1].value,
  505. itemStyle:{
  506. color:color[1]
  507. }
  508. },{
  509. value:data.risk_data[2].value,
  510. itemStyle:{
  511. color:color[2]
  512. }
  513. },{
  514. value:data.risk_data[3].value,
  515. itemStyle:{
  516. color:color[3]
  517. }
  518. },
  519. ],
  520. }]
  521. };
  522. var option3 = {
  523. backgroundColor:'rgba(0,0,0,0)',
  524. title: {
  525. text: ''
  526. },
  527. color:['#dc402c','#fcd865'],
  528. tooltip: {formatter: '{b}: {c} ({d}%)'},
  529. legend: {
  530. y:'bottom',
  531. itemWidth:8,
  532. itemHeight:8,
  533. data:['重大隐患','一般隐患']
  534. },
  535. series: [{
  536. type: 'pie',
  537. radius: ['55%', '60%'],
  538. label: {
  539. normal: {
  540. show: false
  541. },
  542. },
  543. data: data.yh_data
  544. }]
  545. };
  546. var option4 = {
  547. backgroundColor:'rgba(0,0,0,0)',
  548. title: {
  549. text: ''
  550. },
  551. legend: {
  552. y:'bottom',
  553. x:'left',
  554. itemWidth:8,
  555. itemHeight:8,
  556. textStyle:{
  557. color:'#8C8C8C',
  558. },
  559. data:['重大风险', '较大风险','一般风险','低风险']
  560. },
  561. color:color,
  562. tooltip: {
  563. trigger: 'axis',
  564. },
  565. grid: {
  566. left: '1%',
  567. right: '1%',
  568. top: '10px',
  569. bottom:'40px',
  570. containLabel: true
  571. },
  572. xAxis: {
  573. data:fx_name
  574. },
  575. yAxis: {
  576. axisLine:{
  577. show:false
  578. },
  579. splitLine:{
  580. show:true,
  581. lineStyle:{
  582. type:'solid',
  583. color:'#414B66'
  584. }
  585. },
  586. },
  587. series: fx_data
  588. };
  589. var option5 = {
  590. backgroundColor:'rgba(0,0,0,0)',
  591. title: {
  592. text: ''
  593. },
  594. legend: {
  595. y:'bottom',
  596. x:'left',
  597. itemWidth:8,
  598. itemHeight:8,
  599. textStyle:{
  600. color:'#8C8C8C',
  601. },
  602. data:['重大隐患','一般隐患']
  603. },
  604. color:['#dc402c','#fcd865'],
  605. tooltip: {
  606. trigger: 'axis',
  607. },
  608. grid: {
  609. left: '1%',
  610. right: '1%',
  611. top: '10px',
  612. bottom:'40px',
  613. containLabel: true
  614. },
  615. xAxis: {
  616. data:yh_name
  617. },
  618. yAxis: {
  619. axisLine:{
  620. show:false
  621. },
  622. splitLine:{
  623. show:true,
  624. lineStyle:{
  625. type:'solid',
  626. color:'#414B66'
  627. }
  628. },
  629. },
  630. series: yh_data
  631. };
  632. var option8 = {
  633. backgroundColor:'rgba(39, 51, 76, 1)',
  634. title: {
  635. text: ''
  636. },
  637. legend: {
  638. y:'bottom',
  639. x:'left',
  640. itemWidth:8,
  641. itemHeight:8,
  642. textStyle:{
  643. color:'#8C8C8C',
  644. },
  645. data:['重大风险', '较大风险','一般风险','低风险']
  646. },
  647. color:color,
  648. tooltip: {
  649. trigger: 'axis',
  650. },
  651. grid: {
  652. left: '1%',
  653. right: '1%',
  654. top: '10px',
  655. bottom:'40px',
  656. containLabel: true
  657. },
  658. xAxis: {
  659. data:fx_name
  660. },
  661. yAxis: {
  662. axisLine:{
  663. show:false
  664. },
  665. splitLine:{
  666. show:true,
  667. lineStyle:{
  668. type:'solid',
  669. color:'#414B66'
  670. }
  671. },
  672. },
  673. series: fx_data_more
  674. };
  675. var option9 = {
  676. backgroundColor:'rgba(0,0,0,0)',
  677. title: {
  678. text: ''
  679. },
  680. legend: {
  681. y:'bottom',
  682. x:'left',
  683. itemWidth:8,
  684. itemHeight:8,
  685. textStyle:{
  686. color:'#8C8C8C',
  687. },
  688. data:['重大隐患','一般隐患']
  689. },
  690. color:['#dc402c','#fcd865'],
  691. tooltip: {
  692. trigger: 'axis',
  693. },
  694. grid: {
  695. left: '1%',
  696. right: '1%',
  697. top: '10px',
  698. bottom:'40px',
  699. containLabel: true
  700. },
  701. xAxis: {
  702. data:yh_name
  703. },
  704. yAxis: {
  705. axisLine:{
  706. show:false
  707. },
  708. splitLine:{
  709. show:true,
  710. lineStyle:{
  711. type:'solid',
  712. color:'#414B66'
  713. }
  714. },
  715. },
  716. series: yh_data_more
  717. };
  718. //企业风险
  719. let qy_fx_data=[],qy_fx_name=[];
  720. for(let j=0;j<data.enterprise_fx_data[1].data.length;j++){
  721. let text=data.enterprise_fx_data[1].data[j].enterprise_name;
  722. let length=text.length/3
  723. let br_text=text.slice(0,length)+'\n'+text.slice(length,length*2)+'\n'+text.slice(length*2,text.length)
  724. qy_fx_name.push(br_text)
  725. }
  726. for(let i=0;i<data.enterprise_fx_data.length;i++){
  727. let _data=data.enterprise_fx_data[i].data,array=[];
  728. for(let j=0;j<_data.length;j++){
  729. array.push(_data[j].value)
  730. }
  731. qy_fx_data.push({
  732. type: 'bar',
  733. stack:'隐患',
  734. barWidth:10,
  735. data: array,
  736. name:data.enterprise_fx_data[i].name,
  737. // itemStyle: {
  738. // color: new echarts.graphic.LinearGradient(
  739. // 0, 0, 0, 1,
  740. // [
  741. // {offset: 0, color: '#FFEE7F'},
  742. // {offset: 1, color: '#E8B35F'}
  743. // ]
  744. // )
  745. // },
  746. })
  747. }
  748. var option6 = {
  749. backgroundColor:'rgba(0,0,0,0)',
  750. color:color,
  751. tooltip: {trigger: 'axis',},
  752. legend: {
  753. y:'bottom',
  754. x:'left',
  755. itemWidth:8,
  756. itemHeight:8,
  757. textStyle:{
  758. color:'#8C8C8C',
  759. },
  760. data:['重大风险', '较大风险','一般风险','低风险']
  761. },
  762. grid: {
  763. left: '1%',
  764. right: '1%',
  765. bottom: '50px',
  766. top:'10px',
  767. containLabel: true
  768. },
  769. yAxis: {
  770. data: qy_fx_name,
  771. },
  772. xAxis: {
  773. show:false
  774. },
  775. series: qy_fx_data
  776. };
  777. //企业隐患
  778. let qy_yh_data=[],qy_yh_name=[];
  779. for(let j=0;j<data.enterprise_yh_data[0].data.length;j++){
  780. let text=data.enterprise_yh_data[0].data[j].enterprise_name;
  781. let length=text.length/3
  782. let br_text=text.slice(0,length)+'\n'+text.slice(length,length*2)+'\n'+text.slice(length*2,text.length)
  783. qy_yh_name.push(br_text)
  784. }
  785. for(let i=0;i<data.enterprise_yh_data.length;i++){
  786. let _data=data.enterprise_yh_data[i].data,array=[];
  787. for(let j=0;j<_data.length;j++){
  788. array.push(_data[j].value)
  789. }
  790. qy_yh_data.push({
  791. type: 'bar',
  792. stack:'隐患',
  793. barWidth:10,
  794. data: array,
  795. name:data.enterprise_yh_data[i].name,
  796. // itemStyle: {
  797. // color: new echarts.graphic.LinearGradient(
  798. // 0, 0, 0, 1,
  799. // [
  800. // {offset: 0, color: '#FFEE7F'},
  801. // {offset: 1, color: '#E8B35F'}
  802. // ]
  803. // )
  804. // },
  805. })
  806. }
  807. var option7 = {
  808. backgroundColor:'rgba(0,0,0,0)',
  809. color:['#dc402c','#fcd865'],
  810. tooltip: {trigger: 'axis',},
  811. legend: {
  812. y:'bottom',
  813. x:'left',
  814. itemWidth:8,
  815. itemHeight:8,
  816. textStyle:{
  817. color:'#8C8C8C',
  818. },
  819. data:['重大隐患','一般隐患']
  820. },
  821. grid: {
  822. left: '1%',
  823. right: '1%',
  824. bottom: '10px',
  825. top:'10px',
  826. containLabel: true
  827. },
  828. yAxis: {
  829. data: qy_yh_name,
  830. },
  831. xAxis: {
  832. show:false
  833. },
  834. series: qy_yh_data
  835. };
  836. // 使用刚指定的配置项和数据显示图表。
  837. myChart1.setOption(option1);
  838. myChart2.setOption(option2);
  839. myChart3.setOption(option3);
  840. myChart4.setOption(option4);
  841. myChart5.setOption(option5);
  842. myChart6.setOption(option6);
  843. myChart7.setOption(option7);
  844. myChart8.setOption(option8);
  845. myChart9.setOption(option9);
  846. window.addEventListener("resize", () => {
  847. myChart1.resize();
  848. myChart2.resize();
  849. myChart3.resize();
  850. myChart4.resize();
  851. myChart5.resize();
  852. myChart6.resize();
  853. myChart7.resize();
  854. })
  855. })
  856. },
  857. reload(){
  858. this.myChart1.resize();
  859. this.myChart2.resize();
  860. this.myChart3.resize();
  861. this.myChart4.resize();
  862. this.myChart5.resize();
  863. this.myChart6.resize();
  864. this.myChart7.resize();
  865. },
  866. max(){
  867. this.fullscreen='fixed';
  868. let _this=this;
  869. setTimeout(() => {
  870. _this.reload()
  871. }, 200)
  872. },
  873. min(){
  874. this.fullscreen='';
  875. let _this=this;
  876. setTimeout(() => {
  877. _this.reload()
  878. }, 200)
  879. },
  880. goTo(path){
  881. this.$router.push(path)
  882. }
  883. },
  884. mounted(){
  885. this.getData()
  886. },
  887. created(){
  888. this.$api.getInfo().then(res=>{
  889. this.info=res.data.data
  890. })
  891. }
  892. }
  893. </script>