KindergartenUI/src/views/system/constitution/index.vue
2022-08-22 09:05:11 +08:00

755 lines
21 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="classshowclick"
style="width: 250px; text-align: left; height: 32px; color: #c0c4cc"
v-if="className == '请选择班级'"
>{{ className }}</el-button
>
<el-button
@click="classshowclick"
style="width: 250px; text-align: left; height: 32px"
v-else
>{{ className }}</el-button
>
</el-form-item>
<el-form-item label="学生" prop="categoryName" label-width="45px">
<el-button
@click="studentshowclick"
v-if="studentname == '请选择学生'"
style="width: 250px; text-align: left; height: 32px; color: #c0c4cc"
>{{ studentname }}</el-button
>
<el-button
@click="studentshowclick"
style="width: 250px; text-align: left; height: 32px"
v-else
>{{ studentname }}</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="500px"
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="70" 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="190"
align="center"
/>
<el-table-column
property="batchName"
label="批次名称"
width="190"
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="studentshow"
append-to-body
style="margin-top: 70px"
:before-close="studentcancel"
>
<el-table :data="studentInfoList" align="center" style="margin-top: 10px">
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 20px; height: 20px"
circle
v-if="studentId == scope.row.id"
@click="studentclick(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="studentclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="className"
label="班级名称"
width="190"
align="center"
/>
<el-table-column
property="studentName"
label="学生姓名"
width="190"
align="center"
/>
<el-table-column
property="studentName"
label="性别"
width="190"
align="center"
>
<template slot-scope="scope">
{{ scope.row.studentSex == "MALE" ? "男" : "女" }}
</template>
</el-table-column>
<el-table-column
property="homeAddress"
label="住址"
width="190"
align="center"
/>
</el-table>
<pagination
v-show="total3 > 0"
:total="total3"
:page.sync="studentqueryParams.pageNum"
:limit.sync="studentqueryParams.pageSize"
@pagination="studentlist"
/>
</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-dialog
width="1000px"
title="选择所属班级"
:visible.sync="classshow"
append-to-body
:before-close="classcancel"
>
<el-table :data="classinfoList" align="center" style="margin-top: 10px">
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 20px; height: 20px"
circle
@click="classclick(scope.row)"
v-if="classId == scope.row.id"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="classclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="kindergartenName"
label="幼儿园名称"
width="190"
align="center"
/>
<el-table-column
property="className"
label="班级名称"
width="180"
align="center"
>
</el-table-column>
<el-table-column
property="classType"
label="班级类型"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.classType == dictValue1 ? "大班" : "" }}
{{ scope.row.classType == dictValue2 ? "中班" : "" }}
{{ scope.row.classType == dictValue3 ? "小班" : "" }}
{{ scope.row.classType == dictValue4 ? "毕业" : "" }}
</template>
</el-table-column>
<el-table-column
property="classTeacher"
label="班主任姓名"
width="180"
align="center"
>
</el-table-column>
<el-table-column
property="phone"
label="联系电话"
width="190"
align="center"
>
</el-table-column>
</el-table>
<pagination
v-show="total2 > 0"
:total="total2"
:page.sync="classqueryParams.pageNum"
:limit.sync="classqueryParams.pageSize"
@pagination="classinfo"
/>
</el-dialog>
<el-row v-show="itemshow">
<el-col :span="24" class="card-box" style="">
<el-card>
<div style="margin-left: 50px">
<span>学校排名:</span
><span style="margin-left: 20px; margin-right: 20px">{{
analysislist.schoolRank
}}</span
>名
</div>
<div slot="header" style="text-align: center; font-size: 25px">
<span>体测项目分值与全校、全市对比</span>
</div>
<div style="width: 100%; display: flex; flex-wrap: wrap">
<div
v-for="(item, index) in analysislist.itemScoreList"
:key="index"
style="
width: 30%;
height: 300px;
margin-left: 3%;
margin-top: 20px;
"
>
<div
class="bar"
style="width: 400px; height: 300px; margin: 0 auto"
></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 { listStudentInfo } from "@/api/system/studentInfo";
import { listClassinfo } from "@/api/system/classinfo";
import { getRoleInfo, testScoreBatch } from "@/api/system/quality";
import { analysis } from "@/api/system/constitution";
export default {
name: "constitution",
components: {},
data() {
return {
itemshow: false,
itemshow2: false,
total1: 0,
total2: 0,
total3: 0,
total4: 0,
//遮罩层
kindergartenshow: false,
classshow: false,
studentshow: false,
batchCodeshow: false,
//班级类型
dictValue1: "",
dictValue2: "",
dictValue3: "",
dictValue4: "",
ClassType: "class_type",
// 显示搜索条件
showSearch: true,
// 表单参数
form: {},
//学生查询
studentqueryParams: {
pageNum: 1,
pageSize: 10,
classId: "",
nationDictId: null,
studentName: null,
studentSex: null,
studentNumber: null,
birthDate: null,
cardNumber: null,
onceName: null,
homeAddress: null,
},
//班级查询
classqueryParams: {
pageNum: 1,
pageSize: 10,
kindergartenId: "",
className: null,
classType: null,
},
//幼儿园查询参数
kqueryParams: {
pageNum: 1,
pageSize: 10,
organizeId: null,
kindergartenName: null,
kindergartenAddress: null,
kindergartenType: null,
phone: null,
contacts: null,
},
//幼儿园list
kindergartenList: [],
//幼儿园名字
kindergartenName: "请选择幼儿园",
//幼儿园ID
kindergartenId: "",
//班级list
classinfoList: [],
//班级名字
className: "请选择班级",
//班级ID
classId: "",
//学生list
studentInfoList: [],
//学生名字
studentname: "请选择学生",
//学生ID
studentId: "",
//批次名称
batchCodeName: "请选择批次",
//批次ID
batchCodeId: "",
//批次list
testScorelist: [],
//批次编号
testqueryParams: {
pageNum: 1,
pageSize: 10,
},
//analysislist
analysislist: [],
//查询传值
analysisqueryParams: {
// studentId: "10",
// batchCode: "PC202208030005",
studentId: "",
batchCode: "",
},
};
},
mounted() {},
created() {
this.getList();
this.class();
// this.analysislists();
},
methods: {
options() {
var myEchart = document.getElementsByClassName("bar");
// var myEchart = document.querySelectorAll(".bar");
for (var i = 0; i <= this.analysislist.itemScoreList.length; i++) {
var ydata = [
this.analysislist.itemScoreList[i].itemScore,
this.analysislist.itemScoreList[i].schoolAvgScore,
this.analysislist.itemScoreList[i].cityAvgScore,
];
var textname = this.analysislist.itemScoreList[i].itemName;
// console.log(ydata);
var myChart = echarts.init(myEchart[i]);
var option = {
title: {
text: textname,
subtext: "",
left: "50%",
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
var tar = params[1];
return tar.name + "<br/>" + tar.seriesName + " : " + tar.value;
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
splitLine: { show: false },
data: this.analysislist.itemStudentList,
},
yAxis: {
type: "value",
},
series: [
{
name: "Placeholder",
type: "bar",
stack: "Total",
itemStyle: {
borderColor: "blue",
color: "blue",
},
emphasis: {
itemStyle: {
borderColor: "transparent",
color: "transparent",
},
},
data: [0, 0, 0],
},
{
name: "分数",
type: "bar",
stack: "Total",
// center: ["50%", "50%"],
label: {
show: true,
position: "inside",
},
itemStyle: {
normal: {
color: function (colors) {
var colorList = [
"#91cd77",
"#5470c6",
"#fc8251",
"#ef6567",
"#f9c956",
"#75bedc",
];
return colorList[i];
},
},
},
// itemStyle: {
// borderColor: "#94D8F6",
// color: "#94D8F6",
// },
data: ydata,
},
],
};
myChart.setOption(option);
this.itemshow = true;
this.itemshow2 = false;
}
},
//综合体质分析
analysislists() {
analysis(this.analysisqueryParams).then((res) => {
console.log(res);
if (!res.data || res.data == "") {
this.itemshow2 = true;
this.itemshow = false;
this.batchCodeName = "请选择批次";
this.batchCodeId = "";
} else {
this.analysislist = res.data;
this.$nextTick(() => {
this.options();
});
}
});
},
// 点击学生按钮
studentshowclick() {
if (this.studentqueryParams.classId == "") {
this.$message.error("请先选择班级");
} else {
this.studentshow = true;
this.studentlist();
}
},
//点击批次
batchCodeshowclick() {
if (this.analysisqueryParams.studentId == "") {
this.$message.error("请先选择学生");
} else {
this.testScore();
this.batchCodeshow = true;
}
},
//点击批次左边
batchCodeclick(row) {
this.batchCodeName = row.batchName;
this.batchCodeId = row.id;
this.analysisqueryParams.batchCode = row.batchCode;
this.batchCodeshow = false;
this.analysislists();
},
//批次
testScore() {
testScoreBatch(this.testqueryParams).then((res) => {
this.testScorelist = res.rows;
this.total4 = res.total;
});
},
//学生左侧按钮
studentclick(row) {
this.studentname = row.studentName;
this.studentId = row.id;
this.studentshow = false;
this.analysisqueryParams.studentId = row.id;
},
//获取学生
studentlist() {
listStudentInfo(this.studentqueryParams).then((res) => {
this.studentInfoList = res.rows;
this.total3 = res.total;
// console.log(this.studentInfoList);
});
},
//点击所属班级
classshowclick() {
if (this.classqueryParams.kindergartenId == "") {
this.$message.error("请先选择幼儿园");
} else {
this.classshow = true;
this.classinfo();
}
// console.log(this.classqueryParams);
},
//批次关闭
batchCodecancel() {
this.batchCodeshow = false;
},
//学生关闭
studentcancel() {
this.studentshow = false;
},
//幼儿园关闭
kindergartencancel() {
this.kindergartenshow = false;
},
//班级关闭
classcancel() {
this.classshow = false;
},
//班级左侧点击
classclick(row) {
// console.log(row);
this.className = row.className;
this.classId = row.id;
this.studentqueryParams.classId = row.id;
this.classshow = false;
},
//幼儿园左侧点击
kindergartenNameclick(row) {
this.classqueryParams.kindergartenId = row.id;
this.kindergartenName = row.kindergartenName;
this.kindergartenId = row.id;
this.kindergartenshow = false;
},
//班级类型
class() {
tKindergartenInfo(this.ClassType).then((res) => {
this.dictValue1 = res.data[0].dictValue;
this.dictValue2 = res.data[1].dictValue;
this.dictValue3 = res.data[2].dictValue;
this.dictValue4 = res.data[3].dictValue;
});
},
//班级list
classinfo() {
listClassinfo(this.classqueryParams).then((response) => {
this.classinfoList = response.rows;
this.total2 = response.total;
// console.log(this.classinfoList);
});
},
getList() {
//用户权限
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>