修改bug
This commit is contained in:
parent
26df427f9a
commit
c5068f7ea1
@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px">
|
||||
<el-form-item label="时间段" prop="suitTimeSlotFront" label-width="70px" >
|
||||
<el-form-item label="时间段" prop="suitTimeSlot" label-width="70px" >
|
||||
<el-time-picker
|
||||
v-model="ruleForm.suitTimeSlotFront"
|
||||
format="HH:mm"
|
||||
@ -269,8 +269,9 @@ export default {
|
||||
activeTimeType: [
|
||||
{required: true, message: '活动时间不能为空', trigger: 'blur'},
|
||||
],
|
||||
suitTimeSlotFront: [
|
||||
{required: true, message: '时间段不能为空', trigger: 'blur'},
|
||||
//自定义验证逻辑
|
||||
suitTimeSlot: [
|
||||
{ required:true, validator: this.validateTimeRange, trigger: 'change' }
|
||||
],
|
||||
userGradeIds: [
|
||||
{required: true, message: '适用会员等级不能为空', trigger: 'blur'},
|
||||
@ -298,6 +299,23 @@ export default {
|
||||
this.listUserGrade()
|
||||
},
|
||||
methods: {
|
||||
//自定义表单验证逻辑
|
||||
validateTimeRange(rule, value, callback) {
|
||||
const { suitTimeSlotFront, suitTimeSlotAfter } = this.ruleForm;
|
||||
|
||||
if (!suitTimeSlotFront && !suitTimeSlotAfter) {
|
||||
callback(new Error('请选择开始时间和结束时间'));
|
||||
} else if (!suitTimeSlotFront) {
|
||||
callback(new Error('请选择开始时间'));
|
||||
} else if (!suitTimeSlotAfter) {
|
||||
callback(new Error('请选择结束时间'));
|
||||
} else if (suitTimeSlotFront >= suitTimeSlotAfter) {
|
||||
callback(new Error('结束时间必须晚于开始时间'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
Typeindex3(index) {
|
||||
this.tindex3 = index
|
||||
this.ruleForm.suitTimeSlotType = index
|
||||
|
Loading…
Reference in New Issue
Block a user