Bladeren bron

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

lrf402788946 5 jaren geleden
bovenliggende
commit
14a43da7a6
3 gewijzigde bestanden met toevoegingen van 348 en 0 verwijderingen
  1. 15 0
      src/router/index.js
  2. 156 0
      src/views/train-plan/tsbattendance.vue
  3. 177 0
      src/views/train-plan/tsbbedroom.vue

+ 15 - 0
src/router/index.js

@@ -381,6 +381,21 @@ const train = [
     meta: { title: '考勤管理' },
     component: () => import('@/views/train-plan/attendance.vue'),
   },
+  // 07-20新增
+  // 特殊班考勤管理
+  {
+    path: '/train/plan/tsbattendance',
+    name: 'train_plan_tsbattendance',
+    meta: { title: '特殊班考勤管理' },
+    component: () => import('@/views/train-plan/tsbattendance.vue'),
+  },
+  // 特殊班学生分寝管理
+  {
+    path: '/train/plan/tsbbedroom',
+    name: 'train_plan_tsbbedroom',
+    meta: { title: '特殊班寝室管理' },
+    component: () => import('@/views/train-plan/tsbbedroom.vue'),
+  },
   {
     path: '/train/plan/score',
     name: 'train_plan_score',

+ 156 - 0
src/views/train-plan/tsbattendance.vue

@@ -0,0 +1,156 @@
+<template>
+  <div id="tsbattendance">
+    <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>
+      <el-col :span="24" class="btn">
+        <el-button type="primary" size="mini" @click="onekeyBtn">一键签到</el-button>
+      </el-col>
+      <data-table :fields="fields" :data="list" :select="true" :selected="selected" @handleSelect="toSelect"> </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: 'tsbattendance',
+  props: {},
+  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: [
+      {
+        stuname: '测试学生',
+        date: '2020-07-20',
+        time: '14:00',
+        type: '0',
+        status: '0',
+      },
+    ],
+    total: 0,
+    // 特殊班一键签到选中列表
+    selected: [],
+  }),
+  created() {
+    this.searchinfo();
+  },
+  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);
+      }
+    },
+    // 选中签到学生
+    toSelect(selecteds) {
+      this.$set(this, `selected`, selecteds);
+    },
+    // 一键签到
+    onekeyBtn() {
+      console.log(this.selected);
+    },
+  },
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      },
+      deep: true,
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.btn {
+  padding: 10px 0;
+  text-align: right;
+}
+</style>

+ 177 - 0
src/views/train-plan/tsbbedroom.vue

@@ -0,0 +1,177 @@
+<template>
+  <div id="tsbbedroom">
+    <detail-frame :title="pageTitle" v-show="view == 'list'">
+      <el-alert type="warning" title="请确认好学生已经报道后再进行分寝" center :closable="false" class="btn_bar"></el-alert>
+      <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" :usePage="false"></data-table>
+    </detail-frame>
+    <detail-frame :title="classInfo.name" :returns="toReturns" v-if="view != 'list'">
+      <data-table :fields="stufields" :data="sutlist" :opera="stuopera" @edit="toQinshi"></data-table>
+    </detail-frame>
+    <el-dialog :visible.sync="dialog" title="编辑寝室" @close="toClose" width="30%">
+      <data-form :data="form" :fields="tsbbedroomFields" :rules="{}" @save="turnSave"> </data-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import axios from 'axios';
+import dataForm from '@frame/components/form';
+import dataTable from '@frame/components/filter-page-table';
+import detailFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: student } = createNamespacedHelpers('student');
+const { mapActions: bedroom } = createNamespacedHelpers('bedroom');
+const { mapActions: util } = createNamespacedHelpers('util');
+export default {
+  name: 'tsbbedroom',
+  props: {},
+  components: { detailFrame, dataTable, dataForm },
+  data: function() {
+    return {
+      view: 'list',
+      dialog: false,
+      form: {},
+      list: [
+        {
+          term: '1',
+          batch: '1',
+          name: '1',
+        },
+      ],
+      stuBedroom: [],
+      bedroomList: [],
+      originBedRoomList: [],
+      classInfo: {},
+      opera: [
+        {
+          label: '查看寝室',
+          icon: 'el-icon-view',
+          method: 'edit',
+        },
+      ],
+      fields: [
+        { label: '期', prop: 'term' },
+        { label: '批', prop: 'batch' },
+        { label: '班级', prop: 'name' },
+      ],
+      options: undefined,
+      // 编辑学生所在寝室
+      sutlist: [
+        {
+          name: '测试',
+          gender: '男',
+          nation: '汉',
+          id_number: '220182199603257019',
+          termname: '1',
+          batchname: '1',
+          classname: '1',
+          school_name: '吉林大学',
+          faculty: '计算机',
+          major: '计算机',
+          phone: '17319450324',
+          email: '123456@163.com',
+        },
+      ],
+      stuopera: [
+        {
+          label: '编辑寝室',
+          icon: 'el-icon-view',
+          method: 'edit',
+        },
+      ],
+      stufields: [
+        { label: '寝室号', prop: 'code' },
+        { label: '姓名', prop: 'name' },
+        { label: '性别', prop: 'gender' },
+        { label: '民族', prop: 'nation' },
+        { label: '身份证号', prop: 'id_number' },
+        { label: '期', prop: 'termname' },
+        { label: '批次', prop: 'batchname' },
+        { label: '班级', prop: 'classname' },
+        { label: '学校', prop: 'school_name' },
+        { label: '院系', prop: 'faculty' },
+        { label: '专业', prop: 'major' },
+        { label: '手机号', prop: 'phone' },
+        { label: '邮箱', prop: 'email' },
+      ],
+      tsbbedroomFields: [
+        { label: '姓名', model: 'name', type: 'text' },
+        { label: '性别', model: 'gender', type: 'text' },
+        { label: '寝室号', prop: 'code', type: 'input' },
+      ],
+    };
+  },
+  created() {},
+  methods: {
+    ...classes(['query']),
+    ...student({ getStudentList: 'query', updateStudent: 'update' }),
+    ...bedroom({ bedroomApart: 'apart', getBedroomList: 'query', classstuList: 'classstuList' }),
+    ...util({ modelFetch: 'fetch' }),
+    // 查询特殊班级
+    async search() {
+      let termid = _.get(this.defaultOption, 'termid');
+      if (!termid) return;
+      let res = await this.query({ termid });
+      if (this.$checkRes(res)) {
+        // this.$set(this, `list`, res.data);
+      }
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$set(this, `classInfo`, data);
+      this.view = 'class';
+    },
+    // 返回
+    toReturns() {
+      this.view = 'list';
+      this.$set(this, `classInfo`, {});
+      this.$set(this, `stuBedroom`, []);
+    },
+    // 编辑寝室
+    toQinshi({ data }) {
+      this.$set(this, `form`, data);
+      this.dialog = true;
+    },
+    // 提交编辑寝室
+    turnSave() {
+      console.log(this.form);
+    },
+    // 关闭dialog
+    toClose() {
+      this.dialog = false;
+    },
+  },
+  watch: {
+    defaultOption: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (!_.get(this, 'options')) {
+          this.$set(this, `options`, _.cloneDeep(val));
+          this.search();
+        } else {
+          let ntermid = _.get(val, 'termid');
+          let otermid = _.get(this.options, 'termid');
+          if (ntermid && !_.isEqual(ntermid, otermid)) {
+            this.$set(this, `options`, _.cloneDeep(val));
+            this.search();
+          }
+        }
+      },
+    },
+  },
+  computed: {
+    ...mapState(['user', 'defaultOption']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>