first commit
This commit is contained in:
40
app/Admin/Extensions/Tools/ReleasePost.php
Normal file
40
app/Admin/Extensions/Tools/ReleasePost.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Extensions\Tools;
|
||||
|
||||
use Encore\Admin\Grid\Tools\BatchAction;
|
||||
|
||||
class ReleasePost 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;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user