feat(财务台账): 移入经营报表快捷分组 #446

Merged
DoDo merged 1 commits from feature/WuYongJie-finance-ledger-menu into main 2026-10-21 20:50:25 +08:00
4 changed files with 27 additions and 4 deletions

View File

@ -113,9 +113,13 @@ class ShowInAdmin
continue;
}
$sectionPages = array_values(array_filter(
$section['pages'] ?? [],
static fn (array $page): bool => ($page['show_in_section_menu'] ?? true) !== false
));
$pages = $section['slug'] === 'order-data'
? array_values($section['pages'] ?? [])
: $this->sortByTitleLength($section['pages'] ?? []);
? $sectionPages
: $this->sortByTitleLength($sectionPages);
$order = ($sectionIndex + 1) * 10;
if (empty($pages) || in_array($section['slug'], self::WORKSPACE_SECTION_SLUGS, true)) {

View File

@ -20,6 +20,7 @@ class SidebarMenu
['workspace', 'overview', '经营总览', 'monitoring'],
]],
['title' => '经营报表', 'items' => [
['financial-operations', 'ledger', '财务台账', 'menu_book'],
['company-management', 'subject-operating-report', '主体维度经营报表', 'domain'],
['company-management', 'company-cost-arrangement', '公司成本安排', 'account_balance_wallet'],
['company-management', 'tax-forecast', '税金预测表', 'calculate'],

View File

@ -881,7 +881,7 @@ $navigation = [
['slug' => 'bookkeeping-details', 'title' => '记账明细'],
['slug' => 'non-operating-expenses', 'title' => '营业外支出'],
['slug' => 'financial-analysis', 'title' => '财务经营分析表'],
['slug' => 'ledger', 'title' => '财务台账'],
['slug' => 'ledger', 'title' => '财务台账', 'show_in_section_menu' => false],
],
],
[

View File

@ -6,6 +6,7 @@ use App\Models\Auth\Permission;
use App\Models\Auth\Role;
use App\Models\Auth\User;
use App\Utilities\BusinessNavigation;
use App\Utilities\SidebarMenu;
use App\Utilities\SidebarPermissions;
use Tests\Feature\FeatureTestCase;
@ -21,6 +22,21 @@ class FinanceLedgerNavigationTest extends FeatureTestCase
$this->assertFalse($navigation->has('financial-ledger'));
}
public function test_ledger_is_the_first_quick_link_under_operating_reports(): void
{
$this->loginAs();
$reports = collect(SidebarMenu::groups($this->user))->firstWhere('title', '经营报表');
$this->assertNotNull($reports);
$this->assertSame([
'section' => 'financial-operations',
'page' => 'ledger',
'title' => '财务台账',
'icon' => 'menu_book',
], $reports['items'][0]);
}
public function test_ledger_page_and_legacy_link_open_under_financial_operations(): void
{
$this->loginAs();
@ -30,7 +46,7 @@ class FinanceLedgerNavigationTest extends FeatureTestCase
'page' => 'ledger',
]);
$this->get($target . '?tab=flows')
$response = $this->get($target . '?tab=flows')
->assertOk()
->assertSeeText('财务经营报表')
->assertSeeText('财务台账')
@ -38,6 +54,8 @@ class FinanceLedgerNavigationTest extends FeatureTestCase
->assertSee('data-ledger-tab="flows"', false)
->assertSee($target . '?tab=accounts', false);
$this->assertSame(1, substr_count($response->getContent(), 'href="' . e($target) . '"'));
$legacy = route('business.pages.show', [
'section' => 'financial-ledger',
'page' => 'ledger',