1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
| <template>
| <div>
| <Chart :cdata="cdata" />
| </div>
| </template>
|
| <script>
| import Chart from './chart.vue'
| import axios from 'axios';
| export default {
| data() {
| return {
| cdata: {
| category: [
| "12-15",
| "12-16",
| "12-17",
| "12-18",
| "12-19",
| ],
| lineData: [
| 25,
| 50,
| 75,
| 101,
| 101,
| ],
| lineData2: [
| 99,
| 99,
| 99,
| 99,
| 101,
| ],
| barData: [
| 100,
| 100,
| 100,
| 100,
| 101,
| ],
| barData2: [
| 100,
| 100,
| 100,
| 100,
| 101,
| ],
| rateData: [],
| locationData:[]
| }
| };
| },
| components: {
| Chart,
| },
| mounted() {
| // this.changeTiming()
| this.setData();
| },
| methods: {
| // 根据自己的业务情况修改
| // setData () {
| // for (let i = 0; i < this.cdata.barData.length -1; i++) {
| // let rate = this.cdata.barData[i] / this.cdata.lineData[i];
| // this.cdata.rateData.push(rate.toFixed(2));
| // }
| // },
| setData(){
| this.GetLocationData()
| // setInterval(() => {
| // this.GetLocationData()
| // }, 36000);
| },
| //获取立库货位数据
| GetLocationData(){
| var _this=this;
| this.cdata.category=[];
| this.cdata.barData=[];
| this.cdata.barData2=[];
| this.cdata.lineData=[];
| this.cdata.lineData2=[];
| axios.get("http://127.0.0.1:9291/api/Task_Hty/fifteenTotal_quantityndex").then((x)=>{
| console.log(x)
| for (let i = 0; i < x.data.data.daily_statistics.length; i++) {
| let dailyData = x.data.data.daily_statistics[i];
|
| this.cdata.category.push(dailyData.date);
| this.cdata.lineData.push(dailyData.materialCuttingOutlets);
| this.cdata.lineData2.push(dailyData.edgeBandingCuttingOutlets);
| this.cdata.barData.push(dailyData.edgeSandingCuttingOutlets);
| this.cdata.barData2.push(dailyData.drillingCuttingPositions);
| }
| console.log(this.cdata.barData)
| }).catch((x)=>{
| console.log(x);
| })
| },
|
| }
| };
| </script>
|
| <style lang="scss" scoped></style>
|
|