优化删除权限

This commit is contained in:
evoxwht 2023-04-27 10:43:31 +08:00
parent 3e0dc3cc70
commit 9252f05791
3 changed files with 7 additions and 4 deletions

View File

@ -112,7 +112,7 @@ class SystemMenusDao extends BaseDao
* @param string $key
* @return array
*/
public function column(array $where, string $field, string $key)
public function column(array $where, string $field, string $key = '')
{
return $this->search($where)->column($field, $key);
}

View File

@ -228,8 +228,11 @@ class SystemMenusServices extends BaseServices
*/
public function delete(int $id)
{
if ($this->dao->count(['pid' => $id])) {
throw new AdminException(400613);
$ids = $this->dao->column(['pid' => $id], 'id');
if (count($ids)) {
foreach ($ids as $value) {
$this->delete($value);
}
}
return $this->dao->delete($id);
}

View File

@ -388,7 +388,7 @@ export default {
this.$modalSure(delfromData)
.then((res) => {
this.$Message.success(res.msg);
// this.getData();
this.getData();
this.getMenusUnique();
// this.$store.dispatch('menus/getMenusNavList');
})