|
@@ -1,84 +1,85 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <list-frame title="班级管理" @query="search" :total="total" :filter="filFields" :needFilter="false" :needAdd="false">
|
|
|
- <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @completion="toCompletion" @lesson="toLesson" @bedRoom="toBedRoom"></data-table>
|
|
|
+ <list-frame :title="pageTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @view="toClasses"></data-table>
|
|
|
</list-frame>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+var moment = require('moment');
|
|
|
+import _ from 'lodash';
|
|
|
+import Vue from 'vue';
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
export default {
|
|
|
- metaInfo: { title: '班级管理' },
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: {
|
|
|
- listFrame,
|
|
|
- dataTable,
|
|
|
+ components: { listFrame, dataTable },
|
|
|
+ data: () => {
|
|
|
+ return {
|
|
|
+ dialog: false,
|
|
|
+ drawer: false,
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '班级列表',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '年度', prop: 'year' },
|
|
|
+ { label: '标题', prop: 'title' },
|
|
|
+ { label: '状态', prop: 'status', format: i => (i === '0' ? '筹备中' : i === '1' ? '进行中' : '已结束') },
|
|
|
+ ],
|
|
|
+ info: {},
|
|
|
+ form: {},
|
|
|
+ rules: {},
|
|
|
+ list: [],
|
|
|
+ holiday: [],
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
},
|
|
|
- data: () => ({
|
|
|
- opera: [
|
|
|
- {
|
|
|
- label: '班级名单',
|
|
|
- icon: 'el-icon-user',
|
|
|
- method: 'edit',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '查看问卷进度',
|
|
|
- icon: 'el-icon-s-order',
|
|
|
- method: 'completion',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '查看课程表',
|
|
|
- icon: 'el-icon-date',
|
|
|
- method: 'lesson',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '查看寝室',
|
|
|
- icon: 'el-icon-s-home',
|
|
|
- method: 'bedRoom',
|
|
|
- },
|
|
|
- ],
|
|
|
- fields: [
|
|
|
- { label: '班级名称', prop: 'name' },
|
|
|
- { label: '人数', prop: 'number' },
|
|
|
- { label: '班级类型', prop: 'type', format: i => (i === '0' ? '正常班级' : '特殊班级') },
|
|
|
- ],
|
|
|
- filFields: [],
|
|
|
- list: [],
|
|
|
- total: 0,
|
|
|
- }),
|
|
|
created() {
|
|
|
this.search();
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['user']),
|
|
|
- },
|
|
|
methods: {
|
|
|
- ...classes(['query', 'delete']),
|
|
|
+ ...trainplan(['query', 'create', 'delete', 'update', 'notice']),
|
|
|
+ ...classes({ getClasses: 'query' }),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.query({ skip, limit, ...info, headteacherid: this.user.userid || '' });
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
- toEdit({ data }) {
|
|
|
- this.$router.push({ path: '/classes/name/list', query: { id: data.id } });
|
|
|
+ toClasses({ data }) {
|
|
|
+ this.$router.push({ path: './list', query: { id: data.id } });
|
|
|
},
|
|
|
- toCompletion({ data }) {
|
|
|
- this.$router.push({ path: '/question/completion', query: { id: data.id } });
|
|
|
- },
|
|
|
- toLesson({ data }) {
|
|
|
- this.$router.push({ path: '/classes/lesson', query: { id: data.id } });
|
|
|
+ async sendMsg({ data }) {
|
|
|
+ //TODO need test
|
|
|
+ let res = await this.getClasses({ planid: data._id });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let arr = res.data.map(i => i._id);
|
|
|
+ if (arr.length > 0) {
|
|
|
+ const resNotice = await this.sendNotice({ classids: arr });
|
|
|
+ this.$checkRes(resNotice, '发送成功', '发送失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- toBedRoom({ data }) {
|
|
|
- this.$router.push({ path: '/classes/bedroom', query: { id: data.id } });
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
},
|
|
|
},
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|