lrf402788946 4 years ago
parent
commit
243ae61491
1 changed files with 25 additions and 6 deletions
  1. 25 6
      src/views/train-plan/bedroom.vue

+ 25 - 6
src/views/train-plan/bedroom.vue

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