Commit 48446fa6 authored by zhengke's avatar zhengke

修改

parent 528289f3
<template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale"
transition-hide="scale" class="addactivetype">
<q-card style="width: 500px;max-width:500px;">
<q-card-section>
<div class="text-h6">
<span v-if="postMsg.ChangeType==1">批量修改老师</span>
<span v-if="postMsg.ChangeType==2">批量修改教室</span>
<span v-if="postMsg.ChangeType==3">批量修改时段</span>
</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap q-mb-lg" v-if="postMsg.ChangeType==1">
<div class="col-12">
<q-select filled stack-label option-value="TId" option-label="TeacherName" v-model="postMsg.TeacherId"
ref="Teacher_Id" :options="TeacherList" label="关联教师" :dense="false" class="col-6 q-pb-lg" emit-value
map-options />
</div>
</div>
<div class="row wrap q-mb-lg" v-if="postMsg.ChangeType==2">
<div class="col-12">
<q-select filled stack-label option-value="RoomId" option-label="RoomName" v-model="postMsg.ClassRoomId"
ref="ClassRoomId" :options="ClassRoomList" label="关联教室" :dense="false" class="col-6 q-pb-lg"
emit-value map-options />
</div>
</div>
<div class="row wrap" v-if="postMsg.ChangeType==3">
<div class="col-12">
<div style="display:flex;justify-content:flex-end;margin-bottom:20px;">
<q-btn @click="addStep()" size="10px" round color="primary" icon="iconfont icon-img_haha" />
</div>
<div class="row wrap" style="position:relative;" v-for="(subItem,subIndex) in postMsg.TimeList"
:key="subIndex">
<div class="col-4">
<q-input filled v-model="subItem.StartTime" class="col-6 q-pr-lg q-pb-lg" placeholder="开始时间"
mask="time">
<template v-slot:append>
<q-icon name="access_time" class="cursor-pointer">
<q-popup-proxy transition-show="scale" transition-hide="scale">
<q-time v-model="subItem.StartTime">
<div class="row items-center justify-end">
<q-btn v-close-popup label="确定" color="primary" flat />
</div>
</q-time>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-4">
<q-input filled v-model="subItem.EndTime" class="col-6 q-pr-lg q-pb-lg" placeholder="结束时间"
mask="time">
<template v-slot:append>
<q-icon name="access_time" class="cursor-pointer">
<q-popup-proxy transition-show="scale" transition-hide="scale">
<q-time v-model="subItem.EndTime">
<div class="row items-center justify-end">
<q-btn v-close-popup label="确定" color="primary" flat />
</div>
</q-time>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div>
<div class="col-4">
<q-input filled stack-label maxlength="10" :dense="false" v-model="subItem.TimeHour" ref="TimeHour"
class="col-4 q-pr-lg q-pb-lg" label="消耗课时" :rules="[val => !!val || '请填写消耗课时']"
@keyup.native="checkPrice(subItem,'TimeHour')" />
</div>
<div class="delBtnStyle">
<i @click="delStep(subIndex)" class="iconfont icon-guanbi"></i>
</div>
</div>
</div>
</div>
</q-card-section>
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeRuleForm" />
<q-btn label="保存" color="accent q-px-md" style="font-weight:400 !important" @click="saveClass" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
BatchUpdateClassPlan,
getTeacherDropDownList,
queryClassRoomList,
} from '../../api/school/index.js'
export default {
props: {
saveObj: {
type: Object,
default: null
},
},
data() {
return {
persistent: true,
//提交参数
postMsg: {
ClassId: 0,
ChangeType: 1, //调动类型(1-老师,2-教室,3-时段)
ClassPlanIdList: [], //选中的ClassPlanId数组
ClassRoomId: 0, //全局调整--教室编号
TeacherId: 0, //全局调整--教师编号
TimeList: [{
StartTime: "", //开始时间
EndTime: "", //结束时间
TimeHour: 0, //消耗课时
}], //全局调整--上课时段
},
TeacherList: [],
ClassRoomList: [],
}
},
mounted() {
this.postMsg.ChangeType = this.saveObj.ChangeType
this.GetTeacherList();
this.getClassRoomList();
},
methods: {
//保存信息
saveClass() {
if (this.postMsg.ChangeType == 1 && this.postMsg.TeacherId == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择老师`
})
return
}
if (this.postMsg.ChangeType == 2 && this.postMsg.ClassRoomId == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择教室`
})
return
}
if (this.postMsg.ChangeType == 3) {
for (let i = 0; i < this.postMsg.TimeList.length; i++) {
if (this.postMsg.TimeList[i].StartTime == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择第${i+1}节课开始时间`
})
return
}
if (this.postMsg.TimeList[i].EndTime == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择第${i+1}节课结束时间`
})
return
}
}
}
this.postMsg.ClassPlanIdList = this.saveObj.selected;
this.postMsg.ClassId = this.saveObj.ClassId;
BatchUpdateClassPlan(this.postMsg).then(res => {
if (res.Code === 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
})
this.$emit('success');
this.$emit('close');
} else {
this.Error(res.Message);
}
})
},
//关闭窗口
closeRuleForm() {
this.$emit('close');
this.persistent = false
},
//获取教师下拉
GetTeacherList() {
getTeacherDropDownList({}).then(res => {
if (res.Code == 1) {
this.TeacherList = res.Data;
}
})
},
//获取教室下拉
getClassRoomList() {
queryClassRoomList({}).then(res => {
if (res.Code == 1) {
this.ClassRoomList = res.Data;
}
})
},
//点击新增
addStep() {
var obj = {
StartTime: "", //开始时间
EndTime: "", //结束时间
TimeHour: 0, //消耗课时
}
this.postMsg.TimeList.push(obj);
},
//删除
delStep(index) {
this.postMsg.TimeList.splice(index, 1);
},
},
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment