reloaded 5 лет назад
Родитель
Сommit
b2f5d78407
1 измененных файлов с 60 добавлено и 0 удалено
  1. 60 0
      parts/leave.vue

+ 60 - 0
parts/leave.vue

@@ -0,0 +1,60 @@
+<template>
+  <div id="leave">
+    <el-table :data="tableData" border style="width: 100%">
+      <el-table-column prop="starttime" label="请假开始时间"> </el-table-column>
+      <el-table-column prop="endtime" label="请假结束时间"> </el-table-column>
+      <el-table-column prop="stuname" label="学生姓名"> </el-table-column>
+      <el-table-column prop="reason" label="请假理由"> </el-table-column>
+      <el-table-column label="请假类型" align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.type === '0' ? '请假' : scope.row.status === '1' ? '退出' : '' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center">
+        <template slot-scope="scope">
+          <span>{{ scope.row.status === '0' ? '审核中' : scope.row.status === '1' ? '审核通过' : scope.row.status === '2' ? '审核拒绝' : '' }}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: leave } = createNamespacedHelpers('leave');
+export default {
+  name: 'leave',
+  props: {
+    classId: {},
+    total: {},
+  },
+  components: {},
+  data: () => ({
+    tableData: [],
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    ...leave(['fetch', 'query']),
+    async search() {
+      const leaveInfo = await this.query({ classid: this.classId });
+      if (leaveInfo.errcode == 0) {
+        this.$set(this, `tableData`, leaveInfo.data);
+      }
+      this.total = leaveInfo.length;
+    },
+  },
+  watch: {
+    classId: {
+      handler(val) {
+        if (val) {
+          this.search();
+        }
+      },
+      immediate: true,
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>