|
@@ -0,0 +1,138 @@
|
|
|
+<template>
|
|
|
+ <div id="setting">
|
|
|
+ <list-frame v-if="view === 'list'" returns="./index" :title="pageTitle" :needFilter="false" :needAdd="false" :needPag="false">
|
|
|
+ <el-form :inline="true">
|
|
|
+ <el-form-item>
|
|
|
+ <el-select v-model="prerequisite.term" size="small" @change="toGetClass">
|
|
|
+ <el-option-group v-for="(term, index) in termList" :key="index" :label="`第${term.term}期`">
|
|
|
+ <el-option
|
|
|
+ v-for="(batch, bindex) in term.batchnum"
|
|
|
+ :key="`${index}-${bindex}`"
|
|
|
+ :label="batch.type == '0' ? `第${batch.batch}批` : `特殊批`"
|
|
|
+ :value="batch._id"
|
|
|
+ ></el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <data-table ref="table" :fields="fields" :data="list" :opera="opera" @setting="toSetting"></data-table>
|
|
|
+ </list-frame>
|
|
|
+ <detail-frame v-else title="返回" :returns="deReturn">
|
|
|
+ <setting-detail @save="toSave" :classInfo="classInfo" :locationList="locationList" :lyTeacherList="lyTeacherList"></setting-detail>
|
|
|
+ </detail-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
+import dataTable from '@frame/components/data-table';
|
|
|
+import settingDetail from './setting/detail.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainPlan } = createNamespacedHelpers('trainplan');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
+//setting-detail
|
|
|
+const { mapActions: location } = createNamespacedHelpers('location'); //地点
|
|
|
+const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
|
|
|
+const { mapActions: dept } = createNamespacedHelpers('dept'); //配合教师表使用的部门表
|
|
|
+const { mapActions: dirPlan } = createNamespacedHelpers('dirPlan'); //班主任不能上课的列表
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'setting',
|
|
|
+ props: {},
|
|
|
+ components: { listFrame, detailFrame, dataTable, settingDetail },
|
|
|
+ data: () => {
|
|
|
+ return {
|
|
|
+ view: 'list',
|
|
|
+ termList: [],
|
|
|
+ batchList: [],
|
|
|
+ list: [],
|
|
|
+ prerequisite: {},
|
|
|
+ classInfo: {},
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '设置',
|
|
|
+ icon: 'el-icon-setting',
|
|
|
+ method: 'setting',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '班级', prop: 'name' },
|
|
|
+ // { label: '批数', prop: 'batch' },
|
|
|
+ ],
|
|
|
+ //setting-detail list:
|
|
|
+ locationList: [],
|
|
|
+ lyTeacherList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...trainPlan({ getTrainPlan: 'fetch', sendNotice: 'notice' }),
|
|
|
+ ...classes({ getClass: 'query', updateClass: 'update' }),
|
|
|
+ ...lesson({ autoArrange: 'arrange' }),
|
|
|
+ //setting-detail
|
|
|
+ ...location({ getLocationList: 'query' }),
|
|
|
+ ...teacher({ getTeacherList: 'query' }),
|
|
|
+ ...dirPlan({ dirQuery: 'getDirTeacher' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ let res = await this.getTrainPlan(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `termList`, _.get(res.data, 'termnum', []));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toSetting({ data }) {
|
|
|
+ this.view = 'class';
|
|
|
+ this.getSettingLists();
|
|
|
+ this.$set(this, `classInfo`, JSON.parse(JSON.stringify(data)));
|
|
|
+ },
|
|
|
+ async toGetClass(data) {
|
|
|
+ let res = await this.getClass({ batchid: data });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deReturn() {
|
|
|
+ this.view = 'list';
|
|
|
+ },
|
|
|
+ async getSettingLists() {
|
|
|
+ let res;
|
|
|
+ if (this.locationList.length <= 0) {
|
|
|
+ res = await this.getLocationList();
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `locationList`, res.data);
|
|
|
+ }
|
|
|
+ if (this.lyTeacherList.length <= 0) {
|
|
|
+ res = await this.getTeacherList({ islyteacher: '1', status: '4' });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `lyTeacherList`, res.data);
|
|
|
+ }
|
|
|
+ //TODO 需要重写这个方法,班主任上报的是日期,不是批次,需要查出该班主任上报的事件在不在批次时间中
|
|
|
+ res = await this.dirQuery({ batchid: this.batchid });
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
+ async toSave(data) {
|
|
|
+ console.log(data);
|
|
|
+ let res = await this.updateClass(data);
|
|
|
+ if (this.$checkRes(res, '保存成功', res.errmsg || '保存失败')) {
|
|
|
+ this.$router.push({ path: './index' });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|