KindergartenUI/src/views/system/KindergartenPhysicalTest/index.vue
2022-08-26 14:06:36 +08:00

649 lines
18 KiB
Vue

<template>
<div class="app-container">
<el-form
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="90px"
>
<el-form-item label="所属幼儿园" prop="categoryName">
<el-button
@click="kindergartenshow = true"
v-if="kindergartenName == '请选择幼儿园'"
style="width: 250px; text-align: left; height: 32px; color: #c0c4cc"
>{{ kindergartenName }}</el-button
>
<el-button
@click="kindergartenshow = true"
style="width: 250px; text-align: left; height: 32px"
v-else
>{{ kindergartenName }}</el-button
>
</el-form-item>
<el-form-item label="所属批次" prop="categoryName" label-width="70px">
<el-button
@click="batchCodeshowclick"
style="width: 250px; text-align: left; height: 32px; color: #c0c4cc"
v-if="batchCodeName == '请选择批次'"
>{{ batchCodeName }}</el-button
>
<el-button
@click="batchCodeshowclick"
style="width: 250px; text-align: left; height: 32px"
v-else
>{{ batchCodeName }}</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- //批次 -->
<el-dialog
width="590px"
title="选择批次"
:visible.sync="batchCodeshow"
append-to-body
style="margin-top: 20px"
:before-close="batchCodecancel"
>
<el-table :data="testScorelist" align="center" style="margin-top: 0px">
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 20px; height: 20px"
v-if="batchCodeId == scope.row.id"
circle
@click="batchCodeclick(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="batchCodeclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="batchCode"
label="批次编号"
width="200"
align="center"
/>
<el-table-column
property="batchName"
label="批次名称"
width="200"
align="center"
/>
</el-table>
<pagination
v-show="total4 > 0"
:total="total4"
:page.sync="testqueryParams.pageNum"
:limit.sync="testqueryParams.pageSize"
@pagination="testScore"
/>
</el-dialog>
<!-- //幼儿园 -->
<el-dialog
width="850px"
title="选择所属幼儿园"
:visible.sync="kindergartenshow"
append-to-body
:before-close="kindergartencancel"
>
<el-table :data="kindergartenList">
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
circle
@click="kindergartenNameclick(scope.row)"
v-if="kindergartenId == scope.row.id"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="kindergartenNameclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="kindergartenName"
label="幼儿园名字"
width="150"
align="center"
>
</el-table-column>
<el-table-column
property="kindergartenAddress"
label="幼儿园地址"
width="150"
align="center"
>
</el-table-column>
<el-table-column
label="幼儿园所在组织"
align="center"
prop="organizeName"
width="150"
>
</el-table-column>
<el-table-column
property="contacts"
label="联系人"
width="150"
align="center"
>
</el-table-column>
<el-table-column
property="phone"
label="联系电话"
width="150"
align="center"
>
</el-table-column>
</el-table>
<pagination
v-show="total1 > 0"
:total="total1"
:page.sync="kqueryParams.pageNum"
:limit.sync="kqueryParams.pageSize"
@pagination="getList"
/>
</el-dialog>
<el-row v-show="itemshow">
<el-col :span="24" class="card-box" style="">
<el-card>
<div slot="header" style="text-align: center; font-size: 20px">
<span>基本信息</span>
</div>
<div style="margin-left: 50px; text-align: center; margin-top: 20px">
<span>幼儿园名称:</span
><span style="margin-left: 20px; margin-right: 10px">{{
analysislist.kindergartenName
}}</span>
<span style="margin-left: 50px">幼儿园性质:</span
><span style="margin-left: 20px; margin-right: 20px">{{
analysislist.kindergartenType == type.dictValue
? type.dictLabel
: type2.dictLabel
}}</span>
<span style="margin-left: 50px">参与体测人数:</span
><span style="margin-left: 20px">{{
analysislist.testItemStudentCount
}}</span
>人
<div style="display: flex; margin-top: 40px">
<div
slot="header"
style="width: 50%; text-align: center; font-size: 18px"
>
<span>本园参加体测各年龄阶段人数分部</span>
<div
id="main"
style="
width: 500px;
height: 300px;
margin: 0 auto;
padding-top: 40px;
"
></div>
</div>
<div
slot="header"
style="
width: 50%;
text-align: center;
font-size: 18px;
position: relative;
"
>
<span>本园体测成绩达标率(%)</span>
<span>
<span
style="
position: absolute;
top: 58%;
left: 47.5%;
font-size: 25px;
"
>{{ analysislist.standardRate }}%</span
>
<span
style="
position: absolute;
top: 67%;
left: 46.5%;
font-size: 16px;
"
>达标率</span
>
</span>
<div
id="main2"
style="
width: 500px;
height: 300px;
margin: 0 auto;
padding-top: 20px;
"
></div>
</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">
<img style="width: 40px" src="@/icons/笑脸.png" alt="" />
<div><!-- card title -->该幼儿园此批次暂无数据</div>
</div>
<!-- card body -->
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import * as echarts from "echarts";
import {
listKindergartenInfo,
tKindergartenInfo,
} from "@/api/system/kindergartenInfo";
import { getRoleInfo, testScoreBatch } from "@/api/system/quality";
import { analysis } from "@/api/system/KindergartenPhysicalTest";
export default {
name: "KindergartenPhysicalTest",
components: {},
data() {
return {
itemshow: false,
itemshow2: false,
total1: 0,
total4: 0,
//遮罩层
kindergartenshow: false,
batchCodeshow: false,
// 显示搜索条件
showSearch: true,
// 表单参数
form: {},
//班级类型
kindergartenType: "kindergarten_type",
type: {},
type2: {},
//幼儿园查询参数
kqueryParams: {
pageNum: 1,
pageSize: 10,
organizeId: null,
kindergartenName: null,
kindergartenAddress: null,
kindergartenType: null,
phone: null,
contacts: null,
},
//幼儿园list
kindergartenList: [],
//幼儿园名字
kindergartenName: "请选择幼儿园",
//幼儿园ID
kindergartenId: "",
//批次名称
batchCodeName: "请选择批次",
//批次ID
batchCodeId: "",
//批次list
testScorelist: [],
//批次编号
testqueryParams: {
pageNum: 1,
pageSize: 10,
},
analysislist: [],
//查询传值
analysisqueryParams: {
kindergartenId: "",
batchCode: "",
// kindergartenId: "18",
// batchCode: "PC202208030005",
},
};
},
mounted() {},
created() {
this.getList();
// this.analysisinfo();
},
methods: {
analysisinfo() {
analysis(this.analysisqueryParams).then((res) => {
if (res.data == [] || !res.data) {
this.itemshow2 = true;
this.itemshow = false;
} else {
this.analysislist = res.data;
console.log(this.analysislist);
this.options();
var app = {};
var myChart = echarts.init(document.getElementById("main"));
var option;
const posList = [
"left",
"right",
"top",
"bottom",
"inside",
"insideTop",
"insideLeft",
"insideRight",
"insideBottom",
"insideTopLeft",
"insideTopRight",
"insideBottomLeft",
"insideBottomRight",
];
app.configParameters = {
rotate: {
min: 0,
max: 90,
},
align: {
options: {
left: "left",
center: "center",
right: "right",
},
},
verticalAlign: {
options: {
top: "top",
middle: "middle",
bottom: "bottom",
},
},
position: {
options: posList.reduce(function (map, pos) {
map[pos] = pos;
return map;
}, {}),
},
distance: {
min: 0,
max: 100,
},
};
app.config = {
rotate: 0,
align: "center",
verticalAlign: "middle",
position: "top",
distance: 15,
onChange: function () {
const labelOption = {
rotate: app.config.rotate,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
position: app.config.position,
distance: app.config.distance,
};
myChart.setOption({
series: [
{
label: labelOption,
},
{
label: labelOption,
},
{
label: labelOption,
},
{
label: labelOption,
},
],
});
},
};
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}",
fontSize: 16,
rich: {
name: {},
},
};
option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
legend: {
data: ["男", "女"],
},
xAxis: [
{
type: "category",
axisTick: { show: false },
data: ["3-4岁", "4-5岁", "5-6岁", "6岁以上"],
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "男",
type: "bar",
barGap: 0,
color: "#60C5F1",
label: labelOption,
emphasis: {
focus: "series",
},
data: [
this.analysislist.threeAndFourMaleCount,
this.analysislist.fourAndFiveMaleCount,
this.analysislist.fiveAndSixMaleCount,
this.analysislist.sixAndMoreMaleCount,
],
},
{
name: "女",
type: "bar",
color: "#98E0AD",
label: labelOption,
emphasis: {
focus: "series",
},
data: [
this.analysislist.threeAndFourFeMaleCount,
this.analysislist.fourAndFiveFeMaleCount,
this.analysislist.fiveAndSixFeMaleCount,
this.analysislist.sixAndMoreFeMaleCount,
],
},
],
};
option && myChart.setOption(option);
this.itemshow = true;
this.itemshow2 = false;
}
});
},
options() {
var chartDom = document.getElementById("main2");
var myChart = echarts.init(chartDom);
var option2;
option2 = {
tooltip: {
trigger: "item",
},
legend: {
top: "5%",
left: "center",
},
series: [
{
center: ["50%", "60%"],
itemStyle: {
normal: {
label: {
show: true,
formatter: "{d}%", //只要百分比
position: "inside",
},
labelLine: { show: true },
color: function (colors) {
var colorList = [
"#5470c6",
"#fc8251",
"#91cd77",
"#ef6567",
"#f9c956",
"#75bedc",
];
return colorList[colors.dataIndex];
},
},
},
name: "",
type: "pie",
radius: ["40%", "70%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
emphasis: {
label: {
show: false,
fontSize: "20",
fontWeight: "bold",
},
},
labelLine: {
show: false,
},
data: [
{ value: this.analysislist.excellentRate, name: ">80优秀" },
{ value: this.analysislist.qualifyRate, name: "60-80合格" },
{ value: this.analysislist.unQualifyRate, name: "<60不合格" },
],
},
],
};
option2 && myChart.setOption(option2);
},
//点击批次左边
batchCodeclick(row) {
this.batchCodeName = row.batchName;
this.batchCodeId = row.id;
this.analysisqueryParams.batchCode = row.batchCode;
this.batchCodeshow = false;
this.analysisinfo();
},
//点击批次
batchCodeshowclick() {
if (this.analysisqueryParams.kindergartenId == "") {
this.$message.error("请先选择幼儿园");
} else {
this.testScore();
this.batchCodeshow = true;
}
},
//批次
testScore() {
testScoreBatch(this.testqueryParams).then((res) => {
this.testScorelist = res.rows;
this.total4 = res.total;
});
},
//批次关闭
batchCodecancel() {
this.batchCodeshow = false;
},
//幼儿园关闭
kindergartencancel() {
this.kindergartenshow = false;
},
//幼儿园左侧点击
kindergartenNameclick(row) {
this.analysisqueryParams.kindergartenId = row.id;
this.kindergartenName = row.kindergartenName;
this.kindergartenId = row.id;
if (this.analysisqueryParams.batchCode != "") {
this.analysisinfo();
}
this.kindergartenshow = false;
},
getList() {
tKindergartenInfo(this.kindergartenType).then((res) => {
this.type = res.data[0];
this.type2 = res.data[1];
});
//用户权限
getRoleInfo().then((res) => {
console.log(res);
});
//获取幼儿园list
listKindergartenInfo(this.kqueryParams).then((response) => {
this.kindergartenList = response.rows;
this.total1 = response.total;
// console.log(this.kindergartenList);
});
},
// 表单重置
reset() {
this.form = {};
this.resetForm("form");
},
},
};
</script>
<style scoped='scss'>
::v-deep .el-card__header {
border: none;
}
</style>