Files

203 lines
5.6 KiB
Vue

<template>
<view>
<scroll-view scroll-y class="page">
<cu-custom bgColor="bg-cyan" :isBack="true"><block slot="backText">返回</block><block slot="content">人员填报</block></cu-custom>
<view class="photoView">
<view class="photoImage">
<open-data type="userAvatarUrl"></open-data>
</view>
</view>
<form action="">
<view class="cu-form-group margin-top">
<view class="title">医院名称</view>
<input name="hospital" v-model="hospital"></input>
</view>
<view class="cu-form-group">
<view class="title">分院名称</view>
<input name="sortHospital" v-model="sortHospital"></input>
</view>
<view class="cu-form-group">
<view class="title">科室名称</view>
<input placeholder="请输入科室名称" name="department" v-model="department"></input>
</view>
<view class="cu-form-group">
<view class="title">职务名称</view>
<input name="duty" :value="duty" disabled="true"></input>
</view>
<view class="cu-form-group">
<view class="title">二维码编码</view>
<input name="userCode" :value="userCode" disabled="true"></input>
</view>
<view class="cu-form-group">
<view class="title">身份证号码</view>
<input placeholder="请输入身份证号码" name="idcard" v-model="idcard" @input="getIdcard"></input>
</view>
<view class="cu-form-group">
<view class="title">人员名称</view>
<input placeholder="请输入人员名称" name="name" v-model="name"></input>
</view>
<view class="cu-form-group">
<view class="title">手机号码</view>
<input placeholder="请输入手机号码" name="phone" v-model="phone"></input>
</view>
</form>
<view class="padding flex flex-direction" style="padding-top: 20%;">
<button class="cu-btn round bg-cyan margin-tb-sm lg" @click="buttonClick">人员配置</button>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
hospital: '',
sortHospital: '',
department: '',
duty: '',
idcard: '',
userCode: '',
name: '',
phone: ''
}
},
onLoad(e) {
this.userCode = e.qrcode
var str = e.qrcode.substr(0,3)
if (str === "r06") {
this.duty = '交接人员'
} else if (str === 'r07') {
this.duty = '收集人员'
} else if (str === 'r17') {
this.duty = '收集人员'
} else if (str === 'r08') {
this.duty = '转运人员'
} else if (str === 'r09') {
this.duty = '保洁人员'
} else if (str === 'r16') {
this.duty = '交接人员'
} else if (str === 'r18') {
this.duty = '转运人员'
} else if (str === 'r36') {
this.duty = '交接人员'
}
this.getUserIsExist();
},
methods: {
getIdcard: function(e){
this.idcard = e.target.value
},
getName: function(e){
this.name = e.target.value
},
getPhone: function(e){
this.phone = e.target.value
},
getUserIsExist() {
let that = this
uni.request({
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getUserIsExist',
data: {
userCode: that.userCode
},
header: {
'Content-type': 'application/json'
},
success: function(res) {
if(res.data.data.hospital === '' || res.data.data.hospital === null) {
that.hospital = getApp().globalData.hospital
} else {
that.hospital = res.data.data.hospital
}
if(res.data.data.sortHospital === '' || res.data.data.sortHospital === null){
that.sortHospital = getApp().globalData.sortHospital
} else {
that.sortHospital = res.data.data.sortHospital
}
that.department = res.data.data.dept_name
that.idcard = res.data.data.id_card
that.name = res.data.data.name
that.phone = res.data.data.phone
that.userCode = res.data.data.user_qrcode
},
fail: () => {
console.info('小程序域名不正确,请检查域名正确性')
}
})
},
buttonClick(e) {
let that = this;
uni.showLoading({
title: '页面跳转中',
mask: true,
success: function(res) {
let new_that = that;
// console.info(new_that.hospital,new_that.sortHospital,new_that.department,new_that.duty,new_that.name,new_that.idcard,new_that.userCode,new_that.phone)
uni.request({
url: 'https://lekapi.opmonitor.com/?c=app_api&a=PostUserInfo',
data: {
hospital: new_that.hospital,
sortHospital: new_that.sortHospital,
department: new_that.department,
duty: new_that.duty,
name: new_that.name,
id_card: new_that.idcard,
user_qrcode: new_that.userCode,
phone: new_that.phone
},
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
method: 'POST',
success: function(res){
console.info(res.data.data)
if(res.data.data === 'success'){
uni.navigateTo({
url: '/pages/index/index'
})
}
},
fail: () => {
console.info('小程序域名不正确,请检查域名正确性')
}
})
}
})
}
}
}
</script>
<style>
.page {
width: 100vw;
height: 120Vh;
}
.photoView {
padding-top: 50rpx;
position: relative;
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
}
.photoImage {
overflow:hidden;
display: block;
width: 200rpx;
height: 200rpx;
margin: 20rpx;
border-radius: 50%;
border: 2px solid #fff;
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
}
.cu-form-group .title{
min-width: calc(4em + 15px);
font-weight: 600;
}
.picker {
text-align: left;
}
</style>