| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace App\Filament\Pages\Integrations;
- use BackedEnum;
- use Filament\Pages\Page;
- use UnitEnum;
- use Livewire\Attributes\Computed;
- use Illuminate\Http\Request;
- use App\Livewire\Integrations\KnowledgeGraphComponent;
- use App\Livewire\Integrations\KnowledgePointsListComponent;
- use App\Livewire\Integrations\KnowledgePointStatsComponent;
- use App\Livewire\Integrations\KnowledgeNetworkComponent;
- class KnowledgeGraphIntegration extends Page
- {
- protected static ?string $title = '知识图谱整合视图';
- protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-globe-alt';
- protected static ?string $navigationLabel = '知识图谱整合';
- protected static string|UnitEnum|null $navigationGroup = null;
- protected static ?int $navigationSort = 7;
- protected static bool $shouldRegisterNavigation = false;
- protected string $view = 'filament.pages.integrations.knowledge-graph-integration';
- public ?string $selectedKpCode = null;
- public string $activeTab = 'graph';
- public bool $showSidebar = true;
- public function mount(Request $request): void
- {
- $this->selectedKpCode = $request->query('kp_code');
- $this->activeTab = $request->query('tab', 'graph');
- }
- #[Computed]
- public function tabs()
- {
- return [
- 'graph' => [
- 'label' => '知识图谱',
- 'icon' => 'heroicon-o-share',
- 'component' => 'knowledge-graph',
- ],
- 'list' => [
- 'label' => '知识点列表',
- 'icon' => 'heroicon-o-list-bullet',
- 'component' => 'knowledge-points-list',
- ],
- 'stats' => [
- 'label' => '题库统计',
- 'icon' => 'heroicon-o-chart-bar',
- 'component' => 'knowledge-point-stats',
- ],
- 'network' => [
- 'label' => '关联网络',
- 'icon' => 'heroicon-o-squares-2x2',
- 'component' => 'knowledge-network',
- ],
- ];
- }
- public function setActiveTab(string $tab): void
- {
- $this->activeTab = $tab;
- $this->dispatch('tabChanged', tab: $tab);
- }
- public function toggleSidebar()
- {
- $this->showSidebar = !$this->showSidebar;
- }
- public function clearSelection()
- {
- $this->selectedKpCode = null;
- $this->dispatch('clearAllSelections');
- }
- public function updatedSelectedKpCode($value)
- {
- if ($value) {
- $this->dispatch('kpSelected', kpCode: $value);
- }
- }
- public function getBreadcrumbs(): array
- {
- return [
- 'knowledge-graph-integration' => '知识图谱整合视图',
- ];
- }
- }
|