Commit f6ab81bf authored by 张锡奇's avatar 张锡奇
parents d618e641 2cf53fdb
...@@ -23,11 +23,6 @@ ...@@ -23,11 +23,6 @@
flex-grow: 1; flex-grow: 1;
font-size: 14px; font-size: 14px;
} }
&:not(:last-child){
label{
border-bottom:1px solid #ddd;
}
}
>.v-radio{ >.v-radio{
display:flex; display:flex;
>div{ >div{
...@@ -43,6 +38,12 @@ ...@@ -43,6 +38,12 @@
width:100%; width:100%;
min-height: 55px; min-height: 55px;
} }
>.item{
margin-top:6rpx;
p{
margin:0;
}
}
} }
>button{ >button{
width:calc(100% - 10px); width:calc(100% - 10px);
...@@ -58,17 +59,17 @@ ...@@ -58,17 +59,17 @@
<div id="punchClockDetail"> <div id="punchClockDetail">
<img src="./image/health.jpg" /> <img src="./image/health.jpg" />
<div class="list"> <div class="list">
<div class="tip"><span style="color:red;" v-if="!readOnly">*</span>1. 目前健康状况</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>1. 目前健康状况</div>
<v-radio-group v-model="value.sStatus" :disabled="readOnly"> <v-radio-group v-model="value.sStatus" :disabled="status==2">
<div><v-radio value="健康" label="健康"/></div> <div><v-radio value="健康" label="健康"/></div>
<div><v-radio value="有发烧、咳嗽等症状" label="有发烧、咳嗽等症状"/></div> <div><v-radio value="有发烧、咳嗽等症状" label="有发烧、咳嗽等症状"/></div>
<div><v-radio value="其他" label="其他"/></div> <div><v-radio value="其他" label="其他"/></div>
</v-radio-group> </v-radio-group>
</div> </div>
<div class="list" v-if="!readOnly"> <div class="list">
<div class="tip"><span style="color:red;" >*</span>2. 目前所在城市</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>2. 目前所在城市</div>
<x-address <x-address
:disabled="readOnly" :disabled="status==2"
@on-hide="logHide" @on-hide="logHide"
@on-show="logShow" @on-show="logShow"
title="" title=""
...@@ -85,62 +86,61 @@ ...@@ -85,62 +86,61 @@
<span>{{value.sAddressFull}}</span> <span>{{value.sAddressFull}}</span>
</div> </div>
<div class="list"> <div class="list">
<div class="tip"><span style="color:red;" v-if="!readOnly">*</span>4. 是否接触过疑似或确诊的新型肺炎患者</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>4. 是否接触过疑似或确诊的新型肺炎患者</div>
<v-radio-group v-model="value.bTouch" :disabled="readOnly"> <v-radio-group v-model="value.bTouch" :disabled="status==2">
<div><v-radio :value="0" label="否"/></div> <div><v-radio :value="0" label="否"/></div>
<div><v-radio :value="1" label="是"/></div> <div><v-radio :value="1" label="是"/></div>
</v-radio-group> </v-radio-group>
</div> <div class="item" v-if="value.bTouch">
<div class="list" v-if="value.bTouch">
<div class="tip">5. 接触日期</div>
<datetime <datetime
:disabled="readOnly" :disabled="status==2"
title="" title="接触日期"
format='YYYY-MM-DD' format='YYYY-MM-DD'
placeholder="请选择" placeholder="请选择"
value-text-align="left"
:show.sync="isShowDate" :show.sync="isShowDate"
v-model="value.dTouchDate"/> v-model="value.dTouchDate"/>
</div> </div>
</div>
<div class="list"> <div class="list">
<div class="tip"><span style="color:red;" v-if="!readOnly">*</span>6. 体温</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>5. 体温</div>
<xInput <xInput
title="" title=""
:disabled="readOnly" :disabled="status==2"
placeholder="输入体温" placeholder="输入体温"
v-model="value.nTemperature" v-model="value.nTemperature"
type="number" /> @on-change="inputNum('nTemperature')"
type="number"/>
</div> </div>
<div class="list"> <div class="list">
<div class="tip">7. 是否自我隔离</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>6. 是否自我隔离</div>
<v-radio-group v-model="value.bQuarantine" :disabled="readOnly"> <v-radio-group v-model="value.bQuarantine" :disabled="status==2">
<div><v-radio :value="0" label="否"/></div> <div><v-radio :value="0" label="否"/></div>
<div><v-radio :value="1" label="是"/></div> <div><v-radio :value="1" label="是"/></div>
</v-radio-group> </v-radio-group>
</div> </div>
<div class="list"> <div class="list">
<div class="tip">8. 是否就医</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>7. 是否就医</div>
<v-radio-group v-model="value.bHospital" :disabled="readOnly"> <v-radio-group v-model="value.bHospital" :disabled="status==2">
<div><v-radio :value="0" label="否"/></div> <div><v-radio :value="0" label="否"/></div>
<div><v-radio :value="1" label="是"/></div> <div><v-radio :value="1" label="是"/></div>
</v-radio-group> </v-radio-group>
</div> </div>
<div class="list"> <div class="list">
<div class="tip"><span style="color:red;" v-if="!readOnly">*</span>9. 是否去过疫区(湖北,武汉)</div> <div class="tip"><span style="color:red;" v-if="status!=2">*</span>8. 是否去过疫区(湖北,武汉)</div>
<v-radio-group v-model="value.bHaveBeen" :disabled="readOnly"> <v-radio-group v-model="value.bHaveBeen" :disabled="status==2">
<div><v-radio :value="0" label="否"/></div> <div><v-radio :value="0" label="否"/></div>
<div><v-radio :value="1" label="是"/></div> <div><v-radio :value="1" label="是"/></div>
</v-radio-group> </v-radio-group>
</div> </div>
<div class="list"> <div class="list">
<div class="tip">10. 出行明细</div> <div class="tip">9. 出行明细</div>
<textarea :placeholder="readOnly ? '' : '请输入'" :disabled="readOnly" autoHeight="true" v-model="value.sHaveBeenDetail"/> <textarea :placeholder="readOnly ? '' : '请输入'" :disabled="status==2" autoHeight="true" v-model="value.sHaveBeenDetail"/>
</div> </div>
<div class="list"> <div class="list">
<div class="tip">11. 其他情况</div> <div class="tip">10. 其他情况</div>
<textarea :placeholder="readOnly ? '' : '请输入'" :disabled="readOnly" autoHeight="true" v-model="value.sRemark"/> <textarea :placeholder="readOnly ? '' : '请输入'" :disabled="status==2" autoHeight="true" v-model="value.sRemark"/>
</div> </div>
<button @click="upData" v-if="!readOnly">提交</button> <button @click="upData" v-if="status!=2">{{!status?'提交':'修改'}}</button>
</div> </div>
</template> </template>
...@@ -165,19 +165,19 @@ export default { ...@@ -165,19 +165,19 @@ export default {
nTemperature:'', //体温 nTemperature:'', //体温
sAddress:"", //地址 sAddress:"", //地址
sAddressFull:"", //详细地址 sAddressFull:"", //详细地址
bTouch:0, //是否接触过 bTouch:null, //是否接触过
dTouchDate:null, //接触日期 dTouchDate:null, //接触日期
bQuarantine:0, //是否自我隔离 bQuarantine:null, //是否自我隔离
bHospital:0, //是否自我就医 bHospital:null, //是否自我就医
bHaveBeen:0, //是否去过疫区 bHaveBeen:null, //是否去过疫区
sHaveBeenDetail:"", //出行明细 sHaveBeenDetail:"", //出行明细
sRemark:"", //其他情况 sRemark:"", //其他情况
tCreateTime:"", //创建日期 tCreateTime:"", //创建日期
sCreateAppid:"", //openID sCreateAppid:"", //openID
iStatus:1, iStatus:1,
}, },
status:0,//0 新增,1 修改,2 只读
readOnly:false,//是否只读 readOnly:false,//是否只读
millisecond:"",//毫秒数
} }
}, },
computed:{ computed:{
...@@ -186,16 +186,21 @@ export default { ...@@ -186,16 +186,21 @@ export default {
}) })
}, },
async activated(){ async activated(){
window.d = this; this.status = this.$route.query.readOnly == 'true' ? 2 : 0;
this.readOnly = this.$route.query.readOnly == 'true' ? true : false; if(this.$route.query.readOnly == 'true'){
this.status=2
var date=new Date(Number(this.$route.query.dDate))
if(util.dateFormat(date,"yyyy-MM-dd")==util.dateFormat(new Date(),"yyyy-MM-dd")){
this.status=1
}
}
this.value.sCreateAppid=this.$route.params.openId this.value.sCreateAppid=this.$route.params.openId
if(this.readOnly){ if(this.status>0){
await this.getHealthDate(); await this.getHealthDate();
}else{ }else{
this.value.iEmploeeId=this.$route.params.id this.value.iEmploeeId=this.$route.params.id
this.value.sAddressFull=this.$route.params.address this.value.sAddressFull=this.$route.params.address
} }
this.value.dCheckDate=this.value.tCreateTime=util.dateFormat(new Date(),"yyyy-MM-dd hh:mm:ss") this.value.dCheckDate=this.value.tCreateTime=util.dateFormat(new Date(),"yyyy-MM-dd hh:mm:ss")
}, },
methods:{ methods:{
...@@ -212,17 +217,21 @@ export default { ...@@ -212,17 +217,21 @@ export default {
this.value = res[0]; this.value = res[0];
for(let x in this.value){ for(let x in this.value){
if(util.getType(this.value[x]) == 'boolean'){ if(util.getType(this.value[x]) == 'boolean'){
if(this.value[x]){ // if(this.value[x]){
this.value[x] = 1; // this.value[x] = 1;
}else{ // }else{
this.value[x] = 0; // this.value[x] = 0;
} // }
this.value[x]=this.value[x]?1:0
} }
} }
this.address = this.value.sAddressFull; this.address = this.value.sAddress.split(",");
} }
}, },
inputNum(name){
this.value[name]=parseFloat(this.value[name])
},
logHide(e){ logHide(e){
console.log(e) console.log(e)
}, },
...@@ -234,28 +243,41 @@ export default { ...@@ -234,28 +243,41 @@ export default {
}, },
async upData(){//保存数据 async upData(){//保存数据
if(this.checkData()){ if(this.checkData()){
this.value.iStatus=this.status>0?2:1
var value=await this.request("saveHealth",{ var value=await this.request("saveHealth",{
data:this.value, data:this.value,
},"加载中",{}) },"加载中",{})
if(/^\d+$/.test(value)){ if(/^\d+$/.test(value)){
wx.miniProgram.navigateBack() wx.miniProgram.navigateBack()
}else{ }else{
this.$vux.toast.text('保存失败!', 'middle'); this.$vux.toast.text(this.status>0?'修改失败!':'保存失败!', 'middle');
} }
} }
}, },
checkData(){ checkData(){
this.value.nTemperature=parseFloat(this.value.nTemperature)||0
if(!this.value.sStatus){ if(!this.value.sStatus){
this.$vux.toast.text('健康状态必填!', 'middle'); this.$vux.toast.text('健康状态必填!', 'middle');
return false; return false;
}else if(this.address.length==0){ }else if(this.address.length==0){
this.$vux.toast.text('地址必填!', 'middle'); this.$vux.toast.text('地址必填!', 'middle');
return false; return false;
}else if(!this.value.nTemperature){ }else if(!(this.value.nTemperature>0)){
this.$vux.toast.text('体温必填!', 'middle'); this.$vux.toast.text('体温必填!', 'middle');
return false; return false;
}else if(!/[01]/.test(this.value.bTouch)){
this.$vux.toast.text('是否接触过!', 'middle');
return false;
}else if(!/[01]/.test(this.value.bQuarantine)){
this.$vux.toast.text('是否自我隔离!', 'middle');
return false;
}else if(!/[01]/.test(this.value.bHospital)){
this.$vux.toast.text('是否自我就医!', 'middle');
return false;
}else if(!/[01]/.test(this.value.bHaveBeen)){
this.$vux.toast.text('是否去过疫区!', 'middle');
return false;
} }
this.value.nTemperature=parseFloat(this.value.nTemperature)
this.value.sAddress=this.address.join(",") this.value.sAddress=this.address.join(",")
if(!this.value.bTouch){ if(!this.value.bTouch){
delete this.value.dTouchDate delete this.value.dTouchDate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment