diff --git a/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue b/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue index f203ef84..15dce74f 100644 --- a/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue +++ b/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue @@ -1,5 +1,5 @@ @@ -185,7 +196,7 @@ export default { moEndTime: "", afStartTime: "", afEndTime: "", - noAvailableVaccines: '1', + noAvailableVaccines: "1", mobile: "", address: "", longitude: "", @@ -216,7 +227,7 @@ export default { ], inoculationDate: [ { - required: this.dataForm.noAvailableVaccines === '2', + required: this.dataForm.noAvailableVaccines === "2", message: this.$t("validate.required"), trigger: "blur", }, @@ -259,11 +270,11 @@ export default { }; }, }, - props:{ - dialogTitle:{ - type:String, - default:'' - } + props: { + dialogTitle: { + type: String, + default: "", + }, }, methods: { startTimeChange() { @@ -280,14 +291,14 @@ export default { return false; } if (hour_0 == 12) { - if(minute_0 > 0 || second_0 > 0){ + if (minute_0 > 0 || second_0 > 0) { this.$message.error("请选择00:00-12:00时间段的时间"); this.morningTime = null; return false; } } if (hour_1 == 12) { - if(minute_1 > 0 || second_1 > 0){ + if (minute_1 > 0 || second_1 > 0) { this.$message.error("请选择00:00-12:00时间段的时间"); this.morningTime = null; return false; @@ -311,14 +322,14 @@ export default { return false; } if (hour_0 == 12) { - if(minute_0 == 0 && second_0 == 0){ + if (minute_0 == 0 && second_0 == 0) { this.$message.error("请选择12:01-23:59时间段的时间"); this.afterTime = null; return false; } } if (hour_1 == 12) { - if(minute_1 == 0 && second_1 == 0){ + if (minute_1 == 0 && second_1 == 0) { this.$message.error("请选择12:01-23:59时间段的时间"); this.afterTime = null; return false; @@ -339,7 +350,7 @@ export default { latitude = 39.9088810666821; longitude = 116.39743841556731; } - console.log(latitude,longitude); + console.log(latitude, longitude); var center = new window.TMap.LatLng(latitude, longitude); // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById("map_add"), { @@ -487,15 +498,15 @@ export default { ...this.dataForm, ...res.data, }; - this.morningTime = [res.data.moStartTime,res.data.moEndTime] - this.afterTime = [res.data.afStartTime,res.data.afEndTime] - if(res.data.moStartTime !== ''){ - this.morningTime = [res.data.moStartTime,res.data.moEndTime] - this.afterTime = [res.data.afStartTime,res.data.afEndTime] + this.morningTime = [res.data.moStartTime, res.data.moEndTime]; + this.afterTime = [res.data.afStartTime, res.data.afEndTime]; + if (res.data.moStartTime !== "") { + this.morningTime = [res.data.moStartTime, res.data.moEndTime]; + this.afterTime = [res.data.afStartTime, res.data.afEndTime]; } - if(!this.dataForm.longitude && !this.dataForm.latitude){ - this.dataForm.longitude = "120.38945519" - this.dataForm.latitude = "36.0722275" + if (!this.dataForm.longitude && !this.dataForm.latitude) { + this.dataForm.longitude = "120.38945519"; + this.dataForm.latitude = "36.0722275"; } this.initMap(); }) @@ -508,13 +519,24 @@ export default { if (!valid) { return false; } - if(this.morningTime === null && this.dataForm.noAvailableVaccines === '2'){ - this.$message.error('请填写上午接种时间'); - return false + if(!this.dataForm.inoculationDate && + this.dataForm.noAvailableVaccines === "2"){ + this.$message.error("请选择接种日期"); + return false; } - if(this.afterTime === null && this.dataForm.noAvailableVaccines === '2'){ - this.$message.error('请填写下午接种时间'); - return false + if ( + this.morningTime === null && + this.dataForm.noAvailableVaccines === "2" + ) { + this.$message.error("请填写上午接种时间"); + return false; + } + if ( + this.afterTime === null && + this.dataForm.noAvailableVaccines === "2" + ) { + this.$message.error("请填写下午接种时间"); + return false; } this.$http[!this.dataForm.id ? "post" : "put"]( "/epmetuser/icPointVaccinesInoculation/", @@ -522,7 +544,9 @@ export default { ) .then(({ data: res }) => { if (res.code !== 0) { - return this.$message.error(res.internalMsg ? res.internalMsg : res.msg); + return this.$message.error( + res.internalMsg ? res.internalMsg : res.msg + ); } this.$message({ message: this.$t("prompt.success"), @@ -545,6 +569,15 @@ export default { };