<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>
|