diff --git a/api/handler/admin/admin_user_handler.go b/api/handler/admin/admin_user_handler.go index 20312ed..4a951ec 100644 --- a/api/handler/admin/admin_user_handler.go +++ b/api/handler/admin/admin_user_handler.go @@ -73,6 +73,13 @@ func (h *SysUserHandler) Save(c *gin.Context) { resp.ERROR(c, types.InvalidArgs) return } + + // 默认id为1是超级管理员 + if data.Id == 1 { + resp.ERROR(c, "超级管理员不支持更新") + return + } + var user = model.AdminUser{} var res *gorm.DB var userVo vo.AdminUser @@ -135,9 +142,20 @@ func (h *SysUserHandler) ResetPass(c *gin.Context) { // Remove 删除 func (h *SysUserHandler) Remove(c *gin.Context) { - id := h.GetInt(c, "id", 0) - if id > 0 { - res := h.db.Where("id = ?", id).Delete(&model.AdminUser{}) + var data struct { + Id uint + } + if err := c.ShouldBindJSON(&data); err != nil { + resp.ERROR(c, types.InvalidArgs) + return + } + // 默认id为1是超级管理员 + if data.Id == 1 { + resp.ERROR(c, "超级管理员不能删除") + return + } + if data.Id > 0 { + res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{}) if res.Error != nil { resp.ERROR(c, "删除失败") return diff --git a/new-ui/projects/vue-admin/src/components/SearchTable/useAsyncTable.ts b/new-ui/projects/vue-admin/src/components/SearchTable/useAsyncTable.ts index 0e0ebbd..a381c07 100644 --- a/new-ui/projects/vue-admin/src/components/SearchTable/useAsyncTable.ts +++ b/new-ui/projects/vue-admin/src/components/SearchTable/useAsyncTable.ts @@ -11,7 +11,7 @@ function useAsyncTable>( ): TableReturn { const paginationState = reactive({ current: 1, - pageSize: 10, + pageSize: 20, total: 0, }); diff --git a/new-ui/projects/vue-admin/src/views/Role/RoleContainer.vue b/new-ui/projects/vue-admin/src/views/Role/RoleContainer.vue index 7f917b1..8d83be7 100644 --- a/new-ui/projects/vue-admin/src/views/Role/RoleContainer.vue +++ b/new-ui/projects/vue-admin/src/views/Role/RoleContainer.vue @@ -37,7 +37,7 @@ const columns = [ const expandable = reactive({ title: "", - width: 80, + width: 50, }); // 数据 diff --git a/new-ui/projects/vue-admin/src/views/SysAdmin/SysAdminContainer.vue b/new-ui/projects/vue-admin/src/views/SysAdmin/SysAdminContainer.vue index b559059..d2be738 100644 --- a/new-ui/projects/vue-admin/src/views/SysAdmin/SysAdminContainer.vue +++ b/new-ui/projects/vue-admin/src/views/SysAdmin/SysAdminContainer.vue @@ -100,16 +100,18 @@ const handleRemove = async (id, reload) => { /> diff --git a/new-ui/projects/vue-admin/src/views/User/UserContainer.vue b/new-ui/projects/vue-admin/src/views/User/UserContainer.vue index cf8ef9f..bec88e8 100644 --- a/new-ui/projects/vue-admin/src/views/User/UserContainer.vue +++ b/new-ui/projects/vue-admin/src/views/User/UserContainer.vue @@ -37,6 +37,7 @@ const columns: SearchTableColumns[] = [ { title: "过期时间", dataIndex: "expired_time", + width: 180, render: ({ record }) => { return dateFormat(record.expired_time); }, @@ -44,6 +45,7 @@ const columns: SearchTableColumns[] = [ { title: "注册时间", dataIndex: "created_at", + width: 180, render: ({ record }) => { return dateFormat(record.created_at); }, @@ -51,6 +53,8 @@ const columns: SearchTableColumns[] = [ { title: "操作", slotName: "actions", + width: 180, + fixed: "right", }, ];