|
@@ -364,7 +364,7 @@ export default {
|
364
|
364
|
}))
|
365
|
365
|
this.$nextTick(() => {
|
366
|
366
|
this.trendEvent('custTrends') // 绘制图表
|
367
|
|
- this.trendEvent('custTrendsNew') // 绘制新图表
|
|
367
|
+ this.trendEventNew('custTrendsNew') // 绘制新图表
|
368
|
368
|
})
|
369
|
369
|
} else if (res.errno != 4002) {
|
370
|
370
|
this.$message({
|
|
@@ -529,6 +529,147 @@ export default {
|
529
|
529
|
this.myChartNew.setOption(option);
|
530
|
530
|
}
|
531
|
531
|
},
|
|
532
|
+ trendEventNew (chartDataName) {
|
|
533
|
+ // 旧图表
|
|
534
|
+ chartDataName === 'custTrends' && this.myChart && this.myChart.clear()
|
|
535
|
+ // 新图表
|
|
536
|
+ chartDataName === 'custTrendsNew' && this.myChartNew && this.myChartNew.clear()
|
|
537
|
+
|
|
538
|
+ const _this = this;
|
|
539
|
+ let series = []
|
|
540
|
+ let xArr = this[chartDataName].map((v) => {
|
|
541
|
+ return v.idate
|
|
542
|
+ });
|
|
543
|
+ this[chartDataName === 'custTrends' ? 'legendList' : 'legendListNew'].forEach((item, index) => {
|
|
544
|
+ if (item.selectFlag) {
|
|
545
|
+ // series
|
|
546
|
+ let data = this[chartDataName].map((v) => {
|
|
547
|
+ return v[item.key] || v[item.key] == 0 ? v[item.key] : '-'
|
|
548
|
+ });
|
|
549
|
+ series.push({
|
|
550
|
+ type: "line",
|
|
551
|
+ smooth: true,
|
|
552
|
+ name: item.name,
|
|
553
|
+ data: data,
|
|
554
|
+ lineStyle: {
|
|
555
|
+ width: 2
|
|
556
|
+ },
|
|
557
|
+ symbol: xArr.length == 1 ? 'emptyCircle' : 'none',
|
|
558
|
+ itemStyle: {
|
|
559
|
+ color: item.color,
|
|
560
|
+ borderType: "emptyCircle"
|
|
561
|
+ },
|
|
562
|
+ })
|
|
563
|
+ }
|
|
564
|
+ })
|
|
565
|
+
|
|
566
|
+ let option = {
|
|
567
|
+ title: '',
|
|
568
|
+ tooltip: {
|
|
569
|
+ trigger: 'axis',
|
|
570
|
+ show: true,
|
|
571
|
+ formatter: function (params) {
|
|
572
|
+ let result = params[0].name;
|
|
573
|
+ result += '<br/>'
|
|
574
|
+ params.forEach((item, index) => {
|
|
575
|
+ result +=
|
|
576
|
+ item.marker +
|
|
577
|
+ item.seriesName +
|
|
578
|
+ ":" + (_this.$formatNum(item.value)) +
|
|
579
|
+ "<br/>";
|
|
580
|
+ });
|
|
581
|
+ return result;
|
|
582
|
+ }
|
|
583
|
+ },
|
|
584
|
+ legend: {
|
|
585
|
+ itemWidth: 8,
|
|
586
|
+ itemHeight: 2,
|
|
587
|
+ icon: "plain",
|
|
588
|
+ show: false,
|
|
589
|
+ textStyle: {
|
|
590
|
+ fontSize: 12,
|
|
591
|
+ color: '#666666'
|
|
592
|
+ },
|
|
593
|
+ },
|
|
594
|
+ grid:
|
|
595
|
+ {
|
|
596
|
+ top: '6%',
|
|
597
|
+ left: '5%',
|
|
598
|
+ right: '4%',
|
|
599
|
+ bottom: '16%',
|
|
600
|
+ containLabel: false
|
|
601
|
+ },
|
|
602
|
+ xAxis: [
|
|
603
|
+ {
|
|
604
|
+ type: "category",
|
|
605
|
+ data: xArr,
|
|
606
|
+ boundaryGap: false,//设置数据从头开始
|
|
607
|
+ axisLine: {
|
|
608
|
+ show: true,
|
|
609
|
+ lineStyle: {
|
|
610
|
+ color: '#F2F2f2'
|
|
611
|
+ }
|
|
612
|
+ },
|
|
613
|
+ axisTick: {
|
|
614
|
+ show: false
|
|
615
|
+ },
|
|
616
|
+ splitLine: {
|
|
617
|
+ show: false
|
|
618
|
+ },
|
|
619
|
+ axisLabel: {
|
|
620
|
+ color: '#666',
|
|
621
|
+ fontSize: 10,
|
|
622
|
+ rotate: 30,
|
|
623
|
+ },
|
|
624
|
+ }
|
|
625
|
+ ],
|
|
626
|
+ yAxis: {
|
|
627
|
+ type: "value",
|
|
628
|
+ name: '',
|
|
629
|
+ show: true,
|
|
630
|
+ position: 'left',
|
|
631
|
+ axisTick: {
|
|
632
|
+ show: false
|
|
633
|
+ },
|
|
634
|
+ splitLine: {
|
|
635
|
+ lineStyle: {
|
|
636
|
+ color: '#F2F2f2',
|
|
637
|
+ type: "dashed"
|
|
638
|
+ }
|
|
639
|
+ },
|
|
640
|
+ axisLine: {
|
|
641
|
+ show: true,
|
|
642
|
+ lineStyle: {
|
|
643
|
+ color: '#F2F2f2'
|
|
644
|
+ }
|
|
645
|
+ },
|
|
646
|
+ nameTextStyle: {
|
|
647
|
+ color: "#999999",
|
|
648
|
+ fontSize: 13,
|
|
649
|
+ },
|
|
650
|
+ axisLabel: {
|
|
651
|
+ color: '#999999',
|
|
652
|
+ fontSize: 12,
|
|
653
|
+ show: true,
|
|
654
|
+ formatter: function (params) {
|
|
655
|
+ let result = params;
|
|
656
|
+ let resultData;
|
|
657
|
+ resultData = _this.$NumberHandle(result)
|
|
658
|
+ return resultData;
|
|
659
|
+ }
|
|
660
|
+ }
|
|
661
|
+ },
|
|
662
|
+ series: series
|
|
663
|
+ };
|
|
664
|
+ //初始化echarts实例
|
|
665
|
+ if (chartDataName === 'custTrends') {
|
|
666
|
+ this.myChart = this.myChart ? this.myChart : this.$echarts.init(document.getElementById('trend'));
|
|
667
|
+ this.myChart.setOption(option);
|
|
668
|
+ } else if (chartDataName === 'custTrendsNew') {
|
|
669
|
+ this.myChartNew = this.myChartNew ? this.myChartNew : this.$echarts.init(document.getElementById('trendNew'));
|
|
670
|
+ this.myChartNew.setOption(option);
|
|
671
|
+ }
|
|
672
|
+ },
|
532
|
673
|
changeLegend (legendListName, data, index) {
|
533
|
674
|
let arr = this[legendListName].filter((v) => {
|
534
|
675
|
return v.selectFlag
|
|
@@ -545,7 +686,7 @@ export default {
|
545
|
686
|
this.$set(this[legendListName], index, item)
|
546
|
687
|
this.$nextTick(() => {
|
547
|
688
|
legendListName === 'legendList' && this.trendEvent('custTrends')
|
548
|
|
- legendListName === 'legendListNew' && this.trendEvent('custTrendsNew')
|
|
689
|
+ legendListName === 'legendListNew' && this.trendEventNew('custTrendsNew')
|
549
|
690
|
})
|
550
|
691
|
},
|
551
|
692
|
changeTime (time) {//筛选时间变化
|