|
@@ -10,9 +10,20 @@
|
|
|
<data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" :usePage="false"></data-table>
|
|
|
</detail-frame>
|
|
|
<detail-frame :title="classInfo.name" :returns="toReturns" v-if="view != 'list'">
|
|
|
- <el-col :span="2">
|
|
|
- <el-button type="primary" size="mini" @click="toSelect">批量分配选择寝室</el-button>
|
|
|
- </el-col>
|
|
|
+ <el-row type="flex" justify="center">
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-link :underline="false" type="primary" style="font-size:18px">男:{{ getGender('男') }}人</el-link>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-link :underline="false" type="success" style="font-size:18px">女:{{ getGender('女') }}人</el-link>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="2">
|
|
|
+ <el-button type="primary" size="mini" @click="toSelect">批量分配选择寝室</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
<el-checkbox-group v-model="stuList">
|
|
|
<el-table :data="stuBedroom" size="mini" border stripe>
|
|
|
<el-table-column align="center" label="寝室号" prop="bedroom" width="100"></el-table-column>
|
|
@@ -105,6 +116,7 @@ export default {
|
|
|
{ label: '寝室', model: 'bedroom', type: 'select' },
|
|
|
],
|
|
|
options: undefined,
|
|
|
+ ostuList: [],
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
@@ -127,7 +139,7 @@ export default {
|
|
|
this.getSL();
|
|
|
},
|
|
|
async getSL() {
|
|
|
- let res = await this.getStudentList({ classid: this.classInfo._id });
|
|
|
+ let res = await this.getStuList();
|
|
|
if (this.$checkRes(res)) {
|
|
|
let duplicate = _.cloneDeep(res.data);
|
|
|
let mid = _.groupBy(duplicate, 'bedroom');
|
|
@@ -157,6 +169,11 @@ export default {
|
|
|
this.$set(this, `stuBedroom`, arr);
|
|
|
}
|
|
|
},
|
|
|
+ async getStuList() {
|
|
|
+ let res = await this.getStudentList({ classid: this.classInfo._id });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `ostuList`, res.data);
|
|
|
+ return res;
|
|
|
+ },
|
|
|
async toApart() {
|
|
|
let { planid: trainplanid, termid } = this.options;
|
|
|
let batchList = _.uniq(this.list.map(i => i.batchid));
|
|
@@ -199,8 +216,6 @@ export default {
|
|
|
const bedroom = await this.modelFetch({ model: 'bedroom', code: data.bedroom });
|
|
|
data.bedroomid = bedroom.data.id;
|
|
|
// data.bedroom = bedroom.data.code;
|
|
|
- console.log(data.bedroomid);
|
|
|
- console.log(data);
|
|
|
let res = await this.updateStudent(data);
|
|
|
if (this.$checkRes(res, `转寝成功`, res.errmsg || `转寝失败`)) {
|
|
|
this.getSL();
|
|
@@ -227,6 +242,10 @@ export default {
|
|
|
async toSelect() {
|
|
|
this.selectDialog = true;
|
|
|
},
|
|
|
+ getGender(gender) {
|
|
|
+ const r = this.ostuList.filter(f => f.gender == gender);
|
|
|
+ return r.length;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
defaultOption: {
|