wkyy 2 gadi atpakaļ
vecāks
revīzija
eb6c169fad

+ 18 - 0
apis/parents/sickNote.js

@@ -1,6 +1,24 @@
 import requestStudent from '@/apis/utils/request.js';
 import Qs from 'qs';
 
+export function cancelStudentLeaveLog(data) {
+	var url='/mobile/student/cancelStudentLeaveLog';
+	return requestStudent({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
+export function getStudentLeaveLog(data) {
+	var url='/mobile/student/getStudentLeaveLog';
+	return requestStudent({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
 export function addLeave(data) {
 	var url='/mobile/student/addLeave';
 	return requestStudent({

+ 2 - 2
pages/parents/classSchedule/classScheduleDetails.vue

@@ -93,10 +93,10 @@
 							hour = '0' + hour;
 						}
 						if(minute < 10) {
-							minute = '0' + hour;
+							minute = '0' + minute;
 						}
 						if(second < 10) {
-							second = '0' + hour;
+							second = '0' + second;
 						}
 						this.rollcallLogs.rollcallTime = hour + ':' + minute + ':' + second;
 					}

+ 14 - 5
pages/parents/mine/addChildInformation.vue

@@ -47,9 +47,11 @@
 			
 		</view>
 		
+		<u-alert-tips :show-icon="true" type="warning" :title="title" :description="description"
+			:show="alertShow"></u-alert-tips>
+		
 		<button class="submit" @click="submit"> 提交</button>
 		<button class="delete" v-if="form.studentId" @click="deleteStudent"> 删除</button>
-		
 	</view>
 </template>
 
@@ -59,6 +61,9 @@
 	export default {
 		data() {
 			return {
+				alertShow: false,
+				title: '',
+				description: '',
 				form: {
 					studentId: '',
 					studentName: '',
@@ -165,14 +170,18 @@
 					headPhoto: this.form.headPhoto
 				}).then((response) => {
 					uni.hideLoading();
+					this.alertShow = false;
 					uni.navigateBack({
 						
 					})
 				}).catch(error => {
-					uni.showToast({
-						title: error,
-						icon: "none"
-					})
+					uni.hideLoading();
+					this.alertShow = true;
+					this.description = error+','+'例如:填写姓名时可用‘姓名+您的电话’的形式';
+					// uni.showToast({
+					// 	title: error,
+					// 	icon: "none"
+					// })
 				})
 			},
 			getUpdateStudent() {

+ 106 - 27
pages/parents/sickNote/leave.vue

@@ -8,7 +8,8 @@
 					<text>所属班级</text>
 				</view>
 				<view class="value">
-					<text>{{className}}</text>
+					<text v-if="className">{{className}}</text>
+					<text style="color: #777777;" v-else>请选择班级</text>
 					<text class="icon">
 						<u-icon name="arrow-right" color="#c8c8c8"></u-icon>
 					</text>
@@ -22,7 +23,8 @@
 					<text>请假课次日期</text>
 				</view>
 				<view class="value">
-					<text>2023-01-03 周一</text>
+					<text v-if="leaveDate">{{leaveDate}}</text>
+					<text style="color: #777777;" v-else>请选择请假课次日期</text>
 					<text class="icon">
 						<u-icon name="arrow-right" color="#c8c8c8"></u-icon>
 					</text>
@@ -66,7 +68,7 @@
 					<text>请假事由</text>
 				</view>
 				<view class="value">
-					<textarea name="" id="" cols="30" rows="10" placeholder="请假申请"></textarea>
+					<textarea v-model="leaveReason" name="" id="" cols="30" rows="10" placeholder="请假申请"></textarea>
 				</view>
 			</view>
 			<!-- <view class="upload-pictures">
@@ -80,7 +82,7 @@
 		</view>
 
 		<view class="btn">
-			<button>提交请假条</button>
+			<button @click="leaveSubmit">提交请假条</button>
 		</view>
 	</view>
 </template>
@@ -96,23 +98,82 @@
 				studentId: '',
 				classList: [],
 				classShow: false,
-				teacherName: '请选择班级',
-				className: '请选择班级',
+				teacherName: '',
+				className: '',
 				courseList: [],
 				classId: '',
 				list: [],
-				courseShow: false
+				courseShow: false,
+				leaveDate: '',
+				sheetId: '',
+				leaveReason: '',
+				startDate: '',
+				endDate: ''
 			}
 		},
 		onReady() {
+			let myDate = new Date();
+			let myDate2 = new Date();
+			myDate2.setMonth(myDate2.getMonth() + 1);
+			this.startDate = this.getData(myDate);
+			this.endDate = this.getData(myDate2);
+			
 			if (this.carhelp.getStudentId()) {
 				this.studentId = this.carhelp.getStudentId().studentId;
 				this.getLoadMyBuyLog();
 			}
 		},
 		methods: {
+			getData(val) {
+				var n = new Date(val);
+				return n.toLocaleDateString().replace(/\//g, '-');
+			},
+			leaveSubmit() {
+				if(!this.className) {
+					uni.showToast({
+						title: "请选择班级",
+						icon: "none"
+					})
+					return;
+				}
+				if(!this.leaveDate) {
+					uni.showToast({
+						title: "请选择请假课次日期",
+						icon: "none"
+					})
+					return
+				}
+				if(!this.leaveReason) {
+					uni.showToast({
+						title: "请填写请假事由",
+						icon: "none"
+					})
+					return
+				}
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				sickNoteApi.addLeave({
+					studentId: this.studentId,
+					scheduleId: this.sheetId,
+					leaveReason: this.leaveReason
+				}).then((res) => {
+					uni.hideLoading();
+					uni.navigateBack({
+						
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			courseConfirm(e) {
-				console.log(e)
+				this.leaveDate = e[0].label + ' ' + e[1].label;
+				this.sheetId = e[1].value;
 			},
 			getCourseList() {
 				this.courseList = [];
@@ -123,8 +184,8 @@
 				classScheduleApi.loadMySchedule({
 					studentId: this.studentId,
 					classId: this.classId,
-					startDate: '2023-02-24',
-					endDate: '2023-03-31'
+					startDate: this.startDate,
+					endDate: this.endDate
 				}).then((response) => {
 					uni.hideLoading();
 					var list = response.data;
@@ -135,27 +196,42 @@
 							label: list[i].courseDate,
 							children: []
 						})
-						for (var j = 0; j < this.courseList.length; j++) {
-							if(this.courseList[j].label == list[i].courseDate) {
-								this.courseList[j].children.push({
-									value: list[i].sheetId,
-									label: list[i].coursePeriods
-								})
-							}
-						}
 					}
 					
-					for (var i = 0; i < this.courseList.length; i++) {
-						for (var j = 0; j < this.courseList.length; j++) {
-							if(this.courseList[i].label == this.courseList[j].label && i != j) {
-								if(this.courseList[i].children.length > this.courseList[j].children.length) {
-									this.courseList.splice(j, 1);
+					for (var j = 0; j < list.length; j++) {
+						for (var k = 0; k < this.courseList.length; k++) {
+							if(this.courseList[k].label == list[j].courseDate) {
+								if(this.courseList[k].children.length == 1) {
+									var time1 = parseInt(this.courseList[k].children[0].label.slice(0,2));
+									var time2 = parseInt(list[j].coursePeriods.slice(0,2));
+									if(time1 > time2) {
+										this.courseList[k].children.unshift({
+											value: list[j].sheetId,
+											label: list[j].coursePeriods
+										})
+									} else {
+										this.courseList[k].children.push({
+											value: list[j].sheetId,
+											label: list[j].coursePeriods
+										})
+									}
 								} else {
-									this.courseList.splice(i, 1);
+									this.courseList[k].children.push({
+										value: list[j].sheetId,
+										label: list[j].coursePeriods
+									})
 								}
 							}
 						}
 					}
+					
+					for (var m = 0; m < this.courseList.length; m++) {
+						for (var n = 0; n < this.courseList.length; n++) {
+							if(this.courseList[m].label == this.courseList[n].label && m != n) {
+								this.courseList.splice(n, 1);
+							}
+						}
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -207,6 +283,9 @@
 </script>
 
 <style lang="scss" scoped>
+	.asterisk {
+		color: rgba(244, 68, 68, 1);
+	}
 	.infos {
 		padding: 0px 15px;
 		background-color: #fff;
@@ -221,9 +300,9 @@
 			.title {
 				color: #333333;
 
-				.asterisk {
-					color: rgba(244, 68, 68, 1);
-				}
+				// .asterisk {
+				// 	color: rgba(244, 68, 68, 1);
+				// }
 			}
 
 			.value {

+ 202 - 69
pages/parents/sickNote/leaveDetails.vue

@@ -3,25 +3,31 @@
 		<u-navbar title="请假条详情"></u-navbar>
 		<view class="head">
 			<view class="photo">
-				<img src="../../../assets/img/photo2.png" alt="">
+				<u-avatar class="avatar" mode="square"
+					:src="leaveDetail.headPhoto != null ? leaveDetail.headPhoto : '../../assets/img/head.png'" size="84">
+				</u-avatar>
 			</view>
 			<view class="title">
-				周梓轩的请假条
+				{{leaveDetail.studentName}}的请假条
 			</view>
-			<view class="state">
-				待查收
+			<view class="state1" v-if="leaveDetail.status == 0">
+				待处理
+			</view>
+			<view class="state2" v-if="leaveDetail.status == 1">
+				已审核
+			</view>
+			<view class="state3" v-if="leaveDetail.status == -1">
+				已取消
 			</view>
-			
 		</view>
-		
-		
+
 		<view class="main">
 			<view class="item">
 				<view class="title">
 					所属班级
 				</view>
 				<view class="value">
-					郭健康毛笔楷书班
+					{{leaveDetail.className}}
 				</view>
 			</view>
 			<view class="item">
@@ -29,7 +35,7 @@
 					请假日期
 				</view>
 				<view class="value">
-					2023-01-03
+					{{leaveDetail.courseDate}}
 				</view>
 			</view>
 			<view class="item">
@@ -37,7 +43,7 @@
 					请假课次
 				</view>
 				<view class="value">
-					第20节
+					{{leaveDetail.coursePeriods}}
 				</view>
 			</view>
 			<view class="item">
@@ -45,7 +51,7 @@
 					授课老师
 				</view>
 				<view class="value">
-					郭健康
+					{{leaveDetail.teacherName}}
 				</view>
 			</view>
 			<view class="reason">
@@ -53,116 +59,243 @@
 					请假事由
 				</view>
 				<view class="value">
-					阳了!
+					{{leaveDetail.leaveReason}}
 				</view>
 			</view>
-			<view class="accessory">
+			<!-- <view class="accessory">
 				<view class="title">
 					图片附件
 				</view>
 				<view class="value">
 					<img src="../../../assets/img/reason.png" alt="">
 				</view>
-			</view>
-			
+			</view> -->
+
 			<view class="item">
-							<view class="title">
-								提交时间
-							</view>
-							<view class="value">
-								2023-01-01 18:00
-							</view>
-						</view>
+				<view class="title">
+					提交时间
+				</view>
+				<view class="value">
+					{{leaveDetail.createTime}}
+				</view>
+			</view>
+		</view>
+		
+		<view class="btn">
+			<button @click="leaveCancel" v-if="leaveDetail.status == 0">撤销</button>
+			<button style="background-color: #DBDBDB" v-if="leaveDetail.status == -1" disabled>已撤销</button>
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as sickNoteApi from '@/apis/parents/sickNote.js'
+	
 	export default {
 		data() {
 			return {
-				
+				leaveId: '',
+				leaveDetail: {}
+			}
+		},
+		onLoad(op) {
+			if (op.id) {
+				this.leaveId = op.id;
+				this.getLeaveDetail();
 			}
 		},
 		methods: {
+			leaveCancel() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				sickNoteApi.cancelStudentLeaveLog({
+					leaveId: this.leaveId
+				}).then((res) => {
+					uni.hideLoading();
+					uni.navigateBack({
+						
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getLeaveDetail() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				sickNoteApi.getStudentLeaveLog({
+					leaveId: this.leaveId
+				}).then((res) => {
+					uni.hideLoading();
+					this.leaveDetail = res.data;
+					this.leaveDetail.createTime = this.getFormatDate(res.data.createTime);
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getFormatDate(val) {
+				let date = new Date(val);
+				let myyear = date.getFullYear();
+				let mymonth = date.getMonth() + 1;
+				let myweekday = date.getDate();
+				let hour = date.getHours();
+				let minute = date.getMinutes();
+				let second = date.getSeconds();
+				if (mymonth < 10) {
+					mymonth = '0' + mymonth;
+				}
+				if (myweekday < 10) {
+					myweekday = '0' + myweekday;
+				}
+				if(hour < 10) {
+					hour = '0' + hour;
+				}
+				if(minute < 10) {
+					minute = '0' + minute;
+				}
+				if(second < 10) {
+					second = '0' + second;
+				}
 			
+				return (myyear + '-' + mymonth + '-' + myweekday + ' ' + hour + ':' + minute + ':' + second);
+			},
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
-	.head{
+	.head {
 		margin: 12px 16px;
 		padding: 12px;
 		border-radius: 12px;
 		background-color: rgba(255, 255, 255, 1);
 		display: flex;
 		align-items: center;
-		.photo{
+
+		.photo {
 			width: 84rpx;
 			height: 84rpx;
 			border-radius: 4px;
 			overflow: hidden;
-			img{
+
+			img {
 				width: 100%;
 				height: 100%;
 			}
 		}
-		.title{
+
+		.title {
 			color: rgba(51, 51, 51, 1);
 			font-size: 16px;
 			font-weight: bold;
 			margin-left: 24rpx;
 		}
-		.state{
+
+		.state1 {
+			margin-left: auto;
+			border-radius: 50px;
+			background-color: rgba(255, 255, 255, 1);
+			color: rgba(22, 119, 255, 1);
+			font-size: 12px;
+			text-align: center;
+			border: 1px solid 1px solid rgba(22, 119, 255, 1);
+			padding: 7rpx 26rpx;
+		}
+		
+		.state2 {
+			margin-left: auto;
+			border-radius: 50px;
+			background-color: rgba(255, 255, 255, 1);
+			color: rgba(0, 187, 170, 1);
+			font-size: 12px;
+			text-align: center;
+			border: 1px solid rgba(0, 187, 170, 1);
+			padding: 7rpx 26rpx;
+		}
+		
+		.state3 {
 			margin-left: auto;
 			border-radius: 50px;
 			background-color: rgba(255, 255, 255, 1);
-			color: rgba(13, 186, 199, 1);
+			color: rgba(153, 153, 153, 1);
 			font-size: 12px;
 			text-align: center;
-			border: 1px solid rgba(13, 186, 199, 1);
+			border: 1px solid 1px solid rgba(153, 153, 153, 1);
 			padding: 7rpx 26rpx;
 		}
 	}
 
-     .main{
-		 border-radius: 12px;
-		 background-color: #fff;
-		 margin: 0 16px;
-		 .item{
-			 padding: 11px 15px 14px 15px;
-			 border-bottom: 1px solid rgba(244, 244, 244, 1);
-			 display: flex;
-			 justify-content: space-between;
-			 align-items: center;
-			 .title{
-				 color: rgba(119, 119, 119, 1);
-			 }
-			 .value{
-				 color: rgba(51, 51, 51, 1);
-			 }
-		 }
-		 
-		 .reason,.accessory{
-		 			 padding: 11px 15px;
-		 			 border-bottom: 1px solid rgba(244, 244, 244, 1);
-		 			 .title{
-		 			 				 color: rgba(119, 119, 119, 1);
-		 			 }
-		 			 .value{
-						 margin-top: 8px;
-		 			 				 color: rgba(51, 51, 51, 1);
-									 img{
-										 width: 120rpx;
-										 height: 120rpx;
-									 }
-		 			 }
-		 }
-		 .accessory{
-			 .value{
-				 margin-top: 12px;
-			 }
-		 }
-	 }
+	.main {
+		border-radius: 12px;
+		background-color: #fff;
+		margin: 0 16px;
+
+		.item {
+			padding: 11px 15px 14px 15px;
+			border-bottom: 1px solid rgba(244, 244, 244, 1);
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+
+			.title {
+				color: rgba(119, 119, 119, 1);
+			}
+
+			.value {
+				color: rgba(51, 51, 51, 1);
+			}
+		}
+
+		.reason,
+		.accessory {
+			padding: 11px 15px;
+			border-bottom: 1px solid rgba(244, 244, 244, 1);
+
+			.title {
+				color: rgba(119, 119, 119, 1);
+			}
+
+			.value {
+				margin-top: 8px;
+				color: rgba(51, 51, 51, 1);
+
+				img {
+					width: 120rpx;
+					height: 120rpx;
+				}
+			}
+		}
+
+		.accessory {
+			.value {
+				margin-top: 12px;
+			}
+		}
+	}
+	
+	.btn {
+		position: fixed;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		padding: 10px 12px;
+		background-color: #fff;
+	
+		button {
+			border-radius: 50px;
+			background-color: rgba(13, 186, 199, 1);
+			color: rgba(255, 255, 255, 1);
+			font-size: 16px;
+			line-height: 40px;
+		}
+	}
 </style>

+ 35 - 4
pages/parents/sickNote/sickNote.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-navbar title="请假"></u-navbar>
 		<view class="main">
-			<view class="sick-note" v-for="(item,index) in leaveList" :key="index">
+			<view class="sick-note" v-for="(item,index) in leaveList" :key="index" @click="toLeaveDetails(item)">
 				<view class="head">
 					<view class="name">
 						{{item.studentName}}的请假条
@@ -22,7 +22,7 @@
 						{{item.className}}
 					</view>
 					<view class="date">
-						{{item.createTime.slice(0,10)}}
+						{{getFormatDate(item.createTime)}}
 					</view>
 				</view>
 			</view>
@@ -48,10 +48,10 @@
 				studentId: ''
 			}
 		},
-		onReady() {
+		onShow() {
 			if (this.carhelp.getStudentId()) {
 				this.studentId = this.carhelp.getStudentId().studentId;
-				this.getLeaveList();
+				this.getLeaveList(true);
 			}
 		},
 		onReachBottom() {
@@ -60,6 +60,37 @@
 			}
 		},
 		methods: {
+			getFormatDate(val) {
+				let date = new Date(val);
+				let myyear = date.getFullYear();
+				let mymonth = date.getMonth() + 1;
+				let myweekday = date.getDate();
+				let hour = date.getHours();
+				let minute = date.getMinutes();
+				let second = date.getSeconds();
+				if (mymonth < 10) {
+					mymonth = '0' + mymonth;
+				}
+				if (myweekday < 10) {
+					myweekday = '0' + myweekday;
+				}
+				if(hour < 10) {
+					hour = '0' + hour;
+				}
+				if(minute < 10) {
+					minute = '0' + minute;
+				}
+				if(second < 10) {
+					second = '0' + second;
+				}
+			
+				return (myyear + '-' + mymonth + '-' + myweekday + ' ' + hour + ':' + minute + ':' + second);
+			},
+			toLeaveDetails(item) {
+				uni.navigateTo({
+					url: '/pages/parents/sickNote/leaveDetails?id=' + item.leaveId
+				})
+			},
 			toLeave() {
 				uni.navigateTo({
 					url: '/pages/parents/sickNote/leave'