lion 1 year ago
parent a8a02464d4
commit 10e350b0ca

@ -33,6 +33,10 @@ export default {
},
okText:{
type:String
},
hasIscheck:{
type:Boolean,
default:false
}
},
data() {
@ -53,7 +57,7 @@ export default {
if(this.type === 'normal'){
return (
<div>
<Button ghost type="primary" on-click={()=>{this.$emit('update:isShow',false)}}>取消</Button>
<Button ghost type="primary" on-click={()=>{this.$emit('update:isShow',false),this.$emit('update:hasIscheck',false)}}>取消</Button>
<Button type="primary" on-click={()=>{this.$emit('on-ok')}}>{this.okText || '确定'}</Button>
</div>
)
@ -62,6 +66,8 @@ export default {
showChange(e){
this.$emit('update:isShow',e)
this.$emit('on-visible-change',e)
this.$emit('update:hasIscheck',e)
},
validate(){
return new Promise((resolve,reject)=>{
@ -94,20 +100,21 @@ export default {
}
this.$refs['elForm'].validate().then(res=>{
if(res){
if(ischeck){
console.log("res",res)
console.log("ischeck",this.hasIscheck)
if(this.hasIscheck){
this.$emit('mysubmit',true)
}else{
this.$emit('submit')
}
}
}).catch(err => {
console.log("456")
this.$Message.warning({
content: "请填写完整信息",
background: true,
duration: 1
})
if(ischeck){
if(this.hasIscheck){
this.$emit('mysubmit',false)
}
})
@ -123,6 +130,7 @@ export default {
isShow(val){
if(!val && this.type === 'form'){
this.reset()
}
}
},

@ -19,6 +19,7 @@
:action="action"
:data="{
table_name: tableName,
course_id:course_id?course_id:''
}"
:headers="{
Authorization: `Bearer ${getToken()}`,
@ -53,6 +54,7 @@ export default {
default: () => [],
},
tableName: String,
course_id: String
},
data() {
return {
@ -84,7 +86,18 @@ export default {
b.push({ key: key, title: res[key] });
}
}
//
if(this.tableName==='course_contents'){
b.push({ key: '', title: '老师简介' });
b.map(item=>{
if(item.key==='teacher_id'){
item.key = 'teacher_name'
}
})
}
this.table = this.headers = b
console.log("table",this.table)
},
//
uploadFail(err) {
@ -124,6 +137,7 @@ export default {
url: this.import_action,
data:{
table_name: this.tableName,
course_id:this.course_id?this.course_id:'',
data: this.tableList
}
}).then(res => {
@ -132,9 +146,10 @@ export default {
type: 'success',
message: `成功导入${res.total}`
})
this.hidden();
this.$emit('refresh')
})
this.hidden();
this.$emit('refresh')
}
},
computed: {},
@ -152,8 +167,9 @@ export default {
dialogVisible(newval){
console.log("newval",newval,this.tableName)
if(newval){
this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${this.tableName}/excel-show`
this.import_action = `/api/admin/${this.tableName}/import`
let changeTableName = this.tableName.replace('_','-')
this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${changeTableName}/excel-show`
this.import_action = `/api/admin/${changeTableName}/import`
this.getHeaders()
console.log("action",this.action,this.import_action)
}

@ -67,9 +67,9 @@
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" width="280" header-align="center">
<el-table-column align='left' label="操作" width="280" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editClass('add',scope.row.id)"></el-button>
<el-button type="primary" size="small" v-if="scope.row.is_arrange===1" @click="editClass('add',scope.row)"></el-button>
<el-button type="primary" size="small" @click="goAttendance"></el-button>
<el-button type="primary" size="small" @click="setMain(scope.row.id)"></el-button>
</template>
@ -195,8 +195,8 @@
path: '/course/attendance'
})
},
editClass(type, id) {
this.$refs.addClass.id = id
editClass(type, row) {
this.$refs.addClass.id = row.id
this.$refs.addClass.isShow = true
},
setMain(id) {

@ -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,207 +23,113 @@
</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>
</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 :list="list" :isPage="false" :table-item="table_item">
<template v-slot:btns>
<div></div>
</template>
</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
} from '@/api/course/courseContent.js'
import {
index as settingIndex
} from "@/api/course/courseSetting.js"
index
} from '@/api/course/courseContent.js'
import {
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: '', // idcourse_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: [],
id: '', // idcourse_id
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: {
methods: {
//
async getCousreContent() {
const res = await index({
page:1,
page_size: 999,
filter:[{
key:'course_id',
op:'eq',
value:this.id
page: 1,
page_size: 999,
show_relation: ['teacher'],
sort_name: 'date',
sort_type: 'ASC',
filter: [{
key: 'course_id',
op: 'eq',
value: this.id
}]
})
this.list = res.data
},
//
async getSettingList() {
const res = await settingIndex({
page: 1,
page_size: 999,
sort_name: 'created_at',
sort_type: 'ASC',
filter: [{
key: 'course_id',
op: 'eq',
value: this.id
}]
})
this.courseSettings = res.data
},
setSubject(e) {
async getCourseDetail(){
const res = await show({id:this.id,show_relation:['teacher']})
this.subjectObj = this.base.requestToForm(res, this.subjectObj)
},
//
addColum(index) {
const obj = {
time: {
course_period_id:'',
range:['','']
},
monday: {},
tuesday: {},
wednesday: {},
thursday: {},
friday: {},
saturday: {},
sunday: {}
}
this.scheduleData.push(obj)
},
//
delTime(index) {
this.scheduleData.splice(index, 1)
},
//
formatTime(val) {
if (val.range && val.range.length > 0) {
return val.range.join("--")
}
},
openTime(index, time) {
this.$refs.changeTime.setIndex(index, time,this.id)
this.$refs.changeTime.isShow = true
},
updateTime(e) {
this.scheduleData[e.index]['time'] = e.time
importTable() {
this.$refs.imports.show()
},
changeContentStatus(){
this.subjectObj.course_content_status = 1
save(this.subjectObj).then(res=>{
this.$Message.success("发布成功")
this.getCourseDetail()
})
},
},
//
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) {
},
watch: {
isShow(newVal) {
if (newVal) {
this.getCousreContent()
this.getSettingList()
} else {
this.id = ''
this.$refs['dialog'].reset()
}
},
this.getCourseDetail()
this.getCousreContent()
} else {
this.id = ''
this.subjectObj = {}
// this.$refs['dialog'].reset()
}
},
}
}
</script>

@ -1,7 +1,7 @@
<template>
<div>
<xy-dialog ref="dialog" :width="70" :is-show.sync="isShow" :type="'form'" :title="type === 'add' ? '新增课程' : '编辑课程'"
:form="form" :rules='rules' @mysubmit="mysubmit">
:form="form" :rules='rules' :hasIscheck="true" @mysubmit="mysubmit">
<template v-slot:step>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold;display:none">

@ -49,7 +49,6 @@
},
methods: {
setTeachers(e){
console.log(e)
this.teacher_options = e
},
submit() {

@ -78,14 +78,14 @@
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" width="380" header-align="center">
<el-table-column align='left' label="操作" width="380" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editCourse('editor',scope.row.id)"></el-button>
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
<el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm>
<el-button type="primary" size="small" @click="toTxl(scope.row)"></el-button>
<el-button type="primary" size="small" @click="toPay(scope.row)"></el-button>
<el-button type="primary" size="small" v-if="scope.row.is_fee===1" @click="toPay(scope.row)"></el-button>
<el-button type="primary" size="small" @click="showQrCode"></el-button>
</template>
</el-table-column>

Loading…
Cancel
Save