|
|
@@ -8,6 +8,9 @@
|
|
|
@click-nav="handleSelectNav"
|
|
|
@click-item="handleSelectDept"
|
|
|
/>
|
|
|
+ <van-popup v-model:show="data.showPopup" position="bottom" :style="{ height: '50%' }">
|
|
|
+ <van-picker title="选择子科室" :columns="data.children" @confirm="onConfirm" @cancel="onCancel" />
|
|
|
+ </van-popup>
|
|
|
</window-size>
|
|
|
</template>
|
|
|
|
|
|
@@ -25,28 +28,46 @@ export default {
|
|
|
activeIndex: '',
|
|
|
activeCode: '',
|
|
|
depts: [],
|
|
|
+ children: [],
|
|
|
+ showPopup: false,
|
|
|
})
|
|
|
if (Cookies.get('activeIndex')) {
|
|
|
data.activeIndex = Cookies.get('activeIndex')
|
|
|
}
|
|
|
- onMounted(() => {
|
|
|
- getAllDepartments().then((res) => {
|
|
|
- data.depts = res
|
|
|
- })
|
|
|
- })
|
|
|
+ const onConfirm = (val) => {
|
|
|
+ Cookies.set('appointmentDeptCode', val.id)
|
|
|
+ Cookies.set('appointmentDeptName', val.text)
|
|
|
+ router.push('/selectDoctorAndDate/' + val.id + '/' + val.text)
|
|
|
+ }
|
|
|
+ const onCancel = () => {
|
|
|
+ data.showPopup = false
|
|
|
+ data.activeCode = ''
|
|
|
+ }
|
|
|
const handleSelectNav = (val) => {
|
|
|
Cookies.set('activeIndex', val)
|
|
|
}
|
|
|
const handleSelectDept = (val) => {
|
|
|
- Cookies.set('appointmentDeptCode', val.id)
|
|
|
- Cookies.set('appointmentDeptName', val.text)
|
|
|
- router.push('/selectDoctorAndDate/' + val.id + '/' + val.text)
|
|
|
+ if (val.children) {
|
|
|
+ data.children = val.children
|
|
|
+ data.showPopup = true
|
|
|
+ } else {
|
|
|
+ Cookies.set('appointmentDeptCode', val.id)
|
|
|
+ Cookies.set('appointmentDeptName', val.text)
|
|
|
+ router.push('/selectDoctorAndDate/' + val.id + '/' + val.text)
|
|
|
+ }
|
|
|
}
|
|
|
+ onMounted(() => {
|
|
|
+ getAllDepartments().then((res) => {
|
|
|
+ data.depts = res
|
|
|
+ })
|
|
|
+ })
|
|
|
return {
|
|
|
treeHeight,
|
|
|
handleSelectNav,
|
|
|
handleSelectDept,
|
|
|
data,
|
|
|
+ onConfirm,
|
|
|
+ onCancel,
|
|
|
}
|
|
|
},
|
|
|
}
|