|
@@ -1,5 +1,6 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import type { NotificationItem } from '@vben/layouts';
|
|
import type { NotificationItem } from '@vben/layouts';
|
|
|
|
|
+import type { MenuRecordRaw } from '@vben/types';
|
|
|
|
|
|
|
|
import { computed, ref, watch } from 'vue';
|
|
import { computed, ref, watch } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
@@ -39,38 +40,19 @@ async function handleLogout() {
|
|
|
await authStore.logout(false);
|
|
await authStore.logout(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const dropdownMenus = computed(() => [
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('system.medicalInstitution._'),
|
|
|
|
|
- icon: 'mdi:hospital-building',
|
|
|
|
|
- handler: () => router.push('/system/organization'),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('system.enterprise.title'),
|
|
|
|
|
- icon: 'mdi:account-group',
|
|
|
|
|
- handler: () => router.push('/system/enterprise'),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('system.tisane.title'),
|
|
|
|
|
- icon: 'mdi:pill-multiple',
|
|
|
|
|
- handler: () => router.push('/system/tisane'),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('system.role.title'),
|
|
|
|
|
- icon: 'charm:organisation',
|
|
|
|
|
- handler: () => router.push('/system/role'),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('system.user.title'),
|
|
|
|
|
- icon: 'mdi:account-group',
|
|
|
|
|
- handler: () => router.push('/system/user'),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- text: $t('prescription.title'),
|
|
|
|
|
- icon: 'ion:settings-outline',
|
|
|
|
|
- handler: () => router.push('/prescription/management'),
|
|
|
|
|
- },
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+function collectLeafMenus(menus: MenuRecordRaw[]): MenuRecordRaw[] {
|
|
|
|
|
+ return menus.flatMap((menu) =>
|
|
|
|
|
+ menu.children?.length ? collectLeafMenus(menu.children) : [menu],
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const dropdownMenus = computed(() =>
|
|
|
|
|
+ collectLeafMenus(accessStore.accessMenus).map((menu) => ({
|
|
|
|
|
+ text: $t(menu.name),
|
|
|
|
|
+ icon: menu.icon ?? 'mdi:circle-small',
|
|
|
|
|
+ handler: () => router.push(menu.path),
|
|
|
|
|
+ })),
|
|
|
|
|
+);
|
|
|
|
|
|
|
|
watch(
|
|
watch(
|
|
|
() => preferences.app.watermark,
|
|
() => preferences.app.watermark,
|