1
huangxiaoqiang
2025-04-16 9757426ed62d7d4b1479dc0a431002f676983d6b
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
<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>
 
<script>
import Chart from "./chart.vue";
import axios from "@/api/ajax.js";
export default {
  data() {
    return {
      isEfficient: true,
      cdata: {
        xData: [],
        seriesData: [
          {
            value: 200,
            name: "已完成",
            itemStyle: { color: "#32c5e9" },
            label: {
              normal: {
                show: true,
                formatter: "{d}%",
                textStyle: {
                  fontSize: 16,
                  fontWeight: "bolder",
                },
              },
            },
          },
          { value: 100, name: "未完成", itemStyle: { color: "#00000000" } },
        ],
      },
    };
  },
  components: {
    Chart,
  },
  mounted() {
    this.GetEfficient();
    setInterval(() => {
      this.GetEfficient();
    }, 1000);
  },
  methods: {
    GetEfficient() {
      axios.post("/api/dt_product/GetDayGoals", null, "").then((x) => {
        if (x.data.status) {
          this.cdata.seriesData = [
            {
              value: x.data.data.day_actual, //已完成值data.day_target
              name: "已完成",
              itemStyle: { color: "#32c5e9" },
              label: {
                normal: {
                  show: true,
                  formatter: "{d}%",
                  textStyle: {
                    fontSize: 16,
                    fontWeight: "bolder",
                  },
                },
              },
            },
            {
              value: x.data.data.day_continued,//未完成值
              name: "未完成",
              itemStyle: { color: "#00000000" },
            },
          ];
          //开启定时器
          if (this.isEfficient) {
            setInterval(() => {
              this.isEfficient = false;
              this.GetEfficient();
            }, 10000);
          }
        }
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
.ec-font {
  font-size: 18px;
}
</style>