liulijun
2025-11-17 da4257bc32483409af02a06dd342c6981ec786ec
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 "@/api/ajax.js";
export default {
  data() {
    return {
      isProductQuality: true,
      cdata: {
        // category: ["0.5","1", "1.5", "2", "2.5",
        // "3", "3.5","4", "4.5", "5",
        // "5.5","6","6.5","7","7.5",
        // "8", "8.5", "9", "9.5", "10",
        // "10.5", "11","11.5", "12","12.5","13", "13.5", "14", "14.5",
        // "15", "15.5","16", "16.5", "17",
        // "17.5","18","18.5","19","19.5",
        // "20", "20.5", "21", "21.5", "22",
        // "22.5", "23","23.5", "24","24.5","25", "25.5", "26", "26.5",
        // "27", "27.5","28", "28.5", "29",
        // "29.5","30","30.5","31","31.5",
        // "32", "32.5", "33", "33.5", "34",
        // "34.5", "35","35.5", "36","36.5", "37","37.5", "38","38.5","39", "39.5", "40", "40.5",
        // "41", "41.5","42", "42.5", "43",
        // "43.5","44","44.5","45","45.5",
        // "46", "46.5", "47", "47.5", "48"],
        pressData: [[0.5,29],[1,29.5],[1.5,30],[2,30],[2.5,30.5],[3.5,28],[18,30]], //压机历史值
      },
      IsPrevalue:true,
      orderID:""
    };
  },
  components: {
    Chart,
  },
  mounted() {
    this.GetPrevalues();
  },
  methods: {
    GetPrevalues() {
      axios.post("/api/dt_WorkOrder/getPLCData", null, "").then((res) => {
        if (res.data.status) {
          var data=res.data.data.prevalus;
          var id=res.data.data.workorderid;
          if(data==null && id!=this.orderID)
            return console.log("data值为空");
          this.orderID=id;
          this.cdata.pressData=data;
        }
        if(this.IsPrevalue){
            setInterval(() => {
              this.GetPrevalues();
            },3333);
            this.IsPrevalue=false;
          }
      });
    }
  },
};
</script>
<style lang="scss" scoped>
</style>