金源班前会增加班次时间调整
This commit is contained in:
parent
98baa94fb5
commit
ff0b6d21b7
@ -312,11 +312,37 @@
|
|||||||
let end = uni.$u.timeFormat(val.Nav_ClassDetail[0].ENDTIME, 'hh:MM:ss')
|
let end = uni.$u.timeFormat(val.Nav_ClassDetail[0].ENDTIME, 'hh:MM:ss')
|
||||||
this.model.START_TIME = DATE_TIME + ' ' + start
|
this.model.START_TIME = DATE_TIME + ' ' + start
|
||||||
this.model.END_TIME = DATE_TIME + ' ' + end
|
this.model.END_TIME = DATE_TIME + ' ' + end
|
||||||
|
this.checkTime()
|
||||||
|
|
||||||
}
|
}
|
||||||
this.currentOperateMonitor = val
|
this.currentOperateMonitor = val
|
||||||
|
|
||||||
},
|
},
|
||||||
|
formatDate(timestamp) {
|
||||||
|
const date = new Date(timestamp);
|
||||||
|
// 补0:确保个位数是 01/02 而非 1/2
|
||||||
|
const pad = n => n.toString().padStart(2, '0');
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = pad(date.getMonth() + 1); // 月份从0开始,需+1
|
||||||
|
const day = pad(date.getDate());
|
||||||
|
const hour = pad(date.getHours());
|
||||||
|
const minute = pad(date.getMinutes());
|
||||||
|
const second = pad(date.getSeconds());
|
||||||
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||||
|
},
|
||||||
|
checkTime() {
|
||||||
|
const timestamp1 = new Date(this.model.START_TIME).getTime();
|
||||||
|
const timestamp2 = new Date(this.model.END_TIME).getTime();
|
||||||
|
|
||||||
|
// 判断:后面的时间 是否 小于 前面的时间
|
||||||
|
const isTime2LtTime1 = timestamp2 < timestamp1;
|
||||||
|
const endDate = new Date(this.model.END_TIME);
|
||||||
|
if (isTime2LtTime1) {
|
||||||
|
|
||||||
|
endDate.setDate(endDate.getDate() + 1); // 关键API:日期+1,时分秒不变
|
||||||
|
this.model.END_TIME = this.formatDate(endDate.getTime());
|
||||||
|
}
|
||||||
|
},
|
||||||
handleClosePopupMonitor() {
|
handleClosePopupMonitor() {
|
||||||
this.showPopupMonitor = false
|
this.showPopupMonitor = false
|
||||||
},
|
},
|
||||||
@ -367,6 +393,7 @@
|
|||||||
extendRule(json, 'ID', 1, this.model.ID)
|
extendRule(json, 'ID', 1, this.model.ID)
|
||||||
getRequest(json, "/FO/PreShiftMeetingRecord/Get").then(res => {
|
getRequest(json, "/FO/PreShiftMeetingRecord/Get").then(res => {
|
||||||
this.model = res
|
this.model = res
|
||||||
|
this.checkTime()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSearchUser(val) {
|
handleSearchUser(val) {
|
||||||
@ -438,7 +465,7 @@
|
|||||||
submit(type) {
|
submit(type) {
|
||||||
const ele = this.$refs
|
const ele = this.$refs
|
||||||
ele['wForm'].validate().then(res => {
|
ele['wForm'].validate().then(res => {
|
||||||
this.modelEdit = JSON.parse(JSON.stringify(this.model))
|
this.modelEdit = JSON.parse(JSON.stringify(this.model))
|
||||||
const startTime = new Date(this.modelEdit.START_TIME).getTime();
|
const startTime = new Date(this.modelEdit.START_TIME).getTime();
|
||||||
const endTime = new Date(this.modelEdit.END_TIME).getTime();
|
const endTime = new Date(this.modelEdit.END_TIME).getTime();
|
||||||
if (endTime <= startTime) {
|
if (endTime <= startTime) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user