From 759f9254ae7450d000479938d52b38afbdf696f7 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 20 Oct 2023 15:55:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E8=AE=A1=E5=88=92=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/inspectionPlan/index.vue | 96 +++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/src/views/device/inspectionPlan/index.vue b/src/views/device/inspectionPlan/index.vue index d403bc15..7494e847 100644 --- a/src/views/device/inspectionPlan/index.vue +++ b/src/views/device/inspectionPlan/index.vue @@ -347,6 +347,7 @@ this.form.planLoop) { + this.$message({ + message: '可执行时间范围为'+days+'天,循环周期为'+days+'天,超过循环周期'+(days-this.form.planLoop)+'天,请重新选择执行时间!', + type: 'warning' + }) + this.form.planTimeArray = []; + return + } + } + + if (this.form.planLoopType == 'week') { + // 计算日期差值(以毫秒为单位) + let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); + // 转换为周数 + let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7)); + + if (weeks > (this.form.planLoop/7)) { + this.$message({ + message: '可执行时间范围为'+weeks+'周,循环周期为'+weeks+'周,超过循环周期'+(weeks*7-this.form.planLoop)+'天,请重新选择执行时间!', + type: 'warning' + }) + this.form.planTimeArray = []; + return + } + } + + if (this.form.planLoopType == 'month'){ + let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth(); + + if (monthsDiff > this.form.planLoop) { + this.$message({ + message: '可执行时间范围为'+monthsDiff+'月,循环周期为'+monthsDiff+'月,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', + type: 'warning' + }) + this.form.planTimeArray = []; + return + } + } + + if (this.form.planLoopType == 'season'){ + let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth(); + + if (monthsDiff*3 > this.form.planLoop) { + this.$message({ + message: '可执行时间范围为'+monthsDiff*3+'季度,循环周期为'+monthsDiff*3+'季度,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', + type: 'warning' + }) + this.form.planTimeArray = []; + return + } + } + + if (this.form.planLoopType == 'year'){ + // 计算年份差值 + let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear(); + + if (yearsDiff > this.form.planLoop) { + this.$message({ + message: '可执行时间范围为'+yearsDiff+'年,循环周期为'+yearsDiff+'年,超过循环周期'+(yearsDiff-this.form.planLoop)+'年,请重新选择执行时间!', + type: 'warning' + }) + this.form.planTimeArray = []; + return + } + } + + }, // 获取设备List-置入穿梭框信息 setPerson() { getPersonList().then(response => {