From ff0b6d21b7aab03b55570913e6fc635ab2aec0c4 Mon Sep 17 00:00:00 2001 From: yunkexin <760754045@qq.com> Date: Tue, 6 Jan 2026 15:31:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E6=BA=90=E7=8F=AD=E5=89=8D=E4=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8F=AD=E6=AC=A1=E6=97=B6=E9=97=B4=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subPages/FO/1preShiftMeetingEdit.vue | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pages/apply/subPages/FO/1preShiftMeetingEdit.vue b/pages/apply/subPages/FO/1preShiftMeetingEdit.vue index a0532b6..3ae4a70 100644 --- a/pages/apply/subPages/FO/1preShiftMeetingEdit.vue +++ b/pages/apply/subPages/FO/1preShiftMeetingEdit.vue @@ -312,11 +312,37 @@ let end = uni.$u.timeFormat(val.Nav_ClassDetail[0].ENDTIME, 'hh:MM:ss') this.model.START_TIME = DATE_TIME + ' ' + start this.model.END_TIME = DATE_TIME + ' ' + end + this.checkTime() } 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() { this.showPopupMonitor = false }, @@ -367,6 +393,7 @@ extendRule(json, 'ID', 1, this.model.ID) getRequest(json, "/FO/PreShiftMeetingRecord/Get").then(res => { this.model = res + this.checkTime() }) }, handleSearchUser(val) { @@ -438,7 +465,7 @@ submit(type) { const ele = this.$refs 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 endTime = new Date(this.modelEdit.END_TIME).getTime(); if (endTime <= startTime) {