ke_junjie
2025-06-04 bb6e2230bb8ded3c5546bc4e4c282ee343754475
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
<template>
  <!-- 任务节拍 -->
  <div id="Taskbeat" class="global-content">
    <div class="width flex align-center justify-end">
      <label class="color909399 fontsiez1rem">查询日期:</label>
      <el-date-picker
        class="margin-right"
        size="mini"
        value-format="yyyy-MM-dd"
        v-model="pickertime"
        type="date"
        placeholder="选择日期"
      >
      </el-date-picker>
      <el-button type="primary" size="mini" @click="inquer">查询</el-button>
      <el-button type="primary" size="mini" @click="linkto">跳转</el-button>
    </div>
    <div class="width applyheight overflow margin-top4">
      <task-echart class="width height" :chartData="chartData" :colorList="colorList" :yTotals="yMax" />
      <!-- <div class="width height" ref="taskbeatEcharts"></div> -->
    </div>
  </div>
</template>
 
<script>
import { GetTaskBeatAnalysis } from '@/api/reportforms';
import { GetDateStr } from '@/utils/date';
import TaskEchart from '@/views/Home/components/meterEchart.vue';
export default {
  data() {
    return {
      pickertime: GetDateStr(-1),
      chartData: {},
            yMax:-1,
      colorList: ['#0090FF', '#36CE9E', '#FFC005', '#FF515A', '#8B5CFF', '#00CA69']
    };
  },
  components: { TaskEchart },
  computed: {},
  mounted() {
    this.GetTaskBeatAnalysis();
  },
  methods: {
    inquer() {
      this.GetTaskBeatAnalysis();
    },
    //跳转
    linkto() {
      const { href } = this.$router.resolve({
        path: '/taskbeat'
      });
      window.open(href, '_blank');
    },
    GetTaskBeatAnalysis() {
      GetTaskBeatAnalysis({ startTime: this.pickertime }).then(res => {
                this.yMax = res.maxNum
                let stepTotal = 0;
                res.data[1].xdata = res.data[1].xdata.map((mapObj,mapIndex)=>{
                    stepTotal = stepTotal + Number(mapObj);
                    let rateVal = (this.yMax>0?Number((stepTotal/this.yMax*100).toFixed(2)):0)
                    res.data[0].xdata[mapIndex] = rateVal
                    return mapObj
                })
        this.chartData = res;
      });
    }
  }
};
</script>
 
<style lang="scss" scoped>
#Taskbeat {
}
</style>