|
@@ -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"
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
}
|
|
|
}
|