Commit 73c168da authored by 罗超's avatar 罗超

2

parent 4d58c90d
......@@ -9,7 +9,7 @@
>
<q-card style="width: 800px;max-width:900px;">
<q-card-section class="row items-center q-pb-none">
<div class="text-h6">{{ editType == 1 ? "新增" : "详情" }}</div>
<div class="text-h6">{{ editType == 1 ? "新增约课" : "详情" }}</div>
<q-space />
<q-btn icon="close" flat round dense @click="changeDig(false)" />
</q-card-section>
......@@ -20,32 +20,6 @@
<div>{{ dateObj.date }}</div>
</template>
</q-field>
<q-select
filled
stack-label
use-input
option-value="CourseId"
option-label="CourseName"
v-model="teaClassMsg.CourseId"
ref="CourseId"
:options="CourseList"
label="课程"
:dense="false"
class="col-12"
emit-value
map-options
@filter="filterCourse"
@input="getCanTeacherTimeList(), getChapterTree(), changeCourse()"
v-if="editType == 1"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
<!-- 详情显示内容 start-->
<q-field
filled
......@@ -155,6 +129,14 @@
<span v-if="saveObj.AppointState == 1">待确认</span
><span v-if="saveObj.AppointState == 2">已确认</span>
</div>
<q-btn
color="accent"
size="xs"
label="确认"
v-if="saveObj.AppointState == 1"
@click="confirmSub"
class="q-ml-md"
/>
</template>
</q-field>
<q-field
......@@ -194,7 +176,7 @@
size="xs"
label="取消预约"
@click="cancelSub()"
:disable="checkStuType2.length==0"
:disable="checkStuType2.length == 0"
/>
</div>
......@@ -227,6 +209,32 @@
</template>
</q-field>
<!-- 详情显示内容 end -->
<q-select
filled
stack-label
use-input
option-value="CourseId"
option-label="CourseName"
v-model="teaClassMsg.CourseId"
ref="CourseId"
:options="CourseList"
label="课程"
:dense="false"
class="col-12"
emit-value
map-options
@filter="filterCourse"
@input="getCanTeacherTimeList(), getChapterTree(), changeCourse()"
v-if="editType == 1"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
<select-tree
v-show="teaClassMsg.CourseId > 0 && editType == 1"
:treeData="chapterList"
......@@ -304,73 +312,44 @@
</template>
</q-field>
<div
class="col-12"
v-show="editType == 1 || saveObj.ClassType == 3"
class="row col"
v-show="(editType == 1 || saveObj.ClassType == 3)&&showAddStu()"
>
<q-select
filled
stack-label
use-input
option-value="StuId"
option-label="StuName"
v-model="stuInfo"
ref="CourseId"
:options="stuList"
label="选择学员"
:dense="false"
class="col-6"
@filter="filterStu"
@input="addStu"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
<div style="height:1px;background-color:#111"></div>
<q-field filled label="学员列表" stack-label class="col-12">
<template v-slot:control>
<div class="q-gutter-sm">
<div
v-for="(item, index) in checkStuList"
:key="index"
class="q-my-sm"
>
<div class="row">
<span>
{{ item.StuName }}
</span>
<span> 当前课章节:{{ item.CourseChapterNo }}</span>
<span> 下次课章节:{{ item.NextChapterNo }}</span>
<span> 已约次数:{{ item.AppointNum }}</span>
<span v-if="item.AppointDate">
已约至:{{ item.AppointDate }}
</span>
<div>
<q-btn
size="xs"
color="accent"
label="添加"
@click="subscribeCourse(item)"
class="q-mr-md"
/>
<q-btn
size="xs"
color="accent"
label="取消"
@click="cancelStu(item, index)"
/>
</div>
</div>
</div>
</div>
</template>
</q-field>
<div class="col-10">
<q-select
filled
stack-label
use-input
option-value="StuId"
option-label="StuName"
v-model="stuInfo"
ref="CourseId"
:options="stuList"
label="添加学员"
:dense="false"
class="col-6"
@filter="filterStu"
@input="addStu"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-2 q-pt-md">
<q-btn
size="sm"
color="accent"
label="添加"
@click="subscribeCourse"
class="q-ml-md"
:disable="!stuInfo.StuId || stuInfo.StuId <= 0"
/>
</div>
</div>
</div>
</q-card-section>
......@@ -394,7 +373,8 @@ import {
GetCanTeacherClassTimeList,
GetCanAppointmentStuList,
SetAdminScrollAppointment,
CancelAppointment
CancelAppointment,
SetSureAppointment
} from "../../../api/studyabroad/subscribe.js";
import {
queryCourseDropdownList,
......@@ -435,6 +415,7 @@ export default {
watch: {
saveObj: {
handler(val) {
this.stuInfo = "";
if (this.editType == 2 && val.ClassType == 3) {
this.getStu();
}
......@@ -479,7 +460,7 @@ export default {
chapterList: [], //章节列表,
checkChapter: {}, //选择的章节
returnString: [], //章节默认值
checkStuType2: [] //
checkStuType2: [], //
};
},
mounted() {
......@@ -562,36 +543,7 @@ export default {
});
},
addStu() {
if (this.stuInfo) {
this.checkStuList.push(this.stuInfo);
this.stuList.forEach(e => {
this.checkStuList.map(_e => {
if (e.StuId == _e.StuId) {
e.disable = true;
}
});
});
this.allStuList.forEach(e => {
this.checkStuList.map(_e => {
if (e.StuId == _e.StuId) {
e.disable = true;
}
});
});
}
},
cancelStu(item, index) {
this.checkStuList.splice(index, 1);
this.stuList.forEach(e => {
if (e.StuId == item.StuId) {
e.disable = false;
}
});
this.allStuList.forEach(e => {
if (e.StuId == item.StuId) {
e.disable = false;
}
});
console.log(535, this.stuInfo);
},
//获取章节
getChapterTree() {
......@@ -628,31 +580,32 @@ export default {
this.getStu();
}
},
subscribeCourse(stuInfo) {
subscribeCourse() {
if (
new Date(this.dateObj.date).getTime() <
new Date(QCalendar.today()).getTime()
) {
this.$q.notify({
message: `日期小于今天请重新选择日期`,
message: `日期小于今天,请重新选择日期`,
position: "top",
type: "negative"
});
return;
}
if (stuInfo.Date) {
if (this.stuInfo.AppointDate) {
if (
new Date(this.dateObj.date).getTime() <
new Date(stuInfo.Date).getTime()
new Date(this.stuInfo.AppointDate).getTime()
) {
this.$q.notify({
message: `${stuInfo.StuName},不能预约${stuInfo.Date}之前的日期`,
message: `${this.stuInfo.StuName},不能预约${this.stuInfo.AppointDate}之前的日期`,
position: "top",
type: "negative"
});
return;
}
}
if (this.editType == 1) {
if (this.courseCheckList.length === 0) {
this.$q.notify({
......@@ -690,13 +643,10 @@ export default {
}
}
}
}
if (this.editType == 1) {
this.saveMsg.Date = this.dateObj.date;
this.saveMsg.StuId = stuInfo.StuId;
this.saveMsg.StuName = stuInfo.StuName;
this.saveMsg.GuestId = stuInfo.GuestId;
this.saveMsg.StuId = this.stuInfo.StuId;
this.saveMsg.StuName = this.stuInfo.StuName;
this.saveMsg.GuestId = this.stuInfo.GuestId;
this.saveMsg.CourseId = this.teaClassMsg.CourseId;
this.saveMsg.TeacherId = this.teaClassMsg.TeacherId;
this.saveMsg.ChapterNo = this.checkChapter.ChapterNo;
......@@ -704,9 +654,9 @@ export default {
this.saveMsg.ShiftSort = newCourseCheckList.map(e => e.Sort).toString();
} else if (this.editType == 2) {
this.saveMsg.Date = this.dateObj.date;
this.saveMsg.StuId = stuInfo.StuId;
this.saveMsg.StuName = stuInfo.StuName;
this.saveMsg.GuestId = stuInfo.GuestId;
this.saveMsg.StuId = this.stuInfo.StuId;
this.saveMsg.StuName = this.stuInfo.StuName;
this.saveMsg.GuestId = this.stuInfo.GuestId;
this.saveMsg.CourseId = 0;
this.saveMsg.TeacherId = this.saveObj.Tid;
this.saveMsg.ChapterNo = this.saveObj.Ranks;
......@@ -717,14 +667,23 @@ export default {
console.log(447, this.saveMsg);
SetAdminScrollAppointment(this.saveMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
message: "预约成功",
position: "top"
});
this.getStu();
if (this.editType == 2) {
this.changeDig(false);
}
this.stuInfo = "";
this.$q
.dialog({
title: "预约成功",
message: "是否继续预约?",
cancel: "否",
ok: "是",
persistent: true
})
.onOk(() => {
// console.log(">>>> OK");
})
.onCancel(() => {
// console.log(">>>> Cancel");
this.changeDig(false);
});
this.$emit("success");
}
});
......@@ -746,6 +705,42 @@ export default {
this.$emit("success");
}
});
},
//确认约课
confirmSub() {
if (this.saveObj.EnrollNum < this.saveObj.ScrollMinNum) {
this.$q.notify({
message: `最小开班人数为${this.saveObj.ScrollMinNum}`,
position: "top",
type: "negative"
});
return;
}
const msg = {
Date: this.dateObj.date,
TeacherId: this.saveObj.Tid,
ShiftSort: this.saveObj.ShiftSort
};
SetSureAppointment(msg).then(res => {
if (res.Code == 1) {
this.$q.notify({
message: "操作成功",
position: "top",
type: "positive"
});
this.$emit("success");
}
});
},
showAddStu() {
if (
new Date(this.dateObj.date).getTime() <
new Date(QCalendar.today()).getTime()
) {
return false;
}else{
return true
}
}
}
};
......
......@@ -67,6 +67,7 @@
placeholder="开始日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
@change="getData"
>
</el-date-picker>
</template>
......@@ -128,7 +129,7 @@
@click:interval:header2="onClickIntervalHeader2"
>
<template #day-header="{ timestamp }">
<div class="justify-center items-center ">
<div class="justify-center items-center " v-if="viewType == 'week'">
<q-badge
:color="item.bg"
:label="item.TeacherName"
......@@ -137,13 +138,21 @@
class="q-mr-xs"
/>
</div>
<div class="justify-center items-center " v-if="viewType == 'day'">
<q-badge
:color="item.bg"
:label="item.TeacherName"
v-for="(item, index) in legendList"
:key="index"
style="height:20px"
:style="{ width: `${(1 / legendList.length) * 100}%` }"
/>
</div>
</template>
<template #day-body="{ timestamp, timeStartPos, timeDurationHeight }">
<div v-for="(item, index) in events" :key="index">
{{ item.ClassDate }}
<div v-if="item.ClassDate == timestamp.date">
{{ item.ClassDate }}
<div v-for="(_item, _index) in item.RList" :key="_index">
<div
v-for="(__item, __index) in _item.SubList"
......@@ -160,28 +169,101 @@
item.RList.length
)
"
@click.stop="showDetail(__item, item.ClassDate,_item.TeacherId)"
@click.stop="
showDetail(__item, item.ClassDate, _item.TeacherId)
"
>
<div v-if="viewType == 'day' || item.RList.length == 1">
<div class="itemRow">{{ _item.TeacherName }}</div>
<div class="itemRow">{{ __item.CourseName }}</div>
<div>班级:{{ __item.ClassName }}</div>
<div>{{ __item.StartTime }}-{{ __item.EndTime }}</div>
<div>类型:{{ __item.ClassType }}</div>
<div>
进度:{{
__item.TotalPlanNum < 0 ? 0 : __item.TotalPlanNum
}}%
</div>
<div>学员名单:{{ __item.GuestList }}</div>
</div>
<el-popover
placement="top-start"
width="200"
trigger="hover"
v-if="viewType == 'week' && item.RList.length > 1"
>
<div slot="reference" style="height:100vh"></div>
<div slot="reference" style="height:100vh">
<div
v-if="viewType == 'day' || item.RList.length == 1"
class="q-pa-xs"
>
<div class="flex">
<span class="detailLabel">老师:</span
><span>{{ _item.TeacherName }}</span>
</div>
<div class="flex">
<span class="detailLabel">教室:</span
>{{ __item.RoomName }}
</div>
<div class="row flex no-wrap">
<span class="detailLabel">课程:</span
><span style="flex-grow:1">{{
__item.CourseName
}}</span>
</div>
<div class="flex no-wrap">
<span class="detailLabel">班级:</span
><span>{{ __item.ClassName }}</span>
</div>
<div class="flex no-wrap">
<span class="detailLabel">时间:</span
><span
>{{ __item.StartTime }}-{{ __item.EndTime }}</span
>
</div>
<div class="flex no-wrap">
<span class="detailLabel">
类型:<span></span
><span v-if="__item.ClassType == 1">跟班</span
><span v-if="__item.ClassType == 2">试听课</span
><span v-if="__item.ClassType == 3">约课</span></span
>
</div>
<div class="flex no-wrap">
<span class="detailLabel">进度:</span
><span
>{{
__item.CompleteProgress > 0
? __item.CompleteProgress
: 0
}}%</span
>
</div>
<div class="flex no-wrap">
<span class="detailLabel">学员:</span
><span>{{
__item.GuestList.map(e => e.GuestName).toString()
}}</span>
</div>
<div class="flex no-wrap" v-if="__item.ClassType == 3">
<span class="detailLabel">
预约状态:<span></span
><span v-if="__item.AppointState == 1">待确认</span
><span v-if="__item.AppointState == 2">已确认</span>
<q-btn
color="accent"
size="xs"
label="确认"
v-if="__item.AppointState == 1"
@click="
confirmSub(
item.ClassDate,
_item.TeacherId,
__item
)
"
/>
</span>
</div>
<div class="flex no-wrap" v-if="__item.ClassType == 3">
<span class="">最小成班人数:</span
><span>{{ __item.ScrollMinNum }}</span>
</div>
<div class="flex no-wrap" v-if="__item.ClassType == 3">
<span class="">最大成班人数:</span
><span>{{ __item.ScrollMaxNum }}</span>
</div>
<div></div>
</div>
</div>
<div>
<div class="flex">
<span class="detailLabel">老师:</span
......@@ -214,7 +296,13 @@
<div class="flex no-wrap">
<span class="detailLabel">进度:</span
><span>{{ __item.CompleteProgress>0?__item.CompleteProgress:0 }}%</span>
><span
>{{
__item.CompleteProgress > 0
? __item.CompleteProgress
: 0
}}%</span
>
</div>
<div class="flex no-wrap">
<span class="detailLabel">学员:</span
......@@ -261,7 +349,7 @@
:dateObj="dateObj"
:saveObj="saveObj"
:teacherList="TeacherList2"
@success="saveObj={},getData"
@success="successHandle"
/>
</div>
</template>
......@@ -471,7 +559,6 @@ export default {
getData() {
GetAppointmentPlanStat(this.msg).then(res => {
this.events = res.Data;
console.log(498, this.events);
});
},
calcGap(s, e) {
......@@ -514,13 +601,13 @@ export default {
onClickIntervalHeader2(data) {
console.log(6, data);
},
showDetail(data, date,tid) {
showDetail(data, date, tid) {
console.log(7, data);
this.showForm = true;
this.editType = 2;
this.dateObj.date = date;
this.saveObj = data;
this.saveObj.Tid=tid
this.saveObj.Tid = tid;
},
confirmSub(date, id, item) {
if (item.EnrollNum < item.ScrollMinNum) {
......@@ -543,9 +630,13 @@ export default {
position: "top",
type: "positive"
});
this.getData()
this.getData();
}
});
},
successHandle() {
this.saveObj = {};
this.getData();
}
}
};
......
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