KindergartenUI/src/views/system/heightAndWeight/index.vue

370 lines
10 KiB
Vue
Raw Normal View History

2022-08-22 09:05:11 +08:00
<template>
<div class="app-container">
2023-04-14 14:46:32 +08:00
<el-form ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<kindergarten @kinbatlist="kinbatlist" style="width: 500px; display: inline"></kindergarten>
2022-08-31 10:12:22 +08:00
<el-form-item>
2023-04-14 14:46:32 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查看</el-button>
2022-08-22 09:05:11 +08:00
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
2023-04-14 14:46:32 +08:00
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
2022-08-22 09:05:11 +08:00
</el-row>
<el-row v-show="itemshow">
2023-04-14 14:46:32 +08:00
<el-col :span="24" class="card-box" style>
2022-08-22 09:05:11 +08:00
<el-card>
<div style="display: flex; margin-top: 40px">
2023-04-14 14:46:32 +08:00
<div slot="header" style="width: 50%; text-align: center; font-size: 18px">
2022-08-22 09:05:11 +08:00
<span>各年级男/女平均身高(cm)</span>
<div
id="main"
style="
width: 500px;
height: 300px;
margin: 0 auto;
padding-top: 40px;
"
></div>
</div>
2023-04-14 14:46:32 +08:00
<div slot="header" style="width: 50%; text-align: center; font-size: 18px">
2022-08-22 09:05:11 +08:00
<span>各年级男/女平均体重(kg)</span>
<div
id="main2"
style="
width: 500px;
height: 300px;
margin: 0 auto;
padding-top: 40px;
"
></div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20" v-if="itemshow2">
<el-col :span="24" :offset="0">
<el-card>
<div slot="header" style="text-align: center">
2023-04-14 14:46:32 +08:00
<img style="width: 40px" src="@/icons/笑脸.png" alt />
2022-08-22 09:05:11 +08:00
2023-04-14 14:46:32 +08:00
<div>
<!-- card title -->
该批次暂无数据
</div>
2022-08-22 09:05:11 +08:00
</div>
<!-- card body -->
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import * as echarts from "echarts";
2022-08-31 10:12:22 +08:00
import { getRoleInfo } from "@/api/system/quality";
2022-10-20 15:36:56 +08:00
import { heightAndWeightanalysis } from "@/api/system/heightAndWeight";
2022-08-31 10:12:22 +08:00
import Kindergarten from "../../assembly/kindergarten.vue";
2022-08-22 09:05:11 +08:00
export default {
name: "KindergartenPhysicalTest",
2022-08-31 10:12:22 +08:00
components: { Kindergarten },
2022-08-22 09:05:11 +08:00
data() {
return {
itemshow: false,
itemshow2: false,
// 显示搜索条件
showSearch: true,
analysislist: [],
//查询传值
analysisqueryParams: {
2022-08-25 14:24:37 +08:00
kindergartenId: "",
2023-04-14 14:46:32 +08:00
batchCode: ""
2022-08-25 14:24:37 +08:00
// kindergartenId: "18",
// batchCode: "PC202208030005",
2023-04-14 14:46:32 +08:00
}
2022-08-22 09:05:11 +08:00
};
},
mounted() {},
created() {
this.getList();
},
methods: {
2022-08-31 10:12:22 +08:00
handleQuery() {
this.analysisinfo();
},
kinbatlist(kindergartenId, batchCode) {
this.analysisqueryParams.kindergartenId = kindergartenId;
this.analysisqueryParams.batchCode = batchCode;
if (batchCode == "请选择批次") {
this.analysisqueryParams.batchCode = "";
}
},
2022-08-22 09:05:11 +08:00
analysisinfo() {
2023-04-14 14:46:32 +08:00
heightAndWeightanalysis(this.analysisqueryParams).then(res => {
2022-08-23 11:12:00 +08:00
if (!res.data) {
2022-08-25 14:24:37 +08:00
this.itemshow2 = true;
this.itemshow = false;
2022-08-23 11:12:00 +08:00
} else {
this.analysislist = res.data;
var yclassname = [];
var grilsheight = [];
var boyheight = [];
var boyweight = [];
var grilsweight = [];
2022-08-22 09:05:11 +08:00
2022-08-23 11:12:00 +08:00
for (var i = 0; i < this.analysislist.length; i++) {
2023-04-14 14:46:32 +08:00
this.analysislist[i].weightAndHeightAvgScoreList.forEach(el => {
2022-08-23 11:12:00 +08:00
if (el.itemCode == "H001" && el.studentSex == "MALE") {
boyheight.push(el.averageScore);
} else if (el.itemCode == "H001" && el.studentSex == "FEMALE") {
grilsheight.push(el.averageScore);
} else if (el.itemCode == "W001" && el.studentSex == "FEMALE") {
grilsweight.push(el.averageScore);
} else if (el.itemCode == "W001" && el.studentSex == "MALE") {
boyweight.push(el.averageScore);
}
});
if (grilsheight.length == i) {
grilsheight.push(0);
}
if (boyheight.length == i) {
boyheight.push(0);
}
if (boyweight.length == i) {
boyweight.push(0);
}
if (grilsweight.length == i) {
grilsweight.push(0);
2022-08-22 09:05:11 +08:00
}
}
2023-04-14 14:46:32 +08:00
this.analysislist.forEach(e => {
2022-08-23 11:12:00 +08:00
yclassname.push(e.className);
});
var app = {};
var myChart = echarts.init(document.getElementById("main"));
var myChart2 = echarts.init(document.getElementById("main2"));
var option;
var option2;
const posList = [
"left",
"right",
"top",
"bottom",
"inside",
"insideTop",
"insideLeft",
"insideRight",
"insideBottom",
"insideTopLeft",
"insideTopRight",
"insideBottomLeft",
2023-04-14 14:46:32 +08:00
"insideBottomRight"
2022-08-23 11:12:00 +08:00
];
app.configParameters = {
rotate: {
min: 0,
2023-04-14 14:46:32 +08:00
max: 90
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
align: {
options: {
left: "left",
center: "center",
2023-04-14 14:46:32 +08:00
right: "right"
}
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
verticalAlign: {
options: {
top: "top",
middle: "middle",
2023-04-14 14:46:32 +08:00
bottom: "bottom"
}
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
position: {
2023-04-14 14:46:32 +08:00
options: posList.reduce(function(map, pos) {
2022-08-23 11:12:00 +08:00
map[pos] = pos;
return map;
2023-04-14 14:46:32 +08:00
}, {})
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
distance: {
min: 0,
2023-04-14 14:46:32 +08:00
max: 100
}
2022-08-23 11:12:00 +08:00
};
app.config = {
rotate: 0,
align: "center",
verticalAlign: "middle",
position: "top",
distance: 15,
2023-04-14 14:46:32 +08:00
onChange: function() {
2022-08-23 11:12:00 +08:00
const labelOption = {
rotate: app.config.rotate,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
position: app.config.position,
2023-04-14 14:46:32 +08:00
distance: app.config.distance
2022-08-23 11:12:00 +08:00
};
myChart.setOption({
series: [
{
2023-04-14 14:46:32 +08:00
label: labelOption
2022-08-23 11:12:00 +08:00
},
{
2023-04-14 14:46:32 +08:00
label: labelOption
2022-08-23 11:12:00 +08:00
},
{
2023-04-14 14:46:32 +08:00
label: labelOption
2022-08-23 11:12:00 +08:00
},
{
2023-04-14 14:46:32 +08:00
label: labelOption
}
]
2022-08-23 11:12:00 +08:00
});
2023-04-14 14:46:32 +08:00
}
2022-08-23 11:12:00 +08:00
};
const labelOption = {
show: true,
position: app.config.position,
distance: app.config.distance,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
rotate: app.config.rotate,
formatter: "{c}",
2023-07-20 11:41:34 +08:00
fontSize: 14,
2022-08-23 11:12:00 +08:00
rich: {
2023-04-14 14:46:32 +08:00
name: {}
}
2022-08-23 11:12:00 +08:00
};
option = {
tooltip: {
trigger: "axis",
axisPointer: {
2023-04-14 14:46:32 +08:00
type: "shadow"
}
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
legend: {
2023-04-14 14:46:32 +08:00
data: ["男", "女"]
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
xAxis: [
{
type: "category",
axisTick: { show: false },
2023-04-14 14:46:32 +08:00
data: yclassname
}
2022-08-23 11:12:00 +08:00
],
yAxis: [
{
2023-04-14 14:46:32 +08:00
type: "value"
}
2022-08-23 11:12:00 +08:00
],
series: [
{
name: "男",
type: "bar",
2022-08-31 15:29:30 +08:00
barWidth: 35,
2022-08-23 11:12:00 +08:00
color: "#00B050",
label: labelOption,
emphasis: {
2023-04-14 14:46:32 +08:00
focus: "series"
2022-08-23 11:12:00 +08:00
},
2023-04-14 14:46:32 +08:00
data: boyheight
2022-08-23 11:12:00 +08:00
},
{
name: "女",
type: "bar",
2022-08-31 15:29:30 +08:00
barWidth: 35,
2022-08-23 11:12:00 +08:00
color: "red",
label: labelOption,
emphasis: {
2023-04-14 14:46:32 +08:00
focus: "series"
2022-08-23 11:12:00 +08:00
},
2023-04-14 14:46:32 +08:00
data: grilsheight
}
]
2022-08-23 11:12:00 +08:00
};
option2 = {
tooltip: {
trigger: "axis",
axisPointer: {
2023-04-14 14:46:32 +08:00
type: "shadow"
}
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
legend: {
2023-04-14 14:46:32 +08:00
data: ["男", "女"]
2022-08-22 09:05:11 +08:00
},
2022-08-23 11:12:00 +08:00
xAxis: [
{
type: "category",
axisTick: { show: false },
2023-04-14 14:46:32 +08:00
data: yclassname
}
2022-08-23 11:12:00 +08:00
],
yAxis: [
{
2023-04-14 14:46:32 +08:00
type: "value"
}
2022-08-23 11:12:00 +08:00
],
series: [
{
name: "男",
2022-08-31 15:29:30 +08:00
barWidth: 35,
2022-08-23 11:12:00 +08:00
type: "bar",
color: "#00B050",
label: labelOption,
emphasis: {
2023-04-14 14:46:32 +08:00
focus: "series"
2022-08-23 11:12:00 +08:00
},
2023-04-14 14:46:32 +08:00
data: boyweight
2022-08-23 11:12:00 +08:00
},
{
2022-08-31 15:29:30 +08:00
barWidth: 35,
2022-08-23 11:12:00 +08:00
name: "女",
type: "bar",
color: "red",
label: labelOption,
emphasis: {
2023-04-14 14:46:32 +08:00
focus: "series"
2022-08-23 11:12:00 +08:00
},
2023-04-14 14:46:32 +08:00
data: grilsweight
}
]
2022-08-23 11:12:00 +08:00
};
option && myChart.setOption(option);
option2 && myChart2.setOption(option2);
this.itemshow = true;
this.itemshow2 = false;
}
2022-08-22 09:05:11 +08:00
});
},
getList() {
//用户权限
2023-04-14 14:46:32 +08:00
getRoleInfo().then(res => {
2022-08-29 11:51:56 +08:00
var user = res.data.roleKeys;
if (user.includes("enchou")) {
return;
} else if (user.includes("teacher")) {
return;
} else if (user.includes("parent")) {
return;
}
2022-08-22 09:05:11 +08:00
});
},
// 表单重置
reset() {
this.form = {};
this.resetForm("form");
2023-04-14 14:46:32 +08:00
}
}
2022-08-22 09:05:11 +08:00
};
</script>
<style scoped='scss'>
::v-deep .el-card__header {
border: none;
}
2022-08-31 10:12:22 +08:00
::v-deep .el-form {
display: inline;
}
2022-08-22 09:05:11 +08:00
</style>