|
@@ -0,0 +1,113 @@
|
|
|
+<template>
|
|
|
+ <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="getClass">
|
|
|
+ <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.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" :opera="opera"> </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 } = createNamespacedHelpers('attendance');
|
|
|
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '培训学生管理' },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ dataTable,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ classList: [],
|
|
|
+ batchList: [],
|
|
|
+ termList: [],
|
|
|
+ planList: [],
|
|
|
+ opera: [],
|
|
|
+ fields: [
|
|
|
+ { label: '姓名', prop: 'name' },
|
|
|
+ { label: '性别', prop: 'gender' },
|
|
|
+ { label: '民族', prop: 'nation' },
|
|
|
+ { label: '身份证号', prop: 'id_number' },
|
|
|
+ { label: '学校', prop: 'school_name' },
|
|
|
+ { label: '手机号', prop: 'phone' },
|
|
|
+ { label: 'QQ号', prop: 'qq' },
|
|
|
+ { label: '邮箱', prop: 'email' },
|
|
|
+ { label: '职务', prop: 'job' },
|
|
|
+ // { label: '期', prop: 'termname' },
|
|
|
+ // { label: '批次', prop: 'batchname' },
|
|
|
+ // { label: '班级', prop: 'classname' },
|
|
|
+ { label: '是否优秀', prop: 'is_fine', format: i => (i === '0' ? '否' : i === '1' ? '是' : '无资格') },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ form: {},
|
|
|
+ options: undefined,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...trainplan({ schPlanquery: 'query', planFetch: 'fetch' }),
|
|
|
+ ...classes({ classesquery: 'query' }),
|
|
|
+ ...student({ stuquery: 'query' }),
|
|
|
+ async search() {
|
|
|
+ const res = await this.planFetch(this.defaultOption.planid);
|
|
|
+ this.$set(this, `termList`, _.get(res.data, 'termnum'));
|
|
|
+ if (this.defaultOption.termid) this.form.termid = this.defaultOption.termid;
|
|
|
+ this.getClass(this.defaultOption.termid);
|
|
|
+ },
|
|
|
+ async getClass(termid) {
|
|
|
+ const res = await this.classesquery({ termid });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
|
|
|
+ },
|
|
|
+ async onsearch({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.stuquery({ skip, limit, classid: this.form.classid, ...info });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: { ...mapState(['user', 'defaultOption']) },
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|