|
@@ -6,37 +6,59 @@
|
|
|
<span style="font-size:24px">{{ item.name }}</span>
|
|
|
</template>
|
|
|
<data-table style="padding:10px" ref="table" :fields="fields" :data="item.lessons" :opera="opera" @edit="toEdit"></data-table>
|
|
|
- <el-form :inline="true" size="small" style="padding:0 10px" label-width="150px">
|
|
|
+ <el-form :inline="true" size="small" style="padding:0 10px" label-width="120px" @submit.native.prevent>
|
|
|
+ <el-form-item label="班主任">
|
|
|
+ <el-select v-model="item.headteacherid" placeholder="请选择班主任">
|
|
|
+ <el-option-group v-for="group in directorList" :key="group.label" :label="group.label">
|
|
|
+ <el-option v-for="item in group.options" :key="item._id" :label="item.name" :value="item._id"> </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="礼仪课教师">
|
|
|
- <el-select v-model="item.lyteacher" placeholder="请选择礼仪课教师">
|
|
|
+ <el-select v-model="item.lyteacherid" placeholder="请选择礼仪课教师">
|
|
|
<el-option v-for="(tea, index) in lyTeacherList" :key="`lytea${index}`" :label="tea.name" :value="tea.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="开班地点">
|
|
|
- <el-select v-model="item.kb" placeholder="请选择开班地点">
|
|
|
+
|
|
|
+ <el-form-item label="教室地点">
|
|
|
+ <el-select v-model="item.jslocationid" placeholder="请选择教室地点">
|
|
|
<el-option v-for="(place, index) in locationList" :key="`lytea${index}`" :label="place.name" :value="place.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="教室地点">
|
|
|
- <el-select v-model="item.room" placeholder="请选择教室地点">
|
|
|
+
|
|
|
+ <el-form-item label="开班地点">
|
|
|
+ <el-select v-model="item.kbyslocationid" placeholder="请选择开班地点">
|
|
|
<el-option v-for="(place, index) in locationList" :key="`lytea${index}`" :label="place.name" :value="place.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="拓展训练地点">
|
|
|
- <el-select v-model="item.pra" placeholder="请选择拓展训练地点">
|
|
|
+ <el-select v-model="item.kzjhlocationid" placeholder="请选择拓展训练地点">
|
|
|
<el-option v-for="(place, index) in locationList" :key="`lytea${index}`" :label="place.name" :value="place.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="用餐地点">
|
|
|
+ <el-select v-model="item.yclocationid" placeholder="请选择用餐地点">
|
|
|
+ <el-option v-for="(place, index) in locationList" :key="`lytea${index}`" :label="place.name" :value="place.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-row type="flex" justify="center" align="middle">
|
|
|
+ <el-col :span="5">
|
|
|
+ <el-button type="primary" @click="saveLessson(item.class)" size="mini">保存班级课程</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</el-collapse-item>
|
|
|
</el-collapse>
|
|
|
- <el-drawer :with-header="false" :visible.sync="drawer" direction="rtl">
|
|
|
+ <el-drawer :with-header="false" :visible.sync="drawer" direction="rtl" @close="drawerClose">
|
|
|
<el-tabs>
|
|
|
<el-tab-pane style="padding:10px">
|
|
|
<template #label>
|
|
|
<span style="zoom:1.3">{{ form.name }}</span>
|
|
|
</template>
|
|
|
- <el-form ref="form" :model="form" label-width="120px" size="mini" :rules="rules">
|
|
|
+ <el-form ref="form" :model="form" label-width="120px" size="mini" :rules="rules" @submit.native.prevent>
|
|
|
<el-form-item label="时间" prop="date">
|
|
|
{{ form.date }}
|
|
|
</el-form-item>
|
|
@@ -48,8 +70,8 @@
|
|
|
<el-option v-for="(item, index) in subjectList" :key="`subject${index}`" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="任课教师" prop="teacherid" required>
|
|
|
- <el-input v-model="form.teacher_name" :readonly="true" placeholder="点击选择教师" @click="toChooseTeacher"></el-input>
|
|
|
+ <el-form-item label="任课教师" prop="teaid">
|
|
|
+ <el-input v-model="form.teaname" :readonly="true" placeholder="点击选择教师" @click.native="toChooseTeacher"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="时长" prop="day" required>
|
|
|
<el-radio-group v-model="form.day">
|
|
@@ -63,37 +85,92 @@
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-drawer>
|
|
|
- <el-dialog :visible.sync="dialog" title="选择教师"></el-dialog>
|
|
|
+ <el-dialog :visible.sync="dialog" title="选择教师" center @close="toClose">
|
|
|
+ <el-tabs v-model="teaTab">
|
|
|
+ <el-tab-pane style="padding:10px" label="申请授课教师" name="apply">
|
|
|
+ <el-form :model="applyTeacherListPag" :inline="true">
|
|
|
+ <el-form-item label="姓名">
|
|
|
+ <el-input v-model="applyTeacherListPag.name" size="mini" placeholder="请输入要查询的教师姓名"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="mini" @click="changePage(null, 'teacher')">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <data-table style="padding:10px" :fields="teaFields" :data="applyTeacherList" :opera="teaOpera" @seletTea="setTea" :height="300"></data-table>
|
|
|
+ <el-row type="flex" align="middle" justify="end">
|
|
|
+ <el-col :span="24" style="text-align:right;">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :total="applyTeacherListPag.total"
|
|
|
+ :page-size="5"
|
|
|
+ :current-page.sync="applyTeacherListPag.currentPage"
|
|
|
+ @current-change="cur => changePage(cur, 'apply')"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane style="padding:10px" label="可授课教师" name="list">
|
|
|
+ <el-form :model="teacherListPag" :inline="true">
|
|
|
+ <el-form-item label="姓名">
|
|
|
+ <el-input v-model="teacherListPag.name" size="mini" placeholder="请输入要查询的教师姓名"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="mini" @click="changePage(null, 'teacher')">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <data-table style="padding:10px" :fields="teaFields" :data="teacherList" :opera="teaOpera" @seletTea="setTea" :height="300"></data-table>
|
|
|
+ <el-row type="flex" align="middle" justify="end">
|
|
|
+ <el-col :span="24" style="text-align:right;">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :total="teacherListPag.total"
|
|
|
+ :page-size="5"
|
|
|
+ :current-page.sync="teacherListPag.currentPage"
|
|
|
+ @current-change="cur => changePage(cur, 'teacher')"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: location } = createNamespacedHelpers('location'); //地点
|
|
|
+const { mapActions: subject } = createNamespacedHelpers('subject'); //科目
|
|
|
+const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
|
|
|
+const { mapActions: teaPlan } = createNamespacedHelpers('teaPlan'); //教师申请
|
|
|
+const { mapActions: director } = createNamespacedHelpers('director'); //教师
|
|
|
+const { mapActions: dept } = createNamespacedHelpers('dept'); //配合教师表使用的部门表
|
|
|
+
|
|
|
export default {
|
|
|
name: 'lesson-plan',
|
|
|
props: {
|
|
|
start: { type: String, required: true },
|
|
|
end: { type: String, required: true },
|
|
|
classes: { type: Array, default: () => [] },
|
|
|
- locationList: { type: Array, default: () => [] },
|
|
|
- subjectList: { type: Array, default: () => [] },
|
|
|
- lyTeacherList: { type: Array, default: () => [] },
|
|
|
- teacherList: { type: Array, default: () => [] },
|
|
|
- applyTeacherList: { type: Array, default: () => [] },
|
|
|
},
|
|
|
components: { dataTable },
|
|
|
data: () => ({
|
|
|
activeName: '0',
|
|
|
drawer: false,
|
|
|
dialog: false,
|
|
|
+ teaTab: 'apply',
|
|
|
dateList: [],
|
|
|
classList: [],
|
|
|
fields: [
|
|
|
{ label: '日期', prop: 'date' },
|
|
|
{ label: '星期', prop: 'week' },
|
|
|
- { label: '课程', prop: 'lesson' },
|
|
|
- { label: '任课教师', prop: 'teacher' },
|
|
|
+ { label: '课程', prop: 'subname' },
|
|
|
+ { label: '任课教师', prop: 'teaname' },
|
|
|
],
|
|
|
opera: [
|
|
|
{
|
|
@@ -102,26 +179,52 @@ export default {
|
|
|
method: 'edit',
|
|
|
},
|
|
|
],
|
|
|
- formFields: [
|
|
|
- { label: '时间', model: 'date', type: 'text' },
|
|
|
- { label: '星期', model: 'week', type: 'text' },
|
|
|
- { label: '课程', model: 'subid', custom: true },
|
|
|
- { label: '教师', model: 'teacherid', custom: true },
|
|
|
- { label: '时长', model: 'day', type: 'radio' },
|
|
|
+ teaOpera: [
|
|
|
+ {
|
|
|
+ label: '选择教师',
|
|
|
+ icon: 'el-icon-check',
|
|
|
+ method: 'seletTea',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ teaFields: [
|
|
|
+ { label: '姓名', prop: 'name' },
|
|
|
+ { label: '学校', prop: 'school_name' },
|
|
|
+ // { label: '评分', prop: 'xxx' }, //TODO多个评分,暂时没显示
|
|
|
],
|
|
|
dayList: [{ label: '一天' }, { label: '半天' }],
|
|
|
rules: {
|
|
|
subid: [{ required: true, message: '请选择科目' }],
|
|
|
- teacherid: [{ required: true, message: '请选择任课教师' }],
|
|
|
day: [{ required: true, message: '请选择时长' }],
|
|
|
},
|
|
|
form: {},
|
|
|
+ locationList: [],
|
|
|
+ subjectList: [],
|
|
|
+ lyTeacherList: [],
|
|
|
+ teacherList: [],
|
|
|
+ applyTeacherList: [],
|
|
|
+ directorList: [],
|
|
|
+ deptList: [],
|
|
|
+ teacherListPag: {
|
|
|
+ total: 0,
|
|
|
+ cur: 1,
|
|
|
+ },
|
|
|
+ applyTeacherListPag: {
|
|
|
+ total: 0,
|
|
|
+ cur: 1,
|
|
|
+ },
|
|
|
}),
|
|
|
created() {
|
|
|
this.setDateList();
|
|
|
this.setClasses();
|
|
|
+ this.getOtherList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...location({ getLocationList: 'query' }),
|
|
|
+ ...subject({ getSubjectList: 'query' }),
|
|
|
+ ...teacher({ getTeacherList: 'query' }),
|
|
|
+ ...teaPlan({ getApplyTeacherList: 'query' }),
|
|
|
+ ...director({ getDirectorList: 'query' }),
|
|
|
+ ...dept({ getDeptList: 'query' }),
|
|
|
setDateList() {
|
|
|
let start = new Date(this.start);
|
|
|
let end = new Date(this.end);
|
|
@@ -142,8 +245,11 @@ export default {
|
|
|
setClasses() {
|
|
|
let classes = JSON.parse(JSON.stringify(this.classes));
|
|
|
classes.map(i => {
|
|
|
- // i.dateList = JSON.parse(JSON.stringify(this.dateList));
|
|
|
- i.lessons = JSON.parse(JSON.stringify(this.dateList));
|
|
|
+ i.lessons
|
|
|
+ ? i.lessons.map(i => {
|
|
|
+ i.week = new Date(i.date).getDay() === 0 ? 7 : new Date(i.date).getDay();
|
|
|
+ })
|
|
|
+ : (i.lessons = JSON.parse(JSON.stringify(this.dateList)));
|
|
|
return i;
|
|
|
});
|
|
|
this.$set(this, `classList`, classes);
|
|
@@ -160,27 +266,118 @@ export default {
|
|
|
this.form.day ? '' : (this.form.day = '一天');
|
|
|
this.drawer = true;
|
|
|
},
|
|
|
- handleSave({ data, isNew }) {
|
|
|
- console.log(data);
|
|
|
- //根据data.id(班级id)找出是那条数据,然后根据data.date找到那条数据,将课程,教师,时长显示出来
|
|
|
- },
|
|
|
toChooseTeacher() {
|
|
|
//TODO 根据科目id,查询教师和申请授课教师两个列表
|
|
|
if (this.form.subid) {
|
|
|
this.dialog = true;
|
|
|
- this.$emit('getTeacher', this.form.subid);
|
|
|
- }
|
|
|
+ this.toGetTeacherList({ query: { subid: this.form.subid } });
|
|
|
+ } else this.$message.warning('请选择所授科目');
|
|
|
+ },
|
|
|
+ setTea({ data }) {
|
|
|
+ //TODO 需要检查申请教师的数据内容
|
|
|
+ let { id, name } = data;
|
|
|
+ this.$set(this.form, `teaid`, id);
|
|
|
+ this.$set(this.form, `teaname`, name);
|
|
|
+ this.toClose();
|
|
|
+ },
|
|
|
+ toClose() {
|
|
|
+ this.dialog = false;
|
|
|
+ },
|
|
|
+ drawerClose() {
|
|
|
+ this.drawer = false;
|
|
|
+ this.form = {};
|
|
|
+ this.$refs.form.resetFields();
|
|
|
},
|
|
|
toSaveDrawer() {
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
if (valid) {
|
|
|
- console.log(this.form);
|
|
|
+ this.form.subname = this.subjectList.find(f => f._id === this.form.subid).name;
|
|
|
+ let form = JSON.parse(JSON.stringify(this.form));
|
|
|
+ let lesson = _.pick(form, ['day', 'subname', 'teaname', 'subid', 'teaid', 'date', 'week']);
|
|
|
+ // 整理列表所需要的数据
|
|
|
+ let res = this.classList.find(f => f.class === form.class);
|
|
|
+ let classIndex = this.classList.findIndex(f => f.class === form.class);
|
|
|
+ let index = res.lessons.findIndex(f => f.date === form.date);
|
|
|
+ this.$set(this.classList[classIndex].lessons, index, lesson);
|
|
|
+ this.drawerClose();
|
|
|
} else {
|
|
|
console.warn('form validate error!!!');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //选项列表请求
|
|
|
+ async getOtherList() {
|
|
|
+ let res;
|
|
|
+ res = await this.getLocationList();
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `locationList`, res.data);
|
|
|
+ res = await this.getSubjectList();
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `subjectList`, res.data);
|
|
|
+ res = await this.getTeacherList({ is_etiquette_teacher: '1' });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `lyTeacherList`, res.data);
|
|
|
+ res = await this.getDeptList();
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `deptList`, res.data);
|
|
|
+ res = await this.getDirectorList();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let arr = res.data;
|
|
|
+ arr = arr.map(i => {
|
|
|
+ let dept = this.deptList.find(f => f._id === i.department);
|
|
|
+ if (res) i.dept_name = dept.name;
|
|
|
+ else i.dept_name = '无所属部门';
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ let last = this.deptList.map(i => {
|
|
|
+ let options = arr.filter(f => f.department === i._id);
|
|
|
+ let label = i.name;
|
|
|
+ return { options, label };
|
|
|
+ });
|
|
|
+ this.$set(this, `directorList`, last);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //教师列表请求
|
|
|
+ async toGetTeacherList({ query, type }) {
|
|
|
+ let setTeacher = async query => {
|
|
|
+ let res = await this.getTeacherList(query);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `teacherList`, res.data);
|
|
|
+ this.$set(this.teacherListPag, `total`, res.total);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ let setApply = async query => {
|
|
|
+ let res = await this.getApplyTeacherList(query);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `applyTeacherList`, res.data);
|
|
|
+ this.$set(this.applyTeacherListPag, `total`, res.total);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (!type) {
|
|
|
+ //都查
|
|
|
+ setTeacher(query);
|
|
|
+ setApply(query);
|
|
|
+ } else if (type === 'teacher') {
|
|
|
+ //查教师
|
|
|
+ setTeacher(query);
|
|
|
+ } else if (type === 'apply') {
|
|
|
+ //查申请授课
|
|
|
+ setApply(query);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changePage(page = 1, type) {
|
|
|
+ let query = { skip: (page - 1) * 5 < 0 ? 0 : (page - 1) * 5, limit: 5 };
|
|
|
+ if (type === 'teacher') {
|
|
|
+ this.teacherListPag.name && this.teacherListPag.name !== '' ? (query.name = this.teacherListPag.name) : '';
|
|
|
+ } else {
|
|
|
+ this.applyTeacherListPag.name && this.applyTeacherListPag.name !== '' ? (query.name = this.applyTeacherListPag.name) : '';
|
|
|
+ }
|
|
|
+ this.toGetTeacherList({ query, type });
|
|
|
+ },
|
|
|
+ saveLessson(id) {
|
|
|
+ let tcc = this.classList.find(f => f.class === id);
|
|
|
+ console.log(tcc);
|
|
|
+ // let object = { class: tcc.id, term: tcc.termid, batch: tcc.batchid, lessons: tcc.lessons };
|
|
|
+ // // 礼仪课,开班地点,教师地点,拓展训练地点修改班级表
|
|
|
+ // this.$emit(`save`, tcc);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
mainTitle() {
|