From cddb5e6145eee981e21c2d027db80afb9410b371 Mon Sep 17 00:00:00 2001 From: renshen <1005457301@qq.com> Date: Thu, 8 Oct 2026 14:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=BB=8F=E8=90=A5=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=E7=AE=A1=E6=8E=A7=EF=BC=9A=E6=96=B0=E5=A2=9E=E3=80=8C?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=BB=9F=E8=AE=A1=E3=80=8D=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 financial-risk-control 下新增 process-statistics 页面(目录式骨架,先占位: 流程名称/总数量/已完成/待处理/期间),数据源和统计口径确认后再接入。 - 该目录有两个页面了,按目录内页签渲染(复用 section-page-tabs),可以互相切换。 - 侧边栏权限兼容:按页面键只授权过「店铺违规信息预警」的账号也会看到新页面 (两页同属财务经营风险管控权限),并更新相关测试。 --- app/Utilities/SidebarPermissions.php | 23 +++++++++++++ config/business_navigation.php | 17 ++++++++++ resources/views/business/pages/show.blade.php | 3 ++ tests/Feature/Settings/NavigationTest.php | 32 +++++++++++++++++++ .../SystemSettings/UserPermissionsTest.php | 21 +++++++++++- 5 files changed, 95 insertions(+), 1 deletion(-) diff --git a/app/Utilities/SidebarPermissions.php b/app/Utilities/SidebarPermissions.php index 56d134df..e5f02725 100644 --- a/app/Utilities/SidebarPermissions.php +++ b/app/Utilities/SidebarPermissions.php @@ -149,6 +149,29 @@ class SidebarPermissions } unset($section); + // 「财务经营风险管控」新增「流程统计」子页面:按页面键保存过精确权限的账号只会 + // 有 store-violation-alert,会看不到新页面;这里按「能看店铺违规预警 就能看流程统计」 + // 兼容旧配置(两页同属财务经营风险管控权限)。 + foreach ($navigation as &$riskSection) { + if (($riskSection['slug'] ?? null) !== 'financial-risk-control') { + continue; + } + + $pageSlugs = array_column($riskSection['pages'] ?? [], 'slug'); + if (! in_array('store-violation-alert', $pageSlugs, true) || in_array('process-statistics', $pageSlugs, true)) { + continue; + } + + $configuredPages = collect(BusinessNavigation::all()) + ->firstWhere('slug', 'financial-risk-control')['pages'] ?? []; + $statisticsPage = collect($configuredPages)->firstWhere('slug', 'process-statistics'); + + if ($statisticsPage) { + $riskSection['pages'][] = $statisticsPage; + } + } + unset($riskSection); + // 「种菜明细表 / 聚水潭订单标签明细」原先挂在「账单流水数据」下,后来移入新的一级菜单 // 「种菜数据汇总」。按页面键保存过精确权限的账号(访问组/角色)里不会有新的 planting-data, // 会因此看不到这两个被移动的页面;这里按「能看账单流水数据 就能看这两个页面」兼容旧配置。 diff --git a/config/business_navigation.php b/config/business_navigation.php index 4e7d5c6a..7849f8ee 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -844,6 +844,23 @@ $navigation = [ 'icon' => 'security', 'pages' => [ ['slug' => 'store-violation-alert', 'title' => '店铺违规信息预警'], + [ + 'slug' => 'process-statistics', + 'title' => '流程统计', + 'directory' => [ + 'icon' => 'timeline', + 'status' => '待接入', + 'description' => '按流程统计单据数量与处理进度;统计口径和来源确认后接入。', + 'empty' => '流程统计数据源尚未接入。确认统计口径和来源后,这里会显示汇总明细。', + 'fields' => [ + ['name' => 'process_name', 'label' => '流程名称'], + ['name' => 'total_count', 'label' => '总数量', 'kind' => 'integer'], + ['name' => 'completed_count', 'label' => '已完成', 'kind' => 'integer'], + ['name' => 'pending_count', 'label' => '待处理', 'kind' => 'integer'], + ['name' => 'period', 'label' => '期间'], + ], + ], + ], ], ], [ diff --git a/resources/views/business/pages/show.blade.php b/resources/views/business/pages/show.blade.php index 21c66f53..f3274ce1 100644 --- a/resources/views/business/pages/show.blade.php +++ b/resources/views/business/pages/show.blade.php @@ -587,6 +587,9 @@ @include('business.pages.supplier-payables.navigation', ['section' => $supplierWorkspaceSection]) @elseif ($isCourierFinalDirectory) @include('business.pages.partials.section-page-tabs', ['section' => $section]) + @elseif (($section['slug'] ?? '') === 'financial-risk-control') + {{-- 财务经营风险管控下已有多个页面,用目录内页签切换。 --}} + @include('business.pages.partials.section-page-tabs', ['section' => $section]) @endif @if ($tabs->isNotEmpty()) diff --git a/tests/Feature/Settings/NavigationTest.php b/tests/Feature/Settings/NavigationTest.php index 2052694f..711b1c98 100644 --- a/tests/Feature/Settings/NavigationTest.php +++ b/tests/Feature/Settings/NavigationTest.php @@ -131,6 +131,23 @@ class NavigationTest extends FeatureTestCase $this->assertSame('security', $navigation[$riskControlIndex]['icon']); $this->assertSame([ ['slug' => 'store-violation-alert', 'title' => '店铺违规信息预警'], + [ + 'slug' => 'process-statistics', + 'title' => '流程统计', + 'directory' => [ + 'icon' => 'timeline', + 'status' => '待接入', + 'description' => '按流程统计单据数量与处理进度;统计口径和来源确认后接入。', + 'empty' => '流程统计数据源尚未接入。确认统计口径和来源后,这里会显示汇总明细。', + 'fields' => [ + ['name' => 'process_name', 'label' => '流程名称'], + ['name' => 'total_count', 'label' => '总数量', 'kind' => 'integer'], + ['name' => 'completed_count', 'label' => '已完成', 'kind' => 'integer'], + ['name' => 'pending_count', 'label' => '待处理', 'kind' => 'integer'], + ['name' => 'period', 'label' => '期间'], + ], + ], + ], ], $navigation[$riskControlIndex]['pages']); $this->loginAs() @@ -157,6 +174,21 @@ class NavigationTest extends FeatureTestCase ->assertSee('/workspace/financial-risk-control/store-violation-alert', false); } + public function testProcessStatisticsPageIsAvailableUnderRiskControl(): void + { + $this->loginAs() + ->get(route('business.pages.show', [ + 'section' => 'financial-risk-control', + 'page' => 'process-statistics', + ])) + ->assertOk() + ->assertSeeText('流程统计') + ->assertSeeText('流程统计数据源尚未接入。确认统计口径和来源后,这里会显示汇总明细。') + // 目录内页签:两个页面可以互相切换。 + ->assertSee('/workspace/financial-risk-control/store-violation-alert', false) + ->assertSee('/workspace/financial-risk-control/process-statistics', false); + } + public function testGroupedNavigationKeepsRestrictedPagePermissions(): void { $this->user->roles()->sync([Role::where('name', 'manager')->firstOrFail()->id]); diff --git a/tests/Feature/SystemSettings/UserPermissionsTest.php b/tests/Feature/SystemSettings/UserPermissionsTest.php index 96ab6990..e4ac3717 100644 --- a/tests/Feature/SystemSettings/UserPermissionsTest.php +++ b/tests/Feature/SystemSettings/UserPermissionsTest.php @@ -141,7 +141,26 @@ class UserPermissionsTest extends FeatureTestCase $this->assertSame(['financial-risk-control'], array_column($navigation, 'slug')); $this->assertSame( - ['store-violation-alert'], + ['store-violation-alert', 'process-statistics'], + array_column($navigation[0]['pages'], 'slug') + ); + } + + public function test_process_statistics_follows_the_violation_alert_page_permission(): void + { + // 只按页面键授权过的账号(旧配置)也要能看到新增的「流程统计」,与店铺违规预警同权限。 + $regular = $this->account('user'); + $subject = 'user_'.$regular->id; + setting()->set('system.sidebar_permissions', [ + 'configured' => [$subject], + 'subjects' => [$subject => ['financial-risk-control/store-violation-alert']], + ]); + + $navigation = SidebarPermissions::navigationFor($regular); + + $this->assertSame(['financial-risk-control'], array_column($navigation, 'slug')); + $this->assertSame( + ['store-violation-alert', 'process-statistics'], array_column($navigation[0]['pages'], 'slug') ); }