!97 岗位状态修改

Merge pull request !97 from 嗳摸嫫/jun
This commit is contained in:
橙子
2025-09-22 07:13:45 +00:00
committed by Gitee
2 changed files with 24 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar; using SqlSugar;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Yi.Framework.Ddd.Application; using Yi.Framework.Ddd.Application;
@@ -54,5 +55,25 @@ namespace Yi.Framework.Rbac.Application.Services.System
throw new UserFriendlyException(RoleConst.Exist); throw new UserFriendlyException(RoleConst.Exist);
} }
} }
/// <summary>
/// 更新状态
/// </summary>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
[Route("post/{id}/{state}")]
public async Task<PostGetOutputDto> 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);
}
} }
} }

View File

@@ -103,7 +103,7 @@ export function usePost() {
`确认要<strong>${ `确认要<strong>${
row.state === false ? "停用" : "启用" row.state === false ? "停用" : "启用"
}</strong><strong style='color:var(--el-color-primary)'>${ }</strong><strong style='color:var(--el-color-primary)'>${
row.roleName row.postName
}</strong>吗?`, }</strong>吗?`,
"系统提示", "系统提示",
{ {
@@ -132,7 +132,7 @@ export function usePost() {
loading: false loading: false
} }
); );
message(`${row.state === false ? "停用" : "启用"}${row.roleName}`, { message(`${row.state === false ? "停用" : "启用"}${row.postName}`, {
type: "success" type: "success"
}); });
}) })
@@ -143,7 +143,7 @@ export function usePost() {
async function handleDelete(row) { async function handleDelete(row) {
await delPost([row.id]); await delPost([row.id]);
message(`您删除了角色名称为${row.roleName}的这条数据`, { type: "success" }); message(`您删除了岗位名称为${row.postName}的这条数据`, { type: "success" });
onSearch(); onSearch();
} }