一日流程评估echart和刷新组件

This commit is contained in:
zhanglipeng 2021-04-25 11:02:50 +08:00
parent 480c520bbc
commit 473e269e65
4 changed files with 170 additions and 41 deletions

View File

@ -71,7 +71,7 @@
@pagination="getList"
/>
<div class="chart-wrapper">
<line-chart />
<line-chart :queryParams="queryParams" v-if="isRouterAlive" />
</div>
</div>
</template>
@ -82,12 +82,14 @@ import { listDayflowassessmentPjf } from "@/api/benyi/dayflowassessment";
import { listClass } from "@/api/system/class";
export default {
name: "Dayflowassessment",
name: "DayflowassessmentClassAvg",
components: {
LineChart,
},
data() {
return {
//
isRouterAlive: true,
//
loading: true,
//
@ -166,6 +168,8 @@ export default {
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.isRouterAlive = false;
this.$nextTick(() => (this.isRouterAlive = true));
},
/** 重置按钮操作 */
resetQuery() {

View File

@ -48,12 +48,7 @@
</el-form>
<el-table v-loading="loading" border :data="dayflowassessmentList">
<el-table-column
label="评估对象"
align="center"
prop="pgdxxm"
fixed
/>
<el-table-column label="评估对象" align="center" prop="pgdxxm" fixed />
<el-table-column label="最终得分" align="center" prop="bjpjf" />
<el-table-column label="早间接待" align="center" prop="zjjdpjf" />
<el-table-column label="用餐" align="center" prop="ycpjf" />
@ -83,21 +78,28 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div class="chart-wrapper">
<line-chart :queryParams="queryParams" v-if="isRouterAlive" />
</div>
</div>
</template>
<script>
import {
listDayflowassessmentTeacherAvg,
} from "@/api/benyi/dayflowassessment";
import LineChart from "../../dashboard/LineChartTeacherDayFlowAvg";
import { listDayflowassessmentTeacherAvg } from "@/api/benyi/dayflowassessment";
import { listClass } from "@/api/system/class";
import { listUser } from "@/api/system/user";
import { listDetail, getDetail } from "@/api/benyi/dayflow/dayflowmanger";
export default {
name: "Dayflowassessment",
name: "DayflowassessmentTeacherDayFlowAvg",
components: {
LineChart,
},
data() {
return {
isRouterAlive: true,
//
loading: true,
//
@ -158,7 +160,9 @@ export default {
/** 查询幼儿园一日流程评估列表 */
getList() {
this.loading = true;
listDayflowassessmentTeacherAvg(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
listDayflowassessmentTeacherAvg(
this.addDateRange(this.queryParams, this.dateRange)
).then((response) => {
this.dayflowassessmentList = response.rows;
this.total = response.total;
this.loading = false;
@ -192,6 +196,8 @@ export default {
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.isRouterAlive = false;
this.$nextTick(() => (this.isRouterAlive = true));
},
/** 重置按钮操作 */
resetQuery() {

View File

@ -6,7 +6,6 @@
import echarts from "echarts";
require("echarts/theme/macarons"); // echarts theme
import resize from "./mixins/resize";
import { listClass } from "@/api/system/class";
import { listDayflowassessmentPjf } from "@/api/benyi/dayflowassessment";
export default {
@ -24,6 +23,7 @@ export default {
type: String,
default: "350px",
},
queryParams: {},
autoResize: {
type: Boolean,
default: true,
@ -38,7 +38,6 @@ export default {
chart: null,
classOptions: null,
expectedData: null,
actualData: null,
};
},
watch: {
@ -65,18 +64,15 @@ export default {
/** 查询班级信息列表 */
async getClassList() {
await listDayflowassessmentPjf(this.queryParams).then((response) => {
console.log(response.rows);
//console.log(response.rows);
var items = [];
var childcounts = [];
var childcheckincounts = [];
response.rows.forEach((element) => {
items.push(element.byClass.bjmc);
childcounts.push(element.bjpjf);
childcheckincounts.push(element.childcheckincount);
});
this.classOptions = items;
this.expectedData = childcounts;
this.actualData = childcheckincounts;
// console.log(this.classOptions);
});
this.initChart();
@ -121,7 +117,7 @@ export default {
},
series: [
{
name: "幼儿总数",
name: "班级平均分",
itemStyle: {
normal: {
color: "#FF005A",
@ -137,26 +133,6 @@ export default {
animationDuration: 2800,
animationEasing: "cubicInOut",
},
{
name: "幼儿出勤人数",
smooth: true,
type: "line",
itemStyle: {
normal: {
color: "#3888fa",
lineStyle: {
color: "#3888fa",
width: 2,
},
areaStyle: {
color: "#f3f8ff",
},
},
},
data: this.actualData,
animationDuration: 2800,
animationEasing: "quadraticOut",
},
],
});
},

View File

@ -0,0 +1,143 @@
<template>
<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 { listDayflowassessmentTeacherAvg } from "@/api/benyi/dayflowassessment";
export default {
mixins: [resize],
props: {
className: {
type: String,
default: "chart",
},
width: {
type: String,
default: "100%",
},
height: {
type: String,
default: "350px",
},
queryParams: {},
autoResize: {
type: Boolean,
default: true,
},
// chartData: {
// type: Object,
// required: true,
// },
},
data() {
return {
chart: null,
classOptions: null,
expectedData: null,
};
},
watch: {
// chartData: {
// deep: true,
// handler(val) {
// this.setOptions(val);
// },
// },
},
mounted() {
this.$nextTick(() => {
this.getClassList();
});
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
/** 查询班级信息列表 */
async getClassList() {
await listDayflowassessmentTeacherAvg(this.queryParams).then(
(response) => {
console.log(this.queryParams);
var items = [];
var childcounts = [];
response.rows.forEach((element) => {
items.push(element.pgdxxm);
childcounts.push(element.bjpjf);
});
this.classOptions = items;
this.expectedData = childcounts;
// console.log(this.classOptions);
}
);
this.initChart();
},
initChart() {
this.chart = echarts.init(this.$el, "macarons");
this.setOptions();
},
setOptions() {
this.chart.setOption({
title: {
text: "一日流程评估教师平均分",
},
xAxis: {
data: this.classOptions,
boundaryGap: false,
axisTick: {
show: false,
},
},
grid: {
left: 10,
right: 10,
bottom: 20,
top: 30,
containLabel: true,
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
},
padding: [5, 10],
},
yAxis: {
axisTick: {
show: false,
},
},
legend: {
data: this.classOptions,
},
series: [
{
name: "教师平均分",
itemStyle: {
normal: {
color: "#FF005A",
lineStyle: {
color: "#FF005A",
width: 2,
},
},
},
smooth: true,
type: "line",
data: this.expectedData,
animationDuration: 2800,
animationEasing: "cubicInOut",
},
],
});
},
},
};
</script>