Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
12eb5d03d9
@ -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,
|
||||
// 会因此看不到这两个被移动的页面;这里按「能看账单流水数据 就能看这两个页面」兼容旧配置。
|
||||
|
||||
@ -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' => '期间'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -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')
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user