Browse Source

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-school

lrf402788946 4 years ago
parent
commit
f53eb6b167
3 changed files with 139 additions and 0 deletions
  1. 8 0
      src/router/index.js
  2. 3 0
      src/store/index.js
  3. 128 0
      src/views/kaoqin/index.vue

+ 8 - 0
src/router/index.js

@@ -51,6 +51,14 @@ const routes = [
         meta: { title: '教师', sub: '管理' },
         component: () => import('@/views/teacher/index.vue'),
       },
+      //考勤
+      {
+        path: '/kaoqin/index',
+        name: 'kaoqin_list',
+        meta: { title: '考勤', sub: '管理' },
+        component: () => import('@/views/kaoqin/index.vue'),
+      },
+
       {
         path: '/scganli/index',
         name: 'teacher_list',

+ 3 - 0
src/store/index.js

@@ -10,6 +10,8 @@ import schPlan from '@frame/store/sch-plan';
 import schimport from '@frame/store/sch-import';
 import login from '@frame/store/login';
 import dirPlan from '@frame/store/dir-plan';
+import attendance from '@frame/store/attendance';
+
 import util from '@frame/store/util';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
@@ -28,6 +30,7 @@ export default new Vuex.Store({
     login,
     dirPlan,
     util,
+    attendance, //考勤
   },
   state: { ...ustate },
   mutations: { ...umutations },

+ 128 - 0
src/views/kaoqin/index.vue

@@ -0,0 +1,128 @@
+<template>
+  <div id="index">
+    <list-frame title="题库列表页" @query="onsearch" :total="total" :needFilter="false" :needAdd="false">
+      <el-select v-model="form.id" size="mini" placeholder="请选择计划" @change="changejh">
+        <el-option v-for="(i, index) in planList" :key="index" :label="i.title" :value="i.id"></el-option>
+      </el-select>
+
+      <el-select v-model="form.termid" size="mini" placeholder="请选择期" @change="changeqi">
+        <el-option label="请选择" value="shanghai"></el-option>
+        <el-option v-for="(m, index) in termList" :key="index" :label="m.termnum" :value="m.termid"></el-option>
+      </el-select>
+
+      <el-select v-model="form.name" size="mini" placeholder="请选择班">
+        <el-option v-for="(m, index) in classList" :key="index" :label="m.name" :value="m.id"></el-option>
+      </el-select>
+      <el-button type="primary" size="mini" @click="onsearch()"> 查询</el-button>
+      <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @delete="toDelete"> </data-table>
+    </list-frame>
+  </div>
+</template>
+<script>
+import listFrame from '@frame/layout/admin/list-frame';
+import dataTable from '@frame/components/data-table';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('attendance');
+const { mapActions: student } = createNamespacedHelpers('student');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
+const { mapActions: util } = createNamespacedHelpers('util');
+const { mapActions: classes } = createNamespacedHelpers('classes');
+
+export default {
+  metaInfo: { title: '题库列表页' },
+  name: 'index',
+  props: {},
+  components: {
+    listFrame,
+    dataTable,
+  },
+  data: () => ({
+    classList: [],
+    termList: [],
+    planList: [],
+    opera: [
+      {
+        label: '编辑',
+        icon: 'el-icon-edit',
+        method: 'edit',
+      },
+      {
+        label: '删除',
+        icon: 'el-icon-delete',
+        method: 'delete',
+        confirm: true,
+      },
+    ],
+    fields: [
+      { label: '日期', prop: 'date' },
+      { label: '时间', prop: 'time' },
+
+      {
+        label: '类型',
+        prop: 'type',
+        format: item => {
+          return item === '0' ? '上课考勤' : item === '1' ? '上课考勤' : '';
+        },
+      },
+      {
+        label: '状态',
+        prop: 'status',
+        format: item => {
+          return item === '0' ? '未签到' : item === '1' ? '签到' : '迟到';
+        },
+      },
+    ],
+    form: {},
+    list: [],
+    total: 0,
+  }),
+  created() {
+    this.searchinfo();
+  },
+  computed: { ...mapState(['user']) },
+  methods: {
+    ...mapActions(['query', 'delete']),
+    ...student({ stuquery: 'query' }),
+    ...trainplan({ schPlanquery: 'query' }),
+    ...util({ fetchUtil: 'fetch' }),
+    ...classes({ classesquery: 'query' }),
+    async searchinfo() {
+      // let stuid = this.user.id;
+      const res = await this.schPlanquery();
+      this.$set(this, `planList`, res.data);
+    },
+    //计划
+    async changejh(ids) {
+      const res = await this.fetchUtil({ model: 'schtime', planid: ids, schid: this.user.code });
+
+      this.$set(this, `termList`, res.data.term);
+    },
+    async changeqi(termid) {
+      const res = await this.classesquery({ termid });
+      console.log(res.data);
+      this.$set(this, `classList`, res.data);
+    },
+
+    async onsearch({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, termid: this.form.termid, classid: this.form.classid, limit, ...info });
+
+      console.log(res.data);
+
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    toEdit({ data }) {
+      this.$router.push({ path: '/itembank/detail', query: { id: data.id } });
+    },
+    async toDelete({ data }) {
+      const res = await this.delete(data.id);
+      this.$checkRes(res, '删除成功', '删除失败');
+      this.search();
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>