123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <template>
- <moduleEnclosure title="近30天工单趋势">
- <template v-slot:rightce>
- <div class="tabbar">
- <div :class="tabIndex == index?'tab active':'tab'" v-for="(item,index) in tabs" :key="index" @click="tabIndex = index">{{item}}</div>
- </div>
- </template>
-
- <div id="main2" style="width: 100%; height: 100%">
-
- </div>
- </moduleEnclosure>
- </template>
- <script>
- import moduleEnclosure from '@/components/moduleEnclosure.vue';
- import * as echarts from 'echarts';
- import { getQuery11 } from '@/api/bigView.js';
- import { csize } from '@/utils/const.js';
- let myChart3;
- export default {
- components: {
- moduleEnclosure,
- },
- data() {
- return {
- tabs: ['安装','维修','回收'],
- tabIndex: 0,
- myChart2: null,
- };
- },
- mounted() {
- this.timeId = getQuery11((res) => {
- this.init_myChart2(res.data);
- }, 30000);
- },
- beforeUnmount() {
- this.timeId();
- },
- methods: {
- init_myChart2(value) {
- var times = value.map((item) => {
- var str1 = item.ddate.split(' ')[0];
- return str1.slice(5);
- });
- var data1 = value.map((item) => {
- return item.completeMachine;
- });
- var data2 = value.map((item) => {
- return item.completeOrder;
- });
- if (myChart3) {
- myChart3.dispose();
- }
- myChart3 = new echarts.init(document.getElementById('main2'));
- myChart3.setOption({
- tooltip: {
- trigger: 'axis',
- formatter: function (params) {
- var res = '';
- for (var i = 0, l = params.length; i < l; i++) {
- res +=
- '' + params[i].seriesName + ' : ' + params[i].value + '<br>';
- }
- return `<div style="color:#fff;">${res}</div>`;
- },
- transitionDuration: 0,
- backgroundColor: '#092a66',
- borderColor: '#0462b5',
- borderRadius: 8,
- borderWidth: 2,
- padding: [5, 10],
- axisPointer: {
- type: 'line',
- lineStyle: {
- type: 'dashed',
- color: '#8AB1DC',
- },
- },
- },
- legend: {
- icon: 'circle',
- itemWidth: 8,
- itemHeight: 8,
- itemGap: 10,
- top: '16',
- right: '10',
- data: ['新增', '完成'],
- textStyle: {
- fontSize: csize(16),
- color: '#8AB1DC',
- },
- },
- grid: {
- x: csize(65),
- y: csize(50),
- x2: csize(30),
- y2: csize(30),
- containLabel: false,
- },
- xAxis: [
- {
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- interval: Math.floor(times.length / 10),
- showMinLabel: true, //是否显示最小 tick 的 label
- showMaxLabel: true, //是否显示最大 tick 的 label
- fontSize: csize(12),
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#8AB1DC',
- },
- },
- axisTick: {
- show: false,
- },
- data: times,
- },
- ],
- yAxis: [
- {
- type: 'value',
- name: '单',
- nameTextStyle: {
- fontSize: csize(16),
- },
- axisLine: {
- show: false,
- lineStyle: {
- color: '#8AB1DC',
- },
- },
- axisLabel: {
- margin: 10,
- textStyle: {
- fontSize: csize(12),
- },
- },
- splitLine: {
- lineStyle: {
- color: '#364D95',
- },
- },
- axisTick: {
- show: false,
- },
- },
- ],
- series: [
- {
- name: '新增',
- type: 'line',
- smooth: true,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2,
- },
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: 'rgba(137, 189, 27, 0.3)',
- },
- {
- offset: 0.8,
- color: 'rgba(137, 189, 27, 0)',
- },
- ],
- false
- ),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10,
- },
- },
- itemStyle: {
- normal: {
- color: '#1cc840',
- },
- },
- data: data1,
- },
- {
- name: '完成',
- type: 'line',
- smooth: true,
- showSymbol: false,
- lineStyle: {
- normal: {
- width: 2,
- },
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: 'rgba(0, 136, 212, 0.3)',
- },
- {
- offset: 0.8,
- color: 'rgba(0, 136, 212, 0)',
- },
- ],
- false
- ),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 10,
- },
- },
- itemStyle: {
- normal: {
- color: '#43bbfb',
- },
- },
- data: data2,
- },
- ],
- });
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .tabbar{
- display: flex;
- .tab{
- width: 50px;
- color: #ffffff;
- border: 1px solid #254280;
- font-size: 12px;
- font-weight: bold;
- padding: 2px 0;
- margin-right: 14px;
- text-align: center;
- cursor: pointer;
- }
- .active{
- border: 1px solid #153781;
- color: #1a8dc8;
- }
- }
- #main2{
-
- }
- </style>
|