wkyy 1 year ago
parent
commit
5b31e12ba2

+ 60 - 0
apis/teacher/makeUpAttendance.js

@@ -0,0 +1,60 @@
+import requestTeacher from '@/apis/utils/request.js';
+import Qs from 'qs';
+
+export function remove(id) {
+	var url='/mobile/supplementaryRecord/delete/' + id;
+	return requestTeacher({
+		method: 'post',
+		url: url,
+		header: {
+			'Content-Type': 'application/json'
+		}
+	})
+}
+
+export function edit(id) {
+	var url='/mobile/supplementaryRecord/edit/' + id;
+	return requestTeacher({
+		method: 'get',
+		url: url,
+		header: {
+			'Content-Type': 'application/json'
+		}
+	})
+}
+
+export function pageList(data) {
+	var url='/mobile/supplementaryRecord/pageList';
+	return requestTeacher({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+export function supplementaryUpdate(data) {
+	var url='/mobile/teacher/supplementaryUpdate';
+	return requestTeacher({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+export function supplementaryPageList(data) {
+	var url='/mobile/teacher/supplementaryPageList';
+	return requestTeacher({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+export function supplementary(data) {
+	var url='/mobile/teacher/supplementary';
+	return requestTeacher({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}

+ 181 - 10
pages/teacher/makeUpAttendance/addModifyRecords.vue

@@ -15,6 +15,32 @@
 					</text>
 				</view>
 			</view>
+			<view class="item" @click="timeShow(true)">
+				<view class="title">
+					<text class="asterisk">*</text>
+					<text>选择开始时间</text>
+				</view>
+				<view class="value">
+					<text v-if="startTime">{{startTime}}</text>
+					<text style="color: #777777;" v-else>请选择开始时间</text>
+					<text class="icon">
+						<u-icon name="arrow-right" color="#c8c8c8"></u-icon>
+					</text>
+				</view>
+			</view>
+			<view class="item" @click="timeShow(false)">
+				<view class="title">
+					<text class="asterisk">*</text>
+					<text>选择结束时间</text>
+				</view>
+				<view class="value">
+					<text v-if="endTime">{{endTime}}</text>
+					<text style="color: #777777;" v-else>请选择结束时间</text>
+					<text class="icon">
+						<u-icon name="arrow-right" color="#c8c8c8"></u-icon>
+					</text>
+				</view>
+			</view>
 			<view class="item" @click="cshow = true">
 				<view class="title">
 					<text class="asterisk">*</text>
@@ -37,7 +63,7 @@
 					<text v-if="studentContent.length > 2">
 						{{studentContent[0]}},{{studentContent[1]}}等{{studentContent.length}}位学生
 					</text>
-					<text v-else-if="studentContent.length>0 && studentContent.length<2">
+					<text v-else-if="studentContent.length>0 && studentContent.length<3">
 						{{studentContent.join(',')}}
 					</text>
 					<text style="color: #777777;" v-else>可多选</text>
@@ -57,8 +83,13 @@
 		</view>
 
 		<!-- 选择日期 -->
-		<u-picker mode="time" :defaultTime="defaultTime" v-model="show" :params="params" @confirm="confirm"></u-picker>
+		<u-picker mode="time" :defaultTime="defaultTime" v-model="show" :params="params" @confirm="confirm">
+		</u-picker>
 
+		<!-- 选择时间 -->
+		<u-picker mode="time" :defaultTime="tdefaultTime" v-model="tshow" :params="tparams" @confirm="tconfirm">
+		</u-picker>
+		
 		<!-- 选择班级 -->
 		<u-select v-model="cshow" mode="single-column" :list="classList" @confirm="classConfirm"></u-select>
 
@@ -117,6 +148,7 @@
 
 <script>
 	import * as myClassApi from '@/apis/teacher/myClass.js'
+	import * as makeUpAttendanceApi from '@/apis/teacher/makeUpAttendance.js'
 
 	export default {
 		data() {
@@ -130,7 +162,7 @@
 				params: {
 					year: true,
 					month: true,
-					day: false,
+					day: true,
 					hour: false,
 					minute: false,
 					second: false
@@ -144,15 +176,35 @@
 				queryName: '',
 				popShow: false,
 				studentList: [],
+				startTime: '',
+				endTime: '',
+				tparams: {
+					year: false,
+					month: false,
+					day: false,
+					hour: true,
+					minute: true,
+					second: false
+				},
+				tshow: false,
+				tdefaultTime: '',
+				tLogic: '',
+				coursePeriods: '',
+				studentIds: '',
+				studentIdList: []
 			}
 		},
 		onLoad(op) {
 			if (op.id) {
 				this.recordId = op.id;
+				this.classId = op.classId;
 				this.recordTitle = '修改';
+				this.getEdit(op.id);
 			} else {
 				this.recordTitle = '新增';
 			}
+			
+			this.getLoadMyClass();
 		},
 		onReady() {
 			var date = new Date();
@@ -161,12 +213,53 @@
 			if (month >= 1 && month <= 9) {
 				month = '0' + month;
 			}
-			this.defaultTime = year + '-' + month;
-			this.signTime = this.defaultTime;
-
-			this.getLoadMyClass();
+			var day = date.getDate();
+			if (day >= 1 && day <= 9) {
+				day = '0' + day;
+			}
+			this.defaultTime = year + '-' + month + '-' + day;
 		},
 		methods: {
+			getEdit(id) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				makeUpAttendanceApi.edit(id).then((res) => {
+					uni.hideLoading();
+					this.signTime = res.data.courseDate;
+					this.startTime = res.data.coursePeriods.slice(0,5);
+					this.endTime = res.data.coursePeriods.slice(-5);
+					this.className = res.data.className;
+					this.studentIdList = res.data.studentList;
+					
+					this.getLoadClassStudents();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			tconfirm(params) {
+				if(this.tLogic) {
+					this.startTime = params.hour + ':' + params.minute;
+				} else {
+					this.endTime = params.hour + ':' + params.minute;
+				}
+				this.coursePeriods = this.startTime + '-' + this.endTime;
+				this.tshow = false;
+			},
+			timeShow(val) {
+				if(val) {
+					this.tdefaultTime = '08:00';
+				} else {
+					this.tdefaultTime = '12:00';
+				}
+				
+				this.tLogic = val;
+				this.tshow = true;
+			},
 			addStudent() {
 				if(this.studentContent != 0) {
 					this.popShow = false;
@@ -200,7 +293,7 @@
 				this.popShow = true;
 			},
 			confirm(params) {
-				this.signTime = params.year + '-' + params.month;
+				this.signTime = params.year + '-' + params.month + '-' + params.day;
 			},
 			classConfirm(e) {
 				this.classId = e[0].value;
@@ -224,6 +317,20 @@
 						list[i][key] = value;
 					}
 					this.studentList = list;
+					
+					if(this.studentIdList.length != 0) {
+						var studentContentList = [];
+						for (var m = 0; m < this.studentIdList.length; m++) {
+							for (var n = 0; n < this.studentList.length; n++) {
+								if(this.studentIdList[m] == this.studentList[n].studentId) {
+									this.studentList[n].checked = true;
+									studentContentList.push(this.studentList[n].studentName);
+								}
+							}
+						}
+						
+						this.studentContent = studentContentList;
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -254,11 +361,75 @@
 					})
 				})
 			},
+			getSupplementary() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				makeUpAttendanceApi.supplementary({
+					classId: this.classId,
+					courseDate: this.signTime,
+					coursePeriods: this.coursePeriods,
+					rollcallResult: '1',
+					studentIds: this.studentIds
+				}).then((res) => {
+					uni.hideLoading();
+					uni.navigateBack();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getSupplementaryUpdate() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				makeUpAttendanceApi.supplementaryUpdate({
+					supplementaryRecordId: this.recordId,
+					rollcallResult: '1',
+					studentIds: this.studentIds
+				}).then((res) => {
+					uni.hideLoading();
+					uni.navigateBack();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			save() {
-
+				var list = [];
+				for (var i = 0; i < this.studentList.length; i++) {
+					if(this.studentList[i].checked){
+						list.push(this.studentList[i].studentId);
+					}
+				}
+				this.studentIds = list.join(',')
+				
+				if(!this.recordId) {
+					this.getSupplementary();
+				} else {
+					this.getSupplementaryUpdate();
+				}
 			},
 			revoke() {
-
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				makeUpAttendanceApi.remove(this.recordId).then((res) => {
+					uni.hideLoading();
+					uni.navigateBack();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 		}
 	}

+ 71 - 44
pages/teacher/makeUpAttendance/record.vue

@@ -11,7 +11,7 @@
 				</view>
 			</view>
 			<u-picker mode="time" :defaultTime="defaultTime" v-model="show" :params="params" @confirm="confirm"></u-picker>
-			
+
 			<view class="course" @click="cshow = true">
 				<view class="text">
 					{{className}}
@@ -23,64 +23,34 @@
 			<u-select v-model="cshow" mode="single-column" :list="classList" @confirm="classConfirm"></u-select>
 		</view>
 		<view class="record">
-			<view class="record-card">
+			<view class="record-card" v-for="(item, index) in recordList" :key="index" @click="toModifyRecords(item)">
 				<view class="title-time">
 					<view class="title">
-						芭蕾舞新生班
+						{{item.className}}
 					</view>
 					<view class="time">
-						2023-01-05 08:30-10:00
+						{{item.courseDate}}
 					</view>
 				</view>
-
 				<view class="condition">
-					到课
-				</view>
-
-			</view>
-			<view class="record-card">
-				<view class="title-time">
-					<view class="title">
-						芭蕾舞新生班
-					</view>
-					<view class="time">
-						2023-01-05 08:30-10:00
-					</view>
-				</view>
-
-				<view class="condition leave">
-					请假
-				</view>
-
-			</view>
-			<view class="record-card">
-				<view class="title-time">
-					<view class="title">
-						芭蕾舞新生班
-					</view>
-					<view class="time">
-						2023-01-05 08:30-10:00
-					</view>
+					{{item.studentMessage}}
 				</view>
-
-				<view class="condition truant">
-					旷课
-				</view>
-
 			</view>
-			<u-divider>没有更多数据了</u-divider>
 		</view>
+		<u-divider v-if="recordList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">
+			没有更多数据了</u-divider>
 
 		<!-- 底部 -->
 		<view class="btn">
-			<button @click="toAddModifyRecords">新增补课记录</button>
+			<button @click="toAddRecords">新增补课记录</button>
 		</view>
 	</view>
 </template>
 
 <script>
 	import * as myClassApi from '@/apis/teacher/myClass.js'
-	
+	import * as makeUpAttendanceApi from '@/apis/teacher/makeUpAttendance.js'
+
 	export default {
 		data() {
 			return {
@@ -99,6 +69,10 @@
 				classList: [],
 				classId: '',
 				className: '全部课程',
+				recordList: [],
+				pageIndex: 1,
+				pageSize: 10,
+				recordsTotal: 0
 			}
 		},
 		onLoad() {
@@ -110,11 +84,53 @@
 			}
 			this.defaultTime = year + '-' + month;
 			this.signTime = this.defaultTime;
+
+			this.getLoadMyClass();
 		},
 		onReady() {
-			this.getLoadMyClass();
+
+		},
+		onShow() {
+			this.getSupplementaryPageList(true);
+		},
+		onReachBottom() {
+			if (this.recordList.length < this.recordsTotal) {
+				this.myLoadmore();
+			}
 		},
 		methods: {
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getSupplementaryPageList()
+			},
+			getSupplementaryPageList(bl) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				if (bl) {
+					this.recordList = [];
+					this.pageIndex = 1;
+				}
+				makeUpAttendanceApi.pageList({
+					yearMonth: this.signTime,
+					classId: this.classId,
+					pageIndex: this.pageIndex,
+					pageSize: this.pageSize
+				}).then((res) => {
+					uni.hideLoading();
+					this.recordList = [
+						...this.recordList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			getLoadMyClass() {
 				uni.showLoading({
 					title: "加载中",
@@ -145,15 +161,26 @@
 			classConfirm(e) {
 				this.classId = e[0].value;
 				this.className = e[0].label;
+
+				this.getSupplementaryPageList(true);
 			},
 			confirm(params) {
 				this.signTime = params.year + '-' + params.month;
+
+				this.getSupplementaryPageList(true);
 			},
-			toAddModifyRecords() {
+			toAddRecords() {
 				uni.navigateTo({
 					url: '/pages/teacher/makeUpAttendance/addModifyRecords'
 				})
 			},
+			toModifyRecords(item) {
+				uni.navigateTo({
+					url: '/pages/teacher/makeUpAttendance/addModifyRecords?id=' + item.id
+
+						+ '&classId=' + item.classId
+				})
+			},
 		}
 	}
 </script>
@@ -167,7 +194,7 @@
 		bottom: 0;
 		padding: 10px 12px;
 		background-color: #fff;
-	
+
 		button {
 			border-radius: 50px;
 			background-color: rgba(13, 186, 199, 1);
@@ -239,7 +266,7 @@
 			}
 
 			.condition {
-				color: #0DBAC7;
+				// color: #0DBAC7;
 				font-size: 16px;
 				display: flex;
 				align-items: center;