You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.5 KiB

2 years ago
<template>
<div>
2 years ago
<xy-dialog ref="dialog" :width="35" :is-show.sync="isShow" :type="'form'" title="时间设置" :form="form"
:rules='rules' @submit="submit">
<template v-slot:start_time>
2 years ago
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>上课时间:
</div>
<div class="xy-table-item-content">
<el-time-picker @change="changeHHmm" is-range v-model="range" value-format="HH:mm" format="HH:mm"
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围">
</el-time-picker>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
2 years ago
<script>
import {show,save} from "@/api/course/coursePeriod.js"
2 years ago
export default {
components: {
},
data() {
return {
2 years ago
isShow: false,
id:'',
type:'add',
2 years ago
index: 0,
range: [],
form: {
2 years ago
start_time: '',
end_time:''
2 years ago
},
2 years ago
rules: {
start_time:[{
required:true,
message:'请选择上课时间'
}]
}
2 years ago
}
},
created() {},
methods: {
2 years ago
setIndex(index, time ,course_id) {
console.log("time",time)
this.index = index
this.form.id = time.course_period_id
this.range = time.range
if(time.length>0){
this.form.start_time = time.range[0]
this.form.end_time = time.range[1]
}
this.form.course_id = course_id
2 years ago
},
changeHHmm(e) {
if (e) {
2 years ago
this.form.start_time = e[0]
this.form.end_time = e[1]
}else{
this.form.start_time = ''
this.form.end_time = ''
2 years ago
}
},
2 years ago
submit() {
if(this.id){
this.form.id = this.id
}
console.log("form",this.form)
// return
save(this.form).then(res=>{
this.$emit("refreshTime", {
index: this.index,
time:{
range: this.range,
course_period_id:res.id
}
})
this.isShow = false
2 years ago
})
2 years ago
2 years ago
}
},
watch: {
isShow(newVal) {
2 years ago
if (newVal) {
} else {
this.id = ''
this.$refs['dialog'].reset()
}
2 years ago
},
}
}
</script>
<style scoped lang="scss">
2 years ago
2 years ago
</style>