|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<div class="manage-course-container dark-iview-split">
|
|
|
+ <Loading v-if="listLoading" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
|
|
|
<!-- 头部 -->
|
|
|
<div class="mgt-course-header">
|
|
|
<Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterPeriod = e }" @on-visible-change="dropdownStates" v-if="$store.state.user.schoolProfile.school_base">
|
|
@@ -25,7 +26,6 @@
|
|
|
<Icon type="ios-people" size="16" />
|
|
|
<span>自定义名单</span>
|
|
|
</span>
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
<Split v-model="split1">
|
|
@@ -61,13 +61,12 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div slot="right" class="cus-schd-box">
|
|
|
-
|
|
|
<Split v-model="split2">
|
|
|
<!-- 授课教师列表 -->
|
|
|
<div slot="left" class="teacher-list">
|
|
|
<div class="teacher-list-header">
|
|
|
<span>教师</span>
|
|
|
- <Icon type="md-add" size="16" class="tea-action-icon" @click="addTeaStatus = true" />
|
|
|
+ <Icon type="md-add" size="16" class="tea-action-icon" @click="toggleAddTea" />
|
|
|
<Icon type="md-trash" size="16" class="tea-action-icon" @click="removeTeacher" />
|
|
|
</div>
|
|
|
<div class="tea-list-content">
|
|
@@ -105,10 +104,6 @@
|
|
|
<Icon type="md-trash" size="16" />
|
|
|
<span>移除名单</span>
|
|
|
</span>
|
|
|
- <!-- <span v-show="curTab == 1">授课教室:</span>
|
|
|
- <Select v-show="curTab == 1" v-model="setCurClass" style="width:200px;margin-right:30px" size="small">
|
|
|
- <Option v-for="(item,index) in schdClassList" :value="item.classId" :key="index">{{ item.classInfo.name }}</Option>
|
|
|
- </Select> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 教师上课时段设置 -->
|
|
@@ -149,7 +144,7 @@
|
|
|
<Select ref="sltStuList" v-show="!isDefault" clearable v-model="schdList[curClassIndex].stulist" style="width:200px;margin-right:5px" size="small">
|
|
|
<Option v-for="(item,index) in stuList" :value="item.id" :key="index" @click.native="updateStuList(item.name)">{{ item.name }}</Option>
|
|
|
</Select>
|
|
|
- <Icon type="md-add-circle" v-show="!isDefault" style="cursor:pointer" @click="goMgtStuList" />
|
|
|
+ <Icon type="md-add-circle" v-show="!isDefault" style="cursor:pointer" @click="addStuListStatus = true" />
|
|
|
</div>
|
|
|
<Table v-if="schdList[curClassIndex]" :columns="schdList[curClassIndex].stulist ? listColumn : classColumn" :data="students" class="stu-list-table" :loading="stuLoading" no-data-text="暂无学生">
|
|
|
<Loading slot="loading" :top="0" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
|
|
@@ -178,7 +173,7 @@
|
|
|
</div>
|
|
|
<!-- 教师课表 -->
|
|
|
<vuescroll v-show="curTab == 1">
|
|
|
- <TeaTable v-if="hasTimeTable" :teaClassList="schdClassList" :teacher="teaList[curTeaIndex] ? teaList[curTeaIndex].id : ''" :periodId="filterPeriod" :schedData="[courseListShow[this.curCusIndex]]" @selectCell="selectCell" @cancelCell="cancelCell"></TeaTable>
|
|
|
+ <TeaTable style="height: calc(100% - 45px)" :courseId="courseId" v-if="hasTimeTable" :teaClassList="schdClassList" :teacher="teaList[curTeaIndex] ? teaList[curTeaIndex].id : ''" :periodId="filterPeriod" :schedData="schdData" @selectCell="selectCell" @cancelCell="cancelCell"></TeaTable>
|
|
|
<div v-else>
|
|
|
<p class="no-time-table-tips">
|
|
|
{{filterPeriodName}}暂未设置时段,请先
|
|
@@ -189,66 +184,43 @@
|
|
|
</vuescroll>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 添加名单UI -->
|
|
|
- <div slot="right" class="class-setting dark-el-cascader dark-iview-select dark-iview-table" v-show="isAddStuList">
|
|
|
- <div class="add-list-header">
|
|
|
- <!-- <span class="add-list-label">教师:</span>
|
|
|
- <Select ref="sltStuList" clearable label-in-value v-model="schedule.teacherId" style="width:200px;margin-right:30px" size="small" @on-change="setTeaName">
|
|
|
- <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
- </Select> -->
|
|
|
- <span class="add-list-label">教室:</span>
|
|
|
- <el-cascader size="small" placeholder="请设置上课教室" :show-all-levels="false" clearable v-model="schedule.classId" :options="csOptions" :props="props" @change="setClassName($event,'insert')" style="width:180px;">
|
|
|
- </el-cascader>
|
|
|
- <span v-show="schedule.classId" class="attr-label" style="margin-left:20px">默认名单</span>
|
|
|
- <Tooltip v-show="schedule.classId" content="默认名单为教室对应的名单,否则需要指定自定义名单。" max-width="200">
|
|
|
- <Icon type="ios-information-circle-outline" style="margin-left:2px;margin-right:5px" />
|
|
|
- </Tooltip>
|
|
|
- <span v-show="schedule.classId">
|
|
|
- <i-switch v-model="preDefault" size="small" />
|
|
|
- </span>
|
|
|
- <span class="add-list-label" v-show="!preDefault || !schedule.classId" style="margin-left:40px">名单:</span>
|
|
|
- <Select ref="sltStuList" v-show="!preDefault || !schedule.classId" clearable v-model="schedule.stulist" style="width:200px;margin-right:5px" size="small">
|
|
|
- <Option v-for="(item,index) in stuList" :value="item.id" :key="index" @click.native="getStuList(item.name)">{{ item.name }}</Option>
|
|
|
- </Select>
|
|
|
- <Icon type="md-add-circle" v-show="!preDefault || !schedule.classId" class="create-list-icon" @click="goMgtStuList" />
|
|
|
- <div class="action-btn-wrap">
|
|
|
- <span class="action-btn" style="margin-right:40px" @click="confirmAddSchd">
|
|
|
- <Icon type="md-add" size="16" />
|
|
|
- <span>确认添加</span>
|
|
|
- </span>
|
|
|
- <span class="action-btn" @click="cancelAddSchd">
|
|
|
- <Icon type="md-close" size="16" />
|
|
|
- <span>取消添加</span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <Table :columns="schedule.stulist ? listColumn : classColumn" :data="preStus" class="stu-list-table" :loading="stuLoading" no-data-text="暂无学生">
|
|
|
- <Loading slot="loading" :top="0" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
|
|
|
- <template slot-scope="{ row }" slot="picture">
|
|
|
- <PersonalPhoto :name="row.name" :picture="row.picture" />
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="no">
|
|
|
- <span>{{row.no}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row ,index}" slot="action">
|
|
|
- <div class="item-tools" v-if="$access.can('admin.*|student-upd')">
|
|
|
- <Icon type="md-create" size="18" color="white" @click="resetNo(index)" :title="$t('schoolBaseInfo.editSeat')" />
|
|
|
- <Icon type="md-remove-circle" size="18" color="white" style="margin-left:10px" @click="removeStudent(index)" :title="$t('schoolBaseInfo.delStuBtn')" />
|
|
|
+ <!-- 添加名单UI 批量添加-->
|
|
|
+ <div slot="right" class="class-setting dark-iview-input dark-iview-select dark-iview-table" v-show="isAddStuList">
|
|
|
+ <vuescroll>
|
|
|
+ <div class="add-tea-header">
|
|
|
+ <RadioGroup v-model="addType" type="button" button-style="solid" size="small">
|
|
|
+ <Radio label="class">校本名单</Radio>
|
|
|
+ <Radio label="stulist">自定义名单</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ <!-- <Input search placeholder="搜索" style="width:240px;margin-top:0px;margin-left:15px;" size="small" /> -->
|
|
|
+ <div class="action-btn-wrap">
|
|
|
+ <span class="action-btn" style="margin-right:40px" @click="confirmAddSchd">
|
|
|
+ <Icon type="md-add" size="16" />
|
|
|
+ <span>确认添加</span>
|
|
|
+ </span>
|
|
|
+ <span class="action-btn" @click="cancelAddSchd">
|
|
|
+ <Icon type="md-close" size="16" />
|
|
|
+ <span>取消添加</span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="groupId">
|
|
|
- <span>{{row.groupId ? row.groupId : '- -'}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row, index }" slot="groupName">
|
|
|
- <span>{{row.groupName ? row.groupName : '未分组'}}</span>
|
|
|
- </template>
|
|
|
- </Table>
|
|
|
+ </div>
|
|
|
+ <Table ref="sltClass" v-show="addType == 'class'" :columns="classroomCol" :data="calssTable" style="margin-top:10px" @on-selection-change="(selection)=>{sltClass = selection}">
|
|
|
+ <template slot-scope="{ row }" slot="grade">
|
|
|
+ <span>{{$jsFn.getGradeName(schoolBase,row.gradeId)}}</span>
|
|
|
+ </template>
|
|
|
+ </Table>
|
|
|
+ <Table ref="sltList" v-show="addType == 'stulist'" :columns="listCol" :data="stuList" style="margin-top:10px" @on-selection-change="(selection)=>{sltList = selection}">
|
|
|
+ <template slot-scope="{ row }" slot="count">
|
|
|
+ <span>{{row.students.length}}</span>
|
|
|
+ </template>
|
|
|
+ </Table>
|
|
|
+ </vuescroll>
|
|
|
</div>
|
|
|
<!-- 添加授课教师UI -->
|
|
|
<div slot="right" class="class-setting dark-iview-input dark-iview-table" v-show="addTeaStatus">
|
|
|
<vuescroll>
|
|
|
<div class="add-tea-header">
|
|
|
- <Input search placeholder="" style="width:240px;margin-top:4px" size="small" />
|
|
|
+ <Input search placeholder="搜索" style="width:240px;margin-top:4px" size="small" />
|
|
|
<div class="action-btn-wrap">
|
|
|
<span class="action-btn" style="margin-right:40px" @click="confirmAddTea">
|
|
|
<Icon type="md-add" size="16" />
|
|
@@ -260,7 +232,7 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <Table :columns="teaCol" :data="teacherList" style="margin-top:10px" @on-selection-change="(selection)=>{sltTeachers = selection}">
|
|
|
+ <Table ref="sltTea" :columns="teaCol" :data="teacherList" style="margin-top:10px" @on-selection-change="(selection)=>{sltTeachers = selection}">
|
|
|
<template slot-scope="{ row }" slot="picture">
|
|
|
<PersonalPhoto :name="row.name" :picture="row.picture" />
|
|
|
</template>
|
|
@@ -298,12 +270,14 @@
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
- <!-- 添加授课教师 -->
|
|
|
- <!-- <Modal v-model="addTeaStatus" title="添加教师" class-name="dark-iview-modal dark-iview-select" @on-ok="confirmAddTea">
|
|
|
- <Select ref="addTea" label-in-value multiple clearable :placeholder="$t('cusMgt.teacherHolder')" :max-tag-count="3" filterable @on-change="seltChange">
|
|
|
- <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
- </Select>
|
|
|
- </Modal> -->
|
|
|
+ <!-- 创建名单stulist -->
|
|
|
+ <Modal v-model="addStuListStatus" title="创建自定义名单" width="1200" @on-ok="confirmAddStuList" class-name="dark-iview-modal" :loading="modalLoading">
|
|
|
+ <div class="dark-iview-input list-name-box">
|
|
|
+ <span>名称:</span>
|
|
|
+ <Input v-model="listName" placeholder="请输入名单名称..." style="width: 300px" />
|
|
|
+ </div>
|
|
|
+ <StudentList @getSelectInfo="(selction)=>{listSelections = selction}"></StudentList>
|
|
|
+ </Modal>
|
|
|
<!-- 时段设置 -->
|
|
|
<Drawer title="时段设置" class-name="dark-iview-drawer" :closable="false" v-model="showTime" :width="450">
|
|
|
<TimeSetting :periodId="filterPeriod"></TimeSetting>
|
|
@@ -333,6 +307,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
return {
|
|
|
+ listLoading: false,
|
|
|
+ classList: [],
|
|
|
+ addType: 'class',
|
|
|
+ listName: '',
|
|
|
+ addStuListStatus: false,
|
|
|
+ modalLoading: false,
|
|
|
+ listSelections: [],
|
|
|
isUpd: false,
|
|
|
props: {
|
|
|
value: 'id',
|
|
@@ -351,6 +332,8 @@ export default {
|
|
|
isDefault: true,
|
|
|
teacherList: [],
|
|
|
sltTeachers: [],
|
|
|
+ sltClass: [],
|
|
|
+ sltList: [],
|
|
|
teaCol: [
|
|
|
{
|
|
|
type: 'selection',
|
|
@@ -379,6 +362,40 @@ export default {
|
|
|
align: 'center '
|
|
|
}
|
|
|
],
|
|
|
+ listCol: [
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ width: 60,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '名称',
|
|
|
+ key: 'name',
|
|
|
+ align: 'center '
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '学生人数',
|
|
|
+ slot: 'count',
|
|
|
+ align: 'center '
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ classroomCol: [
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ width: 60,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '名称',
|
|
|
+ key: 'name',
|
|
|
+ align: 'center '
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '编码',
|
|
|
+ key: 'no',
|
|
|
+ align: 'center '
|
|
|
+ }
|
|
|
+ ],
|
|
|
classColumn: [
|
|
|
{
|
|
|
title: ' ',
|
|
@@ -494,25 +511,176 @@ export default {
|
|
|
id: '',
|
|
|
name: ''
|
|
|
},
|
|
|
- teacherId:'',
|
|
|
- teacherName:'',
|
|
|
+ teacherId: '',
|
|
|
+ teacherName: '',
|
|
|
stulist: '',
|
|
|
time: [],
|
|
|
notice: ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ teaSchds: {}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //查询教师课表数据
|
|
|
+ async getTeaSchd() {
|
|
|
+ let teaId = this.teaList[this.curTeaIndex].id
|
|
|
+ try {
|
|
|
+ let cusList = await this.getTeaCourse(teaId)
|
|
|
+ let cusSchd = await this.getTeaDetail(cusList)
|
|
|
+ this.$set(this.teaSchds, teaId, [])
|
|
|
+ console.log(cusSchd)
|
|
|
+ cusSchd.forEach(item => {
|
|
|
+ this.teaSchds[teaId].push(...item.courses)
|
|
|
+ })
|
|
|
+ console.log('hehe', this.teaSchds)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取教师所有课程列表
|
|
|
+ getTeaCourse(teaId) {
|
|
|
+ return new Promise((r, j) => {
|
|
|
+ let requestData = {
|
|
|
+ 'code': teaId,
|
|
|
+ 'schoolId': this.$store.state.userInfo.schoolCode,
|
|
|
+ 'scope': 'private'
|
|
|
+ }
|
|
|
+ this.$api.courseMgmt.findCourse(requestData).then(
|
|
|
+ (res) => {
|
|
|
+ if (res.error == null) {
|
|
|
+ let schoolCus = res.courses.filter(item => {
|
|
|
+ return item.scope == 'school'
|
|
|
+ })
|
|
|
+ r(schoolCus)
|
|
|
+ } else {
|
|
|
+ j(res.error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ j(res.error)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取教师所有课程详细信息
|
|
|
+ getTeaDetail(cusList) {
|
|
|
+ return new Promise((r, j) => {
|
|
|
+ let promises = []
|
|
|
+ cusList.forEach(item => {
|
|
|
+ let requestData = {
|
|
|
+ 'code': this.$store.state.userInfo.schoolCode,
|
|
|
+ 'scope': 'school',
|
|
|
+ 'id': item.id
|
|
|
+ }
|
|
|
+ promises.push(this.$api.courseMgmt.findCusInfo(requestData))
|
|
|
+ })
|
|
|
+ Promise.all(promises).then(
|
|
|
+ resAll => {
|
|
|
+ resAll.forEach(async (res, index) => {
|
|
|
+ if (res.courses && res.courses.length > 0) {
|
|
|
+ res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
|
|
|
+ //过滤当前教师的schedule
|
|
|
+ let teaId = this.teaList[this.curTeaIndex].id
|
|
|
+ res.courses[0].schedule = res.courses[0].schedule.filter(item => {
|
|
|
+ return item.teacherId == teaId
|
|
|
+ })
|
|
|
+ res.courses[0].schedule.forEach(item => {
|
|
|
+ //补充教室信息
|
|
|
+ if (item.classId) {
|
|
|
+ let classInfo = this.classList.find(classItem => {
|
|
|
+ return classItem.id == item.classId
|
|
|
+ })
|
|
|
+ item.classInfo = {
|
|
|
+ id: item.classId,
|
|
|
+ name: classInfo ? classInfo.name : '--'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ r(resAll)
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ j(err)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ toggleAddTea() {
|
|
|
+ this.initStatus()
|
|
|
+ this.addTeaStatus = true
|
|
|
+ },
|
|
|
+ initStatus() {
|
|
|
+ this.isAddStuList = false
|
|
|
+ this.addTeaStatus = false
|
|
|
+ },
|
|
|
+ confirmAddStuList() {
|
|
|
+ if (!this.listName) {
|
|
|
+ this.$Message.warning('请输入名单名称')
|
|
|
+ this.modalLoading = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.modalLoading = true
|
|
|
+ }, 0)
|
|
|
+ } else {
|
|
|
+ let stuList = {
|
|
|
+ name: this.listName,
|
|
|
+ id: this.$tools.guid(),
|
|
|
+ code: this.$store.state.userInfo.schoolCode,
|
|
|
+ students: this.listSelections.map(item => { //这里没有学生名字, 需要先查看id集合再查学生信息?
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ code: item.code //学生所在学校的编码,这里先传当前学校编码,暂无未考虑跨校名单
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ tmids: [],
|
|
|
+ course: null
|
|
|
+ }
|
|
|
+ this.saveStuList(stuList)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存名单
|
|
|
+ saveStuList(stuList) {
|
|
|
+ let params = {
|
|
|
+ stuList,
|
|
|
+ scope: "school"
|
|
|
+ }
|
|
|
+ this.$api.courseMgmt.upsertStulist(params).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success('添加成功')
|
|
|
+ this.addStuStatus = false
|
|
|
+ this.stuList.unshift(params.stuList)
|
|
|
+ this.listName = ''
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.modalLoading = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.modalLoading = true
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ clearTable() {
|
|
|
+ this.$refs.sltTea.selectAll(false)
|
|
|
+ this.$refs.sltList.selectAll(false)
|
|
|
+ this.$refs.sltClass.selectAll(false)
|
|
|
+ },
|
|
|
selectCus(index) {
|
|
|
this.selectClass(0)
|
|
|
this.selectTea(0)
|
|
|
this.cancelAddTea()
|
|
|
this.cancelAddSchd()
|
|
|
this.curCusIndex = index
|
|
|
+
|
|
|
},
|
|
|
selectTab(index) {
|
|
|
this.curTab = index
|
|
|
this.setDefClass()
|
|
|
+ let teaId = this.teaList[this.curTeaIndex].id
|
|
|
+ if (index == 1 && teaId && !this.teaSchds[teaId]) {
|
|
|
+ this.getTeaSchd()
|
|
|
+ }
|
|
|
},
|
|
|
//设置默认授课教室
|
|
|
setDefClass() {
|
|
@@ -546,6 +714,25 @@ export default {
|
|
|
})
|
|
|
this.isUpd = true
|
|
|
}
|
|
|
+ //更新课程表数据
|
|
|
+ if (this.teaList[this.curTeaIndex] && this.teaSchds[this.teaList[this.curTeaIndex].id]) {
|
|
|
+ let tableData = this.teaSchds[this.teaList[this.curTeaIndex].id].find(item => {
|
|
|
+ return item.id == this.courseListShow[this.curCusIndex].id
|
|
|
+ })
|
|
|
+ if (tableData) {
|
|
|
+ let s = tableData.schedule.find(item => {
|
|
|
+ return item.classId == data.setClass && item.teacherId == this.teaList[this.curTeaIndex].id
|
|
|
+ })
|
|
|
+ if (s) {
|
|
|
+ s.time.push({
|
|
|
+ week: data.col,
|
|
|
+ id: data.row.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.teaSchds[this.teaList[this.curTeaIndex].id].push(this._.cloneDeep(this.courseListShow[this.curCusIndex]))
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
//取消课程时段设置
|
|
|
cancelCell(data) {
|
|
@@ -561,6 +748,25 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //更新课程表数据
|
|
|
+ if (this.teaList[this.curTeaIndex] && this.teaSchds[this.teaList[this.curTeaIndex].id]) {
|
|
|
+ let tableData = this.teaSchds[this.teaList[this.curTeaIndex].id].find(item => {
|
|
|
+ return item.id == this.courseListShow[this.curCusIndex].id
|
|
|
+ })
|
|
|
+ if (tableData) {
|
|
|
+ let s = tableData.schedule.find(item => {
|
|
|
+ return item.classId == data.setClass && item.teacherId == this.teaList[this.curTeaIndex].id
|
|
|
+ })
|
|
|
+ if (s) {
|
|
|
+ for (let index in s.time) {
|
|
|
+ if (s.time[index].week == data.col && s.time[index].id == data.row.id) {
|
|
|
+ s.time.splice(index, 1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
//修改上课名单
|
|
|
updateStuList(listName) {
|
|
@@ -598,6 +804,7 @@ export default {
|
|
|
selectClass(index) {
|
|
|
this.curClassIndex = index
|
|
|
this.setIsDefault()
|
|
|
+ this.initStatus()
|
|
|
},
|
|
|
//教师列表选择事件
|
|
|
selectTea(index) {
|
|
@@ -605,6 +812,12 @@ export default {
|
|
|
this.curTeaIndex = index
|
|
|
this.setIsDefault()
|
|
|
this.setDefClass()
|
|
|
+ this.initStatus()
|
|
|
+ //获取老师所有授课数据渲染课程表
|
|
|
+ let teaId = this.teaList[this.curTeaIndex].id
|
|
|
+ if (this.curTab == 1 && teaId && !this.teaSchds[teaId]) {
|
|
|
+ this.getTeaSchd()
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 添加名单的时候获取名单对应的学生信息
|
|
@@ -701,25 +914,60 @@ export default {
|
|
|
this.$Message.warning('请设置授课老师')
|
|
|
return
|
|
|
}
|
|
|
- if (!(this.schedule.classId || this.schedule.stulist)) {
|
|
|
- this.$Message.warning('请设置教室或者名单')
|
|
|
+ if (this.addType == 'class' && this.sltClass.length > 0) {
|
|
|
+ //先判断是否有空的schedule(只是添加了老师,没有教室和名单)
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.forEach((item, index) => {
|
|
|
+ if (item.teacherId == this.schedule.teacherId && !item.stulist && !item.classId) {
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.sltClass.forEach(item => {
|
|
|
+ let exist = this.courseListShow[this.curCusIndex].schedule.find(schdItem => {
|
|
|
+ return schdItem.classId == item.id && schdItem.teacherId == this.schedule.teacherId
|
|
|
+ })
|
|
|
+ if (!exist) {
|
|
|
+ this.schedule.classId = item.id
|
|
|
+ this.schedule.classInfo = {
|
|
|
+ id: item.id,
|
|
|
+ name: item.name
|
|
|
+ }
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.push(JSON.parse(JSON.stringify(this.schedule)))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.sltClass = []
|
|
|
+ } else if (this.addType == 'stulist' && this.sltList.length > 0) {
|
|
|
+ //先判断是否有空的schedule(只是添加了老师,没有教室和名单)
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.forEach((item, index) => {
|
|
|
+ if (item.teacherId == this.schedule.teacherId && !item.stulist && !item.classId) {
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.sltList.forEach(item => {
|
|
|
+ let exist = this.courseListShow[this.curCusIndex].schedule.find(schdItem => {
|
|
|
+ return schdItem.stulist == item.id && schdItem.teacherId == this.schedule.teacherId
|
|
|
+ })
|
|
|
+ if (!exist) {
|
|
|
+ this.schedule.stulist = item.id
|
|
|
+ this.schedule.listName = item.name
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.push(JSON.parse(JSON.stringify(this.schedule)))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.sltList = []
|
|
|
+ } else {
|
|
|
+ this.$Message.warning('请先选择名单或者教室')
|
|
|
return
|
|
|
}
|
|
|
- this.courseListShow[this.curCusIndex].schedule.forEach((item, index) => {
|
|
|
- if (item.teacherId == this.schedule.teacherId && !item.stulist && !item.classId) {
|
|
|
- this.courseListShow[this.curCusIndex].schedule.splice(index, 1)
|
|
|
- }
|
|
|
- })
|
|
|
- this.courseListShow[this.curCusIndex].schedule.push(this.schedule)
|
|
|
this.isAddStuList = false
|
|
|
this.updCusInfo()
|
|
|
this.initSchedule()
|
|
|
- // this.selectTea(0)
|
|
|
+ this.clearTable()
|
|
|
},
|
|
|
//取消添加Schd
|
|
|
cancelAddSchd() {
|
|
|
this.isAddStuList = false
|
|
|
this.initSchedule()
|
|
|
+ this.clearTable()
|
|
|
},
|
|
|
//确认或取消添加后初始化数据
|
|
|
initSchedule() {
|
|
@@ -728,8 +976,8 @@ export default {
|
|
|
id: '',
|
|
|
name: ''
|
|
|
},
|
|
|
- teacherId:'',
|
|
|
- teacherName:'',
|
|
|
+ teacherId: '',
|
|
|
+ teacherName: '',
|
|
|
stulist: '',
|
|
|
time: [],
|
|
|
notice: ''
|
|
@@ -738,6 +986,7 @@ export default {
|
|
|
//取消添加老师
|
|
|
cancelAddTea() {
|
|
|
this.addTeaStatus = false
|
|
|
+ this.clearTable()
|
|
|
},
|
|
|
//确认添加教师
|
|
|
confirmAddTea() {
|
|
@@ -760,6 +1009,7 @@ export default {
|
|
|
})
|
|
|
this.updCusInfo()
|
|
|
this.sltTeachers = []
|
|
|
+ this.clearTable()
|
|
|
}
|
|
|
},
|
|
|
// 更新课程数据
|
|
@@ -782,13 +1032,26 @@ export default {
|
|
|
removeStuList() {
|
|
|
this.$Modal.confirm({
|
|
|
title: '移除名单',
|
|
|
- content: `是否确认移除${this.schdList[this.curClassIndex].listName || this.schdList[this.curClassIndex].classInfo.name }?`,
|
|
|
+ content: `是否确认移除${this.schdList[this.curClassIndex].listName || this.schdList[this.curClassIndex].classInfo.name}?`,
|
|
|
onOk: () => {
|
|
|
- for (let i in this.courseListShow[this.curCusIndex].schedule) {
|
|
|
- let curSchd = this.schdList[this.curClassIndex]
|
|
|
- if (this.courseListShow[this.curCusIndex].schedule[i].classId == curSchd.classId && this.courseListShow[this.curCusIndex].schedule[i].stulist == curSchd.stulist) {
|
|
|
- this.courseListShow[this.curCusIndex].schedule.splice(i, 1)
|
|
|
- break
|
|
|
+ //如果只有一个名单的时候移除名单则为清空名单,不能真的删除
|
|
|
+ if (this.schdList.length == 1) {
|
|
|
+ for (let i in this.courseListShow[this.curCusIndex].schedule) {
|
|
|
+ let curSchd = this.schdList[this.curClassIndex]
|
|
|
+ if (this.courseListShow[this.curCusIndex].schedule[i].classId == curSchd.classId && this.courseListShow[this.curCusIndex].schedule[i].stulist == curSchd.stulist) {
|
|
|
+ this.courseListShow[this.curCusIndex].schedule[i].classId = ''
|
|
|
+ this.courseListShow[this.curCusIndex].schedule[i].stulist = ''
|
|
|
+ this.courseListShow[this.curCusIndex].schedule[i].time = []
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (let i in this.courseListShow[this.curCusIndex].schedule) {
|
|
|
+ let curSchd = this.schdList[this.curClassIndex]
|
|
|
+ if (this.courseListShow[this.curCusIndex].schedule[i].classId == curSchd.classId && this.courseListShow[this.curCusIndex].schedule[i].stulist == curSchd.stulist) {
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.splice(i, 1)
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.updCusInfo()
|
|
@@ -816,9 +1079,12 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
goMgtStuList() {
|
|
|
+ //不用跳转页面进行操作
|
|
|
this.$router.push({
|
|
|
name: 'MgtStuList'
|
|
|
})
|
|
|
+ // 在当前页面添加stulist
|
|
|
+ // this.addStuListStatus = true
|
|
|
},
|
|
|
// 切换课表模式和课程模式
|
|
|
toggleView() {
|
|
@@ -834,6 +1100,20 @@ export default {
|
|
|
this.courseListShow = this.courseList.filter(item => {
|
|
|
return item.period.id == this.filterPeriod
|
|
|
})
|
|
|
+
|
|
|
+ let curGd = this.schoolBase.period.find(item => {
|
|
|
+ return item.id == this.filterPeriod
|
|
|
+ })
|
|
|
+ if (curGd) {
|
|
|
+ let filters = curGd.grades.map(item => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //年级筛选条件
|
|
|
+ this.classroomCol[this.classroomCol.length - 1].filters = filters
|
|
|
+ }
|
|
|
this.getCusInfo()
|
|
|
},
|
|
|
//关键字搜索课程
|
|
@@ -845,6 +1125,7 @@ export default {
|
|
|
//获取课程列表
|
|
|
getCourseList() {
|
|
|
this.tableLoading = true
|
|
|
+ this.listLoading = true
|
|
|
let requestData = {
|
|
|
'code': this.$store.state.userInfo.schoolCode,
|
|
|
'scope': 'school'
|
|
@@ -867,12 +1148,14 @@ export default {
|
|
|
).finally(() => {
|
|
|
setTimeout(() => {
|
|
|
this.tableLoading = false
|
|
|
+ this.listLoading = false
|
|
|
}, 500)
|
|
|
})
|
|
|
},
|
|
|
//获取课程完整信息
|
|
|
getCusInfo() {
|
|
|
if (this.courseListShow[this.curCusIndex]) {
|
|
|
+ this.listLoading = true
|
|
|
let requestData = {
|
|
|
'code': this.$store.state.userInfo.schoolCode,
|
|
|
'scope': 'school',
|
|
@@ -920,6 +1203,7 @@ export default {
|
|
|
).finally(() => {
|
|
|
setTimeout(() => {
|
|
|
this.tableLoading = false
|
|
|
+ this.listLoading = false
|
|
|
}, 500)
|
|
|
})
|
|
|
}
|
|
@@ -1149,6 +1433,24 @@ export default {
|
|
|
this.hasTimeTable = this.schoolBase.period[0].timetable ? true : false
|
|
|
}
|
|
|
this.classList = JSON.parse(JSON.stringify(this.$store.state.user.schoolProfile.school_classes))
|
|
|
+ let curGd = this.schoolBase.period[0].grades
|
|
|
+ let filters = curGd.map(item => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //年级筛选条件
|
|
|
+ this.classroomCol.push({
|
|
|
+ title: '年级',
|
|
|
+ slot: 'grade',
|
|
|
+ align: 'center ',
|
|
|
+ filters: filters,
|
|
|
+ filterMultiple: false,
|
|
|
+ filterMethod(value, row) {
|
|
|
+ return row.gradeId == value
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
err => {
|
|
|
this.$Message.warning(this.$t('cusMgt.noSchool'))
|
|
@@ -1163,6 +1465,25 @@ export default {
|
|
|
this.findStuList()
|
|
|
},
|
|
|
computed: {
|
|
|
+ //当前课程id
|
|
|
+ courseId() {
|
|
|
+ return this.courseListShow[this.curCusIndex] ? this.courseListShow[this.curCusIndex].id : ''
|
|
|
+ },
|
|
|
+ //课表数据
|
|
|
+ schdData() {
|
|
|
+ if (this.teaList[this.curTeaIndex]) {
|
|
|
+ return this.teaSchds[this.teaList[this.curTeaIndex].id] || []
|
|
|
+ }
|
|
|
+ return []
|
|
|
+ },
|
|
|
+ //选择教室名单列表
|
|
|
+ calssTable() {
|
|
|
+ let tbData = []
|
|
|
+ tbData = this.classList.filter(item => {
|
|
|
+ return item.periodId == this.filterPeriod
|
|
|
+ })
|
|
|
+ return tbData
|
|
|
+ },
|
|
|
//级联选择年级班级
|
|
|
csOptions() {
|
|
|
let data = []
|
|
@@ -1254,10 +1575,31 @@ export default {
|
|
|
background: #505050;
|
|
|
}
|
|
|
.class-setting .ivu-input {
|
|
|
- border-radius: 16px;
|
|
|
+ /* border-radius: 16px; */
|
|
|
}
|
|
|
.add-list-header .el-input--small .el-input__inner {
|
|
|
height: 26px;
|
|
|
line-height: 26px;
|
|
|
}
|
|
|
+.add-tea-header
|
|
|
+ .ivu-radio-group-button-solid
|
|
|
+ .ivu-radio-wrapper-checked:not(.ivu-radio-wrapper-disabled) {
|
|
|
+ background: white;
|
|
|
+ border-color: white;
|
|
|
+ color: #515a6e;
|
|
|
+}
|
|
|
+.add-tea-header .ivu-radio-group-button .ivu-radio-wrapper {
|
|
|
+ background: #606060;
|
|
|
+ color: white;
|
|
|
+ border-color: #606060;
|
|
|
+}
|
|
|
+.add-tea-header .ivu-radio-group-button .ivu-radio-wrapper-checked,
|
|
|
+.add-tea-header
|
|
|
+ .ivu-radio-group-button
|
|
|
+ .ivu-radio-wrapper-checked.ivu-radio-focus {
|
|
|
+ box-shadow: none;
|
|
|
+}
|
|
|
+.add-tea-header .ivu-radio-group-button .ivu-radio-wrapper:after {
|
|
|
+ height: 0px;
|
|
|
+}
|
|
|
</style>
|