Browse Source

“fix:修改时间样式”

master
123456 3 years ago
parent
commit
18c5d1a732
  1. 144
      src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue

144
src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue

@ -1,5 +1,5 @@
<template> <template>
<div style="height:600px;overflow:auto;padding: 20px;" class="form-class"> <div style="height: 600px; overflow: auto; padding: 20px" class="form-class">
<el-form <el-form
:model="dataForm" :model="dataForm"
:rules="dataRule" :rules="dataRule"
@ -22,24 +22,24 @@
<el-input <el-input
v-model="dataForm.name" v-model="dataForm.name"
placeholder="疫苗接种点名称" placeholder="疫苗接种点名称"
:disabled='dialogTitle == "查看"' :disabled="dialogTitle == '查看'"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="接种日期" prop="inoculationDate"> <el-form-item label="接种时间" :class="dataForm.noAvailableVaccines != '2'?'':'time-class'">
<!-- <el-input <div class="data-block">
v-model="dataForm.inoculationDate" <div style="width: 30%">
placeholder="接种日期"
></el-input> -->
<el-date-picker <el-date-picker
v-model="dataForm.inoculationDate" v-model="dataForm.inoculationDate"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
:disabled='dialogTitle == "查看"' :disabled="dialogTitle == '查看'"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </div>
<el-form-item label="上午接种时间" prop="morningTime" class="time-class"> <div class="time-block">
<div>
<span>上午</span>
<el-time-picker <el-time-picker
is-range is-range
v-model="morningTime" v-model="morningTime"
@ -50,13 +50,14 @@
end-placeholder="结束时间" end-placeholder="结束时间"
placeholder="选择时间范围" placeholder="选择时间范围"
@change="startTimeChange" @change="startTimeChange"
:disabled='dialogTitle == "查看"' :disabled="dialogTitle == '查看'"
:clearable="false" :clearable="false"
:editable="false" :editable="false"
> >
</el-time-picker> </el-time-picker>
</el-form-item> </div>
<el-form-item label="下午接种时间" prop="afterTime" class="time-class"> <div>
<span>下午</span>
<el-time-picker <el-time-picker
is-range is-range
v-model="afterTime" v-model="afterTime"
@ -67,29 +68,36 @@
end-placeholder="结束时间" end-placeholder="结束时间"
placeholder="选择时间范围" placeholder="选择时间范围"
@change="endTimeChange" @change="endTimeChange"
:disabled='dialogTitle == "查看"' :disabled="dialogTitle == '查看'"
:clearable="false" :clearable="false"
:editable="false" :editable="false"
> >
</el-time-picker> </el-time-picker>
</div>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="" prop="noAvailableVaccines"> <el-form-item label="" prop="noAvailableVaccines">
<el-checkbox <el-checkbox
v-model="dataForm.noAvailableVaccines" v-model="dataForm.noAvailableVaccines"
true-label="1" true-label="1"
false-label="2" false-label="2"
:disabled='dialogTitle == "查看"' :disabled="dialogTitle == '查看'"
>暂无疫苗</el-checkbox >暂无疫苗</el-checkbox
> >
</el-form-item> </el-form-item>
<el-form-item label="咨询电话" prop="mobile"> <el-form-item label="咨询电话" prop="mobile">
<el-input v-model="dataForm.mobile" :disabled='dialogTitle == "查看"' placeholder="咨询电话"></el-input> <el-input
v-model="dataForm.mobile"
:disabled="dialogTitle == '查看'"
placeholder="咨询电话"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="接种点地址" prop="address"> <el-form-item label="接种点地址" prop="address">
<el-input <el-input
v-model="dataForm.address" v-model="dataForm.address"
placeholder="例:青岛市时代国际广场" placeholder="例:青岛市时代国际广场"
style="width:65%;" style="width: 65%"
></el-input> ></el-input>
<el-button <el-button
style="margin-left: 10px" style="margin-left: 10px"
@ -154,9 +162,12 @@
</el-form> </el-form>
<div class="submit"> <div class="submit">
<el-button @click="closeSubmit">{{ $t("cancel") }}</el-button> <el-button @click="closeSubmit">{{ $t("cancel") }}</el-button>
<el-button v-if='dialogTitle != "查看"' type="primary" @click="dataFormSubmitHandle()">{{ <el-button
$t("confirm") v-if="dialogTitle != '查看'"
}}</el-button> type="primary"
@click="dataFormSubmitHandle()"
>{{ $t("confirm") }}</el-button
>
</div> </div>
</div> </div>
</template> </template>
@ -185,7 +196,7 @@ export default {
moEndTime: "", moEndTime: "",
afStartTime: "", afStartTime: "",
afEndTime: "", afEndTime: "",
noAvailableVaccines: '1', noAvailableVaccines: "1",
mobile: "", mobile: "",
address: "", address: "",
longitude: "", longitude: "",
@ -216,7 +227,7 @@ export default {
], ],
inoculationDate: [ inoculationDate: [
{ {
required: this.dataForm.noAvailableVaccines === '2', required: this.dataForm.noAvailableVaccines === "2",
message: this.$t("validate.required"), message: this.$t("validate.required"),
trigger: "blur", trigger: "blur",
}, },
@ -259,11 +270,11 @@ export default {
}; };
}, },
}, },
props:{ props: {
dialogTitle:{ dialogTitle: {
type:String, type: String,
default:'' default: "",
} },
}, },
methods: { methods: {
startTimeChange() { startTimeChange() {
@ -280,14 +291,14 @@ export default {
return false; return false;
} }
if (hour_0 == 12) { 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.$message.error("请选择00:00-12:00时间段的时间");
this.morningTime = null; this.morningTime = null;
return false; return false;
} }
} }
if (hour_1 == 12) { 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.$message.error("请选择00:00-12:00时间段的时间");
this.morningTime = null; this.morningTime = null;
return false; return false;
@ -311,14 +322,14 @@ export default {
return false; return false;
} }
if (hour_0 == 12) { 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.$message.error("请选择12:01-23:59时间段的时间");
this.afterTime = null; this.afterTime = null;
return false; return false;
} }
} }
if (hour_1 == 12) { 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.$message.error("请选择12:01-23:59时间段的时间");
this.afterTime = null; this.afterTime = null;
return false; return false;
@ -339,7 +350,7 @@ export default {
latitude = 39.9088810666821; latitude = 39.9088810666821;
longitude = 116.39743841556731; longitude = 116.39743841556731;
} }
console.log(latitude,longitude); console.log(latitude, longitude);
var center = new window.TMap.LatLng(latitude, longitude); var center = new window.TMap.LatLng(latitude, longitude);
// map TMap.Map() // map TMap.Map()
map = new window.TMap.Map(document.getElementById("map_add"), { map = new window.TMap.Map(document.getElementById("map_add"), {
@ -487,15 +498,15 @@ export default {
...this.dataForm, ...this.dataForm,
...res.data, ...res.data,
}; };
this.morningTime = [res.data.moStartTime,res.data.moEndTime] this.morningTime = [res.data.moStartTime, res.data.moEndTime];
this.afterTime = [res.data.afStartTime,res.data.afEndTime] this.afterTime = [res.data.afStartTime, res.data.afEndTime];
if(res.data.moStartTime !== ''){ if (res.data.moStartTime !== "") {
this.morningTime = [res.data.moStartTime,res.data.moEndTime] this.morningTime = [res.data.moStartTime, res.data.moEndTime];
this.afterTime = [res.data.afStartTime,res.data.afEndTime] this.afterTime = [res.data.afStartTime, res.data.afEndTime];
} }
if(!this.dataForm.longitude && !this.dataForm.latitude){ if (!this.dataForm.longitude && !this.dataForm.latitude) {
this.dataForm.longitude = "120.38945519" this.dataForm.longitude = "120.38945519";
this.dataForm.latitude = "36.0722275" this.dataForm.latitude = "36.0722275";
} }
this.initMap(); this.initMap();
}) })
@ -508,13 +519,24 @@ export default {
if (!valid) { if (!valid) {
return false; return false;
} }
if(this.morningTime === null && this.dataForm.noAvailableVaccines === '2'){ if(!this.dataForm.inoculationDate &&
this.$message.error('请填写上午接种时间'); this.dataForm.noAvailableVaccines === "2"){
return false 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'){ if (
this.$message.error('请填写下午接种时间'); this.afterTime === null &&
return false this.dataForm.noAvailableVaccines === "2"
) {
this.$message.error("请填写下午接种时间");
return false;
} }
this.$http[!this.dataForm.id ? "post" : "put"]( this.$http[!this.dataForm.id ? "post" : "put"](
"/epmetuser/icPointVaccinesInoculation/", "/epmetuser/icPointVaccinesInoculation/",
@ -522,7 +544,9 @@ export default {
) )
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { 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({ this.$message({
message: this.$t("prompt.success"), message: this.$t("prompt.success"),
@ -545,6 +569,15 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped>
.data-block {
display: flex;
}
.time-block>div{
margin-bottom: 10px;
}
.time-block span {
padding: 10px;
}
.position_label >>> .el-form-item__label::before { .position_label >>> .el-form-item__label::before {
color: #fff !important; color: #fff !important;
} }
@ -552,21 +585,20 @@ export default {
text-align: center; text-align: center;
margin: auto; margin: auto;
} }
.form-class .el-input{ .form-class .el-input {
width: 75%; width: 75%;
} }
.form-class .el-textarea{ .form-class .el-textarea {
width: 75%!important; width: 75% !important;
} }
.time-class{ .time-class {
position: relative; position: relative;
} }
.time-class::before{ .time-class::before {
content: '*'; content: "*";
color: #F56C6C; color: #f56c6c;
position: absolute; position: absolute;
left:16px; left: 42px;
top: 10px; top: 10px;
} }
</style> </style>

Loading…
Cancel
Save