Explorar o código

修改分班级的人数选择限制,只限制超出的情况了

lrf402788946 %!s(int64=4) %!d(string=hai) anos
pai
achega
2ab82c9289
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/views/train-plan/classes.vue

+ 6 - 0
src/views/train-plan/classes.vue

@@ -184,6 +184,12 @@ export default {
       data.id = _.pick(this.selectInfo, ['classid']).classid;
       let stuList = JSON.parse(JSON.stringify(this.selected));
       data.ids = stuList.map(i => i._id);
+      // 人数检验
+      const requestNum = _.get(this.selectInfo, 'personReq');
+      if (stuList.length > requestNum * 1) {
+        this.$message.error('选择人数超出规定人数,请核对人数!');
+        return;
+      }
       let res = await this.addStudent(data);
       if (this.$checkRes(res, '分配成功', res.errmsg || '分配失败')) {
         this.resetData();