diff --git a/crmeb/app/dao/system/SystemMenusDao.php b/crmeb/app/dao/system/SystemMenusDao.php index 8c6af977a..f114c5b24 100644 --- a/crmeb/app/dao/system/SystemMenusDao.php +++ b/crmeb/app/dao/system/SystemMenusDao.php @@ -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); } diff --git a/crmeb/app/services/system/SystemMenusServices.php b/crmeb/app/services/system/SystemMenusServices.php index 40f568eab..13f175ec0 100644 --- a/crmeb/app/services/system/SystemMenusServices.php +++ b/crmeb/app/services/system/SystemMenusServices.php @@ -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); } diff --git a/template/admin/src/pages/setting/systemMenus/index.vue b/template/admin/src/pages/setting/systemMenus/index.vue index 89491a3b6..810b0bec4 100644 --- a/template/admin/src/pages/setting/systemMenus/index.vue +++ b/template/admin/src/pages/setting/systemMenus/index.vue @@ -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'); })