lion 1 year ago
parent a8a02464d4
commit 10e350b0ca

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

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

@ -67,9 +67,9 @@
</el-table-column> </el-table-column>
</template> </template>
<template v-slot:btns> <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"> <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="goAttendance"></el-button>
<el-button type="primary" size="small" @click="setMain(scope.row.id)"></el-button> <el-button type="primary" size="small" @click="setMain(scope.row.id)"></el-button>
</template> </template>
@ -195,8 +195,8 @@
path: '/course/attendance' path: '/course/attendance'
}) })
}, },
editClass(type, id) { editClass(type, row) {
this.$refs.addClass.id = id this.$refs.addClass.id = row.id
this.$refs.addClass.isShow = true this.$refs.addClass.isShow = true
}, },
setMain(id) { setMain(id) {

@ -2,23 +2,20 @@
<div> <div>
<Modal v-model="isShow" width="70" title="排课设置"> <Modal v-model="isShow" width="70" title="排课设置">
<div class="txl"> <div class="txl">
<div>课程名称第六期高级科创人才研修班</div> <div>课程名称{{subjectObj.name}}</div>
<div>开课日期2024.3.1--2024.9.1</div> <div>开课日期{{subjectObj.start_date}}{{subjectObj.end_date}}</div>
<div>类别正常课程</div> <div>类别{{subjectObj.leibie}}</div>
</div> </div>
<div class="txl"> <div class="txl">
<div>班主任李老师</div> <div>班主任{{subjectObj.teacher?subjectObj.teacher.name:''}}</div>
<div>课表状态未发布</div> <div>课表状态{{subjectObj.course_content_status===1?'已发布':'未发布'}}</div>
</div> </div>
<div class="txl"> <div class="txl">
<div> <div>
<el-button @click="addColum" type="primary" size="small">新增一行</el-button> <el-button type="primary" size="small" @click="importTable"></el-button>
</div> </div>
<div> <div v-if="subjectObj.course_content_status===0">
<el-button type="primary" size="small">导入</el-button> <el-button type="primary" size="small" @click="changeContentStatus"></el-button>
</div>
<div>
<el-button type="primary" size="small">发布课表</el-button>
</div> </div>
<div> <div>
<el-button type="primary" size="small">下载并打印课表</el-button> <el-button type="primary" size="small">下载并打印课表</el-button>
@ -26,207 +23,113 @@
</div> </div>
<div class="schedule"> <div class="schedule">
<el-table :data="scheduleData" border style="width: 100%" row-class-name="hover-row"> <xy-table :list="list" :isPage="false" :table-item="table_item">
<el-table-column v-for="(column, index) in columns" :key="index" :prop="column.prop" :label="column.label" <template v-slot:btns>
:width="column.width"> <div></div>
<template slot-scope="scope"> </template>
<div v-if="column.type === 'time'" class="subjectCell" </xy-table>
@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>
</div> </div>
<template v-slot:footer> <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;' <el-button plain type="primary" plain style='margin-left:5px;margin-bottom:5px;'
@click="isShow=false">取消</el-button> @click="isShow=false">取消</el-button>
</template> </template>
</Modal> </Modal>
<!-- 时间选择 --> <imports ref="imports" :table-name="'course_contents'" :course_id="id+''" @refresh="getCousreContent"></imports>
<change-time ref="changeTime" @refreshTime="updateTime"></change-time>
<!-- 课时选择 -->
<change-subject ref="changeSubject" @refresh="updateSubject"></change-subject>
</div> </div>
</template> </template>
<script> <script>
import changeTime from './changeTime.vue'
import changeSubject from './changeSubject.vue'
import { import {
index, index
show, } from '@/api/course/courseContent.js'
save, import {
destroy show,
} from '@/api/course/courseContent.js' save
import { } from "@/api/course/index.js"
index as settingIndex import imports from "@/views/component/imports.vue"
} from "@/api/course/courseSetting.js"
export default { export default {
components: { components: {
changeTime, imports
changeSubject
}, },
data() { data() {
return { return {
isShow: false, isShow: false,
hoverRowIndex: null, id: '', // idcourse_id
id: '', // idcourse_id subjectObj: {}, //
courseSettings:[],// list: [],
subjectObj: {}, table_item: [{
columns: [{ prop: 'date',
type: 'time', label: '日期',
prop: 'time', align: 'center',
label: '时间', width: 120,
width: '120' }, {
}, prop: 'period',
{ label: '时间 ',
prop: 'monday', align: 'center',
label: '星期一' width: 180,
}, }, {
{ prop: 'teacher.name',
prop: 'tuesday', label: '授课老师',
label: '星期二' align: 'center',
}, width: 120,
{ }, {
prop: 'wednesday', prop: 'theme',
label: '星期三' label: '课程主题',
}, align: 'left'
{ }, {
prop: 'thursday', prop: 'address',
label: '星期四' label: '上课地点',
}, align: 'center'
{ }]
prop: 'friday',
label: '星期五'
},
{
prop: 'saturday',
label: '星期六'
},
{
prop: 'sunday',
label: '星期日'
}
],
scheduleData: [],
} }
}, },
methods: { methods: {
// //
async getCousreContent() { async getCousreContent() {
const res = await index({ const res = await index({
page:1, page: 1,
page_size: 999, page_size: 999,
filter:[{ show_relation: ['teacher'],
key:'course_id', sort_name: 'date',
op:'eq', sort_type: 'ASC',
value:this.id filter: [{
key: 'course_id',
op: 'eq',
value: this.id
}] }]
}) })
this.list = res.data
}, },
// async getCourseDetail(){
async getSettingList() { const res = await show({id:this.id,show_relation:['teacher']})
const res = await settingIndex({ this.subjectObj = this.base.requestToForm(res, this.subjectObj)
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) {
}, },
// importTable() {
addColum(index) { this.$refs.imports.show()
const obj = { },
time: { changeContentStatus(){
course_period_id:'', this.subjectObj.course_content_status = 1
range:['',''] save(this.subjectObj).then(res=>{
}, this.$Message.success("发布成功")
monday: {}, this.getCourseDetail()
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
},
//
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() {} submit() {}
}, },
watch: { watch: {
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
this.getCousreContent() this.getCourseDetail()
this.getSettingList() this.getCousreContent()
} else { } else {
this.id = '' this.id = ''
this.$refs['dialog'].reset() this.subjectObj = {}
} // this.$refs['dialog'].reset()
}, }
},
} }
} }
</script> </script>

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

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

@ -78,14 +78,14 @@
</el-table-column> </el-table-column>
</template> </template>
<template v-slot:btns> <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"> <template slot-scope="scope">
<el-button type="primary" size="small" @click="editCourse('editor',scope.row.id)"></el-button> <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-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
<el-button type="danger" size="small" slot="reference">删除</el-button> <el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm> </el-popconfirm>
<el-button type="primary" size="small" @click="toTxl(scope.row)"></el-button> <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> <el-button type="primary" size="small" @click="showQrCode"></el-button>
</template> </template>
</el-table-column> </el-table-column>

Loading…
Cancel
Save