|
@@ -0,0 +1,87 @@
|
|
|
+<template>
|
|
|
+ <div id="stu-export">
|
|
|
+ <detail-frame :title="pageTitle">
|
|
|
+ <el-row type="flex" align="middle" justify="end" class="btn_bar">
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-button type="primary" size="mini" :disabled="selected.length <= 0">导出已选择计划下的学生</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <data-table :fields="fields" :data="list" :total="total" :opera="[]" :select="true" :selected="selected" @handleSelect="handleSelect"></data-table>
|
|
|
+ </detail-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
+import dataTable from '@frame/components/filter-page-table';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
+export default {
|
|
|
+ name: 'stu-export',
|
|
|
+ props: {},
|
|
|
+ components: { detailFrame, dataTable },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ fields: [
|
|
|
+ { label: '年度', prop: 'year' },
|
|
|
+ { label: '标题', prop: 'title' },
|
|
|
+ { label: '状态', prop: 'status', format: i => (i === '0' ? '筹备中' : i === '1' ? '进行中' : '已结束') },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ selected: [],
|
|
|
+ options: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...trainplan(['query']),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ let planyearid = _.get(this.defaultOption, 'planyearid');
|
|
|
+ const res = await this.query({ skip, limit, ...info, planyearid: planyearid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelect(data) {
|
|
|
+ this.$set(this, `selected`, data);
|
|
|
+ },
|
|
|
+ async toExport() {
|
|
|
+ let ids = this.selected.map(i => i._id);
|
|
|
+ // TODO连接接口去导出多个批次的学生
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ defaultOption: {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ handler(val) {
|
|
|
+ if (!_.get(this, 'options')) {
|
|
|
+ this.$set(this, `options`, _.cloneDeep(val));
|
|
|
+ this.search();
|
|
|
+ } else {
|
|
|
+ let nplanid = _.get(val, 'planid');
|
|
|
+ let oplanid = _.get(this.options, 'planid');
|
|
|
+ if (nplanid && !_.isEqual(nplanid, oplanid)) {
|
|
|
+ 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>
|