优化下拉列表组件,修复若干BUG

This commit is contained in:
2026-03-19 09:50:06 +08:00
parent 9b9ff7f13a
commit abcb9b7b9a
4 changed files with 56 additions and 10 deletions

View File

@@ -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(),
]);
}
/**
* 删除
*/