guhongwei пре 4 година
родитељ
комит
02dfa5ccea

+ 7 - 6
src/views/classes/lesson.vue

@@ -64,12 +64,13 @@ export default {
     ...lesson(['confirmLesson']),
     async getClassInfo() {
       let classid = _.get(this.defaultOption, 'classid');
-      console.log(classid);
-      let res = await this.fetch(classid);
-      if (this.$checkRes(res)) {
-        console.log(res.data);
-        this.$set(this, `classInfo`, res.data);
-        this.getSettingLists(this.classInfo);
+      if (classid) {
+        let res = await this.fetch(classid);
+        if (this.$checkRes(res)) {
+          console.log(res.data);
+          this.$set(this, `classInfo`, res.data);
+          this.getSettingLists(this.classInfo);
+        }
       }
     },
     getRes({ from, result }) {

+ 19 - 6
src/views/classes/name-list.vue

@@ -3,7 +3,14 @@
     <list-frame :title="mainTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
       <el-col :span="24" class="printingBtn">
         <!-- <el-button type="primary" size="mini" @click="toPrint()">打印名牌</el-button> -->
-        <el-button type="primary" size="mini" @click="toComputIsFine()" :disabled="this.defaultOption.classid ? false : true">设置优秀学员</el-button>
+        <el-col :span="12">
+          <el-input placeholder="请输入学生姓名" v-model="stuname" class="input-with-select">
+            <el-button slot="append" icon="el-icon-search" @click="search()"></el-button>
+          </el-input>
+        </el-col>
+        <el-col :span="12">
+          <el-button type="primary" size="mini" @click="toComputIsFine()" :disabled="this.defaultOption.classid ? false : true">设置优秀学员</el-button>
+        </el-col>
       </el-col>
       <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @delete="toDelete" @post="toPost"></data-table>
     </list-frame>
@@ -70,7 +77,7 @@ export default {
         // },
       ],
       fields: [
-        { label: '姓名', prop: 'name' },
+        { label: '姓名', prop: 'name', filter: 'input' },
         { label: '性别', prop: 'gender' },
         { label: '民族', prop: 'nation' },
         { label: '学校', prop: 'school_name' },
@@ -92,6 +99,9 @@ export default {
       rules: {},
       // 组
       groupList: [],
+      // 查询
+      // 学生姓名
+      stuname: '',
     };
   },
   created() {
@@ -111,10 +121,13 @@ export default {
       }
     },
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.query({ skip, limit, ...info, classid: this.id });
-      if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
+      if (this.id) {
+        if (this.stuname) info.name = this.stuname;
+        const res = await this.query({ skip, limit, ...info, classid: this.id });
+        if (this.$checkRes(res)) {
+          this.$set(this, `list`, res.data);
+          this.$set(this, `total`, res.total);
+        }
       }
     },
     toEdit({ data }) {

+ 6 - 4
src/views/classes/print.vue

@@ -66,10 +66,12 @@ export default {
     ...teacher({ getTeacher: 'fetch' }),
     ...director({ getDirector: 'fetch' }),
     tabChange() {
-      if (this.active == 'name') this.nameList();
-      if (this.active == 'cert') this.certList();
-      if (this.active == 'sign') this.signList();
-      if (this.active == 'lesson') this.classLesson();
+      if (this.id) {
+        if (this.active == 'name') this.nameList();
+        if (this.active == 'cert') this.certList();
+        if (this.active == 'sign') this.signList();
+        if (this.active == 'lesson') this.classLesson();
+      }
     },
     async nameList() {
       this.loading = true;

+ 20 - 18
src/views/classes/tsbattendance.vue

@@ -62,27 +62,29 @@ export default {
       let termid = _.get(this.defaultOption, 'termid');
       const res = await this.getClassType();
       if (this.$checkRes(res)) this.$set(this, `classTypeList`, res.data);
-      const classInfo = await this.classesFetch(classid);
-      if (this.$checkRes(classInfo)) {
-        if (classInfo.data.type == '0') {
-          this.$message({
-            message: '非特殊班级,不需要班主任签到',
-            type: 'warning',
-          });
-        } else {
-          this.$set(this, `classInfo`, classInfo.data);
-          let arr = this.classTypeList.find(i => i.sign == '1' && i.code == classInfo.data.type);
-          if (arr) {
-            const res = await this.stuquery({ termid: termid, classid: classInfo.data.id, ...info });
-            if (this.$checkRes(res)) {
-              this.$set(this, `list`, res.data);
-              this.checkSign();
-            }
-          } else {
+      if (classid) {
+        const classInfo = await this.classesFetch(classid);
+        if (this.$checkRes(classInfo)) {
+          if (classInfo.data.type == '0') {
             this.$message({
-              message: '特殊班级,不需要班主任签到',
+              message: '非特殊班级,不需要班主任签到',
               type: 'warning',
             });
+          } else {
+            this.$set(this, `classInfo`, classInfo.data);
+            let arr = this.classTypeList.find(i => i.sign == '1' && i.code == classInfo.data.type);
+            if (arr) {
+              const res = await this.stuquery({ termid: termid, classid: classInfo.data.id, ...info });
+              if (this.$checkRes(res)) {
+                this.$set(this, `list`, res.data);
+                this.checkSign();
+              }
+            } else {
+              this.$message({
+                message: '特殊班级,不需要班主任签到',
+                type: 'warning',
+              });
+            }
           }
         }
       }