派生自 wuyushui/SewerAndRainNetwork

wangqi
2021-04-15 f4b8be4f8d7919d0a9830b86afd23955488b797b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
    <div class="win">
        <div class="border_corner border_corner_left_top"></div>
        <div class="border_corner border_corner_right_top"></div>
        <div class="border_corner border_corner_left_bottom"></div>
        <div class="border_corner border_corner_right_bottom"></div>
        <ul class="tab" v-show="this.$attrs.value === 'feiqi'">
            <li :class="active==0?'hover':''" @click='tabTaggle("ECharts",0)'>实时数据</li>
            <li :class="active==1?'hover':''" @click='tabTaggle("EChartsHour",1)'>小时数据</li>
            <li :class="active==2?'hover':''" @click='tabTaggle("EChartsDate",2)'>日数据</li>
            <li :class="active==3?'hover':''" @click='tabTaggle("EChartsTable",3)'>人工数据</li>
        </ul>
        <ul class="tab" v-show="this.$attrs.value !== 'feiqi'">
            <li :class="active==0?'hover':''" @click='tabTaggle("EChartsRealWasteWater",0)'>实时数据</li>
            <li :class="active==1?'hover':''" @click='tabTaggle("EChartsHourWasteWater",1)'>小时数据</li>
            <li :class="active==2?'hover':''" @click='tabTaggle("EChartsDateWasteWater",2)'>日数据</li>
            <li :class="active==3?'hover':''" @click='tabTaggle("EChartsWasteWaterTable",3)'>人工数据</li>
        </ul>
        <div class="legend" >
            <span >正常</span>
            <i style=" background: #4ec99c;"></i>
            <span >预警</span>
            <i style=" background: red;"></i>
            <span >超标</span>
            <i style=" background: orange;"></i>
        </div>
        <component :is="currentTab" v-bind="$attrs" ref="Echats"></component>
    </div>
</template>
 
<script>
import ECharts from './echarts/Echarts'
import EChartsHour from './echarts/EChartsHour'
import EChartsDate from './echarts/EChartsDate'
import EChartsTable from './echarts/EChartsTable'
 
import EChartsRealWasteWater from './echarts/EChartsRealWasteWater'
import EChartsHourWasteWater from './echarts/EChartsHourWasteWater'
import EChartsDateWasteWater from './echarts/EChartsDateWasteWater'
import EChartsWasteWaterTable from './echarts/EChartsWasteWaterTable'
 
export default {
  name: 'PublicChart',
  components: {
    EChartsHour,
    EChartsDate,
    ECharts,
    EChartsTable,
    EChartsRealWasteWater,
    EChartsHourWasteWater,
    EChartsDateWasteWater,
    EChartsWasteWaterTable
  },
  data () {
    return {
      currentTab: this.current(),
      active: '0'
    }
  },
  // updated () {
  //   this.$refs.Echats.DrawEXHRealTimeDateChart()
  // },
  methods: {
    tabTaggle (taggleMenu, num) {
      this.currentTab = taggleMenu
      this.active = num
    },
    current (currentTab) {
      if (this.$attrs.value === 'feishui') {
        currentTab = 'EChartsRealWasteWater'
      } else {
        currentTab = 'ECharts'
      }
      return currentTab
    }
  }
}
 
</script>
 
<style scoped lang="less">
.win {
  position: relative;
  background:@background-color;
  border: 0.8px solid #396d83;
}
 
.border_corner {
  z-index: 999;
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(0, 0, 0, 0);
  border: 1.5px solid #47d5ea;
}
 
.border_corner_left_top {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}
 
.border_corner_right_top {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}
 
.border_corner_left_bottom {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}
 
.border_corner_right_bottom {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}
 
.tab {
  display: flex;
  border-bottom: 1px solid #396d83;
    padding:0.02rem 0.04rem;
}
 
.tab li {
  background-color: #243a55;
  line-height:0.15rem;
    height: 0.15rem;
  text-align: center;
  border-radius: 5px;
    margin-right: 0.04rem;
    padding:0 0.04rem;
}
.tab li.hover,
.tab li:hover {
  background-color: #0e639e;
  color: #fff;
  cursor: pointer;
}
.legend{
    position: absolute;
    top:0.05rem;
    right: 0;
    display: flex;
    justify-items: center;
}
.legend i {
    display: block;
    width: 0.2rem;
    height: 0.09rem;
    margin:0 0.1rem 0 0.05rem;
    border-radius: 0.02rem;
}
.legend span{
    line-height: 0.09rem;
    height: 0.09rem;
    font-size: 0.06rem;
}
 
</style>