优化选项

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 uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
const store = useStore()
const h_index = ref(0)
onShow((e) => {
getLbtList()
if(store.userInfo && !store.operation_info) { //
// getHospitalList()
getHospitalList()
setTimeout(()=>{
inputDialog.value.open()
},0)
@ -26,7 +27,7 @@
})
//
const hospitals = ref(null)
const hospitals = ref([])
// const hospitals_show = ref(false)
const inputDialog = ref()
const inputClose = ref()
@ -52,6 +53,7 @@
const res = await api.getHospitalList(h_queryParams.value)
if(res.code == 0) {
hospitals.value = res.data.list
console.log(hospitals.value )
}
}
async function getLbtList() { //
@ -97,7 +99,7 @@
// blur_h.value = 0
}
function toBlur(){
hospitals.value = null
// hospitals.value = null
}
async function toSave() {
if(isSurgery.value == -1) {
@ -114,7 +116,9 @@
isSurgery:parseInt(isSurgery.value),
surgery_time:surgery_time.value,
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
const res = await api.hospital(h_query)
@ -169,6 +173,11 @@
url:"/pages/index/note_list?index="+index
})
}
function bindPickerChange(e) {
console.log(hospitals.value )
h_index.value = e.detail.value
}
</script>
<template>
<view class="content page-box">
@ -254,7 +263,10 @@
{{item.name}}
</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 class="pb-item pb-item-btn" @tap="toSave">提交</view>

View File

@ -6,7 +6,9 @@
import {useStore} from '@/store/index.js'
const store = useStore()
import api from "@/api/index.js"
const h_index = ref(0)
onLoad(() => {
getHospitalList()
// console.log(useStore.userInfo)
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
console.log(userinfo.value)
@ -163,6 +165,10 @@
else{
uni.clearStorage();
}
}
function bindPickerChange(e) {
console.log(hospitals.value )
h_index.value = e.detail.value
}
</script>
<template>
@ -216,8 +222,11 @@
手术医院</view>
<view class="rbc-content-row rbc-content-right">
<!-- {{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> -->
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
</picker>
</view>
</view>
</view>