BatchProduct.php 720 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Admin\Actions\Grid;
  3. use App\Admin\Actions\Form\BatchEditProductForm;
  4. use Dcat\Admin\Grid\BatchAction;
  5. use Dcat\Admin\Widgets\Modal;
  6. class BatchProduct extends BatchAction
  7. {
  8. /**
  9. * @return string
  10. */
  11. protected $title = '批量设置';
  12. public function render()
  13. {
  14. $form = BatchEditProductForm::make();
  15. return Modal::make()
  16. ->lg()
  17. ->title($this->title)
  18. ->body($form)
  19. ->onLoad($this->getModalScript())
  20. ->button($this->title);
  21. }
  22. protected function getModalScript()
  23. {
  24. return <<<JS
  25. //获取选中的ID
  26. let key = {$this->getSelectedKeysScript()}
  27. $("#batch-id").val(key)
  28. JS;
  29. }
  30. }