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