From 6005b9329df2cc46f6e12e31cadca9213231892e Mon Sep 17 00:00:00 2001 From: HW-July <7a2a99a@163.com> Date: Mon, 25 Aug 2025 17:12:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E7=8A=B6=E6=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/System/PostService.cs | 21 +++++++++++++++++++ .../src/views/system/post/utils/hook.tsx | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/PostService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/PostService.cs index 1975ed9d..b46d0070 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/PostService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/PostService.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Mvc; using SqlSugar; using Volo.Abp.Application.Dtos; using Yi.Framework.Ddd.Application; @@ -54,5 +55,25 @@ namespace Yi.Framework.Rbac.Application.Services.System throw new UserFriendlyException(RoleConst.Exist); } } + + /// + /// 更新状态 + /// + /// + /// + /// + [Route("post/{id}/{state}")] + public async Task UpdateStateAsync([FromRoute] Guid id, [FromRoute] bool state) + { + var entity = await _repository.GetByIdAsync(id); + if (entity is null) + { + throw new ApplicationException("岗位未存在"); + } + + entity.State = state; + await _repository.UpdateAsync(entity); + return await MapToGetOutputDtoAsync(entity); + } } } \ No newline at end of file diff --git a/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx b/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx index 1aafdb69..1a28febd 100644 --- a/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx +++ b/Yi.Pure.Vue3/src/views/system/post/utils/hook.tsx @@ -103,7 +103,7 @@ export function usePost() { `确认要${ row.state === false ? "停用" : "启用" }${ - row.roleName + row.postName }吗?`, "系统提示", { @@ -132,7 +132,7 @@ export function usePost() { loading: false } ); - message(`已${row.state === false ? "停用" : "启用"}${row.roleName}`, { + message(`已${row.state === false ? "停用" : "启用"}${row.postName}`, { type: "success" }); }) @@ -143,7 +143,7 @@ export function usePost() { async function handleDelete(row) { await delPost([row.id]); - message(`您删除了角色名称为${row.roleName}的这条数据`, { type: "success" }); + message(`您删除了岗位名称为${row.postName}的这条数据`, { type: "success" }); onSearch(); }