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
| <template>
| <div>
| <Chart :cdata="cdata" />
| </div>
| </template>
|
| <script>
| import Chart from './chart.vue'
| export default {
| data () {
| return {
| cdata: {
| category: ['2024-9-18','2024-9-14','2024-9-12','2024-9-11','2024-9-10','2024-9-9',],
| 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(){
| for (let i = 0; i < this.cdata.lineData.length ; i++) {
| let rate = this.cdata.lineData[i];
| this.cdata.rateData.push(rate.toFixed(2));
| }
| console.log("11111111111")
| // 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: []
| }
|
| console.log(this.cdata.rateData)
| })
| },
| changeTiming() {
| setInterval(() => {
| this.cdata.rateData = [];
| this.tops();
| }, 60000)
| },
| }
| };
| </script>
|
| <style lang="scss" scoped>
| </style>
|
|