feat: multi diagrams
This commit is contained in:
@@ -101,12 +101,27 @@ class TerminalResource extends Resource
|
||||
|
||||
Forms\Components\Section::make('组态配置')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('diagram_url')
|
||||
Forms\Components\Repeater::make('diagram_urls')
|
||||
->label('组态界面地址')
|
||||
->url()
|
||||
->maxLength(500)
|
||||
->placeholder('https://example.com/diagram.png')
|
||||
->helperText('组态界面的访问地址'),
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')
|
||||
->label('标题')
|
||||
->required()
|
||||
->maxLength(100)
|
||||
->placeholder('例如: 主组态'),
|
||||
Forms\Components\TextInput::make('url')
|
||||
->label('地址')
|
||||
->required()
|
||||
->url()
|
||||
->maxLength(500)
|
||||
->placeholder('https://example.com/diagram.html'),
|
||||
])
|
||||
->columns(2)
|
||||
->defaultItems(0)
|
||||
->addActionLabel('添加组态地址')
|
||||
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
|
||||
->collapsible()
|
||||
->reorderable(),
|
||||
]),
|
||||
|
||||
Forms\Components\Section::make('网关配置')
|
||||
|
||||
@@ -45,12 +45,19 @@ class ViewTerminal extends ViewRecord
|
||||
|
||||
Infolists\Components\Section::make('组态配置')
|
||||
->schema([
|
||||
Infolists\Components\TextEntry::make('diagram_url')
|
||||
Infolists\Components\RepeatableEntry::make('diagram_urls')
|
||||
->label('组态界面地址')
|
||||
->copyable()
|
||||
->placeholder('未设置')
|
||||
->url(fn($state) => $state)
|
||||
->openUrlInNewTab(),
|
||||
->schema([
|
||||
Infolists\Components\TextEntry::make('title')
|
||||
->label('标题'),
|
||||
Infolists\Components\TextEntry::make('url')
|
||||
->label('地址')
|
||||
->copyable()
|
||||
->url(fn ($state) => $state)
|
||||
->openUrlInNewTab(),
|
||||
])
|
||||
->columns(2)
|
||||
->placeholder('未设置'),
|
||||
]),
|
||||
|
||||
Infolists\Components\Section::make('AI提示词配置')
|
||||
|
||||
@@ -37,7 +37,10 @@ class TerminalApiController extends Controller
|
||||
'terminal_name' => $terminal->name,
|
||||
'terminal_code' => $terminal->code,
|
||||
'station_name' => $terminal->station?->name,
|
||||
'diagram_url' => $terminal->diagram_url,
|
||||
'diagram_urls' => collect($terminal->diagram_urls ?? [])->values()->map(fn ($item) => [
|
||||
'title' => $item['title'] ?? '',
|
||||
'url' => $item['url'] ?? '',
|
||||
])->all(),
|
||||
'scada_data_url' => $terminal->scada_data_url,
|
||||
'scada_tags_url' => $terminal->scada_tags_url,
|
||||
'voice_wakeup_enabled' => $terminal->voice_wakeup_enabled,
|
||||
|
||||
@@ -23,7 +23,7 @@ class Terminal extends Model
|
||||
'ip_address',
|
||||
'mac_address',
|
||||
'station_id',
|
||||
'diagram_url',
|
||||
'diagram_urls',
|
||||
'scada_data_url',
|
||||
'scada_tags_url',
|
||||
'voice_wakeup_enabled',
|
||||
@@ -40,6 +40,7 @@ class Terminal extends Model
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'diagram_urls' => 'array',
|
||||
'voice_wakeup_enabled' => 'boolean',
|
||||
'is_online' => 'boolean',
|
||||
'last_online_at' => 'datetime',
|
||||
@@ -74,7 +75,7 @@ class Terminal extends Model
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->logOnly(['name', 'code', 'station_id', 'diagram_url'])
|
||||
->logOnly(['name', 'code', 'station_id', 'diagram_urls'])
|
||||
->logOnlyDirty()
|
||||
->setDescriptionForEvent(fn(string $eventName) => "终端已{$eventName}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user