Commit 1a29f945 authored by zhengke's avatar zhengke

1

parents ed5158c3 d762ed7f
......@@ -23,21 +23,21 @@
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale">
<q-card style="width: 800px;max-width:900px;" class="CLM-Form">
<q-card-section>
<div class="text-h6">上课计划冲突调整 【{{msg.ClassName}}{{msg.ClassNo}})】</div>
<div class="text-h6">上课计划冲突调整 【{{showMsg.ClassName}}{{showMsg.ClassNo}})】</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<q-table :pagination="pMsg" :loading="loading" no-data-label="暂无相关数据" selection="multiple" flat
:selected.sync="selected" class="sticky-column-table sticky-header-column-table" separator="none"
style="max-height: 400px" :data="dataList" :columns="columns" row-key="ClassPlanId" hide-bottom>
<q-table :pagination="showMsg" :loading="loading" no-data-label="暂无相关数据" selection="multiple" flat
:selected.sync="selectedAll" class="sticky-column-table sticky-header-column-table" separator="none"
style="max-height: 450px" :data="dataList" :columns="columns" row-key="ClassPlanId" hide-bottom>
<template v-slot:top="props">
<div class="text-caption q-px-md text-grey-6 col">
<div class="text-caption q-my-lg q-px-md text-grey-6 col">
变更内容 注意:需要对变更的内容进行打钩
</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" @click="isShowClassForm=true" label="全部重排" />
<q-select filled stack-label style="display:inline-block;width:150px;" option-value="Id"
option-label="Name" v-model="msg.ChangeType" :options="changeTypeList" label="变更类型" :dense="false"
option-label="Name" v-model="postMsg.ChangeType" :options="changeTypeList" label="变更类型" :dense="false"
class="col-6" emit-value map-options />
</div>
</template>
......@@ -99,8 +99,7 @@
</q-banner>
</q-popup-proxy>
</span>
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400;" label="编辑"
@click="getInfo(props.row)">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400;" label="编辑" @click="getInfo()">
<q-popup-proxy>
<q-banner v-if="isShowEdit">
<div class="classConflitDialog">
......@@ -184,26 +183,26 @@
</q-table>
<div class="row wrap" style="margin-top:20px;">
<div class="col-4">
<template v-if="msg.ChangeType==1">
<template v-if="postMsg.ChangeType==1">
<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 />
</template>
<template v-if="msg.ChangeType==2">
<template v-if="postMsg.ChangeType==2">
<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 />
</template>
</div>
<template v-if="msg.ChangeType==3">
<template v-if="postMsg.ChangeType==3">
<div class="col-12">
<div style="display:flex;justify-content:flex-end;margin-bottom:20px;">
<q-btn @click="addStepTwo()" size="10px" round color="primary" icon="iconfont icon-img_haha" />
<q-btn @click="addStepOne(postMsg)" 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" placeholder="开始时间"
<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">
......@@ -219,7 +218,7 @@
</q-input>
</div>
<div class="col-4">
<q-input filled v-model="subItem.EndTime" class="col-6 q-pr-lg" placeholder="结束时间"
<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">
......@@ -236,18 +235,16 @@
</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" label="消耗课时" :rules="[val => !!val || '请填写消耗课时']"
class="col-4 q-pr-lg q-pb-lg" label="消耗课时" :rules="[val => !!val || '请填写消耗课时']"
@keyup.native="checkPrice(subItem,'TimeHour')" />
</div>
<div class="delBtnStyle">
<i @click="delStepTwo(subIndex)" class="iconfont icon-guanbi"></i>
<i @click="delStepOne(postMsg,subIndex)" class="iconfont icon-guanbi"></i>
</div>
</div>
</div>
</template>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
......@@ -268,7 +265,6 @@
UpdateClassPlanSingle,
BatchUpdateClassPlan
} from "../../api/school/index";
export default {
props: {
ClassId: {
......@@ -280,6 +276,10 @@
return {
persistent: true,
changeTypeList: [{
Id: 0,
Name: "课程",
},
{
Id: 1,
Name: "老师",
}, {
......@@ -323,56 +323,27 @@
],
dataList: [],
loading: true,
selected: [], //全选数据
pMsg: {
rowsPerPage: 1000,
},
msg: {
ClassId: 53,
selectedAll: [], //全选数据
showMsg: {
ClassName: "",
ClassNo: "",
ChangeType: 1,
rowsPerPage: 1000,
},
isShowEdit: false,
//单行修改参数
addMsg: {
ClassPlanId: 0,
ClassId: 0,
ClassDate: "",
ClassDateStr: "",
ClassRoomId: 0,
RoomName: "",
TeacherId: 0,
TeacherName: "",
UserIcon: "",
PlanTimeList: [{
ClassTimeId: 0,
StartTime: "",
EndTime: "",
TimeHour: 0,
}]
},
TeacherList: [], //老师下拉数据
ClassRoomList: [], //教室下拉数据
saveLoading: false,
isShowClassForm: false,
isShowConForm: false,
//选中传入对象
selectObj: {
ClassId: 53,
ChangeType: 1,
selected: []
},
saveClassLoading: false,
//提交参数
postMsg: {
ClassId: 0,
ChangeType: 1, //调动类型(1-老师,2-教室,3-时段)
ChangeType: 0, //调动类型(1-老师,2-教室,3-时段)
ClassPlanIdList: [], //选中的ClassPlanId数组
ClassRoomId: 0, //全局调整--教室编号
TeacherId: 0, //全局调整--教师编号
TimeList: [{
PlanList: [],
ClassRoomId: "", //全局调整--教室编号
TeacherId: "", //全局调整--教师编号
PlanTimeList: [{
StartTime: "", //开始时间
EndTime: "", //结束时间
TimeHour: 0, //消耗课时
......@@ -383,19 +354,15 @@
created() {
this.GetTeacherList();
this.getClassRoomList();
},
computed: {
},
mounted() {
if (this.ClassId) {
this.msg.ClassId = this.ClassId;
this.selectObj.ClassId = this.ClassId;
this.postMsg.ClassId = this.ClassId;
}
this.getList();
},
methods: {
//点击新增
//点击新增上课时间段
addStepOne(item) {
var obj = {
StartTime: "", //开始时间
......@@ -404,27 +371,15 @@
}
item.PlanTimeList.push(obj);
},
//删除
//删除上课时间段
delStepOne(item, index) {
item.PlanTimeList.splice(index, 1);
},
//新增
addStepTwo() {
var obj = {
StartTime: "", //开始时间
EndTime: "", //结束时间
TimeHour: 0, //消耗课时
}
this.postMsg.TimeList.push(obj);
},
//删除
delStepTwo(index) {
this.postMsg.TimeList.splice(index, 1);
},
//获取老师名称
getTeacherName(teacherId) {
let obj = {};
obj = this.TeacherList.find(item => {
return item.TId === teacherId; //筛选出匹配数据
return item.TId === teacherId;
});
var tName = "";
if (obj) {
......@@ -432,10 +387,11 @@
}
return tName;
},
//获取教室名称
getClassRoomName(ClassRoomId) {
let obj = {};
obj = this.ClassRoomList.find(item => {
return item.RoomId === ClassRoomId; //筛选出匹配数据
return item.RoomId === ClassRoomId;
});
var tName = "";
if (obj) {
......@@ -448,29 +404,25 @@
this.$emit('close');
this.persistent = false;
},
//获取冲突的数据列表
getList() {
this.loading = true;
this.dataList = [];
GetRepeatClassPlan(this.msg).then(res => {
this.selectedAll = [];
GetRepeatClassPlan({
ClassId: this.ClassId
}).then(res => {
this.loading = false;
if (res.Code == 1) {
this.dataList = res.Data.RepeatList;
this.msg.ClassNo = res.Data.ClassNo;
this.msg.ClassName = res.Data.ClassName;
this.selected = [];
this.showMsg.ClassNo = res.Data.ClassNo;
this.showMsg.ClassName = res.Data.ClassName;
}
})
},
//编辑修改
getInfo(item) {
getInfo() {
this.isShowEdit = true;
var Obj = JSON.parse(JSON.stringify(item));
this.addMsg.ClassPlanId = Obj.ClassPlanId;
this.addMsg.ClassId = Obj.ClassId;
this.addMsg.ClassDate = Obj.ClassDate;
this.addMsg.ClassRoomId = Obj.ClassRoomId;
this.addMsg.TeacherId = Obj.TeacherId;
this.addMsg.PlanTimeList = Obj.PlanTimeList;
},
//获取教师下拉
GetTeacherList() {
......@@ -488,141 +440,117 @@
}
})
},
//点击新增
addStep() {
var obj = {
ClassTimeId: 0,
StartTime: '',
EndTime: '',
TimeHour: 0
}
this.addMsg.PlanTimeList.push(obj);
},
//删除
delStep(index) {
this.addMsg.PlanTimeList.splice(index, 1);
},
//保存
saveSteps() {
for (let i = 0; i < this.addMsg.PlanTimeList.length; i++) {
if (this.addMsg.PlanTimeList[i].StartTime == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择第${i+1}节课开始时间`
})
return
}
if (this.addMsg.PlanTimeList[i].EndTime == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择第${i+1}节课结束时间`
})
return
}
}
this.saveLoading = true
UpdateClassPlanSingle(this.addMsg).then(res => {
this.saveLoading = false
if (res.Code == 1) {
this.isShowEdit = false;
this.getList();
if (res.Data) {
this.$q.notify({
type: 'negative',
position: "top",
message: `还存在冲突数据请继续修改!`
})
}
}
}).catch(() => {
this.saveLoading = false
})
},
//关闭弹窗
closeClassSaveForm() {
this.isShowClassForm = false;
this.isShowConForm = false;
},
//刷新页面
refreshPage() {
this.isShowClassForm = false;
this.getList();
},
//点击修改教师 老师 时段
getCommonEdit(type) {
if (this.selected.length == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请勾选需要修改的数据!`
})
return
} else {
this.selectObj.selected = [];
this.selectObj.ChangeType = type;
this.selected.forEach(x => {
this.selectObj.selected.push(x.ClassPlanId);
})
this.isShowConForm = true;
}
},
//保存信息
saveClass() {
if (this.postMsg.ChangeType == 1 && this.postMsg.TeacherId == 0) {
if (this.selectedAll.length == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择老师`
message: `请勾选需要修改的数据!`
})
return
}
if (this.postMsg.ChangeType == 2 && this.postMsg.ClassRoomId == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择教室`
this.postMsg.PlanList = [];
this.postMsg.ClassPlanIdList = [];
if (this.postMsg.ChangeType == 0) {
this.selectedAll.forEach(x => {
this.postMsg.PlanList.push(x);
})
} else {
this.selectedAll.forEach(x => {
this.postMsg.ClassPlanIdList.push(x.ClassPlanId);
})
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
if (this.postMsg.ChangeType == 0) {
this.saveLoading = true;
UpdateClassPlanSingle({
PlanList: this.postMsg.PlanList
}).then(res => {
this.saveLoading = false
if (res.Code == 1) {
this.isShowEdit = false;
this.getList();
if (res.Data) {
this.$q.notify({
type: 'negative',
position: "top",
message: `还存在冲突数据请继续修改!`
})
} else {
this.$emit('success');
this.$emit('close');
}
}
}).catch(() => {
this.saveLoading = false
})
} else {
if (this.postMsg.ChangeType == 1 && this.postMsg.TeacherId == 0) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择老师`
})
return
}
}
this.postMsg.ClassPlanIdList = this.saveObj.selected;
this.postMsg.ClassId = this.ClassId;
BatchUpdateClassPlan(this.postMsg).then(res => {
if (res.Code === 1) {
if (this.postMsg.ChangeType == 2 && this.postMsg.ClassRoomId == 0) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
type: 'negative',
position: "top",
message: `请选择教室`
})
this.$emit('success');
this.$emit('close');
} else {
this.Error(res.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.ClassId = this.ClassId;
BatchUpdateClassPlan(this.postMsg).then(res => {
if (res.Code === 1) {
this.getList();
if (res.Data) {
this.$q.notify({
type: 'negative',
position: "top",
message: `还存在冲突数据请继续修改!`
})
} else {
this.$emit('success');
this.$emit('close');
}
} else {
this.Error(res.Message);
}
})
}
},
}
}
......
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