guhongwei 5 lat temu
rodzic
commit
87045c1678
1 zmienionych plików z 17 dodań i 9 usunięć
  1. 17 9
      src/views/train-plan/attendance.vue

+ 17 - 9
src/views/train-plan/attendance.vue

@@ -7,16 +7,14 @@
             <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 label="批次">
-          <el-select v-model="form.batchid" placeholder="请先选择期数" @change="getClasses">
-            <el-option v-for="(i, index) in batchList" :key="index" :label="i.name" :value="i._id"></el-option>
-          </el-select>
-        </el-form-item> -->
         <el-form-item label="班级">
           <el-select v-model="form.classid" placeholder="请先选择班级">
             <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="学生姓名">
+          <el-input v-model="form.name" placeholder="请输入学生姓名"></el-input>
+        </el-form-item>
         <el-form-item label="">
           <el-button type="primary" size="mini" @click="onsearch()"> 查询</el-button>
         </el-form-item>
@@ -104,10 +102,20 @@ export default {
     async onsearch({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ termid: this.form.termid, classid: this.form.classid, ...info });
       const newdatas = [];
-      for (const data of res.data) {
-        for (const attend of data.attend) {
-          let newdata = { stuname: data.stuname, ...attend };
-          newdatas.push(newdata);
+      if (this.form.name) {
+        var arr = res.data.filter(item => item.stuname == this.form.name);
+        for (const data of arr) {
+          for (const attend of data.attend) {
+            let newdata = { stuname: data.stuname, ...attend };
+            newdatas.push(newdata);
+          }
+        }
+      } else {
+        for (const data of res.data) {
+          for (const attend of data.attend) {
+            let newdata = { stuname: data.stuname, ...attend };
+            newdatas.push(newdata);
+          }
         }
       }
       if (this.$checkRes(res)) {