41 lines
759 B
PHP
41 lines
759 B
PHP
<?php
|
|
|
|
namespace App\Admin\Extensions\Tools;
|
|
|
|
use Encore\Admin\Grid\Tools\BatchAction;
|
|
|
|
class BatchSend extends BatchAction
|
|
{
|
|
protected $action;
|
|
|
|
public function __construct($action = 1)
|
|
{
|
|
$this->action = $action;
|
|
}
|
|
|
|
public function script()
|
|
{
|
|
return <<<EOT
|
|
|
|
$('{$this->getElementClass()}').on('click', function() {
|
|
|
|
$.ajax({
|
|
method: 'post',
|
|
url: '{$this->resource}/release',
|
|
data: {
|
|
_token:LA.token,
|
|
ids: selectedRows(),
|
|
action: {$this->action}
|
|
},
|
|
success: function () {
|
|
$.pjax.reload('#pjax-container');
|
|
toastr.success('操作成功');
|
|
}
|
|
});
|
|
});
|
|
|
|
EOT;
|
|
|
|
}
|
|
}
|