|
@@ -1,15 +1,16 @@
|
|
|
<template>
|
|
|
<moduleEnclosure title="近30日订单趋势">
|
|
|
- <div id="main3" style="width: 100%; height: 100%"></div>
|
|
|
+ <div id="orderEcharts1" style="width: 100%; height: 100%"></div>
|
|
|
</moduleEnclosure>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import moduleEnclosure from '@/components/moduleEnclosure.vue';
|
|
|
import * as echarts from 'echarts';
|
|
|
-import { getQuery10 } from '@/api/bigView.js';
|
|
|
+import { getOrderTrend } from '@/api/bigView.js';
|
|
|
import { csize } from '@/utils/const.js';
|
|
|
let myChart4;
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
moduleEnclosure,
|
|
@@ -20,40 +21,50 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- // this.timeId = getQuery10((res) => {
|
|
|
- // this.init_myChart2(res.data);
|
|
|
- // }, 40000);
|
|
|
+ getOrderTrend().then(res => {
|
|
|
+ this.initEcharts(res.data);
|
|
|
+ })
|
|
|
},
|
|
|
+
|
|
|
beforeUnmount() {
|
|
|
- this.timeId();
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
methods: {
|
|
|
- init_myChart2(value) {
|
|
|
- var times = value.map((item) => {
|
|
|
- var str1 = item.ddate.split(' ')[0];
|
|
|
- return str1.slice(5);
|
|
|
+ getDate() {
|
|
|
+ const today = new Date();
|
|
|
+ const dates = [];
|
|
|
+
|
|
|
+ for (let i = 0; i < 30; i++) {
|
|
|
+ const d = new Date();
|
|
|
+ d.setDate(today.getDate() - i);
|
|
|
+ dates.push(d.toISOString().split('T')[0].slice(5, 11));
|
|
|
+ }
|
|
|
+
|
|
|
+ return dates;
|
|
|
+ },
|
|
|
+
|
|
|
+ initEcharts(data) {
|
|
|
+ var times = this.getDate();
|
|
|
+ var data1 = data.map((item) => {
|
|
|
+ return item.sxdds || 0;
|
|
|
+ });
|
|
|
+ var data2 = data.map((item) => {
|
|
|
+ return item.fcdds || 0;
|
|
|
});
|
|
|
- var data1 = value.map((item) => {
|
|
|
- return item.completeOrder || 0;
|
|
|
+ var data3 = data.map((item) => {
|
|
|
+ return item.pjdds || 0;
|
|
|
});
|
|
|
- var data2 = value.map((item) => {
|
|
|
- return item.totalOrder || 0;
|
|
|
+ var data4 = data.map((item) => {
|
|
|
+ return item.zzdds || 0;
|
|
|
});
|
|
|
if (myChart4) {
|
|
|
myChart4.dispose();
|
|
|
}
|
|
|
- myChart4 = new echarts.init(document.getElementById('main3'));
|
|
|
+ myChart4 = new echarts.init(document.getElementById('orderEcharts1'));
|
|
|
myChart4.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',
|
|
@@ -67,6 +78,9 @@ export default {
|
|
|
color: '#8AB1DC',
|
|
|
},
|
|
|
},
|
|
|
+ textStyle: {
|
|
|
+ color: '#ffffff'
|
|
|
+ }
|
|
|
},
|
|
|
legend: {
|
|
|
icon: 'circle',
|
|
@@ -75,18 +89,16 @@ export default {
|
|
|
itemGap: 10,
|
|
|
top: '16',
|
|
|
right: '10',
|
|
|
- data: ['维修新增', '维修完成'],
|
|
|
+ data: ['新增销售单', '新增辅材单', '新增配件单', '新增增值单'],
|
|
|
textStyle: {
|
|
|
- fontSize: csize(16),
|
|
|
- color: '#8AB1DC',
|
|
|
+ color: '#ffffff',
|
|
|
},
|
|
|
},
|
|
|
grid: {
|
|
|
- x: csize(65),
|
|
|
- y: csize(50),
|
|
|
- x2: csize(30),
|
|
|
- y2: csize(30),
|
|
|
- containLabel: false,
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
},
|
|
|
xAxis: [
|
|
|
{
|
|
@@ -96,7 +108,6 @@ export default {
|
|
|
interval: Math.floor(times.length / 10),
|
|
|
showMinLabel: true, //是否显示最小 tick 的 label
|
|
|
showMaxLabel: true, //是否显示最大 tick 的 label
|
|
|
- fontSize: csize(12),
|
|
|
},
|
|
|
axisLine: {
|
|
|
show: false,
|
|
@@ -113,9 +124,11 @@ export default {
|
|
|
yAxis: [
|
|
|
{
|
|
|
type: 'value',
|
|
|
- name: '单',
|
|
|
+ name: '(单/台)',
|
|
|
nameTextStyle: {
|
|
|
- fontSize: csize(16),
|
|
|
+ color: "#aaa",
|
|
|
+ nameLocation: "start",
|
|
|
+ // align: 'right'
|
|
|
},
|
|
|
axisLine: {
|
|
|
show: false,
|
|
@@ -141,7 +154,7 @@ export default {
|
|
|
],
|
|
|
series: [
|
|
|
{
|
|
|
- name: '维修新增',
|
|
|
+ name: '新增销售单',
|
|
|
type: 'line',
|
|
|
smooth: true,
|
|
|
showSymbol: false,
|
|
@@ -160,11 +173,11 @@ export default {
|
|
|
[
|
|
|
{
|
|
|
offset: 0,
|
|
|
- color: 'rgba(137, 189, 27, 0.3)',
|
|
|
+ color: 'rgba(253, 173, 96, 0.3)',
|
|
|
},
|
|
|
{
|
|
|
offset: 0.8,
|
|
|
- color: 'rgba(137, 189, 27, 0)',
|
|
|
+ color: 'rgba(253, 173, 96, 0)',
|
|
|
},
|
|
|
],
|
|
|
false
|
|
@@ -175,13 +188,13 @@ export default {
|
|
|
},
|
|
|
itemStyle: {
|
|
|
normal: {
|
|
|
- color: '#F34799',
|
|
|
+ color: '#FDAD60',
|
|
|
},
|
|
|
},
|
|
|
data: data1,
|
|
|
},
|
|
|
{
|
|
|
- name: '维修完成',
|
|
|
+ name: '新增辅材单',
|
|
|
type: 'line',
|
|
|
smooth: true,
|
|
|
showSymbol: false,
|
|
@@ -200,11 +213,11 @@ export default {
|
|
|
[
|
|
|
{
|
|
|
offset: 0,
|
|
|
- color: 'rgba(0, 136, 212, 0.3)',
|
|
|
+ color: 'rgba(68, 226, 143, 0.3)',
|
|
|
},
|
|
|
{
|
|
|
offset: 0.8,
|
|
|
- color: 'rgba(0, 136, 212, 0)',
|
|
|
+ color: 'rgba(68, 226, 143, 0)',
|
|
|
},
|
|
|
],
|
|
|
false
|
|
@@ -215,11 +228,91 @@ export default {
|
|
|
},
|
|
|
itemStyle: {
|
|
|
normal: {
|
|
|
- color: '#38A0D6',
|
|
|
+ color: '#44E28F',
|
|
|
},
|
|
|
},
|
|
|
data: data2,
|
|
|
},
|
|
|
+ {
|
|
|
+ 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(160, 61, 239, 0.3)',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.8,
|
|
|
+ color: 'rgba(160, 61, 239, 0)',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.1)',
|
|
|
+ shadowBlur: 10,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#A03DEF',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: data3,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 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(65, 197, 226, 0.3)',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.8,
|
|
|
+ color: 'rgba(65, 197, 226, 0)',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.1)',
|
|
|
+ shadowBlur: 10,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#41C5E2',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: data4,
|
|
|
+ },
|
|
|
],
|
|
|
});
|
|
|
},
|