123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="module-main">
- <div class="module-box">
- <div class="header">
- <div class="rhombus" />
- <span class="title">医废周数据分析</span>
- </div>
- <echarts v-if="!loading" :data="echartdata" class="echarts" />
- </div>
- </div>
- </template>
- <script>
- import Vue from 'vue';
- import Component from 'vue-class-component';
- import Echarts from '@/common/components/echarts.vue';
- import api from '../../api';
- @Component({
- components: {
- Echarts,
- },
- props: {
- data: {
- type: Object,
- default: null,
- },
- },
- })
- export default class Smodule100 extends Vue {
- loading = true;
- echartdata = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#999',
- },
- },
- },
- color: ['#B24038', '#FFF000', '#709FA6', '#C8856B', '#9DC5B0'], // , '#7D9D85'
- legend: {
- data: [],
- textStyle: {
- color: '#88B1D0',
- fontSize: 10,
- },
- },
- xAxis: [
- {
- type: 'category',
- data: [],
- rotate: 45,
- axisLabel: {
- textStyle: {
- color: '#fff',
- },
- },
- splitLine: {
- show: false, // 去掉网格线
- },
- splitArea: {
- show: false,
- },
- },
- ],
- yAxis: [
- {
- type: 'value',
- interval: 50,
- axisLabel: {
- textStyle: {
- color: '#fff',
- },
- },
- splitLine: {
- show: false, // 去掉网格线
- },
- splitArea: {
- show: false,
- },
- },
- ],
- series: [
- ],
- };
- created() {
- this.getWeekCateRecord();
- setInterval(() => {
- this.getWeekCateRecord();
- }, 5000 * 60);
- }
- getWeekCateRecord() {
- this.loading = true;
- api.getWeekCateRecord().then((res) => {
- this.echartdata.xAxis[0].data = res.data.date;
- this.echartdata.legend.data = res.data.cate;
- const lists = res.data.list;
- const series = [];
- lists.forEach((e) => {
- series.push(
- {
- name: e.title,
- type: 'bar',
- data: e.list,
- },
- );
- });
- this.echartdata.series = series;
- this.loading = false;
- }).catch(() => {}).finally(() => {
- this.loading = false;
- });
- }
- }
- </script>
- <style scoped lang="scss">
- .module-box{
- width: 100%;
- height: 100%;
- position: relative;
- }
- .module-box .header{
- width: 97%;
- height: 40px;
- line-height: 40px;
- padding-left: 3%;
- }
- .module-box .header .rhombus{
- width: 14px;
- height: 14px;
- background: #2D59BC;
- display: inline-block;
- clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
- }
- .module-box .header .title{
- color: #FFFFFF;
- font-size: 15px;
- font-weight: 500;
- margin-left: 2%;
- }
- .module-box .echarts{
- width: 100%;
- height: auto;
- position: absolute;
- top: 40px;
- left: 0;
- right: 0;
- bottom: 0;
- }
-
- </style>
|