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
| <template>
| <div>
| <Chart :cdata="cdata" />
| </div>
| </template>
|
| <script>
| import Chart from './chart.vue'
| import axios from 'axios'
| export default {
| data () {
| return {
| cdata: {
| category: [
| ],
| lineData: [
| ],
| barData: [
| ],
| rateData: [],
| locationData:[]
| }
| };
| },
| components: {
| Chart,
| },
| mounted () {
| 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()
| }, 3000);
| },
| //获取立库货位数据
| GetLocationData() {
| var _this=this;
| axios.post("http://10.78.70.112:8098/api/Dt_Repair/NumberOverhauls").then((x) => {
| this.cdata.category=[];
| this.cdata.barData=[];
| this.cdata.lineData=[];
| 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);
| }
| })
| },
| }
| };
| </script>
|
| <style lang="scss" scoped>
|
| </style>
|
|