From 0d4e6d70822ef7c9e4121e57e25fda57461e4fc3 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Thu, 16 Nov 2023 10:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87-=E4=BF=9D=E5=85=BB=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/inspectionPlan/index.vue | 203 +++++++++++-------- src/views/device/spotCheckPlan/index.vue | 148 +++++++------- src/views/device/upkeepPlan/index.vue | 234 +++++++++++----------- 3 files changed, 311 insertions(+), 274 deletions(-) diff --git a/src/views/device/inspectionPlan/index.vue b/src/views/device/inspectionPlan/index.vue index 59e44e4..a9d8f95 100644 --- a/src/views/device/inspectionPlan/index.vue +++ b/src/views/device/inspectionPlan/index.vue @@ -18,12 +18,14 @@ /> - + + + - + - + - + - + + + + + + + + + 搜索 重置 @@ -250,7 +278,7 @@ - + @@ -260,12 +288,12 @@ - + - + @@ -713,6 +741,7 @@ export default { updateTime: null, createTimeArray: [], updateTimeArray: [], + loopEndArray: [], }, // 表单参数 form: { @@ -760,79 +789,79 @@ export default { this.form.planTimeArray = []; return } - - // 检验 - if (this.form.planLoopType == 'day'){ - // 计算日期差值(以毫秒为单位) - let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); - // 转换为天数 - let days = Math.floor(diff / (1000 * 60 * 60 * 24)); - - if (days > 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 - } - } + // + // // 检验 + // if (this.form.planLoopType == 'day'){ + // // 计算日期差值(以毫秒为单位) + // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); + // // 转换为天数 + // let days = Math.floor(diff / (1000 * 60 * 60 * 24)); + // + // if (days > 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-置入穿梭框信息 @@ -1045,6 +1074,7 @@ export default { planTimeArray: [], equipmentItem: [], personList: [], + loopEndArray: [], }; this.resetForm("form"); }, @@ -1059,6 +1089,7 @@ export default { // 重置日期范围 this.queryParams.createTimeArray = []; this.queryParams.updateTimeArray = []; + this. this.handleQuery(); }, // 多选框选中数据 diff --git a/src/views/device/spotCheckPlan/index.vue b/src/views/device/spotCheckPlan/index.vue index 32783fd..3547786 100644 --- a/src/views/device/spotCheckPlan/index.vue +++ b/src/views/device/spotCheckPlan/index.vue @@ -299,7 +299,7 @@ - + @@ -849,79 +849,79 @@ export default { this.form.planTimeArray = []; return } - - // 检验 - if (this.form.planLoopType == 'day'){ - // 计算日期差值(以毫秒为单位) - let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); - // 转换为天数 - let days = Math.floor(diff / (1000 * 60 * 60 * 24)); - - if (days > 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 - } - } + // + // // 检验 + // if (this.form.planLoopType == 'day'){ + // // 计算日期差值(以毫秒为单位) + // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); + // // 转换为天数 + // let days = Math.floor(diff / (1000 * 60 * 60 * 24)); + // + // if (days > 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-置入穿梭框信息 diff --git a/src/views/device/upkeepPlan/index.vue b/src/views/device/upkeepPlan/index.vue index 9637e5f..c7be21a 100644 --- a/src/views/device/upkeepPlan/index.vue +++ b/src/views/device/upkeepPlan/index.vue @@ -279,12 +279,12 @@ - + - + @@ -367,15 +367,7 @@ - - - 单次 - 多次 - - - - - + - - - - - - - - - - - + 按固定周期 按上次保养时间 + 单次 - - - - - - - + +
+ + + + + + + + + + + + + + + + +
+
+ + + + + + +
@@ -1050,7 +1056,7 @@ export default { type: 'success' }) }, - // 改变保养周期事件 + // 改变保养周期事件-弃用 changeArray(e) { console.log(e) console.log(this.form.planTimeArray) @@ -1070,79 +1076,79 @@ export default { this.form.planTimeArray = []; return } - - // 检验 - if (this.form.planLoopType == 'day') { - // 计算日期差值(以毫秒为单位) - let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); - // 转换为天数 - let days = Math.floor(diff / (1000 * 60 * 60 * 24)); - - if (days > 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 - } - } + // + // // 检验 + // if (this.form.planLoopType == 'day') { + // // 计算日期差值(以毫秒为单位) + // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); + // // 转换为天数 + // let days = Math.floor(diff / (1000 * 60 * 60 * 24)); + // + // if (days > 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 + // } + // } }, // 选择备件确定按钮