瀏覽代碼

分班限制约束

lrf402788946 5 年之前
父節點
當前提交
6ff6f08c9a
共有 1 個文件被更改,包括 1 次插入30 次删除
  1. 1 30
      src/views/plan/classes.vue

+ 1 - 30
src/views/plan/classes.vue

@@ -26,13 +26,6 @@
                 <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i.name"></el-option>
               </el-select>
             </el-form-item>
-            <!-- <el-form-item label="班主任">
-              <el-select v-model="selectInfo.director" placeholder="请选择班主任" filterable>
-                <el-option-group v-for="group in directorList" :key="group.label" :label="group.label">
-                  <el-option v-for="item in group.options" :key="item._id" :label="item.name" :value="item._id"> </el-option>
-                </el-option-group>
-              </el-select>
-            </el-form-item> -->
             <el-form-item>
               <el-button type="primary" @click="toSetClass">确认分班</el-button>
             </el-form-item>
@@ -95,7 +88,6 @@ export default {
   }),
   created() {
     this.search();
-    // this.getOhterList();
   },
   methods: {
     ...trainPlan(['fetch']),
@@ -177,7 +169,7 @@ export default {
       // 整理数据生成班级;将学生列表重新查询=>为了将已经有班级的学生剔除,以便继续分班(重新查询)
       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;
+      if (this.isOutRange(stuList)) return;
       info.students = stuList;
       let res = await this.createClass(info);
       if (this.$checkRes(res, '分班成功', '分班失败')) this.$router.push({ path: '/plan/index' });
@@ -189,27 +181,6 @@ export default {
       // this.selected = [];
       // this.$refs.table.selectReset();
     },
-    async getOhterList() {
-      let res;
-      res = await this.getDeptList();
-      if (this.$checkRes(res)) this.$set(this, `deptList`, res.data);
-      res = await this.getDirectorList();
-      if (this.$checkRes(res)) {
-        let arr = res.data;
-        arr = arr.map(i => {
-          let dept = this.deptList.find(f => f._id === i.department);
-          if (res) i.dept_name = dept.name;
-          else i.dept_name = '无所属部门';
-          return i;
-        });
-        let last = this.deptList.map(i => {
-          let options = arr.filter(f => f.department === i._id);
-          let label = i.name;
-          return { options, label };
-        });
-        this.$set(this, `directorList`, last);
-      }
-    },
     isOutRange(selected) {
       let res = true;
       if (selected.length > this.selectInfo.personReq) this.$message.error('超出班级规定人数');