|
@@ -1,205 +0,0 @@
|
|
-<template>
|
|
|
|
- <div id="lesson">
|
|
|
|
- <!-- 弃用 -->
|
|
|
|
- <detail-frame :title="pageTitle" v-show="view == 'list'">
|
|
|
|
- <el-row type="flex" align="middle" justify="end" class="btn_bar">
|
|
|
|
- <el-col :span="2">
|
|
|
|
- <el-button type="primary" size="mini" plain @click="toArrange">按模板排课</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="2">
|
|
|
|
- <el-button type="primary" size="mini" @click="$router.push({ path: '/train/plan/term/lesson' })">查看本期课表</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" :usePage="false"></data-table>
|
|
|
|
- </detail-frame>
|
|
|
|
- <detail-frame v-if="view == 'classView'" title="班级课表" :returns="() => (view = 'list')">
|
|
|
|
- <class-table ref="lesson" :classInfo="classInfo" @saveResult="getRes"></class-table>
|
|
|
|
- <el-divider></el-divider>
|
|
|
|
- <info-class
|
|
|
|
- ref="classes"
|
|
|
|
- :classInfo="classInfo"
|
|
|
|
- :locationList="locationList"
|
|
|
|
- :lyTeacherList="lyTeacherList"
|
|
|
|
- :headTeacherList="headTeacherList"
|
|
|
|
- @saveResult="getRes"
|
|
|
|
- ></info-class>
|
|
|
|
- <el-row type="flex" align="middle" justify="center" class="btn_bar">
|
|
|
|
- <el-col :span="2">
|
|
|
|
- <el-button type="primary" @click="classSave">保存</el-button>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </detail-frame>
|
|
|
|
- </div>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
-import _ from 'lodash';
|
|
|
|
-import dataTable from '@frame/components/filter-page-table';
|
|
|
|
-import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
|
-import classTable from './parts/class-table';
|
|
|
|
-import infoClass from './parts/class-info';
|
|
|
|
-import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
-const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
|
-const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
|
-//info-class
|
|
|
|
-const { mapActions: location } = createNamespacedHelpers('location'); //地点
|
|
|
|
-const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
|
|
|
|
-const { mapActions: dirPlan } = createNamespacedHelpers('dirPlan'); //班主任不能上课的列表
|
|
|
|
-const { mapActions: teaplan } = createNamespacedHelpers('teaPlan');
|
|
|
|
-const { mapActions: mapDept } = createNamespacedHelpers('dept'); //配合教师表使用的部门表
|
|
|
|
-export default {
|
|
|
|
- name: 'lesson',
|
|
|
|
- props: {},
|
|
|
|
- components: { detailFrame, dataTable, classTable, infoClass },
|
|
|
|
- data: function() {
|
|
|
|
- return {
|
|
|
|
- view: 'list',
|
|
|
|
- list: [],
|
|
|
|
- opera: [
|
|
|
|
- {
|
|
|
|
- label: '查看本班课表',
|
|
|
|
- icon: 'el-icon-view',
|
|
|
|
- method: 'edit',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- fields: [
|
|
|
|
- { label: '期', prop: 'term' },
|
|
|
|
- { label: '批', prop: 'batch' },
|
|
|
|
- { label: '班级', prop: 'name' },
|
|
|
|
- ],
|
|
|
|
- options: {},
|
|
|
|
- classInfo: {},
|
|
|
|
- //info-class
|
|
|
|
- lyTeacherList: [],
|
|
|
|
- locationList: [],
|
|
|
|
- headTeacherList: [],
|
|
|
|
- deptList: [],
|
|
|
|
- result: [],
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- created() {},
|
|
|
|
- methods: {
|
|
|
|
- ...classes(['query']),
|
|
|
|
- ...lesson({ autoArrange: 'arrange' }),
|
|
|
|
- //info-class
|
|
|
|
- ...location({ getLocationList: 'query' }),
|
|
|
|
- ...teacher({ getTeacherList: 'query' }),
|
|
|
|
- ...dirPlan({ dirQuery: 'getDirTeacher' }),
|
|
|
|
- ...mapDept({ getDept: 'query' }),
|
|
|
|
- ...teaplan(['findTeacher']),
|
|
|
|
- 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.getSettingLists(data);
|
|
|
|
- this.$set(this, `classInfo`, data);
|
|
|
|
- this.view = 'classView';
|
|
|
|
- },
|
|
|
|
- async toArrange() {
|
|
|
|
- this.$confirm('此操作将会将默认 年度计划 下所有的班级课表重置,若您已经修改过某班的信息,请谨慎使用', '提示', {
|
|
|
|
- confirmButtonText: '按模板排课',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning',
|
|
|
|
- })
|
|
|
|
- .then(async () => {
|
|
|
|
- let planid = _.get(this.defaultOption, 'planid');
|
|
|
|
- let res = await this.autoArrange(planid);
|
|
|
|
- this.$checkRes(res, '排课成功', res.errmsg || '排课失败');
|
|
|
|
- })
|
|
|
|
- .catch(async () => {
|
|
|
|
- console.log('已取消');
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- async getSettingLists(data) {
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
- if (this.headTeacherList.length <= 0) {
|
|
|
|
- res = await this.findTeacher({ planid: data.planid, termid: data.termid, batchid: data.batchid });
|
|
|
|
- let duplicate = _.cloneDeep(res.data);
|
|
|
|
- if (this.$checkRes(res)) {
|
|
|
|
- if (this.deptList.length <= 0) {
|
|
|
|
- let dept = await this.getDept();
|
|
|
|
- if (this.$checkRes(res)) this.$set(this, `deptList`, dept.data);
|
|
|
|
- }
|
|
|
|
- //班主任按部门分组
|
|
|
|
- let group = _.groupBy(res.data, 'department');
|
|
|
|
- let keys = Object.keys(group);
|
|
|
|
- let arr = keys.map(key => {
|
|
|
|
- let r = this.deptList.find(f => f.id == key);
|
|
|
|
- let obj = {};
|
|
|
|
- if (r) {
|
|
|
|
- obj.name = r.name;
|
|
|
|
- obj.list = group[key];
|
|
|
|
- }
|
|
|
|
- return obj;
|
|
|
|
- });
|
|
|
|
- this.$set(this, `headTeacherList`, arr);
|
|
|
|
- //班主任筛选可以当礼仪老师列表,和 礼仪教师列表合并
|
|
|
|
- duplicate = duplicate.filter(f => f.islyteacher == '1');
|
|
|
|
- this.$set(this, `lyTeacherList`, [...this.lyTeacherList, ...duplicate]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- classSave() {
|
|
|
|
- this.$refs.lesson.toSave();
|
|
|
|
- this.$refs.classes.toSave();
|
|
|
|
- },
|
|
|
|
- getRes({ from, result }) {
|
|
|
|
- let r = this.result.find(f => f.from == from);
|
|
|
|
- if (r) {
|
|
|
|
- console.log(`已有${from}的保存结果,未清除`);
|
|
|
|
- return;
|
|
|
|
- } else {
|
|
|
|
- this.result.push({ from, result });
|
|
|
|
- }
|
|
|
|
- if (this.result.length == 2) {
|
|
|
|
- let resR = this.result.every(e => e.result == true);
|
|
|
|
- if (resR) this.$message.success('保存成功');
|
|
|
|
- this.$set(this, `result`, []);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- 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>
|
|
|