同步主体维度经营报表页面 #103

Merged
yueyang merged 1 commits from fix/yueyang-subject-operating-report into main 2026-09-04 17:40:45 +08:00
4 changed files with 45 additions and 3 deletions

View File

@ -144,6 +144,7 @@ class TableRegistry
{
return [
'company-management/basic-information' => CompanyInformation::class,
'company-management/subject-operating-report' => StoreInformation::class,
'company-management/registration' => CompanyRegistration::class,
'company-management/changes' => CompanyChange::class,
'company-management/cancellation' => CompanyCancellation::class,
@ -252,6 +253,7 @@ class TableRegistry
{
return in_array("{$section}/{$page}", [
'company-management/basic-information',
'company-management/subject-operating-report',
'store-management/basic-information',
'store-management/store-report',
'trademark-management/information',

View File

@ -11,9 +11,9 @@ return [
'title' => '主体维度经营报表',
'directory' => [
'icon' => 'query_stats',
'status' => '尚未同步',
'description' => '按店铺唯一 ID 和主体生效、失效日期归属销量;自动汇总前,先固定 Excel 中的报表字段。',
'empty' => '经营报表尚未同步。完成店铺主体和销量镜像接入后,这里会显示可追溯的主体数据。',
'status' => '共享镜像',
'description' => '店铺主体和销量统一读取团队共享业务镜像;销量按主体生效区间归属并汇总。',
'empty' => '经营报表共享镜像尚未完成同步。',
'fields' => [
['name' => 'city', 'label' => '市'],
['name' => 'entity', 'label' => '主体'],

View File

@ -366,6 +366,11 @@
<span class="material-icons-outlined" aria-hidden="true">visibility</span>
<span>当前页面只读显示既有上游资料;未匹配的 Excel 字段保留为空,不代表业务上没有数据。</span>
</div>
@elseif (($directory['status'] ?? null) === '共享镜像' && $directoryTotal > 0)
<div class="directory-table-notice" role="status">
<span class="material-icons-outlined" aria-hidden="true">cloud_done</span>
<span>当前显示团队共享业务镜像数据,分页和汇总均基于已同步镜像。</span>
</div>
@else
<div class="directory-table-notice" role="status">
<span class="material-icons-outlined" aria-hidden="true">sync_problem</span>

View File

@ -2,7 +2,10 @@
namespace Tests\Feature\Business;
use App\Business\UpstreamBusinessInformation;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Carbon;
use Mockery;
use Tests\Feature\FeatureTestCase;
class PrototypePageTest extends FeatureTestCase
@ -33,6 +36,38 @@ class PrototypePageTest extends FeatureTestCase
->assertOk()->assertSeeText('请连接团队共享数据库')->assertDontSeeText('共 0 条');
}
public function testSubjectOperatingReportReadsSharedStoreReportRows(): void
{
$service = Mockery::mock(UpstreamBusinessInformation::class);
$service->shouldReceive('paginate')->once()->with('company-management', 'subject-operating-report', 50)
->andReturn(new LengthAwarePaginator([
(object) [
'entity' => '测试主体',
'erp_store_name' => '测试店铺',
'recent_three_month_sales_1' => 10,
'recent_three_month_sales_2' => 20,
'recent_three_month_sales_3' => 30,
'store_sales_12m' => 60,
'entity_sales_12m' => 60,
],
], 1, 50, 1, ['path' => '/']));
$this->app->instance(UpstreamBusinessInformation::class, $service);
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'company-management',
'page' => 'subject-operating-report',
]))
->assertOk()
->assertSeeText('共享镜像')
->assertSeeText('测试主体')
->assertSeeText('测试店铺')
->assertSeeText('共 1 条')
->assertSeeText('当前显示团队共享业务镜像数据')
->assertDontSeeText('经营报表尚未同步。完成店铺主体和销量镜像接入后')
->assertDontSeeText('经营报表共享镜像尚未完成同步。');
}
protected function tearDown(): void
{
Carbon::setTestNow();