PageCache.php 929 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: OneDark
  5. * Date: 2018/9/29
  6. * Time: 13:44
  7. */
  8. namespace App\Admin\Extensions\Tools;
  9. use Encore\Admin\Grid\Tools\BatchAction;
  10. class PageCache extends BatchAction {
  11. protected $action;
  12. public function __construct($action = 0)
  13. {
  14. $this->action = $action;
  15. }
  16. public function script()
  17. {
  18. return <<<EOT
  19. $('{$this->getElementClass()}').on('click', function() {
  20. $.ajax({
  21. method: 'post',
  22. url: '{$this->resource}/release',
  23. data: {
  24. _token:LA.token,
  25. ids: selectedRows(),
  26. action: {$this->action}
  27. },
  28. success: function () {
  29. $.pjax.reload('#pjax-container');
  30. toastr.success('操作成功');
  31. }
  32. });
  33. });
  34. EOT;
  35. }
  36. }