|
|
|
|
@ -2,23 +2,20 @@
|
|
|
|
|
<div>
|
|
|
|
|
<Modal v-model="isShow" width="70" title="排课设置">
|
|
|
|
|
<div class="txl">
|
|
|
|
|
<div>课程名称:第六期高级科创人才研修班</div>
|
|
|
|
|
<div>开课日期:2024.3.1--2024.9.1</div>
|
|
|
|
|
<div>类别:正常课程</div>
|
|
|
|
|
<div>课程名称:{{subjectObj.name}}</div>
|
|
|
|
|
<div>开课日期:{{subjectObj.start_date}}至{{subjectObj.end_date}}</div>
|
|
|
|
|
<div>类别:{{subjectObj.leibie}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="txl">
|
|
|
|
|
<div>班主任:李老师</div>
|
|
|
|
|
<div>课表状态:未发布</div>
|
|
|
|
|
<div>班主任:{{subjectObj.teacher?subjectObj.teacher.name:''}}</div>
|
|
|
|
|
<div>课表状态:{{subjectObj.course_content_status===1?'已发布':'未发布'}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="txl">
|
|
|
|
|
<div>
|
|
|
|
|
<el-button @click="addColum" type="primary" size="small">新增一行</el-button>
|
|
|
|
|
<el-button type="primary" size="small" @click="importTable">导入</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-button type="primary" size="small">导入</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-button type="primary" size="small">发布课表</el-button>
|
|
|
|
|
<div v-if="subjectObj.course_content_status===0">
|
|
|
|
|
<el-button type="primary" size="small" @click="changeContentStatus">发布课表</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<el-button type="primary" size="small">下载并打印课表</el-button>
|
|
|
|
|
@ -26,124 +23,75 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="schedule">
|
|
|
|
|
<el-table :data="scheduleData" border style="width: 100%" row-class-name="hover-row">
|
|
|
|
|
<el-table-column v-for="(column, index) in columns" :key="index" :prop="column.prop" :label="column.label"
|
|
|
|
|
:width="column.width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="column.type === 'time'" class="subjectCell"
|
|
|
|
|
@click="openTime(scope.$index,scope.row[column.prop])">
|
|
|
|
|
{{ formatTime(scope.row[column.prop]) }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="subjectCell" v-else @click="openSubject(scope.$index,column.prop,scope.row[column.prop])">
|
|
|
|
|
<div v-if="formatSubject(scope.row[column.prop])" class="close"
|
|
|
|
|
@click.stop="delColum(scope.$index,column.prop)">X</div>
|
|
|
|
|
<div v-html='formatSubject(scope.row[column.prop])'></div>
|
|
|
|
|
</div>
|
|
|
|
|
<xy-table :list="list" :isPage="false" :table-item="table_item">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<div></div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" :width="80">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<el-button type="danger" size="small" @click="delTime(scope.$index)">删除</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</xy-table>
|
|
|
|
|
</div>
|
|
|
|
|
<template v-slot:footer>
|
|
|
|
|
<el-button type="primary" style='margin-left:5px;margin-bottom:5px;' @click="submit">确认</el-button>
|
|
|
|
|
<!-- <el-button type="primary" style='margin-left:5px;margin-bottom:5px;' @click="submit">确认</el-button> -->
|
|
|
|
|
<el-button plain type="primary" plain style='margin-left:5px;margin-bottom:5px;'
|
|
|
|
|
@click="isShow=false">取消</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
<!-- 时间选择 -->
|
|
|
|
|
<change-time ref="changeTime" @refreshTime="updateTime"></change-time>
|
|
|
|
|
<!-- 课时选择 -->
|
|
|
|
|
<change-subject ref="changeSubject" @refresh="updateSubject"></change-subject>
|
|
|
|
|
<imports ref="imports" :table-name="'course_contents'" :course_id="id+''" @refresh="getCousreContent"></imports>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import changeTime from './changeTime.vue'
|
|
|
|
|
import changeSubject from './changeSubject.vue'
|
|
|
|
|
import {
|
|
|
|
|
index,
|
|
|
|
|
show,
|
|
|
|
|
save,
|
|
|
|
|
destroy
|
|
|
|
|
index
|
|
|
|
|
} from '@/api/course/courseContent.js'
|
|
|
|
|
import {
|
|
|
|
|
index as settingIndex
|
|
|
|
|
} from "@/api/course/courseSetting.js"
|
|
|
|
|
show,
|
|
|
|
|
save
|
|
|
|
|
} from "@/api/course/index.js"
|
|
|
|
|
import imports from "@/views/component/imports.vue"
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
changeTime,
|
|
|
|
|
changeSubject
|
|
|
|
|
imports
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isShow: false,
|
|
|
|
|
hoverRowIndex: null,
|
|
|
|
|
id: '', // 课程id,其他接口的course_id
|
|
|
|
|
courseSettings:[],//课时
|
|
|
|
|
subjectObj: {},
|
|
|
|
|
columns: [{
|
|
|
|
|
type: 'time',
|
|
|
|
|
prop: 'time',
|
|
|
|
|
label: '时间',
|
|
|
|
|
width: '120'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'monday',
|
|
|
|
|
label: '星期一'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'tuesday',
|
|
|
|
|
label: '星期二'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'wednesday',
|
|
|
|
|
label: '星期三'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'thursday',
|
|
|
|
|
label: '星期四'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'friday',
|
|
|
|
|
label: '星期五'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'saturday',
|
|
|
|
|
label: '星期六'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'sunday',
|
|
|
|
|
label: '星期日'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
scheduleData: [],
|
|
|
|
|
subjectObj: {}, // 课程信息
|
|
|
|
|
list: [],
|
|
|
|
|
table_item: [{
|
|
|
|
|
prop: 'date',
|
|
|
|
|
label: '日期',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 120,
|
|
|
|
|
}, {
|
|
|
|
|
prop: 'period',
|
|
|
|
|
label: '时间 ',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 180,
|
|
|
|
|
}, {
|
|
|
|
|
prop: 'teacher.name',
|
|
|
|
|
label: '授课老师',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 120,
|
|
|
|
|
}, {
|
|
|
|
|
prop: 'theme',
|
|
|
|
|
label: '课程主题',
|
|
|
|
|
align: 'left'
|
|
|
|
|
}, {
|
|
|
|
|
prop: 'address',
|
|
|
|
|
label: '上课地点',
|
|
|
|
|
align: 'center'
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取排课
|
|
|
|
|
async getCousreContent() {
|
|
|
|
|
const res = await index({
|
|
|
|
|
page:1,
|
|
|
|
|
page_size: 999,
|
|
|
|
|
filter:[{
|
|
|
|
|
key:'course_id',
|
|
|
|
|
op:'eq',
|
|
|
|
|
value:this.id
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取课时
|
|
|
|
|
async getSettingList() {
|
|
|
|
|
const res = await settingIndex({
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 999,
|
|
|
|
|
sort_name: 'created_at',
|
|
|
|
|
show_relation: ['teacher'],
|
|
|
|
|
sort_name: 'date',
|
|
|
|
|
sort_type: 'ASC',
|
|
|
|
|
filter: [{
|
|
|
|
|
key: 'course_id',
|
|
|
|
|
@ -151,80 +99,35 @@
|
|
|
|
|
value: this.id
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
this.courseSettings = res.data
|
|
|
|
|
},
|
|
|
|
|
setSubject(e) {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 增加一行
|
|
|
|
|
addColum(index) {
|
|
|
|
|
const obj = {
|
|
|
|
|
time: {
|
|
|
|
|
course_period_id:'',
|
|
|
|
|
range:['','']
|
|
|
|
|
this.list = res.data
|
|
|
|
|
},
|
|
|
|
|
monday: {},
|
|
|
|
|
tuesday: {},
|
|
|
|
|
wednesday: {},
|
|
|
|
|
thursday: {},
|
|
|
|
|
friday: {},
|
|
|
|
|
saturday: {},
|
|
|
|
|
sunday: {}
|
|
|
|
|
}
|
|
|
|
|
this.scheduleData.push(obj)
|
|
|
|
|
async getCourseDetail(){
|
|
|
|
|
const res = await show({id:this.id,show_relation:['teacher']})
|
|
|
|
|
this.subjectObj = this.base.requestToForm(res, this.subjectObj)
|
|
|
|
|
},
|
|
|
|
|
// 删除一行
|
|
|
|
|
delTime(index) {
|
|
|
|
|
this.scheduleData.splice(index, 1)
|
|
|
|
|
},
|
|
|
|
|
// 更改上课时间
|
|
|
|
|
formatTime(val) {
|
|
|
|
|
if (val.range && val.range.length > 0) {
|
|
|
|
|
return val.range.join("--")
|
|
|
|
|
}
|
|
|
|
|
importTable() {
|
|
|
|
|
this.$refs.imports.show()
|
|
|
|
|
},
|
|
|
|
|
openTime(index, time) {
|
|
|
|
|
this.$refs.changeTime.setIndex(index, time,this.id)
|
|
|
|
|
this.$refs.changeTime.isShow = true
|
|
|
|
|
changeContentStatus(){
|
|
|
|
|
this.subjectObj.course_content_status = 1
|
|
|
|
|
save(this.subjectObj).then(res=>{
|
|
|
|
|
this.$Message.success("发布成功")
|
|
|
|
|
this.getCourseDetail()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
updateTime(e) {
|
|
|
|
|
this.scheduleData[e.index]['time'] = e.time
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 更改课程
|
|
|
|
|
formatSubject(val) {
|
|
|
|
|
if (!val) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
if (JSON.stringify(val) === '{}') {
|
|
|
|
|
return ''
|
|
|
|
|
} else {
|
|
|
|
|
return `<div>${val.teacher_value}</div><div>${val.name_value}</div><div>${val.room}</div>`
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
openSubject(index, prop, form) {
|
|
|
|
|
this.$refs.changeSubject.courseSettings = this.courseSettings
|
|
|
|
|
this.$refs.changeSubject.setIndex(index, prop, form,this.id)
|
|
|
|
|
this.$refs.changeSubject.isShow = true
|
|
|
|
|
},
|
|
|
|
|
updateSubject(e) {
|
|
|
|
|
console.log("e1", e)
|
|
|
|
|
this.scheduleData[e.index][e.prop] = e
|
|
|
|
|
},
|
|
|
|
|
delColum(index, prop) {
|
|
|
|
|
this.scheduleData[index][prop] = {}
|
|
|
|
|
},
|
|
|
|
|
//
|
|
|
|
|
submit() {}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
isShow(newVal) {
|
|
|
|
|
if (newVal) {
|
|
|
|
|
this.getCourseDetail()
|
|
|
|
|
this.getCousreContent()
|
|
|
|
|
this.getSettingList()
|
|
|
|
|
} else {
|
|
|
|
|
this.id = ''
|
|
|
|
|
this.$refs['dialog'].reset()
|
|
|
|
|
this.subjectObj = {}
|
|
|
|
|
// this.$refs['dialog'].reset()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|