设备-保养前端优化

yangwl
wws 1 year ago
parent 7e033eba23
commit 0d4e6d7082

@ -18,12 +18,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="车间" prop="planWorkshop"> <el-form-item label="车间" prop="planWorkshop">
<el-input <el-select v-model="queryParams.planWorkshop" placeholder="请选择车间" clearable>
v-model="queryParams.planWorkshop" <el-option
placeholder="请输入车间编码" v-for="work in workCenterList"
clearable :key="work.factoryCode"
@keyup.enter.native="handleQuery" :label="work.factoryName"
:value="work.factoryCode"
/> />
</el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="false" label="产线" prop="planProdLine"> <el-form-item v-if="false" label="产线" prop="planProdLine">
<el-input <el-input
@ -145,7 +147,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建人" prop="createBy"> <el-form-item v-if="false" label="创建人" prop="createBy">
<el-input <el-input
v-model="queryParams.createBy" v-model="queryParams.createBy"
placeholder="请输入创建人" placeholder="请输入创建人"
@ -153,7 +155,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item v-if="false" label="创建时间" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTimeArray" v-model="queryParams.createTimeArray"
type="daterange" type="daterange"
@ -166,7 +168,7 @@
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="更新人" prop="updateBy"> <el-form-item v-if="false" label="更新人" prop="updateBy">
<el-input <el-input
v-model="queryParams.updateBy" v-model="queryParams.updateBy"
placeholder="请输入更新人" placeholder="请输入更新人"
@ -174,7 +176,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="更新时间" prop="updateTime"> <el-form-item v-if="false" label="更新时间" prop="updateTime">
<el-date-picker <el-date-picker
v-model="queryParams.updateTimeArray" v-model="queryParams.updateTimeArray"
type="daterange" type="daterange"
@ -187,6 +189,32 @@
:picker-options="pickerOptions"> :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label-width="100px" label="循环范围开始" prop="planLoopStart">
<el-date-picker
v-model="queryParams.loopStartArray"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item label-width="100px" label="循环范围结束" prop="planLoopEnd">
<el-date-picker
v-model="queryParams.loopEndArray"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -250,7 +278,7 @@
<el-table-column width="150" label="计划编码" align="center" prop="planCode"/> <el-table-column width="150" label="计划编码" align="center" prop="planCode"/>
<el-table-column width="120" label="计划名称" align="center" prop="planName"/> <el-table-column width="120" label="计划名称" align="center" prop="planName"/>
<el-table-column width="100" label="车间编码" align="center" prop="planWorkshop"/> <el-table-column width="100" label="车间编码" align="center" prop="planWorkshop"/>
<el-table-column width="150" label="工作中心" align="center" prop="workCenterName"/> <el-table-column width="150" label="车间" align="center" prop="workCenterName"/>
<el-table-column v-if="false" label="产线" align="center" prop="planProdLine"/> <el-table-column v-if="false" label="产线" align="center" prop="planProdLine"/>
<el-table-column v-if="false" label="设备名称" align="center" prop="equipmentName"/> <el-table-column v-if="false" label="设备名称" align="center" prop="equipmentName"/>
<el-table-column v-if="false" label="设备编码" align="center" prop="equipmentCode"/> <el-table-column v-if="false" label="设备编码" align="center" prop="equipmentCode"/>
@ -260,12 +288,12 @@
<dict-tag :options="dict.type.device_loop_type" :value="scope.row.planLoopType"/> <dict-tag :options="dict.type.device_loop_type" :value="scope.row.planLoopType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="循环执行时间开始" align="center" prop="planLoopStart" width="180"> <el-table-column label="循环范围开始" align="center" prop="planLoopStart" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="循环执行时间结束" align="center" prop="planLoopEnd" width="180"> <el-table-column label="循环范围结束" align="center" prop="planLoopEnd" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span>
</template> </template>
@ -713,6 +741,7 @@ export default {
updateTime: null, updateTime: null,
createTimeArray: [], createTimeArray: [],
updateTimeArray: [], updateTimeArray: [],
loopEndArray: [],
}, },
// //
form: { form: {
@ -760,79 +789,79 @@ export default {
this.form.planTimeArray = []; this.form.planTimeArray = [];
return return
} }
//
// // //
if (this.form.planLoopType == 'day'){ // if (this.form.planLoopType == 'day'){
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let days = Math.floor(diff / (1000 * 60 * 60 * 24)); // let days = Math.floor(diff / (1000 * 60 * 60 * 24));
//
if (days > this.form.planLoop) { // if (days > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+days+'天,循环周期为'+days+'天,超过循环周期'+(days-this.form.planLoop)+'天,请重新选择执行时间!', // message: ''+days+','+days+','+(days-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'week') { // if (this.form.planLoopType == 'week') {
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7)); // let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
//
if (weeks > (this.form.planLoop/7)) { // if (weeks > (this.form.planLoop/7)) {
this.$message({ // this.$message({
message: '可执行时间范围为'+weeks+'周,循环周期为'+weeks+'周,超过循环周期'+(weeks*7-this.form.planLoop)+'天,请重新选择执行时间!', // message: ''+weeks+','+weeks+','+(weeks*7-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'month'){ // 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(); // 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) { // if (monthsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+monthsDiff+'月,循环周期为'+monthsDiff+'月,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', // message: ''+monthsDiff+','+monthsDiff+','+(monthsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'season'){ // 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(); // 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) { // if (monthsDiff*3 > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+monthsDiff*3+'季度,循环周期为'+monthsDiff*3+'季度,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', // message: ''+monthsDiff*3+','+monthsDiff*3+','+(monthsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'year'){ // if (this.form.planLoopType == 'year'){
// // //
let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear(); // let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear();
//
if (yearsDiff > this.form.planLoop) { // if (yearsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+yearsDiff+'年,循环周期为'+yearsDiff+'年,超过循环周期'+(yearsDiff-this.form.planLoop)+'年,请重新选择执行时间!', // message: ''+yearsDiff+','+yearsDiff+','+(yearsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
}, },
// List-穿 // List-穿
@ -1045,6 +1074,7 @@ export default {
planTimeArray: [], planTimeArray: [],
equipmentItem: [], equipmentItem: [],
personList: [], personList: [],
loopEndArray: [],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -1059,6 +1089,7 @@ export default {
// //
this.queryParams.createTimeArray = []; this.queryParams.createTimeArray = [];
this.queryParams.updateTimeArray = []; this.queryParams.updateTimeArray = [];
this.
this.handleQuery(); this.handleQuery();
}, },
// //

@ -299,7 +299,7 @@
<el-table-column width="120" label="计划编码" align="center" prop="planCode" /> <el-table-column width="120" label="计划编码" align="center" prop="planCode" />
<el-table-column width="120" label="计划名称" align="center" prop="planName" /> <el-table-column width="120" label="计划名称" align="center" prop="planName" />
<el-table-column label="车间编码" align="center" prop="planWorkshop" /> <el-table-column label="车间编码" align="center" prop="planWorkshop" />
<el-table-column width="150" label="工作中心" align="center" prop="workCenterName"/> <el-table-column width="150" label="车间" align="center" prop="workCenterName"/>
<el-table-column v-if="false" label="产线" align="center" prop="planProdLine" /> <el-table-column v-if="false" label="产线" align="center" prop="planProdLine" />
<el-table-column v-if="false" label="设备名称" align="center" prop="equipmentName" /> <el-table-column v-if="false" label="设备名称" align="center" prop="equipmentName" />
<el-table-column v-if="false" label="设备编码" align="center" prop="equipmentCode" /> <el-table-column v-if="false" label="设备编码" align="center" prop="equipmentCode" />
@ -849,79 +849,79 @@ export default {
this.form.planTimeArray = []; this.form.planTimeArray = [];
return return
} }
//
// // //
if (this.form.planLoopType == 'day'){ // if (this.form.planLoopType == 'day'){
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let days = Math.floor(diff / (1000 * 60 * 60 * 24)); // let days = Math.floor(diff / (1000 * 60 * 60 * 24));
//
if (days > this.form.planLoop) { // if (days > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+days+'天,循环周期为'+days+'天,超过循环周期'+(days-this.form.planLoop)+'天,请重新选择执行时间!', // message: ''+days+','+days+','+(days-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'week') { // if (this.form.planLoopType == 'week') {
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7)); // let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
//
if (weeks > (this.form.planLoop/7)) { // if (weeks > (this.form.planLoop/7)) {
this.$message({ // this.$message({
message: '可执行时间范围为'+weeks+'周,循环周期为'+weeks+'周,超过循环周期'+(weeks*7-this.form.planLoop)+'天,请重新选择执行时间!', // message: ''+weeks+','+weeks+','+(weeks*7-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'month'){ // 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(); // 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) { // if (monthsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+monthsDiff+'月,循环周期为'+monthsDiff+'月,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', // message: ''+monthsDiff+','+monthsDiff+','+(monthsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'season'){ // 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(); // 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) { // if (monthsDiff*3 > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+monthsDiff*3+'季度,循环周期为'+monthsDiff*3+'季度,超过循环周期'+(monthsDiff-this.form.planLoop)+'月,请重新选择执行时间!', // message: ''+monthsDiff*3+','+monthsDiff*3+','+(monthsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'year'){ // if (this.form.planLoopType == 'year'){
// // //
let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear(); // let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear();
//
if (yearsDiff > this.form.planLoop) { // if (yearsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为'+yearsDiff+'年,循环周期为'+yearsDiff+'年,超过循环周期'+(yearsDiff-this.form.planLoop)+'年,请重新选择执行时间!', // message: ''+yearsDiff+','+yearsDiff+','+(yearsDiff-this.form.planLoop)+',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
}, },
// List-穿 // List-穿

@ -279,12 +279,12 @@
<dict-tag :options="dict.type.device_loop_type" :value="scope.row.planLoopType"/> <dict-tag :options="dict.type.device_loop_type" :value="scope.row.planLoopType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="循环执行时间开始" align="center" prop="planLoopStart" width="180"> <el-table-column label="循环范围开始" align="center" prop="planLoopStart" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="循环执行时间结束" align="center" prop="planLoopEnd" width="180"> <el-table-column label="循环范围结束" align="center" prop="planLoopEnd" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span>
</template> </template>
@ -367,15 +367,7 @@
<el-input v-model="form.planName" placeholder="请输入保养名称"/> <el-input v-model="form.planName" placeholder="请输入保养名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span=12 :offset="1"> <el-col :span="8" :offset="1">
<el-form-item label="保养类型:">
<el-radio v-model="form.upkeep" label="0"></el-radio>
<el-radio v-model="form.upkeep" label="1"></el-radio>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="车间:"> <el-form-item label="车间:">
<el-select v-model="form.planWorkshop" placeholder="请选择车间" clearable> <el-select v-model="form.planWorkshop" placeholder="请选择车间" clearable>
<el-option <el-option
@ -387,12 +379,24 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :offset="1" :span="6" v-if="form.upkeep == 1"> </el-row>
<el-row>
<el-col :span="20">
<el-form-item label-width="110px" label="保养生成规则:">
<el-radio v-model="form.calculationRule" label="0"></el-radio>
<el-radio v-model="form.calculationRule" label="1"></el-radio>
<el-radio v-model="form.calculationRule" label="2"></el-radio>
</el-form-item>
</el-col>
</el-row>
<el-row>
<div v-if="form.calculationRule != '2' ">
<el-col :span="6">
<el-form-item label="循环周期:"> <el-form-item label="循环周期:">
<el-input v-model="form.planLoop" placeholder="请输入循环周期"/> <el-input v-model="form.planLoop" placeholder="请输入循环周期"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2" v-if="form.upkeep == 1"> <el-col :span="2">
<el-select v-model="form.planLoopType" placeholder="周期" clearable> <el-select v-model="form.planLoopType" placeholder="周期" clearable>
<el-option <el-option
v-for="dict in dict.type.device_loop_type" v-for="dict in dict.type.device_loop_type"
@ -402,18 +406,8 @@
/> />
</el-select> </el-select>
</el-col> </el-col>
</el-row> <el-col :span="15" :offset="1">
<el-row> <el-form-item label-width="100px" label="保养时间范围">
<el-col :span="20">
<el-form-item label-width="160px" label="计划保养时间计算规则:">
<el-radio v-model="form.calculationRule" label="0"></el-radio>
<el-radio v-model="form.calculationRule" label="1"></el-radio>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.calculationRule == 0">
<el-col :span="20">
<el-form-item label-width="100px" label="保养执行时间">
<el-date-picker <el-date-picker
@change="changeArray" @change="changeArray"
v-model="form.planTimeArray" v-model="form.planTimeArray"
@ -424,6 +418,18 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</div>
<div v-else>
<el-col :span="8">
<el-form-item label-width="100px" label="保养开始时间">
<el-date-picker
v-model="form.planLoopStart"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</div>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
@ -1050,7 +1056,7 @@ export default {
type: 'success' type: 'success'
}) })
}, },
// // -
changeArray(e) { changeArray(e) {
console.log(e) console.log(e)
console.log(this.form.planTimeArray) console.log(this.form.planTimeArray)
@ -1070,79 +1076,79 @@ export default {
this.form.planTimeArray = []; this.form.planTimeArray = [];
return return
} }
//
// // //
if (this.form.planLoopType == 'day') { // if (this.form.planLoopType == 'day') {
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let days = Math.floor(diff / (1000 * 60 * 60 * 24)); // let days = Math.floor(diff / (1000 * 60 * 60 * 24));
//
if (days > this.form.planLoop) { // if (days > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为' + days + '天,循环周期为' + days + '天,超过循环周期' + (days - this.form.planLoop) + '天,请重新选择执行时间!', // message: '' + days + ',' + days + ',' + (days - this.form.planLoop) + ',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'week') { // if (this.form.planLoopType == 'week') {
// // //
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime(); // let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
// // //
let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7)); // let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
//
if (weeks > (this.form.planLoop / 7)) { // if (weeks > (this.form.planLoop / 7)) {
this.$message({ // this.$message({
message: '可执行时间范围为' + weeks + '周,循环周期为' + weeks + '周,超过循环周期' + (weeks * 7 - this.form.planLoop) + '天,请重新选择执行时间!', // message: '' + weeks + ',' + weeks + ',' + (weeks * 7 - this.form.planLoop) + ',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'month') { // 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(); // 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) { // if (monthsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为' + monthsDiff + '月,循环周期为' + monthsDiff + '月,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!', // message: '' + monthsDiff + ',' + monthsDiff + ',' + (monthsDiff - this.form.planLoop) + ',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'season') { // 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(); // 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) { // if (monthsDiff * 3 > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为' + monthsDiff * 3 + '季度,循环周期为' + monthsDiff * 3 + '季度,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!', // message: '' + monthsDiff * 3 + ',' + monthsDiff * 3 + ',' + (monthsDiff - this.form.planLoop) + ',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
//
if (this.form.planLoopType == 'year') { // if (this.form.planLoopType == 'year') {
// // //
let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear(); // let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear();
//
if (yearsDiff > this.form.planLoop) { // if (yearsDiff > this.form.planLoop) {
this.$message({ // this.$message({
message: '可执行时间范围为' + yearsDiff + '年,循环周期为' + yearsDiff + '年,超过循环周期' + (yearsDiff - this.form.planLoop) + '年,请重新选择执行时间!', // message: '' + yearsDiff + ',' + yearsDiff + ',' + (yearsDiff - this.form.planLoop) + ',',
type: 'warning' // type: 'warning'
}) // })
this.form.planTimeArray = []; // this.form.planTimeArray = [];
return // return
} // }
} // }
}, },
// //

Loading…
Cancel
Save