更新 'src/Grid/Displayers/Actions.php'

回收站删除问题,url参数格式错误
This commit is contained in:
陈成|13142600015 2023-04-06 13:53:14 +08:00
parent 9415f1543b
commit 3a3f883805

View File

@ -144,12 +144,12 @@ class Actions extends AbstractDisplayer
$actions = $this->prepends; $actions = $this->prepends;
foreach ($this->actions as $action) { foreach ($this->actions as $action) {
$method = 'render'.ucfirst($action); $method = 'render' . ucfirst($action);
array_push($actions, $this->{$method}()); array_push($actions, $this->{$method}());
} }
$actions = array_merge($actions, $this->appends); $actions = array_merge($actions, $this->appends);
$actions_str=implode('', $actions); $actions_str = implode('', $actions);
return <<<EOT return <<<EOT
<div class="btn-group"> <div class="btn-group">
$actions_str $actions_str
@ -193,6 +193,7 @@ EOT;
$resume_checkout = "<label><input type='checkbox' class='resume_checkout' name='resume_checkout' style='width: 18px;height: 13px;position: relative;top:2px;'>{$tip}</label>"; $resume_checkout = "<label><input type='checkbox' class='resume_checkout' name='resume_checkout' style='width: 18px;height: 13px;position: relative;top:2px;'>{$tip}</label>";
return $resume_checkout; return $resume_checkout;
} }
/** /**
* Render delete action. * Render delete action.
* *
@ -201,21 +202,22 @@ EOT;
protected function renderDelete() protected function renderDelete()
{ {
$title = ''; $title = '';
$url_pams = ''; $url_pams = [];
if(strstr($this->getResource(),'firm/company') && !(strstr($this->getResource(),'firm/companyimg'))&& !(strstr($this->getResource(),'firm/companysetmeal'))) { if (strstr($this->getResource(), 'firm/company') && !(strstr($this->getResource(), 'firm/companyimg')) && !(strstr($this->getResource(), 'firm/companysetmeal'))) {
$deleteConfirm = trans('admin.delete_company_confirm'); $deleteConfirm = trans('admin.delete_company_confirm');
}elseif (strstr($this->getResource(),'personal/members')) { } elseif (strstr($this->getResource(), 'personal/members')) {
$deleteConfirm = trans('admin.delete_person_confirm'); $deleteConfirm = trans('admin.delete_person_confirm');
} elseif (strstr($this->getResource(),'recycle/index')){ } elseif (strstr($this->getResource(), 'recycle/index')) {
$scope = array_get(request()->all(),'scope',1); $scope = array_get(request()->all(), 'scope', 1);
$url_pams='?scope='.$scope; $url_pams['scope'] = $scope;
$deleteConfirm = trans('admin.delete_confirm'); $deleteConfirm = trans('admin.delete_confirm');
}elseif (strstr($this->getResource(),'personal/resume')){ } elseif (strstr($this->getResource(), 'personal/resume')) {
$deleteConfirm = trans('admin.delete_confirm'); $deleteConfirm = trans('admin.delete_confirm');
$title = $this->resume_checkout(); $title = $this->resume_checkout();
} else { } else {
$deleteConfirm = trans('admin.delete_confirm'); $deleteConfirm = trans('admin.delete_confirm');
} }
$url_pams = empty(http_build_query($url_pams)) ? '' : '&' . http_build_query($url_pams);
$confirm = trans('admin.confirm'); $confirm = trans('admin.confirm');
$cancel = trans('admin.cancel'); $cancel = trans('admin.cancel');
$script = <<<SCRIPT $script = <<<SCRIPT
@ -239,7 +241,7 @@ function render_action_delete() {
return new Promise(function(resolve) { return new Promise(function(resolve) {
$.ajax({ $.ajax({
method: 'post', method: 'post',
url: '{$this->getResource()}/' + id +'$url_pams'+'?is_resume='+is_resume, url: '{$this->getResource()}/' + id +'?is_resume='+is_resume+'{$url_pams}',
data: { data: {
_method:'delete', _method:'delete',
_token:LA.token, _token:LA.token,