feat: 更新医院选择功能,支持医院ID
This commit is contained in:
parent
bacbffa2c2
commit
7a1a129a56
@ -12,10 +12,10 @@
|
||||
</view>
|
||||
</template>
|
||||
<scroll-view v-if="list.length" class="h-full bg-white" scroll-y="true">
|
||||
<view v-for="i in list" :key="`filter-${i.hospitalId}`" class="flex items-center px-15 py-12 border-b"
|
||||
<view v-for="i in list" :key="`filter-${getHospitalId(i)}`" class="flex items-center px-15 py-12 border-b"
|
||||
@click="select(i)">
|
||||
<view class="mr-10 w-0 flex-grow text-base text-dark">{{ i.name }}</view>
|
||||
<image v-if="hospital && hospital.hospitalId === i.hospitalId" class="flex-shrink-0 icon-checked"
|
||||
<image v-if="hospital && getHospitalId(hospital) === getHospitalId(i)" class="flex-shrink-0 icon-checked"
|
||||
src="/static/form/checked.svg" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -52,6 +52,10 @@ function select(i) {
|
||||
hospital.value = i;
|
||||
}
|
||||
|
||||
function getHospitalId(item) {
|
||||
return item?.hospitalId || item?._id || "";
|
||||
}
|
||||
|
||||
function getMore() {
|
||||
if (hasMore.value && !loading.value) {
|
||||
changePage(page.value + 1)
|
||||
@ -60,7 +64,11 @@ function getMore() {
|
||||
|
||||
function save() {
|
||||
if (hospital.value) {
|
||||
uni.$emit(eventName.value, hospital.value.name)
|
||||
uni.$emit(eventName.value, {
|
||||
hospitalId: getHospitalId(hospital.value),
|
||||
hospitalName: hospital.value.name || hospital.value.hospitalName || "",
|
||||
name: hospital.value.name || hospital.value.hospitalName || "",
|
||||
})
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
toast('请选择医院')
|
||||
|
||||
@ -78,7 +78,13 @@ function selectHospital() {
|
||||
url: `/pages/work/hospital-select?eventName=${eventName}`
|
||||
})
|
||||
uni.$once(eventName, data => {
|
||||
form.value.hospitalName = data
|
||||
if (typeof data === 'string') {
|
||||
form.value.hospitalName = data
|
||||
form.value.hospitalId = ''
|
||||
} else {
|
||||
form.value.hospitalName = data?.hospitalName || data?.name || ''
|
||||
form.value.hospitalId = data?.hospitalId || data?._id || ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -110,6 +116,7 @@ async function save() {
|
||||
return toast('请上传医师执业资格证第二页')
|
||||
}
|
||||
const data = {
|
||||
hospitalId: formData.value.hospitalId || '',
|
||||
hospitalName: formData.value.hospitalName,
|
||||
medicalLicenseFront: formData.value.medicalLicenseFront,
|
||||
medicalLicenseBack: formData.value.medicalLicenseBack,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user