|
|
@ -347,6 +347,7 @@
|
|
|
|
<el-col :span=12 :offset="1">
|
|
|
|
<el-col :span=12 :offset="1">
|
|
|
|
<el-form-item label-width="100px" label="巡检执行时间">
|
|
|
|
<el-form-item label-width="100px" label="巡检执行时间">
|
|
|
|
<el-date-picker
|
|
|
|
<el-date-picker
|
|
|
|
|
|
|
|
@change="changeArray"
|
|
|
|
v-model="form.planTimeArray"
|
|
|
|
v-model="form.planTimeArray"
|
|
|
|
type="datetimerange"
|
|
|
|
type="datetimerange"
|
|
|
|
range-separator="至"
|
|
|
|
range-separator="至"
|
|
|
@ -744,6 +745,101 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
// 改变巡检周期事件
|
|
|
|
|
|
|
|
changeArray(e) {
|
|
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
console.log(this.form.planTimeArray)
|
|
|
|
|
|
|
|
if (this.form.planLoop == null) {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: '请输入循环周期!',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.form.planTimeArray = [];
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.form.planLoopType == null) {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: '请选择循环类型!',
|
|
|
|
|
|
|
|
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-置入穿梭框信息
|
|
|
|
// 获取设备List-置入穿梭框信息
|
|
|
|
setPerson() {
|
|
|
|
setPerson() {
|
|
|
|
getPersonList().then(response => {
|
|
|
|
getPersonList().then(response => {
|
|
|
|