KnowledgePointQuestionStats.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Filament\Pages;
  3. use App\Services\KnowledgePointQuestionStatsService;
  4. use BackedEnum;
  5. use Filament\Pages\Page;
  6. use Filament\Support\Enums\Width;
  7. use Livewire\Attributes\Computed;
  8. use UnitEnum;
  9. class KnowledgePointQuestionStats extends Page
  10. {
  11. protected static ?string $title = '知识点题量统计';
  12. protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-table-cells';
  13. protected static ?string $navigationLabel = '知识点题量统计';
  14. protected static string|UnitEnum|null $navigationGroup = '题库管理';
  15. protected static ?int $navigationSort = 6;
  16. protected Width|string|null $maxContentWidth = Width::Full;
  17. protected string $view = 'filament.pages.knowledge-point-question-stats';
  18. /** @return list<array{kp_code: string, kp_name: string, questions_count: int, tem_non_duplicate_count: int, sort_order: int}> */
  19. #[Computed(cache: false)]
  20. public function statRows(): array
  21. {
  22. return app(KnowledgePointQuestionStatsService::class)->buildRows();
  23. }
  24. #[Computed(cache: false)]
  25. public function markdownExport(): string
  26. {
  27. return app(KnowledgePointQuestionStatsService::class)->toMarkdownTable($this->statRows);
  28. }
  29. }