mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
fix:修复菜单规则和会员分组被禁用后在远程select中依然可以选择的问题
This commit is contained in:
parent
5b6523160f
commit
7f14c02724
@ -69,7 +69,7 @@ class Menu extends Backend
|
||||
public function select()
|
||||
{
|
||||
$isTree = $this->request->param('isTree');
|
||||
$data = $this->getMenus(false);
|
||||
$data = $this->getMenus([['type', 'in', ['menu_dir', 'menu']], ['status', '=', '1']]);
|
||||
|
||||
if ($isTree && !$this->keyword) {
|
||||
$data = $this->tree->assembleTree($this->tree->getTreeArray($data, 'title'));
|
||||
@ -79,24 +79,20 @@ class Menu extends Backend
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getMenus($getButton = true)
|
||||
protected function getMenus($where = [])
|
||||
{
|
||||
$rules = $this->getRuleList($getButton);
|
||||
$rules = $this->getRuleList($where);
|
||||
return $this->tree->assembleChild($rules);
|
||||
}
|
||||
|
||||
protected function getRuleList($getButton = true)
|
||||
protected function getRuleList($where = [])
|
||||
{
|
||||
$ids = $this->auth->getRuleIds();
|
||||
|
||||
$where = [];
|
||||
// 如果没有 * 则只获取用户拥有的规则
|
||||
if (!in_array('*', $ids)) {
|
||||
$where[] = ['id', 'in', $ids];
|
||||
}
|
||||
if (!$getButton) {
|
||||
$where[] = ['type', 'in', ['menu_dir', 'menu']];
|
||||
}
|
||||
|
||||
if ($this->keyword) {
|
||||
$keyword = explode(' ', $this->keyword);
|
||||
|
@ -66,7 +66,7 @@ class Rule extends Backend
|
||||
public function select()
|
||||
{
|
||||
$isTree = $this->request->param('isTree');
|
||||
$data = $this->getRule();
|
||||
$data = $this->getRule([['status', '=', '1']]);
|
||||
|
||||
if ($isTree && !$this->keyword) {
|
||||
$data = $this->tree->assembleTree($this->tree->getTreeArray($data, 'title'));
|
||||
@ -76,9 +76,8 @@ class Rule extends Backend
|
||||
]);
|
||||
}
|
||||
|
||||
public function getRule()
|
||||
public function getRule($where = [])
|
||||
{
|
||||
$where = [];
|
||||
if ($this->keyword) {
|
||||
$keyword = explode(' ', $this->keyword);
|
||||
foreach ($keyword as $item) {
|
||||
|
@ -46,7 +46,7 @@
|
||||
v-model="baTable.form.items!.group_id"
|
||||
:placeholder="t('user.user.grouping')"
|
||||
:input-attr="{
|
||||
params: { isTree: true },
|
||||
params: { isTree: true, search: [{ field: 'status', val: '1', operator: '=' }] },
|
||||
field: 'name',
|
||||
'remote-url': userGroup + 'index',
|
||||
}"
|
||||
|
Loading…
Reference in New Issue
Block a user