|
@@ -11,14 +11,15 @@
|
|
|
<div slot="extra">
|
|
|
<transition name="fade">
|
|
|
<div style="margin-top:5px;">
|
|
|
+ <Icon type="md-add" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.addCus')" @click="addCusStatus = true" />
|
|
|
<Icon type="md-create" v-show="(listType == 'school' && courseListS.length) || (listType == 'private' && courseListP.length) " class="add-icon" :title="$t('cusMgt.editCus')" @click="editCus()" />
|
|
|
- <Icon type="md-add" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.addCus')" @click="showAddCourse()" />
|
|
|
<Icon type="md-trash" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.delCus')" @click="delCourse" />
|
|
|
</div>
|
|
|
</transition>
|
|
|
</div>
|
|
|
+ <!-- 标准课程列表 -->
|
|
|
<TabPane :label="$t('cusMgt.scCus')" name="school">
|
|
|
- <div v-for="(item,index) in courseListS" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
|
|
|
+ <div v-for="(item,index) in courseListShow" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
|
|
|
<p class="course-name">
|
|
|
{{item.name}}
|
|
|
<Icon type="ios-information-circle-outline" @click="toggleCusInfo" :title="$t('cusMgt.cusInfo')" />
|
|
@@ -32,15 +33,16 @@
|
|
|
<EmptyData :top="150" :textContent="$t('cusMgt.noScCus')"></EmptyData>
|
|
|
</div>
|
|
|
</TabPane>
|
|
|
+ <!-- 个人课程列表 -->
|
|
|
<TabPane :label="$t('cusMgt.privCus')" name="private">
|
|
|
- <div v-for="(item,index) in courseListP" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
|
|
|
+ <div v-for="(item,index) in courseListShow" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
|
|
|
<p class="course-name">
|
|
|
{{item.name}}
|
|
|
<Icon type="ios-information-circle-outline" @click="toggleCusInfo" :title="$t('cusMgt.cusInfo')" />
|
|
|
</p>
|
|
|
<p class="course-code">
|
|
|
<Icon type="md-pricetags" />
|
|
|
- {{item.id}}
|
|
|
+ {{item.no}}
|
|
|
</p>
|
|
|
</div>
|
|
|
<div v-if="courseListP.length == 0">
|
|
@@ -58,9 +60,9 @@
|
|
|
<div class="course-classroom-list-header">
|
|
|
<span class="course-classroom-label">{{$t('courseManage.classroom.classroomList')}}</span>
|
|
|
<Icon custom="iconfont icon-schedule" v-show="listType == 'school'" class="add-icon" size="16" title="课表模式" />
|
|
|
- <Icon type="md-add" v-show="listType == 'private'" class="add-icon" @click="addClassroom()" />
|
|
|
- <Icon type="md-create" v-show="listType == 'private'" class="add-icon" @click="editClassStatus = true" />
|
|
|
- <Icon type="md-trash" v-show="listType == 'private'" class="add-icon" @click="deleteClass()" />
|
|
|
+ <Icon type="md-add" v-show="listType == 'private'" class="add-icon" @click="newSlStatus = true" />
|
|
|
+ <Icon type="md-create" v-show="listType == 'private' && teaClassList.length" class="add-icon" @click="editClassStatus = true" />
|
|
|
+ <Icon type="md-trash" v-show="listType == 'private' && teaClassList.length" class="add-icon" @click="removeStuList()" />
|
|
|
</div>
|
|
|
<div class="course-classroom-list-content">
|
|
|
<vuescroll>
|
|
@@ -77,7 +79,7 @@
|
|
|
<span :class="item.stulist ? 'class-name':'def-class-name'">{{item.stulist ? item.listName : '默认名单'}}</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
- <EmptyData v-if="teaClassList.length == 0" :top="160" :textContent="$t('cusMgt.noCusClass')"></EmptyData>
|
|
|
+ <EmptyData v-if="teaClassList.length == 0" :top="160" textContent="暂无上课名单"></EmptyData>
|
|
|
</vuescroll>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -215,19 +217,21 @@
|
|
|
<Input v-if="listType == 'school' && courseListS[curCusIndex]" v-model="courseListS[curCusIndex].name" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
|
|
|
<Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].name" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
|
|
|
</FormItem>
|
|
|
- <FormItem :label="$t('cusMgt.cusCode')" prop="id" class="disabled-iview-select">
|
|
|
+ <FormItem :label="$t('cusMgt.cusCode')" prop="no" class="disabled-iview-select">
|
|
|
<Input v-if="listType == 'school' && courseListS[curCusIndex]" v-model="courseListS[curCusIndex].no" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
|
|
|
- <Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].no" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
|
|
|
+ <Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].no" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem :label="$t('courseManage.base.courseNotice')">
|
|
|
- <div ref="courseNotice" v-show="!baseEditStatus"></div>
|
|
|
+ <!-- 暂时注释课程公告功能 -->
|
|
|
+ <span>课程公告暂未处理</span>
|
|
|
+ <!-- <div ref="courseNotice" v-show="!baseEditStatus"></div>
|
|
|
<div v-show="baseEditStatus" style="height:fit-content;color:white;font-size:16px;padding-left:10px;width:100%;">
|
|
|
<vuescroll>
|
|
|
<div v-if="listType == 'school' && courseListS[curCusIndex] && checkNotice(courseListS[curCusIndex].notice)" v-html="courseListS[curCusIndex][0].notice" style=""></div>
|
|
|
<div v-else-if="listType == 'private' && courseListP[curCusIndex] && checkNotice(courseListP[curCusIndex].notice)" v-html="courseListP[curCusIndex].notice" style=""></div>
|
|
|
<div v-else style="">{{$t('cusMgt.noNotice')}}</div>
|
|
|
</vuescroll>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</FormItem>
|
|
|
<FormItem label="">
|
|
|
<Button style="width:100%;margin-top:10px;" @click="edNotice">{{baseEditStatus ? $t('cusMgt.edit') : $t('cusMgt.save')}}</Button>
|
|
@@ -235,38 +239,23 @@
|
|
|
</Form>
|
|
|
</div>
|
|
|
</Drawer>
|
|
|
- <Modal v-model="newPrivateStatus" :title="$t('courseManage.classroom.personalClassroomTitle')" @on-ok="confirmNewClass" class-name="dark-iview-modal dark-iview-form">
|
|
|
- <Form ref="personalClassroom" :model="privateClass" label-position="top" label-colon>
|
|
|
- <FormItem :label="$t('cusMgt.className')" prop="name">
|
|
|
- <Input v-model="privateClass.name" :placeholder="$t('courseManage.classroom.classroomName')">
|
|
|
- </Input>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('courseManage.classroom.invitationCode')" prop="id">
|
|
|
- <span style="font-size:18px;color:white;">{{privateClass.id}}</span>
|
|
|
- </FormItem>
|
|
|
- </Form>
|
|
|
+ <!-- 创建名单 -->
|
|
|
+ <Modal v-model="newSlStatus" title="创建自定义名单" width="1200" @on-ok="confirmCreateList" 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)=>{createStuList = selction}"></StudentList>
|
|
|
</Modal>
|
|
|
- <!-- 编辑名单信息 -->
|
|
|
- <!-- <Modal v-model="editClassStatus" :title="$t('cusMgt.editClassInfo')" @on-ok="confirmUpdClass" class-name="dark-iview-modal dark-iview-form">
|
|
|
- <Form v-if="editClassStatus" ref="personalClassroom" :model="courseListP[curCusIndex].classes[curClassIndex]" label-position="top" label-colon>
|
|
|
- <FormItem :label="$t('cusMgt.className')" prop="name">
|
|
|
- <Input v-model="courseListP[curCusIndex].classes[curClassIndex].name" :placeholder="$t('courseManage.classroom.classroomName')">
|
|
|
- </Input>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('courseManage.classroom.invitationCode')" prop="id">
|
|
|
- <span style="font-size:18px;color:white;">{{courseListP[curCusIndex].classes[curClassIndex].id}}</span>
|
|
|
- </FormItem>
|
|
|
- </Form>
|
|
|
- </Modal> -->
|
|
|
<Modal v-model="addCusStatus" :title="$t('cusMgt.addCus')" @on-ok="confirmAddCus" class-name="dark-iview-modal dark-iview-form">
|
|
|
<Form ref="addCusInfo" :model="addCusInfo" :rules="ruleAddCus">
|
|
|
- <FormItem prop="courseName" :label="$t('cusMgt.cusName')">
|
|
|
- <Input type="text" v-model="addCusInfo.courseName" :placeholder="$t('cusMgt.nameHolder')"></Input>
|
|
|
+ <FormItem prop="name" :label="$t('cusMgt.cusName')">
|
|
|
+ <Input type="text" v-model="addCusInfo.name" :placeholder="$t('cusMgt.nameHolder')"></Input>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
<Form ref="addCusInfo" :model="addCusInfo" :rules="ruleAddCus">
|
|
|
- <FormItem prop="courseCode" :label="$t('cusMgt.cusCode')">
|
|
|
- <Input type="text" v-model="addCusInfo.courseCode" :placeholder="$t('cusMgt.codeHolder')"></Input>
|
|
|
+ <FormItem prop="no" :label="$t('cusMgt.cusCode')">
|
|
|
+ <Input type="text" v-model="addCusInfo.no" :placeholder="$t('cusMgt.codeHolder')"></Input>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</Modal>
|
|
@@ -325,6 +314,7 @@ export default {
|
|
|
value: 'sl'
|
|
|
}
|
|
|
],
|
|
|
+ modalLoading: true,
|
|
|
curAcType: 'ev',
|
|
|
evList: [],//评测列表
|
|
|
voteList: [],//投票列表
|
|
@@ -333,6 +323,7 @@ export default {
|
|
|
slList: [],//自主学习
|
|
|
delSelection: [],
|
|
|
selections: [],
|
|
|
+ createStuList: [],//创建自定义名单学生列表
|
|
|
classList: [],
|
|
|
tableHeight: 100,
|
|
|
classColumn: [
|
|
@@ -401,7 +392,7 @@ export default {
|
|
|
showQrStatus: false,
|
|
|
showCusInfo: false,
|
|
|
listLoading: false,
|
|
|
- newPrivateStatus: false,
|
|
|
+ newSlStatus: false,
|
|
|
stuLoading: false,
|
|
|
selectClassStatus: false,
|
|
|
listType: 'school',
|
|
@@ -413,27 +404,21 @@ export default {
|
|
|
curClassIndex: 0,
|
|
|
courseListS: [],
|
|
|
courseListP: [],
|
|
|
+ courseListShow: [],
|
|
|
addCusInfo: {
|
|
|
- courseName: '',
|
|
|
- courseCode: ''
|
|
|
+ name: '',
|
|
|
+ no: '',
|
|
|
+ id: ''
|
|
|
},
|
|
|
+ listName: '',
|
|
|
ruleAddCus: {
|
|
|
- courseName: [
|
|
|
+ name: [
|
|
|
{ required: true, message: this.$t('cusMgt.nameHolder'), trigger: 'change' }
|
|
|
],
|
|
|
- courseCode: [
|
|
|
+ no: [
|
|
|
{ required: true, validator: validateCode, trigger: 'change' }
|
|
|
]
|
|
|
},
|
|
|
- privateClass: {
|
|
|
- id: '',
|
|
|
- name: '',
|
|
|
- notice: ''
|
|
|
- },
|
|
|
- sysClass: {
|
|
|
- id: '',
|
|
|
- name: ''
|
|
|
- },
|
|
|
stuList: []
|
|
|
}
|
|
|
},
|
|
@@ -441,19 +426,9 @@ export default {
|
|
|
//获取学生名单
|
|
|
getStuList() {
|
|
|
this.tabName = 'stus'
|
|
|
- let schedule = {}
|
|
|
- // 获取当前schedule
|
|
|
- if (this.listType == 'school') {
|
|
|
- if (this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule && this.courseListS[this.curCusIndex].schedule[this.curClassIndex]) {
|
|
|
- schedule = this.courseListS[this.curCusIndex].schedule[this.curClassIndex]
|
|
|
- }
|
|
|
- } else if (this.listType == 'private') {
|
|
|
- if (this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule && this.courseListP[this.curCusIndex].schedule[this.curClassIndex]) {
|
|
|
- schedule = this.courseListP[this.curCusIndex].schedule[this.curClassIndex]
|
|
|
- }
|
|
|
- }
|
|
|
+ let schedule = this.teaClassList[this.curClassIndex]
|
|
|
//先判断自定义名单
|
|
|
- if (schedule.stulist && !schedule.fullStu) {
|
|
|
+ if (schedule && schedule.stulist && !schedule.fullStu) {
|
|
|
//TODO 学生id换详细信息
|
|
|
this.stuLoading = true
|
|
|
this.$api.courseMgmt.findStuSummary({
|
|
@@ -481,7 +456,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
//教室默认名单
|
|
|
- if (schedule.classId && !schedule.students) {
|
|
|
+ if (schedule && schedule.classId && !schedule.students) {
|
|
|
//TODO 根据班级id查询学生信息
|
|
|
this.findClassStu()
|
|
|
}
|
|
@@ -491,20 +466,15 @@ export default {
|
|
|
this.stuLoading = true
|
|
|
let params = {
|
|
|
'school_code': this.listType == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
|
|
|
- 'ids': [this.classList[this.curClassIndex].id],
|
|
|
+ 'ids': [this.teaClassList[this.curClassIndex].classId],
|
|
|
//school:校本班级 teacher:私人课程校本名单 private:私人课程动态名单
|
|
|
'scope': this.listType
|
|
|
}
|
|
|
this.$api.schoolSetting.getClassroomStudent(params).then(
|
|
|
(res) => {
|
|
|
if (!res.error) {
|
|
|
- if (res.classrooms.length > 0) {
|
|
|
- if (this.listType == 'school') {
|
|
|
- this.$set(this.courseListS[this.curCusIndex][this.curClassIndex], 'students', res.classrooms[0].students)
|
|
|
- }
|
|
|
- else {
|
|
|
- this.$set(this.courseListP[this.curCusIndex].classes[this.curClassIndex], 'students', res.classrooms[0].students)
|
|
|
- }
|
|
|
+ if (res.stus.length > 0) {
|
|
|
+ this.$set(this.courseListShow[this.curCusIndex].schedule[this.curClassIndex], 'students', res.stus[0])
|
|
|
}
|
|
|
} else {
|
|
|
this.$Message.error('API error!')
|
|
@@ -576,7 +546,7 @@ export default {
|
|
|
})
|
|
|
this.evList = res.examInfo
|
|
|
} else {
|
|
|
- this$Message.error('API ERROR!')
|
|
|
+ this.$Message.error('API ERROR!')
|
|
|
}
|
|
|
}
|
|
|
)
|
|
@@ -731,71 +701,18 @@ export default {
|
|
|
return true
|
|
|
}
|
|
|
},
|
|
|
- //确认修改班级信息
|
|
|
- confirmUpdClass() {
|
|
|
- this.listLoading = true
|
|
|
- this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
|
|
|
- this.$api.courseMgmt.upsertPrivateCus({
|
|
|
- course: this.courseListP[this.curCusIndex],
|
|
|
- option: 'update'
|
|
|
- }).then(
|
|
|
- (res) => {
|
|
|
- if (!res.error) {
|
|
|
- this.$Message.success(this.$t('cusMgt.editOk'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.editErr'))
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- this.$Message.error(this.$t('cusMgt.editErr'))
|
|
|
- }
|
|
|
- ).finally(() => {
|
|
|
- this.listLoading = false
|
|
|
- this.editClassStatus = false
|
|
|
- })
|
|
|
- },
|
|
|
- //删除上课班级
|
|
|
- deleteClass() {
|
|
|
+ //移除课程名单
|
|
|
+ removeStuList() {
|
|
|
let _this = this
|
|
|
- let delClass = this._.cloneDeep(this.classList[this.curClassIndex])
|
|
|
this.$Modal.confirm({
|
|
|
title: this.$t('cusMgt.delClassTitle'),
|
|
|
- content: `${this.$t('cusMgt.delStuContent')}${this.classList[this.curClassIndex].name}?`,
|
|
|
+ content: `${this.$t('cusMgt.delStuContent')}${this.teaClassList[this.curClassIndex].listName}?`,
|
|
|
onOk: function () {
|
|
|
_this.listLoading = true
|
|
|
let index = _this.curClassIndex
|
|
|
_this.curClassIndex = 0
|
|
|
- _this.courseListP[_this.curCusIndex].classes.splice(index, 1)
|
|
|
- _this.courseListP[_this.curCusIndex].code = _this.$store.state.userInfo.TEAMModelId
|
|
|
- _this.$api.courseMgmt.upsertPrivateCus({
|
|
|
- course: _this.courseListP[_this.curCusIndex],
|
|
|
- option: 'update'
|
|
|
- }).then(
|
|
|
- (res) => {
|
|
|
- if (!res.error) {
|
|
|
- //删除个人班级数据
|
|
|
- _this.$api.schoolSetting.delClassroom({
|
|
|
- id: delClass.id,
|
|
|
- scope: delClass.scope,
|
|
|
- school_code: _this.$store.state.userInfo.TEAMModelId
|
|
|
- }).then(
|
|
|
- res => {
|
|
|
- _this.$Message.success(this.$t('cusMgt.delOk'))
|
|
|
- },
|
|
|
- err => {
|
|
|
- _this.$Message.error(this.$t('cusMgt.delErr'))
|
|
|
- }
|
|
|
- )
|
|
|
- } else {
|
|
|
- _this.$Message.error(this.$t('cusMgt.delErr'))
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- _this.$Message.error(this.$t('cusMgt.delErr'))
|
|
|
- }
|
|
|
- ).finally(() => {
|
|
|
- _this.listLoading = false
|
|
|
- })
|
|
|
+ _this.courseListShow[_this.curCusIndex].schedule.splice(index, 1)
|
|
|
+ _this.updCusInfo()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -803,57 +720,19 @@ export default {
|
|
|
this.toggleCusInfo()
|
|
|
this.edNotice()
|
|
|
},
|
|
|
- //保存个人课程
|
|
|
- saveNotice() {
|
|
|
- this.listLoading = true
|
|
|
- this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
|
|
|
- this.$api.courseMgmt.upsertPrivateCus({
|
|
|
- course: this.courseListP[this.curCusIndex],
|
|
|
- option: 'update'
|
|
|
- }).then(
|
|
|
- (res) => {
|
|
|
- if (!res.error) {
|
|
|
- this.$Message.success(this.$t('cusMgt.editOk'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.editErr'))
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- this.$Message.error(this.$t('cusMgt.editErr'))
|
|
|
- }
|
|
|
- ).finally(() => {
|
|
|
- this.listLoading = false
|
|
|
- this.baseEditStatus = !this.baseEditStatus
|
|
|
- })
|
|
|
+ toggleCusInfo() {
|
|
|
+ this.showCusInfo = !this.showCusInfo
|
|
|
},
|
|
|
edNotice() {
|
|
|
if (this.baseEditStatus) {
|
|
|
this.baseEditStatus = !this.baseEditStatus
|
|
|
this.initEditor()
|
|
|
} else {
|
|
|
- if (this.listType == 'private') {
|
|
|
- this.saveNotice()
|
|
|
- } else {
|
|
|
- this.baseEditStatus = !this.baseEditStatus
|
|
|
- this.courseListS[this.curCusIndex][this.curClassIndex].code = this.$store.state.userInfo.schoolCode
|
|
|
- this.$api.courseMgmt.upsertNotice(this.courseListS[this.curCusIndex][this.curClassIndex]).then(
|
|
|
- res => {
|
|
|
- if (!res.error) {
|
|
|
- this.$Message.success(this.$t('cusMgt.saveOk'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.saveErr'))
|
|
|
- }
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('cusMgt.saveErr'))
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
+ this.updCusInfo()
|
|
|
+ this.baseEditStatus = !this.baseEditStatus
|
|
|
}
|
|
|
},
|
|
|
- toggleCusInfo() {
|
|
|
- this.showCusInfo = !this.showCusInfo
|
|
|
- },
|
|
|
+
|
|
|
//初始化富文本编辑器
|
|
|
initEditor() {
|
|
|
if (!this.noticeEditor) {
|
|
@@ -911,46 +790,68 @@ export default {
|
|
|
let cName = this.classList[this.curClassIndex].name
|
|
|
this.createQRCode(`http://teammodelos-test.chinacloudsites.cn/joinclass?tId=${tId}&cId=${cId}&tName=${tName}&cName=${cName}`)
|
|
|
},
|
|
|
-
|
|
|
- //添加上课班级
|
|
|
- addClassroom() {
|
|
|
- let randomCode = 'P'
|
|
|
- for (let i = 0; i < 8; i++) {
|
|
|
- randomCode += this.$jsFn.getBtwRandom(0, 9)
|
|
|
+ //确认添加自定义名单
|
|
|
+ confirmCreateList() {
|
|
|
+ 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.TEAMModelId,
|
|
|
+ students: this.createStuList.map(item => { //这里没有学生名字, 需要先查看id集合再查学生信息?
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ code: item.code //学生所在学校的编码,这里先传当前学校编码,暂无未考虑跨校名单
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ tmids: [],
|
|
|
+ course: null
|
|
|
+ }
|
|
|
+ this.saveStuList(stuList)
|
|
|
}
|
|
|
- this.privateClass.id = randomCode
|
|
|
- this.newPrivateStatus = true
|
|
|
},
|
|
|
- //确认添加上课班级
|
|
|
- confirmNewClass() {
|
|
|
- this.privateClass['scope'] = 'private'
|
|
|
- this.privateClass['code'] = this.$store.state.userInfo.TEAMModelId
|
|
|
- this.privateClass['teacher'] = {
|
|
|
- id: this.$store.state.userInfo.TEAMModelId,
|
|
|
- name: this.$store.state.userInfo.name
|
|
|
+ // 保存名单
|
|
|
+ saveStuList(stuList) {
|
|
|
+ let params = {
|
|
|
+ stuList,
|
|
|
+ scope: "private"
|
|
|
}
|
|
|
- this.courseListP[this.curCusIndex].classes.push(this._.cloneDeep(this.privateClass))
|
|
|
- this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
|
|
|
- this.$api.courseMgmt.upsertPrivateCus({
|
|
|
- course: this.courseListP[this.curCusIndex],
|
|
|
- option: 'update'
|
|
|
- }).then(
|
|
|
- (res) => {
|
|
|
- if (!res.error) {
|
|
|
- this.$Message.success(this.$t('cusMgt.saveOk'))
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('cusMgt.saveErr'))
|
|
|
- }
|
|
|
+ this.$api.courseMgmt.upsertStulist(params).then(
|
|
|
+ res => {
|
|
|
+ this.newSlStatus = false
|
|
|
+ //TODO 添加到当前课程schedule
|
|
|
+ this.courseListShow[this.curCusIndex].schedule = this.courseListShow[this.curCusIndex].schedule || []
|
|
|
+ this.courseListShow[this.curCusIndex].schedule.push({
|
|
|
+ classId: '',
|
|
|
+ notice: '',
|
|
|
+ listName: this.listName,
|
|
|
+ stulist: stuList.id,
|
|
|
+ teacher: {
|
|
|
+ id: this.$store.state.userInfo.TEAMModelId,
|
|
|
+ name: this.$store.state.userInfo.name
|
|
|
+ },
|
|
|
+ time:[]
|
|
|
+ })
|
|
|
+ this.updCusInfo()
|
|
|
},
|
|
|
- (err) => {
|
|
|
- this.$Message.error(this.$t('cusMgt.saveErr'))
|
|
|
+ err => {
|
|
|
+ this.modalLoading = false
|
|
|
+ setTimeout(() => {
|
|
|
+ this.modalLoading = true
|
|
|
+ }, 0)
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
//课程选项卡点击事件
|
|
|
tabClick(name) {
|
|
|
this.curCusIndex = 0
|
|
|
- this.changeClassroom(0)
|
|
|
+ this.courseListShow = name == 'school' ? this.courseListS : this.courseListP
|
|
|
+ this.selectCourse(0)
|
|
|
},
|
|
|
changeClassroom(index) {
|
|
|
this.curClassIndex = index
|
|
@@ -980,15 +881,15 @@ export default {
|
|
|
content: `确认删除${this.courseListP[this.curCusIndex].name}吗?`,
|
|
|
onOk: () => {
|
|
|
this.$api.courseMgmt.deleteCourse({
|
|
|
- id: this.courseListP[this.curCusIndex].id,
|
|
|
- code: this.$store.state.userInfo.TEAMModelId,
|
|
|
- scope: this.courseListP[this.curCusIndex].scope
|
|
|
+ id: this.courseListShow[this.curCusIndex].id,
|
|
|
+ code: this.courseListShow[this.curCusIndex].code.replace('Course-', ''),
|
|
|
+ scope: 'private'
|
|
|
}).then(
|
|
|
res => {
|
|
|
if (!res.error) {
|
|
|
let index = this.curCusIndex
|
|
|
this.curCusIndex = 0
|
|
|
- this.courseListP.splice(index, 1)
|
|
|
+ this.courseListShow.splice(index, 1)
|
|
|
this.$Message.success('删除成功!')
|
|
|
} else {
|
|
|
this.$Message.error('删除失败!')
|
|
@@ -1004,36 +905,35 @@ export default {
|
|
|
selectCourse(index) {
|
|
|
this.curClassIndex = 0
|
|
|
this.curCusIndex = index
|
|
|
- if ((this.listType == 'school' && !this.courseListS[this.curCusIndex].schedule) || (this.listType == 'school' && !this.courseListS[this.curCusIndex].schedule)) {
|
|
|
+ if (!this.courseListShow[this.curCusIndex].schedule) {
|
|
|
this.getCusInfo()
|
|
|
} else {
|
|
|
this.changeClassroom(0)
|
|
|
}
|
|
|
},
|
|
|
- //添加个人课程
|
|
|
- showAddCourse() {
|
|
|
- this.addCusStatus = true
|
|
|
- },
|
|
|
+ // 新增个人课程
|
|
|
confirmAddCus() {
|
|
|
this.$refs['addCusInfo'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
let requestData = {
|
|
|
option: 'insert',
|
|
|
+ scope: 'private',
|
|
|
course: {
|
|
|
- name: this.addCusInfo.courseName,
|
|
|
- id: this.addCusInfo.courseCode,
|
|
|
+ name: this.addCusInfo.name,
|
|
|
+ no: this.addCusInfo.no,
|
|
|
+ id: this.$tools.guid(),
|
|
|
code: this.$store.state.userInfo.TEAMModelId,
|
|
|
- classes: [],
|
|
|
+ schedule: [],
|
|
|
scope: 'private'
|
|
|
}
|
|
|
}
|
|
|
- this.$api.courseMgmt.upsertPrivateCus(requestData).then(
|
|
|
+ this.$api.courseMgmt.saveOrUpdateCourse(requestData).then(
|
|
|
(res) => {
|
|
|
if (res.error == null) {
|
|
|
- this.$Message.success('保存成功!')
|
|
|
+ this.$Message.success('添加成功!')
|
|
|
this.courseListP.push(requestData.course)
|
|
|
} else {
|
|
|
- this.$Message.success('保存失败!')
|
|
|
+ this.$Message.success('添加失败!')
|
|
|
}
|
|
|
},
|
|
|
(err) => {
|
|
@@ -1045,6 +945,24 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 更新个人课程
|
|
|
+ updCusInfo() {
|
|
|
+ this.courseListShow[this.curCusIndex].code = this.courseListShow[this.curCusIndex].code.replace('Course-', '')
|
|
|
+ this.$api.courseMgmt.saveOrUpdateCourse({
|
|
|
+ course: this.courseListShow[this.curCusIndex],
|
|
|
+ option: 'update',
|
|
|
+ scope: this.courseListShow[this.curCusIndex].scope || 'private'
|
|
|
+ }).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success('更新成功')
|
|
|
+ // this.isUpd = false
|
|
|
+ }
|
|
|
+ ).catch(() => {
|
|
|
+ this.$Message.error('更新失败')
|
|
|
+ }).finally(()=>{
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
//获取标准课程列表(调整)
|
|
|
//获取个人和校本课程列表,API调整后没有进行分开处理
|
|
|
getCourseList() {
|
|
@@ -1063,7 +981,13 @@ export default {
|
|
|
this.courseListP = res.courses.filter(item => {
|
|
|
return item.scope == 'private'
|
|
|
})
|
|
|
- // this.selectCourse(0)
|
|
|
+ //设置当前课程列表
|
|
|
+ if (this.courseListS.length > 0) {
|
|
|
+ this.courseListShow = this.courseListS
|
|
|
+ } else {
|
|
|
+ this.tabName = 'private'
|
|
|
+ this.courseListShow = this.courseListP
|
|
|
+ }
|
|
|
this.getCusInfo()
|
|
|
} else {
|
|
|
this.$Message.error('API ERROR!')
|
|
@@ -1088,7 +1012,6 @@ export default {
|
|
|
if (!res.error) {
|
|
|
if (res.courses && res.courses.length > 0) {
|
|
|
res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
|
|
|
-
|
|
|
// 获取自定义名单信息
|
|
|
let ids = res.courses[0].schedule.map(item => {
|
|
|
return item.stulist
|
|
@@ -1135,6 +1058,7 @@ export default {
|
|
|
} else {
|
|
|
this.$set(this.courseListP, this.curCusIndex, res.courses[0])
|
|
|
}
|
|
|
+ this.changeClassroom(0)
|
|
|
}
|
|
|
}
|
|
|
)
|
|
@@ -1158,9 +1082,7 @@ export default {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
let dom = document.getElementById('table-height')
|
|
|
- console.log(dom)
|
|
|
- console.log(dom.offsetHeight)
|
|
|
- this.tableHeight = dom.offsetHeight - 60
|
|
|
+ this.tableHeight = dom.offsetHeight - 50
|
|
|
})
|
|
|
},
|
|
|
computed: {
|
|
@@ -1174,35 +1096,17 @@ export default {
|
|
|
},
|
|
|
//课程名单 —— schedule
|
|
|
teaClassList() {
|
|
|
- if (this.listType == 'school') {
|
|
|
- if (this.courseListS.length > 0 && this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule) {
|
|
|
- return this.courseListS[this.curCusIndex].schedule.filter(item => {
|
|
|
- return item.teacher.id == this.$store.state.userInfo.TEAMModelId
|
|
|
- })
|
|
|
- } else {
|
|
|
- return []
|
|
|
- }
|
|
|
- } else if (this.listType == 'private') {
|
|
|
- if (this.courseListP.length > 0 && this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule) {
|
|
|
- return this.courseListP[this.curCusIndex].schedule
|
|
|
- } else {
|
|
|
- return []
|
|
|
- }
|
|
|
+ if (this.courseListShow.length > 0 && this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule) {
|
|
|
+ return this.courseListShow[this.curCusIndex].schedule.filter(item => {
|
|
|
+ return item.teacher.id == this.$store.state.userInfo.TEAMModelId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
}
|
|
|
},
|
|
|
students() {
|
|
|
- if (this.listType == 'school') {
|
|
|
- if (this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule && this.courseListS[this.curCusIndex].schedule[this.curClassIndex]) {
|
|
|
- return this.courseListS[this.curCusIndex].schedule[this.curClassIndex].students
|
|
|
- } else {
|
|
|
- return []
|
|
|
- }
|
|
|
- } else if (this.listType == 'private') {
|
|
|
- if (this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule && this.courseListP[this.curCusIndex].schedule[this.curClassIndex]) {
|
|
|
- return this.courseListP[this.curCusIndex].schedule[this.curClassIndex].students
|
|
|
- } else {
|
|
|
- return []
|
|
|
- }
|
|
|
+ if (this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule && this.courseListShow[this.curCusIndex].schedule[this.curClassIndex]) {
|
|
|
+ return this.courseListShow[this.curCusIndex].schedule[this.curClassIndex].students
|
|
|
} else {
|
|
|
return []
|
|
|
}
|