guhongwei 4 yıl önce
ebeveyn
işleme
5500834342
1 değiştirilmiş dosya ile 22 ekleme ve 1 silme
  1. 22 1
      src/views/classes/leave.vue

+ 22 - 1
src/views/classes/leave.vue

@@ -1,6 +1,14 @@
 <template>
   <div id="leave">
     <listFrame :title="pageTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
+      <el-col :span="12" style="margin:10px 0;">
+        <el-col :span="20">
+          <el-select v-model="studentid" filterable clearable placeholder="请选择学生" style="width: 90%;">
+            <el-option v-for="(i, index) in stuList" :key="index" :label="i.name" :value="i._id"> </el-option>
+          </el-select>
+        </el-col>
+        <el-button type="primary" @click="search()">查询</el-button>
+      </el-col>
       <leaveInfo :tableData="tableData"></leaveInfo>
     </listFrame>
   </div>
@@ -12,6 +20,7 @@ import listFrame from '@frame/layout/admin/list-frame';
 import leaveInfo from '@frame/parts/leave';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: leave } = createNamespacedHelpers('leave');
+const { mapActions: student } = createNamespacedHelpers('student');
 export default {
   name: 'leave',
   props: {},
@@ -21,19 +30,31 @@ export default {
       classId: {},
       total: 0,
       tableData: [],
+      studentid: '',
+      stuList: [],
     };
   },
-  created() {},
+  created() {
+    this.searchtermstu();
+  },
   methods: {
     ...leave(['fetch', 'query']),
+    ...student({ stuquery: 'query' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       if (!this.id) return;
+      if (this.studentid) info.studentid = this.studentid;
       const leaveInfo = await this.query({ skip, limit, ...info, classid: this.id });
       if (leaveInfo.errcode == 0) {
         this.$set(this, `tableData`, leaveInfo.data);
         this.$set(this, 'total', leaveInfo.total);
       }
     },
+    async searchtermstu() {
+      let res = await this.stuquery({ classid: this.id });
+      if (res.errcode == 0) {
+        this.$set(this, `stuList`, res.data);
+      }
+    },
     toreturn() {
       window.history.go(-1);
     },