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