fix: 隐藏空的日志扣分统计区 #894
@ -375,13 +375,21 @@
|
||||
'date' => $worklogCurrent['statistics_date'],
|
||||
'details' => 1,
|
||||
]) . '#worklog-detail';
|
||||
$hasWorklogPenalty = $worklogPenaltyError !== null || $worklogPenalty['members'] !== [];
|
||||
@endphp
|
||||
<div class="log-statistics-cards">
|
||||
<a class="log-statistics-card is-link" href="#worklog-penalty" title="点击查看扣分明细">
|
||||
<span>{{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计</span>
|
||||
<strong>{{ $worklogPenalty['total_points_formatted'] }}</strong>
|
||||
<span class="log-statistics-card__hint">点击查看扣分明细</span>
|
||||
</a>
|
||||
@if ($hasWorklogPenalty)
|
||||
<a class="log-statistics-card is-link" href="#worklog-penalty" title="点击查看扣分明细">
|
||||
<span>{{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计</span>
|
||||
<strong>{{ $worklogPenalty['total_points_formatted'] }}</strong>
|
||||
<span class="log-statistics-card__hint">点击查看扣分明细</span>
|
||||
</a>
|
||||
@else
|
||||
<div class="log-statistics-card">
|
||||
<span>{{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计</span>
|
||||
<strong>{{ $worklogPenalty['total_points_formatted'] }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
<a class="log-statistics-card is-link" href="{{ $currentDetailsUrl }}" title="点击查看提交人明细">
|
||||
<span>{{ $worklogCurrent['statistics_date'] }} 提交人数</span>
|
||||
<strong>{{ number_format((int) $worklogCurrent['submitter_count']) }}</strong>
|
||||
@ -504,46 +512,46 @@
|
||||
</section>
|
||||
@endif
|
||||
|
||||
<section id="worklog-penalty" class="log-statistics-panel" aria-label="日志漏写扣分统计" data-worklog-penalty>
|
||||
<div class="log-statistics-panel__head">
|
||||
<strong>日志漏写扣分统计</strong>
|
||||
<span>
|
||||
@if ($worklogPenalty['start_date'])
|
||||
{{ $worklogPenalty['start_date'] }} 至 {{ $worklogPenalty['end_date'] }} · 合计 {{ $worklogPenalty['total_points_formatted'] }} 分
|
||||
@else
|
||||
暂无已截止统计日
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
@if ($worklogPenaltyError)
|
||||
<div class="log-statistics-empty">{{ $worklogPenaltyError }}</div>
|
||||
@elseif ($worklogPenalty['members'] === [])
|
||||
<div class="log-statistics-empty">当前时间范围暂无漏写扣分记录。</div>
|
||||
@else
|
||||
<div class="log-statistics-table-wrap">
|
||||
<table class="log-statistics-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>姓名</th>
|
||||
<th>漏写次数</th>
|
||||
<th>漏写日期</th>
|
||||
<th>扣分计算</th>
|
||||
<th>累计扣分</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($worklogPenalty['members'] as $penalty)
|
||||
<tr>
|
||||
<td>{{ $penalty['name'] }}</td>
|
||||
<td class="is-number">{{ number_format((int) $penalty['missed_count']) }}</td>
|
||||
<td class="is-wrapped">{{ implode('、', $penalty['missed_dates']) }}</td>
|
||||
<td class="is-wrapped">{{ $penalty['penalty_formula'] }}</td>
|
||||
<td class="is-number"><strong>{{ $penalty['penalty_points_formatted'] }}</strong></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@if ($hasWorklogPenalty)
|
||||
<section id="worklog-penalty" class="log-statistics-panel" aria-label="日志漏写扣分统计" data-worklog-penalty>
|
||||
<div class="log-statistics-panel__head">
|
||||
<strong>日志漏写扣分统计</strong>
|
||||
<span>
|
||||
@if ($worklogPenalty['start_date'])
|
||||
{{ $worklogPenalty['start_date'] }} 至 {{ $worklogPenalty['end_date'] }} · 合计 {{ $worklogPenalty['total_points_formatted'] }} 分
|
||||
@else
|
||||
暂无已截止统计日
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@if ($worklogPenaltyError)
|
||||
<div class="log-statistics-empty">{{ $worklogPenaltyError }}</div>
|
||||
@else
|
||||
<div class="log-statistics-table-wrap">
|
||||
<table class="log-statistics-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>姓名</th>
|
||||
<th>漏写次数</th>
|
||||
<th>漏写日期</th>
|
||||
<th>扣分计算</th>
|
||||
<th>累计扣分</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($worklogPenalty['members'] as $penalty)
|
||||
<tr>
|
||||
<td>{{ $penalty['name'] }}</td>
|
||||
<td class="is-number">{{ number_format((int) $penalty['missed_count']) }}</td>
|
||||
<td class="is-wrapped">{{ implode('、', $penalty['missed_dates']) }}</td>
|
||||
<td class="is-wrapped">{{ $penalty['penalty_formula'] }}</td>
|
||||
<td class="is-number"><strong>{{ $penalty['penalty_points_formatted'] }}</strong></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@ -188,6 +188,51 @@ class PagesTest extends FeatureTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testLogStatisticsPageHidesTheEmptyPenaltyPanel(): void
|
||||
{
|
||||
Carbon::setTestNow(Carbon::parse('2026-11-05 15:00:00', 'Asia/Shanghai'));
|
||||
|
||||
$repository = Mockery::mock(DingWorklogMirrorRepository::class);
|
||||
$repository->shouldReceive('available')->andReturnTrue();
|
||||
$repository->shouldReceive('state')->once()->andReturn([
|
||||
'status' => 'succeeded',
|
||||
'last_error_code' => null,
|
||||
'last_attempted_at' => '2026-11-05 14:00:00',
|
||||
'last_succeeded_at' => '2026-11-05 14:00:00',
|
||||
'mirror_row_count' => 1,
|
||||
]);
|
||||
$repository->shouldReceive('dailySummary')->once()->andReturn([]);
|
||||
$repository->shouldNotReceive('submissionsForDate');
|
||||
$repository->shouldNotReceive('permissionApplyUrl');
|
||||
$this->app->instance(DingWorklogMirrorRepository::class, $repository);
|
||||
|
||||
$penalty = Mockery::mock(DingWorklogPenaltyCalculator::class);
|
||||
$penalty->shouldReceive('summary')->once()->andReturn([
|
||||
'start_date' => '2026-11-04',
|
||||
'end_date' => '2026-11-04',
|
||||
'total_points' => '0',
|
||||
'total_points_formatted' => '0',
|
||||
'members' => [],
|
||||
]);
|
||||
$this->app->instance(DingWorklogPenaltyCalculator::class, $penalty);
|
||||
|
||||
try {
|
||||
$this->loginAs()
|
||||
->get(route('business.pages.show', [
|
||||
'section' => 'other',
|
||||
'page' => 'log-statistics',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSeeText('2026-11-04 起扣分合计')
|
||||
->assertDontSeeText('点击查看扣分明细')
|
||||
->assertDontSeeText('日志漏写扣分统计')
|
||||
->assertDontSeeText('当前时间范围暂无漏写扣分记录。')
|
||||
->assertDontSee('id="worklog-penalty"', false);
|
||||
} finally {
|
||||
Carbon::setTestNow();
|
||||
}
|
||||
}
|
||||
|
||||
public function testInventoryReportProvidesAFilteredExportButton(): void
|
||||
{
|
||||
InventoryWarehouseNameMapping::query()->create([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user