Browse Source

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

lrf402788946 5 years ago
parent
commit
cc0610deda

+ 2 - 0
src/store/index.js

@@ -23,6 +23,7 @@ import util from '@frame/store/util';
 import count from '@frame/store/count';
 import setting from '@frame/store/setting';
 import trainBatch from '@frame/store/train-plan-year';
+import attendance from '@frame/store/attendance';
 
 import nation from '@frame/store/nation';
 import completion from '@frame/store/question-completion';
@@ -69,6 +70,7 @@ export default new Vuex.Store({
     count,
     setting,
     trainBatch,
+    attendance,
   },
   state: { ...ustate, ...dostate },
   mutations: { ...umutations, ...domutations },

+ 6 - 2
src/views/new-plan/class/lesson/lesson-table.vue

@@ -15,7 +15,7 @@
           <template v-slot="{ row, $index }">
             <el-row>
               <el-col :span="24">{{ getProp(row, `subname_day${index + 1}`) }}</el-col>
-              <el-col :span="24" v-if="getProp(row, `teaname_day${index + 1}`)">{{ getProp(row, `teaname_day${index + 1}`) }}</el-col>
+              <el-col class="teaname" :span="24" v-if="getProp(row, `teaname_day${index + 1}`)">{{ getProp(row, `teaname_day${index + 1}`) }}</el-col>
             </el-row>
           </template>
         </el-table-column>
@@ -346,4 +346,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.teaname {
+  border-top: 1px dashed #cccccc;
+}
+</style>

+ 115 - 14
src/views/train-plan/attendance.vue

@@ -1,28 +1,129 @@
 <template>
-  <div id="attendance">
-    <p>attendance</p>
+  <div id="index">
+    <list-frame title="考勤管理" @query="onsearch" :total="total" :needFilter="false" :needAdd="false">
+      <el-form :inline="true" size="mini">
+        <el-form-item label="期">
+          <el-select v-model="form.termid" placeholder="请选择期数" @change="getBatch">
+            <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-button type="primary" size="mini" @click="onsearch()"> 查询</el-button>
+        </el-form-item>
+      </el-form>
+      <data-table :fields="fields" :data="list"> </data-table>
+    </list-frame>
   </div>
 </template>
-
 <script>
+import _ from 'lodash';
+import listFrame from '@frame/layout/admin/list-frame';
+import dataTable from '@frame/components/data-table';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: attendance } = createNamespacedHelpers('attendance');
+const { mapActions: student } = createNamespacedHelpers('student');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
+const { mapActions: classes } = createNamespacedHelpers('classes');
+
 export default {
+  metaInfo: { title: '考勤管理' },
   name: 'attendance',
   props: {},
-  components: {},
-  data: function() {
-    return {};
+  components: {
+    listFrame,
+    dataTable,
+  },
+  data: () => ({
+    classList: [],
+    batchList: [],
+    termList: [],
+    fields: [
+      { label: '学生姓名', prop: 'stuname' },
+      { 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();
   },
-  created() {},
-  methods: {},
-  computed: {
-    ...mapState(['user']),
-    pageTitle() {
-      return `${this.$route.meta.title}`;
+  computed: { ...mapState(['user', 'defaultOption']) },
+  methods: {
+    ...attendance(['query', 'delete']),
+    ...student({ stuquery: 'query' }),
+    ...trainplan({ planfetch: 'fetch' }),
+    ...classes({ classesquery: 'query' }),
+    async searchinfo() {
+      const res = await this.planfetch(this.defaultOption.planid);
+      let terms = res.data.termnum;
+      this.$set(this, `termList`, terms);
+      if (this.defaultOption.termid) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      }
+    },
+    getBatch(termid) {
+      let batchs = this.termList.filter(f => f._id === termid);
+      if (batchs.length > 0) {
+        let { batchnum } = batchs[0];
+        this.$set(this, `batchList`, batchnum);
+      }
+    },
+    async getClasses(batchid) {
+      const res = await this.classesquery({ batchid });
+      this.$set(this, `classList`, res.data);
+    },
+    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.$checkRes(res)) {
+        this.$set(this, `total`, newdatas.length);
+        let _newdatas = newdatas.splice(skip, skip + limit);
+        this.$set(this, `list`, _newdatas);
+      }
     },
   },
-  metaInfo() {
-    return { title: this.$route.meta.title };
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      },
+      deep: true,
+    },
   },
 };
 </script>

+ 71 - 13
src/views/train-plan/leave.vue

@@ -1,28 +1,86 @@
 <template>
-  <div id="leave">
-    <p>leave</p>
+  <div id="index">
+    <list-frame :title="mainTitle" @query="search" :total="total" :needAdd="false" :needFilter="false">
+      <data-table :fields="fields" :data="list" :opera="opera"></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: leave } = createNamespacedHelpers('leave');
+const { mapActions: student } = createNamespacedHelpers('student');
 export default {
-  name: 'leave',
+  metaInfo: { title: '请假和退出管理' },
+  name: 'index',
   props: {},
-  components: {},
-  data: function() {
-    return {};
+  components: {
+    listFrame,
+    dataTable,
+  },
+  data: () => ({
+    opera: [],
+    fields: [
+      { label: '学生名称', prop: 'stuname' },
+      { label: '开始时间', prop: 'starttime' },
+      { label: '结束时间', prop: 'endtime' },
+      { label: '请假理由', prop: 'reason' },
+
+      {
+        label: '状态',
+        prop: 'status',
+        format: item => {
+          return item === '0' ? '审核中' : item === '1' ? '通过' : '未通过';
+        },
+      },
+      { label: '拒绝原因', prop: 'refcause' },
+      {
+        label: '类型',
+        prop: 'type',
+        format: item => {
+          return item === '0' ? '请假' : '退出';
+        },
+      },
+    ],
+    searchInfo: {},
+    list: [],
+    total: 0,
+  }),
+  created() {
+    this.search();
   },
-  created() {},
-  methods: {},
   computed: {
-    ...mapState(['user']),
-    pageTitle() {
-      return `${this.$route.meta.title}`;
+    ...mapState(['user', 'defaultOption']),
+    mainTitle() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      let sub = meta.sub || '';
+      return `${main}${sub}`;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
     },
   },
-  metaInfo() {
-    return { title: this.$route.meta.title };
+  methods: {
+    ...leave(['query']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      info = { planid: this.defaultOption.planid, termid: this.defaultOption.termid };
+      const res = await this.query({ skip, limit, ...info });
+      this.$set(this, `list`, res.data);
+      this.$set(this, `total`, res.total);
+    },
+  },
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.search();
+      },
+      deep: true,
+    },
   },
 };
 </script>