<template>
    <div class="course-plan-container">
        <div class="class-list-wrap">
            <div class="class-list-header">
                <div v-if="!isSearch">
                    <span>班级列表</span>
                    <Icon type="md-search" class="action-btn-icon" @click="toggleSearch" />
                </div>
                <div v-else class="dark-iview-input">
                    <Input icon="ios-close"
                           v-model="classFilter.keyWord"
                           placeholder="关键字搜索..."
                           autofocus
                           style="width:calc(100% - 15px)"
                           @on-click="toggleSearch"
                           @on-change="onSearchClass"
                           @on-enter="onSearchClass" />
                </div>
            </div>
            <div class="class-list-content">
                <vuescroll>
                    <Loading v-show="isListLoading" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
                    <div class="class-list-item" v-for="(item,index) in classListShow" :key="index" @click="selectClass(index)" :class="curClassIndex == index ? 'block-bg block-bg-active':'block-bg'">
                        <div class="class-list-item-left">
                            <p class="class-name">{{item.classroomName}}</p>
                            <p class="head-teacher">
                                <span>{{$t('schoolBaseInfo.headmaster')}}</span>
                                <span class="primary-text-color">{{item.headMaster}}</span>
                            </p>
                        </div>
                    </div>
                    <EmptyData v-if="classListShow.length == 0" style="padding-top:120px;"></EmptyData>
                </vuescroll>
            </div>
        </div>
        <div class="cus-table-wrap">
            <div class="cus-table-header common-save-btn">
                <span>课程表</span>
                <Button style="float:right;margin-right:50px;margin-top:6px;" @click="showImportCus">
                    <Icon type="md-add" color="white" size="18" />导入课表
                </Button>
            </div>
            <div class="cus-table-content dark-iview-table">
                <vuescroll>
                    <div class="cus-table-top dark-iview-input dark-iview-select">
                        <div class="semester-filter-wrap">
                            <!--<span class="label">学期</span>
                        <Select v-model="semester" size="small" style="width: 200px;display:inline-block;">
                            <Option v-for="(item,index) in semesterList.semesters" :value="item.semesterCode">{{item.semesterName}}</Option>
                        </Select>-->
                        </div>
                        <h1 class="sch-title">课程表</h1>
                    </div>
                    <div v-if="this.classListShow[this.curClassIndex]">
                        <Table :columns="timeColumns" disabled-hover :data="classListShow[curClassIndex].classPlan" border :span-method="handleSpan" class="cus-table">
                            <!--上午/下午-->
                            <template slot-scope="{ row, index }" slot="sub">
                                <p style="padding:10px 0px 4px 0px;font-size: 20px;">
                                    {{parseInt(row.time.substr(0,2)) > 12 ? '下午':'上午'}}
                                </p>
                            </template>
                            <!--时段-->
                            <template slot-scope="{ row, index }" slot="time">
                                <p style="padding:10px 0px 4px 0px;font-size: 20px;">
                                    {{row.time}}
                                </p>
                                <p style="font-size:12px;padding:4px 0px 10px 0px;">
                                    {{'('+row.label+')'}}
                                </p>
                            </template>
                            <!--星期一-->
                            <template slot-scope="{ row, index }" slot="MON">
                                <div :class="row.weeklies.MON.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.MON.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'MON')" />
                                        <Icon v-if="row.weeklies.MON.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'MON')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.MON.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.MON.teacher}}</p>
                                </div>
                            </template>
                            <!--星期二-->
                            <template slot-scope="{ row, index }" slot="TUE">
                                <div :class="row.weeklies.TUE.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.TUE.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'TUE')" />
                                        <Icon v-if="row.weeklies.TUE.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'TUE')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.TUE.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.TUE.teacher}}</p>
                                </div>
                            </template>
                            <!--星期三-->
                            <template slot-scope="{ row, index }" slot="WED">
                                <div :class="row.weeklies.WED.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.WED.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'WED')" />
                                        <Icon v-if="row.weeklies.WED.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'WED')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.WED.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.WED.teacher}}</p>
                                </div>
                            </template>
                            <!--星期四-->
                            <template slot-scope="{ row, index }" slot="THU">
                                <div :class="row.weeklies.THU.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div class="toggle-status-btn-wrap" v-if="row.weeklies.THU.status == 1">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'THU')" />
                                        <Icon v-if="row.weeklies.THU.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'THU')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.THU.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.THU.teacher}}</p>
                                </div>
                            </template>
                            <!--星期五-->
                            <template slot-scope="{ row, index }" slot="FRI">
                                <div :class="row.weeklies.FRI.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.FRI.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'FRI')" />
                                        <Icon v-if="row.weeklies.FRI.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'FRI')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.FRI.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.FRI.teacher}}</p>
                                </div>
                            </template>
                            <!--星期六-->
                            <template slot-scope="{ row, index }" slot="SAT">
                                <div :class="row.weeklies.SAT.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.SAT.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'SAT')" />
                                        <Icon v-if="row.weeklies.SAT.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'SAT')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.SAT.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.SAT.teacher}}</p>
                                </div>
                            </template>
                            <!--星期日-->
                            <template slot-scope="{ row, index }" slot="SUN">
                                <div :class="row.weeklies.SUN.status == 1 ? 'week-day-cell':'week-day-cell vact-status'">
                                    <div v-if="row.weeklies.SUN.status == 1" class="toggle-status-btn-wrap">
                                        <Icon class="cell-action-icon" type="ios-settings" title="设置课程" @click="showSetCus(row,'SUN')" />
                                        <Icon v-if="row.weeklies.SUN.courseName" class="cell-action-icon" type="md-trash" title="取消课程" @click="showCancelCus(row,'SUN')" />
                                    </div>
                                    <p class="course-name">{{row.weeklies.SUN.courseName}}</p>
                                    <p class="teacher-name">{{row.weeklies.SUN.teacher}}</p>
                                </div>
                            </template>
                        </Table>
                    </div>
                    <Loading v-if="isLoading" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
                </vuescroll>
            </div>
        </div>
        <Modal v-model="importCusStatus"
               title="导入课程"
               width="1000"
               class-name="dark-iview-modal"
               @on-ok="confImpStatus = true"
               @on-cancel="cancelImport">
            <ImportExcel ref="impXls" :headerKeys="headerKeys" :headerTitles="headerTitles" @getTableData="getTableData"></ImportExcel>
            <div class="error-tips-wrap">
                <span style="color:#ed4014;" v-if="errorCourse.length > 0">
                    <span>错误课程：</span><span>{{errorCourse.join(',')}}</span>
                </span>
                <span style="color:#ff9900" v-if="errorClass.length > 0">
                    <span>错误班级：</span><span>{{errorClass.join(',')}}</span>
                </span>
                <span style="color:#2db7f5" v-if="errorTeacher.length > 0">
                    <span>错误授课老师：</span><span>{{errorTeacher.join(',')}}</span>
                </span>
                <span style="color:#ed4014" v-if="moreClass">
                    <span>只能以班级为单位导入！</span>
                </span>
            </div>
        </Modal>
        <Modal v-model="setCusStatus"
               title="设置课程"
               class-name="dark-iview-modal dark-iview-form"
               @on-ok="confirmSetCus"
               @on-cancel="cancelSetCus">
            <Form :model="cusItem" :label-width="90">
                <FormItem label="课程名称">
                    <Select v-model="cusItem.courseId">
                        <Option v-for="(item,index) in courseList" :key="index" :value="item.id">{{item.courseName}}</Option>
                    </Select>
                </FormItem>
                <FormItem label="授课老师">
                    <Select v-model="cusItem.teacher">
                        <Option v-for="(item,index) in cusTeaList" :key="index" :value="item.id">{{item.name}}</Option>
                    </Select>
                </FormItem>
            </Form>
        </Modal>
        <Modal v-model="cancelCusStatus"
               title="取消课程"
               class-name="dark-iview-modal dark-iview-form"
               @on-ok="confirmCancelCus">
            <p v-if="delCusInfo.row" style="color:white;font-size:16px;">确认取消当前课程？</p>
        </Modal>
        <Modal v-model="confImpStatus"
               title="确认导入"
               class-name="dark-iview-modal dark-iview-form"
               @on-ok="importCus">
            <p style="color:white;font-size:16px;">批量导入课程将覆盖班级原来的课表，确认批量导入并且覆盖原来的课表？</p>
        </Modal>
    </div>
