首页考勤统计
This commit is contained in:
@ -1,135 +1,161 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}" />
|
||||
<div :class="className" :style="{ height: height, width: width }" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
import echarts from "echarts";
|
||||
require("echarts/theme/macarons"); // echarts theme
|
||||
import resize from "./mixins/resize";
|
||||
import { listClass } from "@/api/system/class";
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
default: "chart",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
default: "100%",
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '350px'
|
||||
default: "350px",
|
||||
},
|
||||
autoResize: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
chartData: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
// chartData: {
|
||||
// type: Object,
|
||||
// required: true,
|
||||
// },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
chart: null,
|
||||
classOptions: null,
|
||||
expectedData: null,
|
||||
actualData: null,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
chartData: {
|
||||
deep: true,
|
||||
handler(val) {
|
||||
this.setOptions(val)
|
||||
}
|
||||
}
|
||||
// chartData: {
|
||||
// deep: true,
|
||||
// handler(val) {
|
||||
// this.setOptions(val);
|
||||
// },
|
||||
// },
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
})
|
||||
this.getClassList();
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
this.chart.dispose();
|
||||
this.chart = null;
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
this.setOptions(this.chartData)
|
||||
/** 查询班级信息列表 */
|
||||
async getClassList() {
|
||||
await listClass(this.queryParams).then((response) => {
|
||||
// console.log(response.rows);
|
||||
var items = [];
|
||||
var childcounts = [];
|
||||
var childcheckincounts = [];
|
||||
response.rows.forEach((element) => {
|
||||
items.push(element.bjmc);
|
||||
childcounts.push(element.childcount);
|
||||
childcheckincounts.push(element.childcheckincount);
|
||||
});
|
||||
this.classOptions = items;
|
||||
this.expectedData = childcounts;
|
||||
this.actualData = childcheckincounts;
|
||||
// console.log(this.classOptions);
|
||||
});
|
||||
this.initChart();
|
||||
},
|
||||
setOptions({ expectedData, actualData } = {}) {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, "macarons");
|
||||
this.setOptions();
|
||||
},
|
||||
setOptions() {
|
||||
this.chart.setOption({
|
||||
xAxis: {
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
data: this.classOptions,
|
||||
boundaryGap: false,
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: 10,
|
||||
right: 10,
|
||||
bottom: 20,
|
||||
top: 30,
|
||||
containLabel: true
|
||||
containLabel: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
type: "cross",
|
||||
},
|
||||
padding: [5, 10]
|
||||
padding: [5, 10],
|
||||
},
|
||||
yAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ['expected', 'actual']
|
||||
data: ["幼儿总数", "幼儿出勤人数"],
|
||||
},
|
||||
series: [{
|
||||
name: 'expected', itemStyle: {
|
||||
normal: {
|
||||
color: '#FF005A',
|
||||
lineStyle: {
|
||||
color: '#FF005A',
|
||||
width: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: expectedData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'cubicInOut'
|
||||
},
|
||||
{
|
||||
name: 'actual',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#3888fa',
|
||||
lineStyle: {
|
||||
color: '#3888fa',
|
||||
width: 2
|
||||
series: [
|
||||
{
|
||||
name: "幼儿总数",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#FF005A",
|
||||
lineStyle: {
|
||||
color: "#FF005A",
|
||||
width: 2,
|
||||
},
|
||||
},
|
||||
areaStyle: {
|
||||
color: '#f3f8ff'
|
||||
}
|
||||
}
|
||||
},
|
||||
smooth: true,
|
||||
type: "line",
|
||||
data: this.expectedData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: "cubicInOut",
|
||||
},
|
||||
data: actualData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
name: "幼儿出勤人数",
|
||||
smooth: true,
|
||||
type: "line",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#3888fa",
|
||||
lineStyle: {
|
||||
color: "#3888fa",
|
||||
width: 2,
|
||||
},
|
||||
areaStyle: {
|
||||
color: "#f3f8ff",
|
||||
},
|
||||
},
|
||||
},
|
||||
data: this.actualData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: "quadraticOut",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -13,11 +13,16 @@
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<bar-chart/>
|
||||
<bar-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="32">
|
||||
<el-row :gutter="30">
|
||||
<el-col :xs="24" :sm="24" :lg="24">
|
||||
<div class="chart-wrapper">
|
||||
<line-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
<!-- <el-calendar v-model="value" id="calendar">-->
|
||||
<!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
|
||||
<!--<template slot="dateCell" slot-scope="{date, data}">-->
|
||||
@ -49,6 +54,7 @@
|
||||
import RaddarChart from "./dashboard/RaddarChart";
|
||||
import PieChart from "./dashboard/PieChart";
|
||||
import BarChart from "./dashboard/BarChart";
|
||||
import LineChart from "./dashboard/LineChart";
|
||||
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
|
||||
//备用进行班级园历显示操作import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
|
||||
|
||||
@ -58,14 +64,16 @@ export default {
|
||||
components: {
|
||||
RaddarChart,
|
||||
PieChart,
|
||||
BarChart
|
||||
BarChart,
|
||||
LineChart,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
calendarData: [],
|
||||
value: new Date(),
|
||||
// 查询参数
|
||||
queryParams: {}
|
||||
queryParams: {},
|
||||
// lineChartData: lineChartData.newVisitis,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -78,7 +86,10 @@ export default {
|
||||
// this.calendarData = response.calendarData;
|
||||
// });
|
||||
// }
|
||||
}
|
||||
// handleSetLineChartData(type) {
|
||||
// this.lineChartData = lineChartData[type];
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -88,7 +99,6 @@ export default {
|
||||
background-color: rgb(240, 242, 245);
|
||||
position: relative;
|
||||
|
||||
|
||||
.el-card.is-always-shadow {
|
||||
box-shadow: none;
|
||||
border: 0;
|
||||
|
@ -33,8 +33,8 @@ module.exports = {
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
// target: `http://localhost:8083`,
|
||||
target: `http://120.53.14.147:9990/`,
|
||||
target: `http://localhost:8083`,
|
||||
//target: `http://120.53.14.147:9990/`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
Reference in New Issue
Block a user