Jelajahi Sumber

挂号科室添加三级目录。

lighter 4 tahun lalu
induk
melakukan
f25c8442e6
1 mengubah file dengan 29 tambahan dan 8 penghapusan
  1. 29 8
      src/views/hospital-service/appointment/Appointment.vue

+ 29 - 8
src/views/hospital-service/appointment/Appointment.vue

@@ -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,
     }
   },
 }