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

View File

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

View File

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