| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <style lang="scss">
- .index{
- .content{
- background: #151932;
- color:#fff;
- padding:0 20px;
- position: relative;
- .max,.min{
- position: absolute;
- top: 40px;
- right: 20px;
- cursor: pointer;
- z-index: 999;
- }
- .min{
- display: none;
- }
- }
- #fixed{
- position: fixed;
- width: 100%;
- height: 100vh;
- left: 0;
- top: 0;
- z-index: 99999;
- overflow: auto;
- .all{
- top: 80px!important;
- }
- .max{
- display: none;
- }
- .min{
- display: inline-block;
- }
- }
- .title{
- text-align: center;
- margin-bottom: 30px;
- position: relative;
- span{
- position: absolute;
- top: 10px;
- width: 80%;
- text-align: center;
- left: 0;
- right: 0;
- margin: auto;
- font-size: 25px;
- line-height: 70px;
- font-weight:300;
- }
- }
- .datas{
- // margin-bottom: 60px;
- display: flex;
- &>li{
- list-style: none;
- padding-right: 20px;
- vertical-align: top;
- .li{
- background: rgba(39, 51, 76, 0.64);
- margin-bottom: 30px;
- padding: 20px;
- position: relative;
- &::before{
- content: url(../images/bk.png);
- position: absolute;
- right:0;
- top:-5px;
- transform: rotate(90deg);
- }
- &::after{
- content: url(../images/bk.png);
- position: absolute;
- right:0;
- bottom:-5px;
- transform: rotate(180deg);
- }
- }
- .top{
- position: absolute;
- left:0;
- top:0;
- }
- .bottom{
- position: absolute;
- left:0;
- bottom:0;
- transform: rotate(-90deg);
- }
- .all{
- font-size: 48px;
- color: #fff;
- position: absolute;
- left: 0;
- right: 0;
- top: 75px;
- margin: auto;
- width: 100px;
- text-align: center;
- z-index: 999;
- span{
- color: #D2D9E3;
- font-size: 12px;
- display: block;
- }
- }
- .li_new{
- background: rgba(39, 51, 76, 0.64);
- margin-bottom: 30px;
- padding: 20px;
- position: relative;
- &::before{
- content: url(../images/bk-1.png);
- position: absolute;
- right:0;
- top:-5px;
- transform: rotate(90deg);
- }
- &::after{
- content: url(../images/bk-1.png);
- position: absolute;
- right:0;
- bottom:-5px;
- transform: rotate(180deg);
- }
- }
- h4{
- margin-bottom: 20px;
- color:#fff;
- }
- .count{
- margin-bottom: 40px;
- margin-top: 27px;
- span{
- padding: 0 10px;
- display: inline-block;
- width: 160px;
- height: 28px;
- font-size: 14px;
- line-height: 28px;
- padding-left: 40px;
- margin-bottom: 20px;
- margin-right: 60px;
- }
- .span1{
- background: url(../images/hy.png);
- }
- .span2{
- background: url(../images/qy.png);
- }
- .span3{
- background: url(../images/fxd.png);
- }
- .span4{
- background: url(../images/gkrw.png);
- margin-right: 0;
- }
- }
- table{
- width: 100%;
- thead td{
- font-size: 16px;
- }
- td{
- font-size: 14px;
- padding: 5px;
- color:#D2D9E3;
- line-height: 25px;
- }
- }
- }
- }
- }
- </style>
- <template>
- <section class="index">
- <div class="content" :id="fullscreen">
- <img @click="max" class="max" src="../images/max.png" alt="">
- <img @click="min" class="min" src="../images/min.png" alt="">
- <h1 class="title">
- <img height="90px" width="100%" src="../images/bg_2.jpg" alt="">
- <span>{{info.realname}}可视化系统</span>
- </h1>
- <ul class="datas">
- <li style="width:30%;">
- <div class="li">
- <img class="top" src="../images/bk.png" alt="">
- <h4>安全风险实时统计</h4>
- <div style="position:relative;">
- <p class="all">
- {{count}} <span>总风险(起)</span>
- </p>
- <div id="chart1" style="width: 100%;height:230px;"></div>
- </div>
- <div id="chart2" style="width: 100%;height:250px;"></div>
- <img class="bottom" src="../images/bk.png" alt="">
- </div>
- <div class="li">
- <img class="top" src="../images/bk.png" alt="">
- <h4>安全隐患实时统计</h4>
- <div style="position:relative;">
- <p class="all" style="top:75px;" v-if='data.yh_data'>
- {{data.yh_data[0].value+data.yh_data[1].value}} <span>总隐患数(起)</span>
- </p>
- <div id="chart3" style="width: 100%;height:250px;"></div>
- </div>
- <img class="bottom" src="../images/bk.png" alt="">
- </div>
- </li>
- <li style="width:40%">
- <div class="li">
- <img class="top" src="../images/bk.png" alt="">
- <h4>系统实时监测</h4>
- <p class="count">
- <span class="span3">风险点 {{data.riskpoint_count}} 个</span>
- <span class="span4">管控任务 {{data.monittask_count}} 个</span>
- </p>
- <h4>风险点任务</h4>
- <div id="chart4" style="width: 100%;height:310px;"></div>
- <br><br>
- <h4>风险点任务</h4>
- <div id="chart5" style="width: 100%;height:310px;"></div>
- <img class="bottom" src="../images/bk.png" alt="">
- </div>
- </li>
- <li style="width:30%;padding:0;">
- <div class="li_new">
- <img class="top" src="../images/bk-1.png" alt="">
- <h4>最新告警</h4>
- <table cellpadding='0' cellspacing='0'>
- <!-- <thead><td>序号</td><td>企业名称</td><td>告警次数</td></thead> -->
- <tr v-for="(item,index) in data.latest_warning" :key='index'>
- <td>{{item.riskpoint_name}}</td>
- <td>{{item.monit_name}}</td><td>{{item.ctime}}</td></tr>
- </table>
- <img class="bottom" src="../images/bk-1.png" alt="">
- </div>
- <div class="li">
- <img class="top" src="../images/bk.png" alt="">
- <h4>风险点告警TOP5</h4>
- <div id="chart6" style="width: 100%;height:378px;"></div>
- <img class="bottom" src="../images/bk.png" alt="">
- </div>
- </li>
- </ul>
- </div>
- </section>
- </template>
- <script>
- import echarts from 'echarts';
- export default {
- data(){
- return{
- fullscreen:'',
- info:{},
- count:0,
- data:{}
- }
- },
- methods:{
- getData(){
- this.$api.getChartData({type:'qy'}).then(res=>{
- this.data=res.data.data
- var data=res.data.data;
- let count=0;
- for(let i=0;i<data.risk_data.length;i++){
- count+=data.risk_data[i].value
- }
- this.count=count;
-
- // 基于准备好的dom,初始化echarts实例
- var myChart1 = this.$echarts.init(document.getElementById('chart1'),'dark');
- var myChart2 = this.$echarts.init(document.getElementById('chart2'),'dark');
- var myChart3 = this.$echarts.init(document.getElementById('chart3'),'dark');
- var myChart4 = this.$echarts.init(document.getElementById('chart4'),'dark');
- var myChart5 = this.$echarts.init(document.getElementById('chart5'),'dark');
- var myChart6 = this.$echarts.init(document.getElementById('chart6'),'dark');
- this.myChart1=myChart1;
- this.myChart2=myChart2;
- this.myChart3=myChart3;
- this.myChart4=myChart4;
- this.myChart5=myChart5;
- this.myChart6=myChart6;
- // 指定图表的配置项和数据
- let color=['#dc402c','#ee5930','#fcd865','#3074b5']
- var option1 = {
- backgroundColor:'rgba(0,0,0,0)',
- color:color,
- tooltip: {formatter: '{b}: {c} ({d}%)'},
- legend: {
- y:'bottom',
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- color:'#8C8C8C',
- },
- data:['重大风险', '较大风险','一般风险','低风险']
- },
- series: [{
- type: 'pie',
- radius: ['55%', '60%'],
- label: {
- normal: {
- show: false
- },
- },
- data: data.risk_data
- }]
- };
- var option2 = {
- backgroundColor:'rgba(0,0,0,0)',
- color:color,
- tooltip: {formatter: '{b}: {c}'},
- grid: {
- left: '1%',
- right: '1%',
- bottom: '30px',
- // top:'50px',
- containLabel: true
- },
- xAxis: {
- data: ['重大风险', '较大风险','一般风险','低风险'],
- },
- yAxis: {
- axisLine:{
- show:false
- },
- splitLine:{
- show:true,
- lineStyle:{
- type:'solid',
- color:'#414B66'
- }
- },
- },
- series: [{
- type: 'bar',
- barWidth: 20,
- data: [
- {
- value:data.risk_data[0].value,
- itemStyle:{
- color:color[0]
- }
- },{
- value:data.risk_data[1].value,
- itemStyle:{
- color:color[1]
- }
- },{
- value:data.risk_data[2].value,
- itemStyle:{
- color:color[2]
- }
- },{
- value:data.risk_data[3].value,
- itemStyle:{
- color:color[3]
- }
- },
- ],
- }]
- };
- var option3 = {
- backgroundColor:'rgba(0,0,0,0)',
- title: {
- text: ''
- },
- color:['#dc402c','#fcd865'],
- tooltip: {formatter: '{b}: {c} ({d}%)'},
- legend: {
- y:'bottom',
- itemWidth:8,
- itemHeight:8,
- data:['重大隐患','一般隐患']
- },
- series: [{
- type: 'pie',
- radius: ['55%', '60%'],
- label: {
- normal: {
- show: false
- },
- },
- data:data.yh_data
- }]
- };
- let fxd_name=[]
- for(let i=0;i<data.riskpoint_count_data.length;i++){
- fxd_name.push(data.riskpoint_count_data[i].name)
- }
- var option4 = {
- backgroundColor:'rgba(0,0,0,0)',
- // color:['#3398dc'],
- tooltip: {formatter: '{b}: {c}'},
- grid: {
- left: '1%',
- right: '1%',
- bottom: '20px',
- top:'20px',
- containLabel: true
- },
- xAxis: {
- data: fxd_name,
- },
- yAxis: {
- axisLine:{
- show:false
- },
- splitLine:{
- show:true,
- lineStyle:{
- type:'solid',
- color:'#414B66'
- }
- },
- },
- series: [{
- type: 'bar',
- barWidth: 20,
- data: data.riskpoint_count_data,
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- {offset: 0, color: '#7AF7FF'},
- {offset: 1, color: '#3687FF'}
- ]
- )
- },
- }]
- };
- let fxd_date_name=[]
- for(let i=0;i<data.time_count.length;i++){
- fxd_date_name.push(data.time_count[i].date)
- }
- var option5 = {
- backgroundColor:'rgba(0,0,0,0)',
- // color:['#3398dc'],
- tooltip: {formatter: '{b}: {c}'},
- grid: {
- left: '1%',
- right: '1%',
- bottom: '20px',
- top:'20px',
- containLabel: true
- },
- xAxis: {
- data: fxd_date_name,
- },
- yAxis: {
- axisLine:{
- show:false
- },
- splitLine:{
- show:true,
- lineStyle:{
- type:'solid',
- color:'#414B66'
- }
- },
- },
- series: [{
- type: 'line',
- smooth: 0.6,
- data: data.time_count,
- areaStyle: {},
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- {offset: 0, color: '#7AF7FF'},
- {offset: 1, color: '#3687FF'}
- ]
- )
- },
- }]
- };
- var option6 = {
- backgroundColor:'rgba(0,0,0,0)',
- color:['#3398dc'],
- tooltip: {formatter: '{b}: {c}'},
- legend: {
- y:'bottom',
- x:'left',
- itemWidth:8,
- itemHeight:8,
- textStyle:{
- color:'#8C8C8C',
- },
- data:['风险点', '管控任务']
- },
- grid: {
- left: '1%',
- right: '1%',
- bottom: '10px',
- top:'10px',
- containLabel: true
- },
- yAxis: {
- data: ['加油区1', '加油区2','加油区3','加油区4','加油区5'],
- },
- xAxis: {
- show:false
- },
- series: [
- {
- name: '风险点',
- type: 'bar',
- barWidth:10,
- data: [320, 332, 301, 334,690],
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- {offset: 0, color: '#FFEE7F'},
- {offset: 1, color: '#E8B35F'}
- ]
- )
- },
- },
- {
- name: '管控任务',
- type: 'bar',
- barWidth:10,
- data: [30, 132, 201, 34,270],
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- {offset: 0, color: '#7AF7FF'},
- {offset: 1, color: '#3687FF'}
- ]
- )
- },
- },
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart1.setOption(option1);
- myChart2.setOption(option2);
- myChart3.setOption(option3);
- myChart4.setOption(option4);
- myChart5.setOption(option5);
- myChart6.setOption(option6);
- window.addEventListener("resize", () => {
- myChart1.resize();
- myChart2.resize();
- myChart3.resize();
- myChart4.resize();
- myChart5.resize();
- myChart6.resize();
- })
- })
- },
- reload(){
- this.myChart1.resize();
- this.myChart2.resize();
- this.myChart3.resize();
- this.myChart4.resize();
- this.myChart5.resize();
- this.myChart6.resize();
- },
- max(){
- this.fullscreen='fixed';
- let _this=this;
- setTimeout(() => {
- _this.reload()
- }, 200)
- },
- min(){
- this.fullscreen='';
- let _this=this;
- setTimeout(() => {
- _this.reload()
- }, 200)
- }
- },
- mounted(){
- this.getData()
- },
- created(){
- this.$api.getInfo().then(res=>{
- this.info=res.data.data
- })
- }
- }
- </script>
|