</template>
<script>

    import Loading from '@/common/Loading.vue'
    import ImportExcel from '@/common/ImportExcel.vue'
    export default {
        components: {
            Loading, ImportExcel
        },
        inject: ['reload'],
        data() {
            return {
                confImpStatus: false,
                classFilter: {
                    keyWord: ''
                },
                isSearch: false,
                isLoading: false,
                courseList: [],
                cusItem: {
                    courseId: '',
                    teacher: '',
                    row: {},
                    day: ''
                },
                delCusInfo: {},
                errorClass: [],
                errorCourse: [],
                errorTeacher: [],
                excelData: [],
                headerKeys: ['classroomCode', 'courseName', 'courseCode', 'teacher', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'],
                headerTitles: ['班级', '课程名称', '课程编码', '授课老师', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
                importCusStatus: false,
                setCusStatus: false,
                cancelCusStatus: false,
                moreClass: false,
                schoolInfo: {},
                subIndex: 0,
                //semester: [],
                isListLoading: false,
                classList: [],
                classListShow: [],
                curClassIndex: 0,
                tableData: [],
                importData: [],
                timeColumns: [
                    {
                        title: ' ',
                        slot: 'sub',
                        width: 100,
                        align: 'center',
                        className: 'custom-bg'
                    },
                    {
                        title: ' ',
                        slot: 'time',
                        width: 200,
                        align: 'center'
                    },
                    {
                        title: '星期一',
                        slot: 'MON',
                        align: 'center'
                    },
                    {
                        title: '星期二',
                        slot: 'TUE',
                        align: 'center'
                    },
                    {
                        title: '星期三',
                        slot: 'WED',
                        align: 'center'
                    },
                    {
                        title: '星期四',
                        slot: 'THU',
                        align: 'center'
                    },
                    {
                        title: '星期五',
                        slot: 'FRI',
                        align: 'center'
                    },
                    {
                        title: '星期六',
                        slot: 'SAT',
                        align: 'center'
                    },
                    {
                        title: '星期日',
                        slot: 'SUN',
                        align: 'center'
                    }
                ]
            }
        },
        methods: {
            showCancelCus(row, day) {
                this.cancelCusStatus = true

                this.delCusInfo.row = row
                this.delCusInfo.day = day
            },
            //确认取消课程
            confirmCancelCus() {
                let requestData = {
                    id: this.delCusInfo.row.weeklies[this.delCusInfo.day].courseId,
                    code: this.delCusInfo.row.weeklies[this.delCusInfo.day].teacherCode,
                    classroomCode: this.classListShow[this.curClassIndex].classroomCode,
                    time:this.delCusInfo.row.time,
                    day:this.delCusInfo.day
                }
                this.isLoading = true
                this.$api.courseMgmt.deleteTime(requestData).then(
                    (res) => {
                        if (!res.error) {
                            this.$Message.success('取消成功')
                            this.classListShow[this.curClassIndex].classPlan[this.delCusInfo.row._index].weeklies[this.delCusInfo.day].teacher = undefined
                            this.classListShow[this.curClassIndex].classPlan[this.delCusInfo.row._index].weeklies[this.delCusInfo.day].teacherCode = undefined
                            this.classListShow[this.curClassIndex].classPlan[this.delCusInfo.row._index].weeklies[this.delCusInfo.day].courseName = undefined
                            this.classListShow[this.curClassIndex].classPlan[this.delCusInfo.row._index].weeklies[this.delCusInfo.day].courseId = undefined
                            let tempArr = JSON.parse(JSON.stringify(this.classListShow[this.curClassIndex].classPlan))
                            this.classListShow[this.curClassIndex].classPlan = []
                            this.classListShow[this.curClassIndex].classPlan = [...tempArr]
                        }
                        this.isLoading = false
                    },
                    (err) => {
                        this.$Message.error('取消失败')
                        this.isLoading = false
                    }
                )
            },
            //关键字搜索班级
            onSearchClass() {
                this.classListShow = this.classList.filter((item) => {
                    return item.classroomName.indexOf(this.classFilter.keyWord) !== -1
                })
            },
            /**切换搜索状态 */
            toggleSearch() {
                this.isSearch = !this.isSearch
            },
            //获取课程列表
            getCourseList() {
                let requestData = {
                    code: this.$store.state.userInfo.schoolCode
                }
                this.$api.courseMgmt.findCourse(requestData).then(
                    (res) => {
                        if (res.error == null) {
                            this.courseList = res.result.data
                        }
                    },
                    (err) => {
                        this.$Message.error('API error！')
                    }
                )
            },
            //取消设置课程
            cancelSetCus() {
                this.cusItem.teacher = ''
                this.cusItem.courseId = ''
            },
            //确认设置课程
            confirmSetCus() {
                this.isLoading = true
                let requestData = {
                    courseId: this.cusItem.courseId,
                    classroomCode: this.classListShow[this.curClassIndex].classroomCode,
                    code: this.cusItem.teacher,
                    courseTime: {
                        label: this.cusItem.row.label,
                        time: this.cusItem.row.time,
                        day: this.cusItem.day
                    }
                }
                this.$api.courseMgmt.upsertPlanDto(requestData).then(
                    (res) => {
                        if (!res.error && res.result.data) {
                            this.$set(this.classListShow[this.curClassIndex].classPlan[this.cusItem.row._index].weeklies[this.cusItem.day], 'courseName', this.courseList.filter((item) => {
                                return item.id == this.cusItem.courseId
                            })[0].courseName)

                            this.$set(this.classListShow[this.curClassIndex].classPlan[this.cusItem.row._index].weeklies[this.cusItem.day], 'teacher', this.cusTeaList.filter((item) => {
                                return item.id == this.cusItem.teacher
                            })[0].name)

                            this.$Message.success('设置成功！')
                            this.cusItem.teacher = ''
                            this.cusItem.courseId = ''
                        } else {
                            this.$Message.error('设置失败！')
                        }
                        this.isLoading = false
                    },
                    (err) => {
                        this.isLoading = false
                    }
                )
            },
            //显示设置课程对话框
            showSetCus(row, day) {
                this.cusItem.row = row
                this.cusItem.day = day
                this.setCusStatus = true
            },
            //处理表格导入的数据
            getTableData(data) {
                this.excelData = data
                let keys = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
                let groupData = this.$jsFn.groupBy(data, 'classroomCode')
                if (groupData.length > 1) {
                    this.$Message.warning('只能以班级为单位导入！')
                    this.moreClass = true
                    this.excelData.length = 0
                } else {
                    for (let itemData of data) {
                        //验证班级code
                        let classroom = this.classList.filter((item) => {
                            return item.classroomCode == itemData.classroomCode
                        })
                        if (classroom.length == 0) {
                            this.errorClass.push(itemData.classroomCode)
                            continue
                        }
                        //验证教师id
                        let teacher = this.$store.state.teachers.teacherList.filter((item) => {
                            return item.id == itemData.teacher
                        })
                        if (teacher.length == 0) {
                            this.errorTeacher.push(itemData.teacher)
                            continue
                        }
                        //验证课程编码
                        let courseId = ''
                        let course = this.courseList.filter((item) => {
                            return item.courseCode == itemData.courseCode
                        })
                        if (course.length > 0) {
                            courseId = course[0].id
                        } else {
                            this.errorCourse.push(itemData.courseCode)
                            continue
                        }


                        for (let key of keys) {
                            if (itemData[key]) {
                                let indexes = itemData[key].toString().split(',')
                                for (let index of indexes) {
                                    let reqItem = {
                                        classroomCode: itemData.classroomCode,
                                        courseId: courseId,
                                        code: teacher[0].id,
                                        courseTime: {}
                                    }
                                    reqItem.courseTime.label = this.tableData[parseInt(index) - 1].label
                                    reqItem.courseTime.time = this.tableData[parseInt(index) - 1].time
                                    reqItem.courseTime.day = key
                                    this.importData.push(reqItem)
                                }
                            }
                        }
                    }
                    if (this.errorClass.length > 0 || this.errorCourse.length > 0 || this.errorTeacher.length > 0) {
                        this.$Message.error({
                            content: '错误数据不能导入，请检查数据是否正确',
                            duration: 5,
                        })
                    } else {
                        this.$Message.info('文件读取成功')
                    }
                }
            },
            //显示导入课程
            showImportCus() {
                this.importCusStatus = true
                this.moreClass = false
            },
            //确认导入课程
            importCus() {
                this.$refs['impXls'].file = undefined
                this.errorClass.length = 0
                this.errorCourse.length = 0
                this.errorTeacher.length = 0
                this.isLoading = true
                if (this.importData.length > 0) {
                    this.$api.courseMgmt.importAllPlan({
                        classroomCode: this.importData[0].classroomCode,
                        coursePlans: this.importData
                    }).then(
                        (res) => {
                            if (res.error == null) {
                                this.$Message.success('导入成功！')
                                this.reload()
                            } else {
                                this.$Message.error('API ERROR！')
                            }
                            this.importData.length = 0
                            this.isLoading = false
                        },
                        (err) => {
                            this.$Message.error('API ERROR！')
                            this.isLoading = false
                            this.importData.length = 0
                        }
                    )
                } else {
                    this.$Message.warning('暂无需要导入的数据！')  
                }
            },
            cancelImport() {
                this.$refs['impXls'].file = undefined
                this.errorClass.length = 0
                this.errorCourse.length = 0
                this.errorTeacher.length = 0
                this.importData.length = 0
            },
            selectClass(index) {
                this.curClassIndex = index
                this.isLoading = true
                if (!this.classListShow[this.curClassIndex].isFull) {
                    this.findClassPlan()
                } else {
                    setTimeout(() => {
                        this.isLoading = false
                    }, 500)
                }
            },
            //根据上下午合并单元格
            handleSpan({ row, column, rowIndex, columnIndex }) {
                this.getSubIndex()
                if (rowIndex === 0 && columnIndex === 0) {
                    return [this.subIndex, 1]
                } else if (rowIndex < this.subIndex && columnIndex === 0) {
                    return [0, 0]
                }
                if (rowIndex == this.subIndex && columnIndex === 0) {
                    return [this.schoolInfo.timetable.length - this.subIndex, 1]
                } else if (rowIndex > this.subIndex && columnIndex === 0) {
                    return [0, 0]
                }
            },
            //计算上下午分割点
            getSubIndex() {
                for (let index in this.schoolInfo.timetable) {
                    if (parseInt(this.tableData[index].time.substr(0, 2)) > 12) {
                        this.subIndex = parseInt(index)
                        break
                    }
                }
            },
            //根据班级查询课程安排
            findClassPlan() {
                if (this.classListShow.length > 0) {
                    let requestData = {
                        "classes[*].classroomCode": this.classListShow[this.curClassIndex].classroomCode
                    }
                    this.$api.courseMgmt.findPlan(requestData).then(
                        (res) => {
                            if (res.error == null) {
                                let jStr = JSON.stringify(this.tableData)
                                this.$set(this.classListShow[this.curClassIndex], 'classPlan', JSON.parse(jStr))
                                for (let planItem of res.result.data) {
                                    let course = this.courseList.filter((item) => {
                                        return item.id == planItem.id
                                    })
                                    let courseName = course.length > 0 ? course[0].courseName : '无课程名'
                                    let teacher = this.$store.state.teachers.teacherList.filter((item) => {
                                        return item.id == planItem.code
                                    })
                                    let teacherName = teacher.length > 0 ? teacher[0].name : '无名称'
                                    let realClass = planItem.classes.filter((item) => {
                                        return item.classroomCode == this.classListShow[this.curClassIndex].classroomCode
                                    })
                                    for (let timeItem of realClass[0].courseTimes) {
                                        //可优化
                                        for (let i = 0; i < this.classListShow[this.curClassIndex].classPlan.length; i++) {
                                            if (timeItem && this.classListShow[this.curClassIndex].classPlan[i].time == timeItem.time) {
                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].teacher = teacherName
                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].teacherCode = planItem.code
                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].courseName = courseName
                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].courseId = planItem.id
                                                break
                                            }
                                        }
                                    }
                                }
                                this.classListShow[this.curClassIndex].isFull = true
                                this.isLoading = false
                            } else {
                                this.$Message.error('API error!')
                                this.isLoading = false
                            }
                        },
                        (err) => {
                            this.isLoading = false
                        }
                    )
                } else {
                    this.isLoading = false
                }
            }
        },
        async created() {
            await this.getCourseList()
            await this.$store.dispatch('teachers/getTeacherList').then(res => { })

            //直接读取登录成功拿到得学校基础信息
            this.schoolInfo = JSON.parse(JSON.stringify(this.$store.state.user.schoolProfile.school_base))
            if (!this.schoolInfo) {
                this.$Message.warning('尚未加入学校，没有学校数据')
            }
            this.classList = JSON.parse(JSON.stringify(this.$store.state.user.schoolProfile.school_class))
            this.classListShow = [...this.classList]
            this.findClassPlan()
            
            /*await this.$store.dispatch('schoolBaseInfo/getClassroom').then(res => {
                this.classList = this.$store.state.schoolBaseInfo.classroomList
                this.classListShow = [...this.classList]
                this.findClassPlan()
                this.schoolInfo = this.$store.state.schoolBaseInfo.schoolBaseInfo
                this.tableData = this.$store.state.schoolBaseInfo.schoolBaseInfo.timetable.filter((item, index) => {
                    return item.type == 1
                })
            })*/

        },
        mounted() {
        },
        computed: {
            cusTeaList() {
                let curCourse = this.courseList.filter((item) => {
                    return item.id == this.cusItem.courseId
                })
                if (curCourse.length > 0) {
                    return this.$store.state.teachers.teacherList.filter((item) => {
                        return curCourse[0].teachers.indexOf(item.id) !== -1
                    })
                } else {
                    return []
                }
            },
            semesterList() {
                if (this.classListShow.length > 0) {
                    let data = this.$jsFn.getPeriod(this.$store.state.user.schoolProfile.school_base, this.classListShow[this.curClassIndex].periodCode)

                    return data
                } else {
                    return {}
                }
            }
        }
    }
</script>
<style scoped lang="less">
    @import "./CoursePlan.less";
</style>
<style>
    .cus-table-content .ivu-table {
        width: 100%;
    }

    .ivu-table .custom-bg {
        background: #404040 !important;
    }
</style>