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
<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>
 
<script>
import Chart from "./chart.vue";
import axios from "@/api/ajax.js"
export default {
  data() {
    return {
      isActivation: true,
      datelist: [ "2024-06-06", "2024-06-05", "2024-06-04", "2024-06-03", "2024-06-02", "2024-06-01", "2024-05-31" ],
      cdata: {
        category: ["06-01", "06-02", "06-03", "06-04", "06-05", "06-06", "06-07"],
        actionData: [100, 100, 100, 100, 100, 100, 100],
      },
    };
  },
  components: {
    Chart,
  },
  mounted() {
    this.GetUtilization();
  },
  methods: {
    GetUtilization() {
      axios.post("/api/dt_WorkOrder/getUtilization", null, "").then((x) => {
        if (x.data.status) {
          var data = x.data.data;
          if(data==null){
            return;
          }
          var dateslist=[];
          data.datelist.forEach(x=>{
            var date=x.substring(x.indexOf("-")+1,x.length);
            dateslist.push(date);
          });
          this.cdata={
            category:dateslist.reverse(),
            actionData: data.perdatalist.reverse()
          };
          if(this.isActivation){
            setInterval(() => {
              this.GetUtilization();
            },5000);
            this.isActivation=false;
          }
        }
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
</style>