数据看板

This commit is contained in:
lSun 2024-12-23 18:53:43 +08:00
parent 49e79471da
commit 73ac8490cb
1 changed files with 117 additions and 111 deletions

View File

@ -1,132 +1,138 @@
<template> <template>
<div class="content"> <div class="content">
<div class="content-box"> <div class="content-box">
<div class="title-box"> <div class="title-box">
<div style="margin-left: 10px;font-size: 22px;font-weight: bold;">当月异常统计</div> <div style="margin-left: 10px;font-size: 22px;font-weight: bold;">当月异常统计</div>
</div> </div>
<div class="chart-box" @click="toggleDialog(12)"> <div class="chart-box" @click="toggleDialog(12)">
<div id="barBox" style="width: 100%;height: 400px;"></div> <div id="barBox" style="width: 100%;height: 400px;"></div>
</div> </div>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts';
export default { export default {
components: { components: {},
name: 'bottomTwo',
props: {
pageData: {
// required: true,
type: Object,
default: {
addressErrorNum: 0,
earlyNum: 0,
einErrorNum: 0,
lateNum: 0,
leaveNum: 0,
skippingNum: 0
}
},
}, },
name: 'bottomTwo', data() {
props: { return {
pageData: { pieCharts: null,
// required: true, dateTime: "",
type: Object, barYData: [22, 18, 11, 23, 29, 33]
default:{ }
addressErrorNum:0, },
earlyNum:0, watch: {
einErrorNum:0, pageData: {
lateNum:0, handler() {
leaveNum:0,
skippingNum:0
}
},
},
data() {
return {
pieCharts: null,
dateTime:"",
barYData:[22, 18, 11, 23, 29, 33]
}
},
watch: {
pageData: {
handler() {
this.getInitData()
},
immediate: true
}
},
created() {
},
mounted() {
this.getInitData() this.getInitData()
}, },
methods: { immediate: true
getInitData(){ }
setTimeout(()=>{ },
this.barYData=[Number(this.pageData.lateNum),Number(this.pageData.earlyNum),Number(this.pageData.skippingNum),Number(this.pageData.leaveNum),Number(this.pageData.addressErrorNum),Number(this.pageData.einErrorNum)] created() {
console.log(this.barYData)
this.initChart()
},500)
}, },
initChart(){ mounted() {
this.pieCharts = echarts.init(document.getElementById('barBox')) this.getInitData()
var option = { },
grid: { methods: {
left: '5%', getInitData() {
right: '5%', setTimeout(() => {
bottom: '5%', this.barYData = [Number(this.pageData.lateNum), Number(this.pageData.earlyNum), Number(this.pageData.skippingNum), Number(this.pageData.leaveNum), Number(this.pageData.addressErrorNum), Number(this.pageData.einErrorNum)]
top: '5%', console.log(this.barYData)
containLabel: true, this.initChart()
}, }, 500)
xAxis: {
data: ['迟到', '早退', '旷工', '请假', '打卡地异常', '出入异常']
},
yAxis: {},
series: [{
type: 'bar',
data:this.barYData,
itemStyle:{
color:"#157DF3"
}
}]
};
this.pieCharts.setOption(option)
//
this.pieCharts.on('click', function (params) {
//
console.log(params);
//
//
// alert('' + params.name);
});
},
toggleDialog(v) {
this.$emit('openDialog', { order: v })
},
}, },
initChart() {
this.pieCharts = echarts.init(document.getElementById('barBox'))
var option = {
grid: {
left: '5%',
right: '5%',
bottom: '5%',
top: '5%',
containLabel: true,
},
xAxis: {
data: ['迟到', '早退', '旷工', '请假', '打卡地异常', '出入异常']
},
yAxis: {},
series: [{
type: 'bar',
data: this.barYData,
itemStyle: {
color: "#157DF3"
},
label: {
show: true, //
position: 'top', //
formatter: '{c}' //
}
}]
};
this.pieCharts.setOption(option)
//
this.pieCharts.on('click', function (params) {
//
console.log(params);
//
//
// alert('' + params.name);
});
},
toggleDialog(v) {
this.$emit('openDialog', {order: v})
},
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content{ .content {
width: 100%;
height: 100%;
// padding-top: 20px;
.content-box {
width: 100%; width: 100%;
height: 100%; height: 100%;
// padding-top: 20px; padding: 10px;
.content-box{ background-color: #fff;
width: 100%; border-radius: 10px;
height: 100%; }
padding: 10px;
background-color: #fff;
border-radius: 10px;
}
.title-box{
width: 100%;
height: 30px;
display: flex;
justify-content: space-between;
align-items: center;
} .title-box {
.chart-box{ width: 100%;
width: 100%; height: 30px;
height: 450px; display: flex;
} justify-content: space-between;
align-items: center;
}
.chart-box {
width: 100%;
height: 450px;
}
} }