懒羊羊
2023-12-12 776fbe36aec576c164c9edfe6be13d833eaef7b9
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>
 
<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        // category: [
        //   "市区",
        //   "万州",
        //   "江北",
        //   "南岸",
        //   "北碚",
        //   "綦南",
        //   "长寿",
        //   "永川",
        //   "璧山",
        //   "江津",
        //   "城口",
        //   "大足",
        //   "垫江",
        //   "丰都",
        //   "奉节",
        //   "合川",
        //   "江津区",
        //   "开州",
        //   "南川",
        //   "彭水",
        //   "黔江",
        //   "石柱",
        //   "铜梁",
        //   "潼南",
        //   "巫山",
        //   "巫溪",
        //   "武隆",
        //   "秀山",
        //   "酉阳",
        //   "云阳",
        //   "忠县",
        //   "川东",
        //   "检修"
        // ],
        // lineData: [
        //   18092,
        //   20728,
        //   24045,
        //   28348,
        //   32808,
        //   36097,
        //   39867,
        //   44715,
        //   48444,
        //   50415,
        //   56061,
        //   62677,
        //   59521,
        //   67560,
        //   18092,
        //   20728,
        //   24045,
        //   28348,
        //   32808,
        //   36097,
        //   39867,
        //   44715,
        //   48444,
        //   50415,
        //   36097,
        //   39867,
        //   44715,
        //   48444,
        //   50415,
        //   50061,
        //   32677,
        //   49521,
        //   32808
        // ],
        // barData: [
        //   4600,
        //   5000,
        //   5500,
        //   6500,
        //   7500,
        //   8500,
        //   9900,
        //   12500,
        //   14000,
        //   21500,
        //   23200,
        //   24450,
        //   25250,
        //   33300,
        //   4600,
        //   5000,
        //   5500,
        //   6500,
        //   7500,
        //   8500,
        //   9900,
        //   22500,
        //   14000,
        //   21500,
        //   8500,
        //   9900,
        //   12500,
        //   14000,
        //   21500,
        //   23200,
        //   24450,
        //   25250,
        //   7500
        // ],
        category: ['2023-11-8','2023-11-7','2023-11-6','2023-11-5','2023-11-4','2023-11-3',],
        lineData: [50,34,56,22,79,32],
        barData: [22,10,22,3,50,15],
        rateData: [] //完成率
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
    this.tops();
    this.changeTiming();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length ; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
 
    tops(){
      // let that = this;
      this.$http.get('http://192.168.0.249:8083/productionOrdeInfo/bottomLeftChart')
          .then((response)=>{
            this.cdata = {
              barData: response.data.data.barData,
              lineData: response.data.data.lineData,
              category: response.data.data.category,
              rateData: []
            }
            for (let i = 0; i < this.cdata.barData.length ; i++) {
              let rate = this.cdata.barData[i] / this.cdata.lineData[i];
              this.cdata.rateData.push(rate.toFixed(2));
            }
          })
    },
    changeTiming() {
      setInterval(() => {
        this.cdata.rateData = [];
        this.tops();
      }, 60000)
    },
  }
};
</script>
 
<style lang="scss" scoped>
</style>