|
@@ -1,11 +1,16 @@
|
|
|
<template>
|
|
|
<div id="lesson">
|
|
|
<transition name="el-zoom-in-center">
|
|
|
- <list-frame v-if="view === 'list'" :title="mainTitle" @query="search" :total="total" :filter="filterFields" :needAdd="false">
|
|
|
+ <list-frame v-if="view === 'list'" :title="mainTitle" @query="batchSearch" :total="total" :filter="filterFields" :needAdd="false" :needPag="false">
|
|
|
+ <template #options="{item}">
|
|
|
+ <template v-if="item.model === 'term'">
|
|
|
+ <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
<data-table ref="table" :fields="fields" :data="list" :opera="opera" @date="toDate"></data-table>
|
|
|
</list-frame>
|
|
|
<detail-frame v-else :title="detailTitle" :returns="returnList">
|
|
|
- <lesson-plan start="2020-01-01" end="2020-01-07" :classes="classes"></lesson-plan>
|
|
|
+ <lesson-plan :start="batch.startdate" :end="batch.enddate" :classes="classes"></lesson-plan>
|
|
|
</detail-frame>
|
|
|
</transition>
|
|
|
</div>
|
|
@@ -16,6 +21,10 @@ import lessonPlan from './lesson-plan';
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
+import _ from 'lodash';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainPlan } = createNamespacedHelpers('trainplan');
|
|
|
+const { mapActions: mapClasses } = createNamespacedHelpers('classes');
|
|
|
export default {
|
|
|
metaInfo: { title: '安排课程' },
|
|
|
name: 'lesson',
|
|
@@ -24,6 +33,7 @@ export default {
|
|
|
data: () => ({
|
|
|
view: 'list',
|
|
|
detailTitle: '',
|
|
|
+ termList: [],
|
|
|
opera: [
|
|
|
{
|
|
|
label: '排课',
|
|
@@ -32,11 +42,12 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
fields: [
|
|
|
- { label: '期次', prop: 'term' },
|
|
|
+ { label: '', prop: 'name' },
|
|
|
{ label: '批数', prop: 'batch' },
|
|
|
],
|
|
|
- filterFields: [{ label: '期数', model: 'term' }], //期数应该改成下拉,从计划里拿出来的
|
|
|
- list: [{ term: 1, batch: 1 }],
|
|
|
+ filterFields: [{ label: '期数', model: 'term', type: 'select' }], //期数应该改成下拉,从计划里拿出来的
|
|
|
+ list: [],
|
|
|
+ batch: {},
|
|
|
total: 0,
|
|
|
classes: [
|
|
|
{
|
|
@@ -59,12 +70,34 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
methods: {
|
|
|
- async search({ skip = 0, limit = 10, ...info } = {}) {},
|
|
|
- toDate({ data }) {
|
|
|
- this.view = 'lesson';
|
|
|
- this.$set(this, `detailTitle`, `第${data.term}期 第${data.batch}批次`);
|
|
|
+ ...trainPlan({
|
|
|
+ getTrainPlan: 'fetch',
|
|
|
+ }),
|
|
|
+ ...mapClasses({
|
|
|
+ getClass: 'fetch',
|
|
|
+ }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ let res = await this.getTrainPlan(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `termList`, res.data.termnum);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ batchSearch({ skip, limit, ...info }) {
|
|
|
+ let { term } = info;
|
|
|
+ let res = this.termList.find(f => f._id === term);
|
|
|
+ this.$set(this, `list`, _.sortBy(res.batchnum, ['batch']));
|
|
|
+ },
|
|
|
+ async toDate({ data }) {
|
|
|
+ // TODO 根据批id查班级
|
|
|
+ let res = await this.getClass({ batchid: data._id });
|
|
|
+ // this.view = 'lesson';
|
|
|
+ console.log(data);
|
|
|
+ let { type, classes } = data;
|
|
|
+ // this.$set(this, `detailTitle`, `第${data.term}期 第${data.batch}批次`);
|
|
|
},
|
|
|
returnList() {
|
|
|
this.view = 'list';
|
|
@@ -82,6 +115,9 @@ export default {
|
|
|
let main = meta.title || '';
|
|
|
return main;
|
|
|
},
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|