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
| <template>
| <div>
| <Chart :cdata="cdata" />
| </div>
| </template>
|
| <script>
| import Chart from './chart.vue'
| export default {
| data () {
| return {
| cdata: {
| category: [
| ],
| lineData: [
| ],
| barData: [
| ],
| rateData: [],
| locationData:[]
| }
| };
| },
| components: {
| Chart,
| },
| mounted () {
| // this.GetLocationData();
| 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()
| }, 40000);
| },
| //获取立库货位数据
| GetLocationData(){
| var _this=this;
| this.cdata.category=[];
| this.cdata.barData=[];
| this.cdata.lineData=[];
| this.$http.post("/api/Largescreen/fifteenTotal_quantityndex","查询中...").then((x)=>{
| for (let i = 0; i < x.data.daily_statistics.length; i++) {
| let dailyData = x.data.daily_statistics[i];
|
| this.cdata.category.push(dailyData.date);
| this.cdata.barData.push(dailyData.day_outbound);
| this.cdata.lineData.push(dailyData.day_inventory);
| }
| // for (let i = 0; i <= this.cdata.barData.length -1; i++) {
| // if(this.cdata.rateData.length!=this.cdata.barData.length){
| // let rate = this.cdata.barData[i] / this.cdata.lineData[i];
| // this.cdata.rateData.push(rate.toFixed(2));
| // }
| // }
| }).catch((x)=>{
| console.log(x);
| })
| },
|
| }
| };
| </script>
|
| <style lang="scss" scoped>
|
| </style>
|
|