| | |
| | | <template> |
| | | <div class="excellent_proportion"> |
| | | <div class="excellent_top header_excellent"> |
| | | <img class="pie_img" :src="require('@/assets/images/regionalOverview/pieChart.png')" alt=""> |
| | | <span class="proportion_title"><span v-if="timeArea">优良天数占比({{ timeArea }})</span><span v-else>优良天数占比</span></span> |
| | | <img class="open" :src="require('@/assets/images/regionalOverview/open.png')" alt="" style="cursor:pointer" @click="jumpLevelStatistic"> |
| | | <img |
| | | class="pie_img" |
| | | :src="require('@/assets/images/regionalOverview/pieChart.png')" |
| | | alt="" |
| | | /> |
| | | <span class="proportion_title" |
| | | ><span v-if="timeArea">优良天数占比({{ timeArea }})</span |
| | | ><span v-else>优良天数占比</span></span |
| | | > |
| | | <img |
| | | class="open" |
| | | :src="require('@/assets/images/regionalOverview/open.png')" |
| | | alt="" |
| | | style="cursor: pointer" |
| | | @click="jumpLevelStatistic" |
| | | /> |
| | | </div> |
| | | <div class="proportion_pie" v-if="this.timeArea"> |
| | | <pie-chart-new :datas="data" :save="false" /> |
| | | </div> |
| | | <div v-else style="width: 100%"> |
| | | <el-empty style="width: 100%" :image-size="60" description="无统计数据"></el-empty> |
| | | <el-empty |
| | | style="width: 100%" |
| | | :image-size="60" |
| | | description="无统计数据" |
| | | ></el-empty> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | data() { |
| | | return { |
| | | timeArea: '', |
| | | data: [] |
| | | data: [], |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryPieChartOfPollutionLevel() |
| | | }, |
| | | mounted() { |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | // 获取天气污染等级比例饼状图数据 |
| | | queryPieChartOfPollutionLevel() { |
| | |
| | | method: 'get', |
| | | params: { |
| | | regionCode: this.$store.state.regionCode, |
| | | year: new Date().getFullYear() |
| | | } |
| | | }).then(res => { |
| | | year: new Date().getFullYear(), |
| | | }, |
| | | }).then((res) => { |
| | | if (res.code === 0) { |
| | | this.timeArea = res.data.time |
| | | this.data = res.data.values.map((item) => { |
| | |
| | | const levelIndex = item.pollution |
| | | let level = '' |
| | | switch (levelIndex) { |
| | | case '0': level = '优' |
| | | case '0': |
| | | level = '优' |
| | | break |
| | | case '1': level = '良' |
| | | case '1': |
| | | level = '良' |
| | | break |
| | | case '2': level = '轻度污染' |
| | | case '2': |
| | | level = '轻度污染' |
| | | break |
| | | case '3': level = '中度污染' |
| | | case '3': |
| | | level = '中度污染' |
| | | break |
| | | case '4': level = '重度污染' |
| | | case '4': |
| | | level = '重度污染' |
| | | break |
| | | case '5': level = '严重污染' |
| | | case '5': |
| | | level = '严重污染' |
| | | } |
| | | newMap.name = level + ': ' + item.proportion |
| | | return newMap |
| | |
| | | // 跳转页面 |
| | | jumpLevelStatistic() { |
| | | this.$router.push({ path: '/analyse/analyse/levelStatistic' }) |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | |
| | | .header_excellent { |
| | | position: relative; |
| | | height: 40px; |
| | | background-color: #F8F7F7; |
| | | background-color: #f8f7f7; |
| | | .pie_img { |
| | | position: absolute; |
| | | top: 10px; |