优化选项

This commit is contained in:
阿怪 2023-12-29 00:59:58 +08:00
parent 5c7d95a2be
commit 8733d995ec
2 changed files with 27 additions and 6 deletions

View File

@ -11,10 +11,11 @@
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue' // import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
const store = useStore() const store = useStore()
const h_index = ref(0)
onShow((e) => { onShow((e) => {
getLbtList() getLbtList()
if(store.userInfo && !store.operation_info) { // if(store.userInfo && !store.operation_info) { //
// getHospitalList() getHospitalList()
setTimeout(()=>{ setTimeout(()=>{
inputDialog.value.open() inputDialog.value.open()
},0) },0)
@ -26,7 +27,7 @@
}) })
// //
const hospitals = ref(null) const hospitals = ref([])
// const hospitals_show = ref(false) // const hospitals_show = ref(false)
const inputDialog = ref() const inputDialog = ref()
const inputClose = ref() const inputClose = ref()
@ -52,6 +53,7 @@
const res = await api.getHospitalList(h_queryParams.value) const res = await api.getHospitalList(h_queryParams.value)
if(res.code == 0) { if(res.code == 0) {
hospitals.value = res.data.list hospitals.value = res.data.list
console.log(hospitals.value )
} }
} }
async function getLbtList() { // async function getLbtList() { //
@ -97,7 +99,7 @@
// blur_h.value = 0 // blur_h.value = 0
} }
function toBlur(){ function toBlur(){
hospitals.value = null // hospitals.value = null
} }
async function toSave() { async function toSave() {
if(isSurgery.value == -1) { if(isSurgery.value == -1) {
@ -114,7 +116,9 @@
isSurgery:parseInt(isSurgery.value), isSurgery:parseInt(isSurgery.value),
surgery_time:surgery_time.value, surgery_time:surgery_time.value,
userId:user_info.userId, userId:user_info.userId,
hospitalId:choosed_h.value?.ID // hospitalId:choosed_h.value?.ID
hospitalId:hospitals.value[h_index.value]?.ID
} }
// console.log(h_query);return // console.log(h_query);return
const res = await api.hospital(h_query) const res = await api.hospital(h_query)
@ -169,6 +173,11 @@
url:"/pages/index/note_list?index="+index url:"/pages/index/note_list?index="+index
}) })
} }
function bindPickerChange(e) {
console.log(hospitals.value )
h_index.value = e.detail.value
}
</script> </script>
<template> <template>
<view class="content page-box"> <view class="content page-box">
@ -254,7 +263,10 @@
{{item.name}} {{item.name}}
</view> </view>
</view> --> </view> -->
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox> <!-- <uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox> -->
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
</picker>
</view> </view>
</view> </view>
<view class="pb-item pb-item-btn" @tap="toSave">提交</view> <view class="pb-item pb-item-btn" @tap="toSave">提交</view>

View File

@ -6,7 +6,9 @@
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
const store = useStore() const store = useStore()
import api from "@/api/index.js" import api from "@/api/index.js"
const h_index = ref(0)
onLoad(() => { onLoad(() => {
getHospitalList()
// console.log(useStore.userInfo) // console.log(useStore.userInfo)
userinfo.value = JSON.parse(uni.getStorageSync('userInfo')) userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
console.log(userinfo.value) console.log(userinfo.value)
@ -163,6 +165,10 @@
else{ else{
uni.clearStorage(); uni.clearStorage();
} }
}
function bindPickerChange(e) {
console.log(hospitals.value )
h_index.value = e.detail.value
} }
</script> </script>
<template> <template>
@ -216,8 +222,11 @@
手术医院</view> 手术医院</view>
<view class="rbc-content-row rbc-content-right"> <view class="rbc-content-row rbc-content-right">
<!-- {{h_info?.name}} --> <!-- {{h_info?.name}} -->
<uni-combox :border="false" @input="onInputH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="userinfo.HospitalId"></uni-combox> <!-- <uni-combox :border="false" @input="onInputH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="userinfo.HospitalId"></uni-combox> -->
<!-- <uni-icons type="forward" color="gray" size="20"></uni-icons> --> <!-- <uni-icons type="forward" color="gray" size="20"></uni-icons> -->
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
</picker>
</view> </view>
</view> </view>
</view> </view>