fix: 测试报告开始结束时间校验

This commit is contained in:
chenjianxing 2020-07-21 20:09:19 +08:00
parent 43f9f190f7
commit 2e62d31a66
4 changed files with 20 additions and 3 deletions

View File

@ -19,12 +19,12 @@
<el-col :span="12">
<span>{{$t('report.test_start_time')}}</span>
<span v-if="!isReport">{{reportInfo.startTime}}</span>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.startTime"/>
<el-date-picker @change="startTimeChange" v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.startTime"/>
</el-col>
<el-col :span="12">
<span>{{$t('report.test_end_time')}}</span>
<span v-if="!isReport">{{reportInfo.endTime}}</span>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.endTime"/>
<el-date-picker @change="endTimeChange" v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.endTime"/>
</el-col>
</el-row>
@ -55,7 +55,7 @@
principal: 'Michael',
executors: ['Michael','Tom','Jiessie'],
startTime: '2020-6-18',
endTime: '2020-6-18'
endTime: '2020-6-19'
}
}
},
@ -63,6 +63,20 @@
type: Boolean,
default: true
}
},
methods: {
startTimeChange(value) {
if (!!this.reportInfo.endTime && this.reportInfo.endTime - this.reportInfo.startTime < 0) {
this.reportInfo.startTime = undefined;
this.$warning(this.$t('commons.date.data_time_error'));
}
},
endTimeChange(value) {
if (!!this.reportInfo.startTime && this.reportInfo.endTime - this.reportInfo.startTime < 0) {
this.reportInfo.endTime = undefined;
this.$warning(this.$t('commons.date.data_time_error'));
}
}
}
}
</script>

View File

@ -114,6 +114,7 @@ export default {
start_date_time: 'Start date and time',
end_date_time: 'End date time',
range_separator: "To",
data_time_error: "Start date cannot be later than the end date",
},
trigger_mode: {
name: "Trigger Mode",

View File

@ -114,6 +114,7 @@ export default {
start_date_time: '开始日期时间',
end_date_time: '结束日期时间',
range_separator: "至",
data_time_error: "开始日期不能大于结束日期",
},
trigger_mode: {
name: "触发方式",

View File

@ -112,6 +112,7 @@ export default {
start_date_time: '開始日期時間',
end_date_time: '結束日期時間',
range_separator: "至",
data_time_error: "開始日期不能大於結束日期",
},
trigger_mode: {
name: "觸發方式",