NurseStationApp/pages/information/information.vue

199 lines
5.3 KiB
Vue
Raw Normal View History

2022-10-17 11:21:23 +08:00
<template>
<view class="app">
<view class="" style="background-color: #F4F5F7;height: 20rpx;width:100%">
</view>
<view class="userinfo info">
<view class="item">
<span>姓名:</span>
<u-input v-model="query.patientName" type="text" placeholder='' maxlength='5' />
</view>
<view class="item">
<span>电话:</span>
<u-input v-model="query.phone" maxlength='11' type="text" placeholder='' />
</view>
<view class="item">
<span>身份证号:</span>
<u-input v-model="query.cardNo" type="text" placeholder='' maxlength='18' />
</view>
<view class="item" @tap='areashow=true'>
<span>所属区域:</span>
2022-10-18 08:54:14 +08:00
<view>{{address}}</view>
2022-10-17 11:21:23 +08:00
</view>
<view class="item">
<span>详细地址:</span>
<u-input v-model="query.address" type="text" placeholder='' />
</view>
<view class="item" @tap='getAddress()'>
<span>所在位置:</span>
<view></view>
<!-- <u-input type="text" placeholder='' /> -->
</view>
</view>
2022-10-18 08:54:14 +08:00
<u-select v-model="areashow" mode="mutil-column-auto" label-name='areaName' value-name='areaCode'
:list="arealist" @confirm="areaconfirm"></u-select>
2022-10-17 11:21:23 +08:00
<view class="info">
<view class="service">
<view class="title">
所属服务
</view>
<view class="Multiplechoice">
2022-10-18 08:54:14 +08:00
<view :class="query.nurseTypeIdList.find(e => e == item.id)?'choices':'choice'"
v-for="(item,index) in getNurseTypelist" :key="item.id" @tap="addnurseType(item)">
{{item.nurseTypeName}}
2022-10-17 11:21:23 +08:00
</view>
2022-10-31 09:04:45 +08:00
<view @tap="godisease(item)" :class="query.diseaseInfoList.length>0?'choices':'choice'"
2022-10-18 08:54:14 +08:00
v-for="(item,index) in medicalcarelist" :key="item.id">
2022-10-17 11:21:23 +08:00
{{item.nurseTypeName}}
</view>
</view>
</view>
2022-10-18 08:54:14 +08:00
<u-button type="primary" style='width:30%;float: right;margin-top: 50rpx;' @tap='informationinfo'>提交
</u-button>
2022-10-17 11:21:23 +08:00
</view>
2022-10-18 08:54:14 +08:00
<u-toast ref="uToast" />
2022-10-17 11:21:23 +08:00
</view>
</template>
<script>
import {
getRegionAndStreetInfo,
2022-10-18 08:54:14 +08:00
getNurseType,
information
2022-10-17 11:21:23 +08:00
} from '@/api/information/index.js'
export default {
data() {
return {
arealist: [], //区街道list
areashow: false, //经纬度开关
getNurseTypelist: [], //护理类型数组
2022-10-18 08:54:14 +08:00
medicalcarelist: [], //医疗护理数组
address: '', //页面所属区域
2022-10-17 11:21:23 +08:00
query: { //信息请求数组
patientName: "",
cardNo: "",
phone: "",
address: "",
areaCode: "",
nurseTypeIdList: [],
diseaseInfoList: [],
2022-10-31 09:04:45 +08:00
patientId: '',
2022-10-17 11:21:23 +08:00
}
};
},
methods: {
2022-10-18 08:54:14 +08:00
//提交信息
informationinfo() {
information(this.query).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '完善信息成功',
type: 'success',
url: '',
duration: '1500'
})
2022-10-31 09:04:45 +08:00
// setInterval(() => {
// uni.navigateBack({
// delta: 1, //返回层数2则上上页
// })
// }, 1500);
2022-10-18 08:54:14 +08:00
} else if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
url: ''
})
}
})
2022-10-17 11:21:23 +08:00
},
//获取所在位置
getAddress() {
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
}
});
},
//护理类型请求
getNurseTypeInfo() {
getNurseType().then(res => {
2022-10-18 08:54:14 +08:00
this.medicalcarelist = res.data.filter(e => e.nurseTypeName == '医疗护理')
this.getNurseTypelist = res.data.filter(e => e.nurseTypeName != '医疗护理')
2022-10-17 11:21:23 +08:00
})
},
//区街道
areaInfo() {
getRegionAndStreetInfo().then(res => {
2022-10-18 08:54:14 +08:00
//区下无街道添加一个空街道
2022-10-17 11:21:23 +08:00
res.data.forEach(e => {
if (e.children.length == 0) {
e.children.push({
areaCode: "",
areaName: "暂无街道",
children: null,
id: '',
})
}
})
this.arealist = res.data;
})
},
//区街道选择
areaconfirm(e) {
2022-10-18 08:54:14 +08:00
this.query.areaCode = e[e.length - 1].value
this.address = e[0].label + '-' + e[1].label
2022-10-17 11:21:23 +08:00
},
2022-10-18 08:54:14 +08:00
//点击所需服务
addnurseType(item) {
if (this.query.nurseTypeIdList.findIndex(e => e == item.id) == -1) {
this.query.nurseTypeIdList.push(item.id)
} else {
this.query.nurseTypeIdList = this.query.nurseTypeIdList.filter(e => e != item.id)
}
},
2022-10-31 09:04:45 +08:00
godisease(item) {
2022-10-17 11:21:23 +08:00
uni.navigateTo({
2022-10-18 08:54:14 +08:00
url: `/pages/disease/disease?diseaseInfoList=${JSON.stringify(this.query.diseaseInfoList)}`
2022-10-17 11:21:23 +08:00
})
},
},
2022-10-18 08:54:14 +08:00
//进入界面加载
onLoad() {
2022-10-31 09:04:45 +08:00
let that = this
uni.getStorage({
key: 'patientId',
success: function(res) {
that.query.patientId = res.data
}
});
2022-10-18 08:54:14 +08:00
this.areaInfo()
this.getNurseTypeInfo();
},
//带参返回
onShow() {
let that = this
uni.$on('disease', function(data) {
that.query.diseaseInfoList = JSON.parse(data.disease)
if (that.query.diseaseInfoList.length > 0) {
that.medicalcarelist.forEach(e => {
if (that.query.nurseTypeIdList.findIndex(el => el == e.id) == -1) {
that.query.nurseTypeIdList.push(e.id)
2022-10-31 09:04:45 +08:00
} else {}
})
} else {
console.log(that.query.nurseTypeIdList)
that.medicalcarelist.forEach(e => {
console.log(e)
that.query.nurseTypeIdList = that.query.nurseTypeIdList.filter(el => el != e.id)
2022-10-18 08:54:14 +08:00
})
}
})
}
2022-10-17 11:21:23 +08:00
}
</script>
<style lang="scss">
2022-10-24 14:42:03 +08:00
@import './information.scss';
2022-10-17 11:21:23 +08:00
</style>