|
@@ -1,20 +1,24 @@
|
|
|
<template>
|
|
|
<div id="plan">
|
|
|
- <!-- 根据计划,获取所有期数及期数下批次,然后提供选择期数;查询出该期数下学校上报的学生,选择学生手动分班 -->
|
|
|
- <list-frame :title="mainTitle" @query="stuSearch" :total="total" :filter="filterFields" :needAdd="false" returns="./index">
|
|
|
+ <!-- 根据计划,获取所有期数及期数下批次,然后提供选择期数;查询出该期数下学校上报的学生,选择学生手动分班 :filter="filterFields"-->
|
|
|
+ <list-frame :title="mainTitle" @query="stuSearch" :total="total" :needAdd="false" :needFilter="false" returns="./index">
|
|
|
<template #options="{item}">
|
|
|
<template v-if="item.model === 'termid'">
|
|
|
<el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
|
|
|
</template>
|
|
|
</template>
|
|
|
<el-card style="padding:10px">
|
|
|
- <el-row type="flex" justify="space-around" :gutter="10" align="middle" style="padding:10px 0;">
|
|
|
- <el-col :span="7">班级需求:{{ selectInfo.personReq }}人</el-col>
|
|
|
- <el-col :span="7">已选择学生:{{ selected.length }}人</el-col>
|
|
|
- <el-col :span="7">男性:{{ selectInfo.male }}人</el-col>
|
|
|
- <el-col :span="7">女性:{{ selectInfo.female }}人</el-col>
|
|
|
- </el-row>
|
|
|
<el-row>
|
|
|
+ <el-form :inline="true" size="mini">
|
|
|
+ <el-form-item label="期">
|
|
|
+ <el-select v-model="selectInfo.termid" placeholder="请选择期数" @change="stuSearch">
|
|
|
+ <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="toSetClass">一键分班</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<el-form :inline="true" size="mini">
|
|
|
<el-form-item label="批次">
|
|
|
<el-select v-model="selectInfo.batchid" placeholder="请先选择期数" @change="getClasses">
|
|
@@ -31,6 +35,13 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
+ <el-row type="flex" justify="space-around" :gutter="10" align="middle" style="padding:10px 0;">
|
|
|
+ <el-col :span="7">班级需求:{{ selectInfo.personReq }}人</el-col>
|
|
|
+ <el-col :span="7">已选择学生:{{ selected.length }}人</el-col>
|
|
|
+ <el-col :span="7">男性:{{ selectInfo.male }}人</el-col>
|
|
|
+ <el-col :span="7">女性:{{ selectInfo.female }}人</el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
<data-table
|
|
|
ref="table"
|
|
|
:fields="fields"
|
|
@@ -70,7 +81,7 @@ export default {
|
|
|
{ label: '学校', prop: 'school_name' },
|
|
|
{ label: '性别', prop: 'gender' },
|
|
|
],
|
|
|
- filterFields: [{ label: '期数', model: 'termid', type: 'select' }],
|
|
|
+ filterFields: [], //{ label: '期数', model: 'termid', type: 'select' }
|
|
|
list: [],
|
|
|
selected: [],
|
|
|
selectedTest: [],
|
|
@@ -105,15 +116,15 @@ export default {
|
|
|
},
|
|
|
//查询选择期上报的学生,提供批次选择
|
|
|
async stuSearch({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- let { termid } = info;
|
|
|
- this.selectInfo.termid = termid;
|
|
|
- const res = await this.getStudentList({ termid: termid, skip, limit });
|
|
|
+ // let { termid } = info;
|
|
|
+ // this.selectInfo.termid = termid;
|
|
|
+ const res = await this.getStudentList({ termid: this.selectInfo.termid, skip, limit });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
if (skip !== 0) return;
|
|
|
- this.getBatch(termid);
|
|
|
+ this.getBatch(this.selectInfo.termid);
|
|
|
},
|
|
|
getBatch(termid) {
|
|
|
let batchs = this.termList.filter(f => f._id === termid);
|
|
@@ -171,12 +182,14 @@ export default {
|
|
|
},
|
|
|
async toSetClass() {
|
|
|
// 整理数据生成班级;将学生列表重新查询=>为了将已经有班级的学生剔除,以便继续分班(重新查询)
|
|
|
- let info = JSON.parse(JSON.stringify(_.omit(this.selectInfo, ['male', 'female', 'personReq'])));
|
|
|
- let stuList = JSON.parse(JSON.stringify(this.selected));
|
|
|
- // if (this.isOutRange(stuList)) return;
|
|
|
- info.students = stuList;
|
|
|
+ let info = JSON.parse(JSON.stringify(_.omit(this.selectInfo, ['male', 'female', 'personReq', 'students'])));
|
|
|
+ info.planid = this.id;
|
|
|
+ //手动添加学生使用这部分,接口换了,之后转移到新加的手动
|
|
|
+ // let stuList = JSON.parse(JSON.stringify(this.selected));
|
|
|
+ // // if (this.isOutRange(stuList)) return;
|
|
|
+ // info.students = stuList;
|
|
|
let res = await this.createClass(info);
|
|
|
- if (this.$checkRes(res, '分班成功', '分班失败')) this.$router.push({ path: '/plan/index' });
|
|
|
+ if (this.$checkRes(res, '分班成功', '分班失败')) this.$router.push({ path: './index' });
|
|
|
//重置信息
|
|
|
// this.selectInfo = {
|
|
|
// male: 0,
|