From 194a55a03f84534e41ac354edfbf39573fded5bf Mon Sep 17 00:00:00 2001 From: Timi Date: Sat, 12 Sep 2026 16:21:05 +0800 Subject: [PATCH] update home tab --- src/pages/tabs/HomeTab.vue | 210 +++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 79 deletions(-) diff --git a/src/pages/tabs/HomeTab.vue b/src/pages/tabs/HomeTab.vue index d161cb3..2be1ceb 100644 --- a/src/pages/tabs/HomeTab.vue +++ b/src/pages/tabs/HomeTab.vue @@ -1,22 +1,27 @@ @@ -35,32 +40,76 @@ const userStore = useUserStore(); const unreadNotifyCount = ref(0); let isPageActive = true; -const entryList = [ +interface HomeEntry { + path: string; + permission: string; + icon: string; + title: string; +} + +interface HomeEntryGroup { + title: string; + layout?: "customer"; + entryList: HomeEntry[]; +} + +const entryGroupList: HomeEntryGroup[] = [ { - path: "/customer/quick-sign-in", - permission: permissionCodes.eventRecord.create, - icon: "scan", - title: "快速扫码登记", - desc: "扫码选择客户并按配置事件登记", - wide: true + title: "客户管理", + layout: "customer", + entryList: [ + { + path: "/management/customers/create?redirect=/customers", + permission: permissionCodes.customer.create, + icon: "edit-1", + title: "录入" + }, + { + path: "/customer/registration", + permission: permissionCodes.eventRecord.create, + icon: "task-checked", + title: "登记" + }, + { + path: "/customer/quick-sign-in", + permission: permissionCodes.eventRecord.create, + icon: "scan", + title: "快速扫码登记" + } + ] }, { - path: "/management/customers/create?redirect=/customers", - permission: permissionCodes.customer.create, - icon: "edit-1", - title: "录入", - desc: "新建客户档案并完善基础资料" - }, - { - path: "/customer/registration", - permission: permissionCodes.eventRecord.create, - icon: "task-checked", - title: "登记", - desc: "按流程完成客户登记" + title: "订单管理", + entryList: [ + { + path: "/management/sales-orders", + permission: permissionCodes.salesOrder.read, + icon: "task", + title: "订单列表" + }, + { + path: "/management/sales-orders/create", + permission: permissionCodes.salesOrder.create, + icon: "task-add", + title: "创建订单" + }, + { + path: "/management/customer-packages/create", + permission: permissionCodes.customerPackage.create, + icon: "layers", + title: "创建套餐订单" + } + ] } ]; -const visibleEntryList = computed(() => entryList.filter(item => userStore.hasPermissions(item.permission))); +const visibleEntryGroupList = computed(() => entryGroupList + .map(group => ({ + ...group, + entryList: group.entryList.filter(item => userStore.hasPermissions(item.permission)) + })) + .filter(group => group.entryList.length)); +const visibleEntryCount = computed(() => visibleEntryGroupList.value.reduce((count, group) => count + group.entryList.length, 0)); const canReadNotify = computed(() => userStore.hasPermissions(corePermissionCodes.notify.read)); async function go(path: string): Promise { @@ -100,58 +149,60 @@ onUnmounted(() => {