diff --git a/app/admin/controller/auth/Menu.php b/app/admin/controller/auth/Menu.php index 50b172e6..d8ae031a 100644 --- a/app/admin/controller/auth/Menu.php +++ b/app/admin/controller/auth/Menu.php @@ -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); diff --git a/app/admin/controller/user/Rule.php b/app/admin/controller/user/Rule.php index 3a5f3e07..a73ddb6d 100644 --- a/app/admin/controller/user/Rule.php +++ b/app/admin/controller/user/Rule.php @@ -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) { diff --git a/web/src/views/backend/user/user/popupForm.vue b/web/src/views/backend/user/user/popupForm.vue index f83accdf..b8ebcf63 100644 --- a/web/src/views/backend/user/user/popupForm.vue +++ b/web/src/views/backend/user/user/popupForm.vue @@ -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', }"