优化下拉列表组件,修复若干BUG
This commit is contained in:
@@ -45,8 +45,7 @@ class User extends Backend
|
||||
}
|
||||
|
||||
if ($request->get('select') || $request->post('select')) {
|
||||
$this->_select();
|
||||
return $this->success();
|
||||
return $this->select($request);
|
||||
}
|
||||
|
||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||
@@ -182,6 +181,32 @@ class User extends Backend
|
||||
return $this->success('', ['row' => $row]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程下拉数据(供 remoteSelect 使用)
|
||||
*/
|
||||
public function select(Request $request): Response
|
||||
{
|
||||
$response = $this->initializeBackend($request);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||
$res = $this->model
|
||||
->withoutField('password')
|
||||
->withJoin($this->withJoinTable, $this->withJoinType)
|
||||
->visible(['admin' => ['username']])
|
||||
->alias($alias)
|
||||
->where($where)
|
||||
->order($order)
|
||||
->paginate($limit);
|
||||
|
||||
return $this->success('', [
|
||||
'list' => $res->items(),
|
||||
'total' => $res->total(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user