refector: 时间范围校验及默认选择

This commit is contained in:
caoqianming 2023-04-05 01:47:01 +08:00
parent 03990b8fba
commit f3fccd4da2
3 changed files with 33 additions and 4 deletions

View File

@ -116,6 +116,7 @@
<script>
var that;
import getStartAndEnd from '../../../utils/getTime.js';
import baTreePicker from "../../comm/ba-tree-picker/ba-tree-picker.vue";
import nonNullCheck from '../../../utils/nonNullCheck.js';
import resetData from '../../../utils/common.js';
@ -181,6 +182,7 @@
this.showBtns = false;
}
}else{
this.datetimerange = getStartAndEnd()
this.showBtns = true;
}
},
@ -357,6 +359,14 @@
return false;
}
if (this.formData.start_time>=this.formData.end_time){
uni.showToast({
title: '时间选择范围错误',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.state_work)) {
uni.showToast({
title: '请选择生产状态',

View File

@ -83,6 +83,7 @@
</template>
<script>
import getStartAndEnd from '../../../utils/getTime.js';
import nonNullCheck from '../../../utils/nonNullCheck.js';
import baTreePicker from "../../comm/ba-tree-picker/ba-tree-picker.vue";
export default {
@ -144,6 +145,7 @@
this.showBtns = false;
}
}else{
this.datetimerange = getStartAndEnd()
this.showBtns = true;
}
},
@ -277,6 +279,13 @@
})
return false;
}
if (this.formData.come_time>=this.formData.leave_time){
uni.showToast({
title: '时间选择范围错误',
icon: "none"
})
return false;
}
// if (!nonNullCheck(this.formData.belong_dept)) {
// uni.showToast({

View File

@ -112,7 +112,8 @@
</template>
<script>
import nonNullCheck from '../../../utils/nonNullCheck.js';
import getStartAndEnd from '../../../utils/getTime.js';
import nonNullCheck from '../../../utils/nonNullCheck.js';
import resetData from '../../../utils/common.js';
export default {
name: "visit",
@ -176,6 +177,7 @@
this.formData.visit_time = this.datetimerange[0]
this.formData.leave_time = this.datetimerange[1]
},
},
onLoad(params) {
if (params.visit) {
@ -188,6 +190,7 @@
this.showBtns = true;
}
} else {
this.datetimerange = getStartAndEnd()
this.showBtns = true;
}
},
@ -324,6 +327,13 @@
})
return false;
}
if (this.formData.visit_time>=this.formData.leave_time){
uni.showToast({
title: '时间选择范围错误',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.receptionist) && this.formData.purpose!=50) {
uni.showToast({
title: '请选择接待人',