diff --git a/admin/index.html b/admin/index.html index dd21267..b67cea0 100644 --- a/admin/index.html +++ b/admin/index.html @@ -11,7 +11,7 @@ (function () { const config_data_str = localStorage.getItem('APP_CONFIG') let config_data = { - token: 'A4B7C15C-FCEE-41EF-8E2D-16442D0F72E8', + token: '09445215-36E0-493A-A864-755EDABF175A', api: { url: [{ name: '开发环境', diff --git a/admin/src/pages/config/router.vue b/admin/src/pages/config/router.vue index 99110ed..e629ef9 100644 --- a/admin/src/pages/config/router.vue +++ b/admin/src/pages/config/router.vue @@ -143,6 +143,8 @@ const AdminDelete = async () => { if (edit_data.value.pid === 0) { const index = table_list.value.findIndex(item => item.id === response.data.id) table_list.value.splice(index, 1) + const select_index = admin_auth_select.value.findIndex(item => item.id === response.data.id) + admin_auth_select.value.splice(select_index, 1) } else { const index = table_list.value.findIndex(item => item.id === edit_data.value.pid) const children_index = table_list.value[index].children.findIndex(item => item.id === response.data.id) @@ -178,9 +180,14 @@ const editDoneClick = async () => { edit_show.value = false table_ref.value.setCurrentRow(null) if (data.id === 0) { - window.$message().success('创建') + window.$message().success('创建成功') if (data.pid === 0) { - table_list.value.unshift(response.data.info) + const info = JSON.parse(JSON.stringify(response.data.info)) + table_list.value.unshift({ + ...info, + children: [] + }) + admin_auth_select.value.unshift(info) } else { const index = table_list.value.findIndex(item => item.id === data.pid) table_list.value[index].children.unshift(response.data.info) @@ -212,8 +219,11 @@ const editDoneClick = async () => { } if (index === -1) { table_list.value.unshift(response.data.info); + admin_auth_select.value.unshift(response.data.info) } else { table_list.value.splice(index, 0, response.data.info); + const select_index = admin_auth_select.value.findIndex(item => item.id === data.id) + admin_auth_select.value.splice(select_index, 1) } } else { index = table_list.value.findIndex(item => item.id === data.pid); diff --git a/api/app/Http/Controllers/AdminAuthController.php b/api/app/Http/Controllers/AdminAuthController.php index 4da1808..537d3ff 100644 --- a/api/app/Http/Controllers/AdminAuthController.php +++ b/api/app/Http/Controllers/AdminAuthController.php @@ -89,11 +89,11 @@ class AdminAuthController extends Controller $data = [ 'info' => $item, ]; - $auth_group_list = AdminAuth::where('pid', $item->id)->where('type', 2)->where('check', 1)->where('del', 2)->orderBy('order', 'desc')->get(); + $auth_group_list = AdminAuth::where('pid', $item->id)->where('type', 2)->where('del', 2)->orderBy('order', 'desc')->get(); $data['list'] = $auth_group_list; $list[] = $data; } - $auth_group_single = AdminAuth::where('pid', 0)->where('type', 2)->where('check', 1)->where('del', 2)->orderBy('order', 'desc')->get()->toArray(); + $auth_group_single = AdminAuth::where('pid', 0)->where('type', 2)->where('del', 2)->orderBy('order', 'desc')->get()->toArray(); return Yo::echo([ 'list' => array_merge($list, $auth_group_single) ]);