岗位管理:增删改查功能

This commit is contained in:
陈淳
2022-09-13 17:05:53 +08:00
parent 01631860f4
commit 7b6d8671cf
33 changed files with 665 additions and 58 deletions

Binary file not shown.

View File

@@ -168,6 +168,14 @@
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DeptController.PageList(Yi.Framework.Model.Models.DeptEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="dept"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.DictionaryController.PageList(Yi.Framework.Model.Models.DictionaryEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
@@ -270,6 +278,14 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.PostController.PageList(Yi.Framework.Model.Models.PostEntity,Yi.Framework.Common.Models.PageParModel)">
<summary>
动态条件分页查询
</summary>
<param name="post"></param>
<param name="page"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Controllers.RoleController">
<summary>
角色管理

View File

@@ -0,0 +1,52 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class DeptController : BaseSimpleCrudController<DeptEntity>
{
private IDeptService _iDeptService;
public DeptController(ILogger<DeptEntity> logger, IDeptService iDeptService) : base(logger, iDeptService)
{
_iDeptService = iDeptService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="dept"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] DeptEntity dept, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iDeptService.SelctPageList(dept, page));
}
public override async Task<Result> Add(DeptEntity entity)
{
return await base.Add(entity);
}
public override async Task<Result> Update(DeptEntity entity)
{
return await base.Update(entity);
}
}
}

View File

@@ -0,0 +1,52 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class PostController : BaseSimpleCrudController<PostEntity>
{
private IPostService _iPostService;
public PostController(ILogger<PostEntity> logger, IPostService iPostService) : base(logger, iPostService)
{
_iPostService = iPostService;
}
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="post"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public async Task<Result> PageList([FromQuery] PostEntity post, [FromQuery] PageParModel page)
{
return Result.Success().SetData(await _iPostService.SelctPageList(post, page));
}
public override async Task<Result> Add(PostEntity entity)
{
return await base.Add(entity);
}
public override async Task<Result> Update(PostEntity entity)
{
return await base.Update(entity);
}
}
}

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IDeptService:IBaseService<DeptEntity>
{
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="dept"></param>
/// <param name="page"></param>
/// <returns></returns>
Task<PageModel<List<DeptEntity>>> SelctPageList(DeptEntity dept, PageParModel page);
}
}

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IPostService:IBaseService<PostEntity>
{
/// <summary>
/// 动态条件分页查询
/// </summary>
/// <param name="post"></param>
/// <param name="page"></param>
/// <returns></returns>
Task<PageModel<List<PostEntity>>> SelctPageList(PostEntity post, PageParModel page);
}
}

View File

@@ -0,0 +1,9 @@
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IDeptService:IBaseService<DeptEntity>
{
}
}

View File

@@ -1,12 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IDictionaryInfoService : IBaseService<DictionaryInfoEntity>
{
public partial interface IDictionaryInfoService:IBaseService<DictionaryInfoEntity>
{
}
}

View File

@@ -0,0 +1,9 @@
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IPostService:IBaseService<PostEntity>
{
}
}

View File

@@ -0,0 +1,9 @@
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IRoleDeptService:IBaseService<RoleDeptEntity>
{
}
}

View File

@@ -0,0 +1,9 @@
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Interface
{
public partial interface IUserPostService:IBaseService<UserPostEntity>
{
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
/// <summary>
/// 部门表
///</summary>
[SugarTable("Dept")]
public partial class DeptEntity:IBaseModelEntity
{
public DeptEntity()
{
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 部门名称
///</summary>
[SugarColumn(ColumnName="DeptName" )]
public string DeptName { get; set; }
/// <summary>
/// 部门编码
///</summary>
[SugarColumn(ColumnName="DeptCode" )]
public string DeptCode { get; set; }
/// <summary>
/// 负责人
///</summary>
[SugarColumn(ColumnName="Leader" )]
public string Leader { get; set; }
/// <summary>
/// 父级id
///</summary>
[SugarColumn(ColumnName="ParentId" )]
public long? ParentId { get; set; }
/// <summary>
/// 创建者
///</summary>
[SugarColumn(ColumnName="CreateUser" )]
public long? CreateUser { get; set; }
/// <summary>
/// 创建时间
///</summary>
[SugarColumn(ColumnName="CreateTime" )]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
/// 修改时间
///</summary>
[SugarColumn(ColumnName="ModifyTime" )]
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 是否删除
///</summary>
[SugarColumn(ColumnName="IsDeleted" )]
public bool? IsDeleted { get; set; }
/// <summary>
/// 租户Id
///</summary>
[SugarColumn(ColumnName="TenantId" )]
public long? TenantId { get; set; }
/// <summary>
/// 排序字段
///</summary>
[SugarColumn(ColumnName="OrderNum" )]
public int? OrderNum { get; set; }
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
}
}

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public DictionaryEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
@@ -22,7 +21,7 @@ namespace Yi.Framework.Model.Models
/// <summary>
/// 字典名称
///</summary>
[SugarColumn(ColumnName= "DictName")]
[SugarColumn(ColumnName="DictName" )]
public string DictName { get; set; }
/// <summary>
/// 字典类型

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public DictionaryInfoEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]

View File

@@ -5,15 +5,10 @@ using System.Text.Json.Serialization;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
/// <summary>
/// 日志表
///</summary>
public partial class LogEntity:IBaseModelEntity
{
public LogEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
@@ -24,7 +19,6 @@ namespace Yi.Framework.Model.Models
///</summary>
[SugarColumn(ColumnName="CreateUser" )]
public long? CreateUser { get; set; }
/// <summary>
/// 修改者
///</summary>

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
/// <summary>
/// 岗位表
///</summary>
[SugarTable("Post")]
public partial class PostEntity:IBaseModelEntity
{
public PostEntity()
{
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 岗位编码
///</summary>
[SugarColumn(ColumnName="PostCode" )]
public string PostCode { get; set; }
/// <summary>
/// 岗位名称
///</summary>
[SugarColumn(ColumnName="PostName" )]
public string PostName { get; set; }
/// <summary>
/// 创建者
///</summary>
[SugarColumn(ColumnName="CreateUser" )]
public long? CreateUser { get; set; }
/// <summary>
/// 创建时间
///</summary>
[SugarColumn(ColumnName="CreateTime" )]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
/// 修改时间
///</summary>
[SugarColumn(ColumnName="ModifyTime" )]
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 是否删除
///</summary>
[SugarColumn(ColumnName="IsDeleted" )]
public bool? IsDeleted { get; set; }
/// <summary>
/// 租户Id
///</summary>
[SugarColumn(ColumnName="TenantId" )]
public long? TenantId { get; set; }
/// <summary>
/// 排序字段
///</summary>
[SugarColumn(ColumnName="OrderNum" )]
public int? OrderNum { get; set; }
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
/// <summary>
/// 角色部门关系表
///</summary>
[SugarTable("RoleDept")]
public partial class RoleDeptEntity:IBaseModelEntity
{
public RoleDeptEntity()
{
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 角色id
///</summary>
[SugarColumn(ColumnName="RoleId" )]
public long? RoleId { get; set; }
/// <summary>
/// 部门id
///</summary>
[SugarColumn(ColumnName="Dept" )]
public long? Dept { get; set; }
/// <summary>
/// 创建者
///</summary>
[SugarColumn(ColumnName="CreateUser" )]
public long? CreateUser { get; set; }
/// <summary>
/// 创建时间
///</summary>
[SugarColumn(ColumnName="CreateTime" )]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
/// 修改时间
///</summary>
[SugarColumn(ColumnName="ModifyTime" )]
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 是否删除
///</summary>
[SugarColumn(ColumnName="IsDeleted" )]
public bool? IsDeleted { get; set; }
/// <summary>
/// 租户Id
///</summary>
[SugarColumn(ColumnName="TenantId" )]
public long? TenantId { get; set; }
/// <summary>
/// 排序字段
///</summary>
[SugarColumn(ColumnName="OrderNum" )]
public int? OrderNum { get; set; }
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
}
}

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public RoleEntity()
{
//this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
@@ -55,7 +54,7 @@ namespace Yi.Framework.Model.Models
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
///
/// 角色编码
///</summary>
[SugarColumn(ColumnName="RoleCode" )]
public string RoleCode { get; set; }
@@ -69,5 +68,10 @@ namespace Yi.Framework.Model.Models
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
/// <summary>
/// 角色数据范围
///</summary>
[SugarColumn(ColumnName="DataScope" )]
public int? DataScope { get; set; }
}
}

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public RoleMenuEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public TenantEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]

View File

@@ -118,5 +118,10 @@ namespace Yi.Framework.Model.Models
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
/// <summary>
/// 部门id
///</summary>
[SugarColumn(ColumnName="DeptId" )]
public long? DeptId { get; set; }
}
}

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
/// <summary>
/// 用户岗位表
///</summary>
[SugarTable("UserPost")]
public partial class UserPostEntity:IBaseModelEntity
{
public UserPostEntity()
{
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 用户id s
///</summary>
[SugarColumn(ColumnName="UserId" )]
public long? UserId { get; set; }
/// <summary>
/// 岗位id
///</summary>
[SugarColumn(ColumnName="Post" )]
public long? Post { get; set; }
/// <summary>
/// 创建者
///</summary>
[SugarColumn(ColumnName="CreateUser" )]
public long? CreateUser { get; set; }
/// <summary>
/// 创建时间
///</summary>
[SugarColumn(ColumnName="CreateTime" )]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
/// 修改时间
///</summary>
[SugarColumn(ColumnName="ModifyTime" )]
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 是否删除
///</summary>
[SugarColumn(ColumnName="IsDeleted" )]
public bool? IsDeleted { get; set; }
/// <summary>
/// 租户Id
///</summary>
[SugarColumn(ColumnName="TenantId" )]
public long? TenantId { get; set; }
/// <summary>
/// 排序字段
///</summary>
[SugarColumn(ColumnName="OrderNum" )]
public int? OrderNum { get; set; }
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName="Remark" )]
public string Remark { get; set; }
}
}

View File

@@ -13,7 +13,6 @@ namespace Yi.Framework.Model.Models
{
public UserRoleEntity()
{
this.IsDeleted = false;
this.CreateTime = DateTime.Now;
}
[JsonConverter(typeof(ValueToStringConverter))]
@@ -40,6 +39,11 @@ namespace Yi.Framework.Model.Models
[SugarColumn(ColumnName="CreateTime" )]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
/// <summary>
/// 修改时间
///</summary>
[SugarColumn(ColumnName="ModifyTime" )]
@@ -54,10 +58,5 @@ namespace Yi.Framework.Model.Models
///</summary>
[SugarColumn(ColumnName="TenantId" )]
public long? TenantId { get; set; }
/// <summary>
/// 修改者
///</summary>
[SugarColumn(ColumnName="ModifyUser" )]
public long? ModifyUser { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class DeptService : BaseService<DeptEntity>, IDeptService
{
public async Task<PageModel<List<DeptEntity>>> SelctPageList(DeptEntity dept, PageParModel page)
{
RefAsync<int> total = 0;
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(dept.DeptName), u => u.DeptName.Contains(dept.DeptName))
.WhereIF(dept.IsDeleted.IsNotNull(), u => u.IsDeleted == dept.IsDeleted)
.OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<DeptEntity>>(data, total);
}
}
}

View File

@@ -0,0 +1,28 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class PostService : BaseService<PostEntity>, IPostService
{
public async Task<PageModel<List<PostEntity>>> SelctPageList(PostEntity post, PageParModel page)
{
RefAsync<int> total = 0;
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(post.PostName), u => u.PostName.Contains(post.PostName))
.WhereIF(!string.IsNullOrEmpty(post.PostCode), u => u.PostCode.Contains(post.PostCode))
.WhereIF(post.IsDeleted.IsNotNull(), u => u.IsDeleted == post.IsDeleted)
.OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<PostEntity>>(data, total);
}
}
}

View File

@@ -0,0 +1,14 @@
using SqlSugar;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class DeptService : BaseService<DeptEntity>, IDeptService
{
public DeptService(IRepository<DeptEntity> repository) : base(repository)
{
}
}
}

View File

@@ -0,0 +1,14 @@
using SqlSugar;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class PostService : BaseService<PostEntity>, IPostService
{
public PostService(IRepository<PostEntity> repository) : base(repository)
{
}
}
}

View File

@@ -0,0 +1,14 @@
using SqlSugar;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class RoleDeptService : BaseService<RoleDeptEntity>, IRoleDeptService
{
public RoleDeptService(IRepository<RoleDeptEntity> repository) : base(repository)
{
}
}
}

View File

@@ -0,0 +1,14 @@
using SqlSugar;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class UserPostService : BaseService<UserPostEntity>, IUserPostService
{
public UserPostService(IRepository<UserPostEntity> repository) : base(repository)
{
}
}
}

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询部门列表
export function listDept(query) {
return request({
url: '/system/dept/list',
url: '/dept/pageList',
method: 'get',
params: query
})
@@ -20,7 +20,7 @@ export function listDeptExcludeChild(deptId) {
// 查询部门详细
export function getDept(deptId) {
return request({
url: '/system/dept/' + deptId,
url: '/dept/getById/' + deptId,
method: 'get'
})
}
@@ -28,7 +28,7 @@ export function getDept(deptId) {
// 新增部门
export function addDept(data) {
return request({
url: '/system/dept',
url: '/dept/add',
method: 'post',
data: data
})
@@ -37,7 +37,7 @@ export function addDept(data) {
// 修改部门
export function updateDept(data) {
return request({
url: '/system/dept',
url: '/dept/update',
method: 'put',
data: data
})
@@ -45,8 +45,13 @@ export function updateDept(data) {
// 删除部门
export function delDept(deptId) {
if("string"==typeof(deptId))
{
deptId=[deptId];
}
return request({
url: '/system/dept/' + deptId,
method: 'delete'
url: '/dept/delList',
method: 'delete',
data:postId
})
}

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/system/post/list',
url: '/post/pageList',
method: 'get',
params: query
})
@@ -12,7 +12,7 @@ export function listPost(query) {
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/post/getById/' + postId,
method: 'get'
})
}
@@ -20,7 +20,7 @@ export function getPost(postId) {
// 新增岗位
export function addPost(data) {
return request({
url: '/system/post',
url: '/post/add',
method: 'post',
data: data
})
@@ -29,7 +29,7 @@ export function addPost(data) {
// 修改岗位
export function updatePost(data) {
return request({
url: '/system/post',
url: '/post/update',
method: 'put',
data: data
})
@@ -37,8 +37,13 @@ export function updatePost(data) {
// 删除岗位
export function delPost(postId) {
if("string"==typeof(postId))
{
postId=[postId];
}
return request({
url: '/system/post/' + postId,
method: 'delete'
url: '/post/delList',
method: 'delete',
data:postId
})
}

View File

@@ -17,8 +17,8 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="岗位状态" clearable>
<el-form-item label="状态" prop="isDeleted">
<el-select v-model="queryParams.isDeleted" placeholder="岗位状态" clearable>
<el-option
v-for="dict in sys_normal_disable"
:key="dict.value"
@@ -77,13 +77,13 @@
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="岗位编号" align="center" prop="postId" />
<el-table-column label="岗位编号" align="center" prop="id" />
<el-table-column label="岗位编码" align="center" prop="postCode" />
<el-table-column label="岗位名称" align="center" prop="postName" />
<el-table-column label="岗位排序" align="center" prop="postSort" />
<el-table-column label="状态" align="center" prop="status">
<el-table-column label="岗位排序" align="center" prop="orderNum" />
<el-table-column label="状态" align="center" prop="isDeleted">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
<dict-tag :options="sys_normal_disable" :value="scope.row.isDeleted" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -126,11 +126,11 @@
<el-form-item label="岗位编码" prop="postCode">
<el-input v-model="form.postCode" placeholder="请输入编码名称" />
</el-form-item>
<el-form-item label="岗位顺序" prop="postSort">
<el-input-number v-model="form.postSort" controls-position="right" :min="0" />
<el-form-item label="岗位顺序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="岗位状态" prop="status">
<el-radio-group v-model="form.status">
<el-form-item label="岗位状态" prop="isDeleted">
<el-radio-group v-model="form.isDeleted">
<el-radio
v-for="dict in sys_normal_disable"
:key="dict.value"
@@ -175,12 +175,12 @@ const data = reactive({
pageSize: 10,
postCode: undefined,
postName: undefined,
status: undefined
isDeleted: undefined
},
rules: {
postName: [{ required: true, message: "岗位名称不能为空", trigger: "blur" }],
postCode: [{ required: true, message: "岗位编码不能为空", trigger: "blur" }],
postSort: [{ required: true, message: "岗位顺序不能为空", trigger: "blur" }],
orderNum: [{ required: true, message: "岗位顺序不能为空", trigger: "blur" }],
}
});
@@ -190,8 +190,8 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
listPost(queryParams.value).then(response => {
postList.value = response.rows;
total.value = response.total;
postList.value = response.data.data;
total.value = response.data.total;
loading.value = false;
});
}
@@ -203,11 +203,11 @@ function cancel() {
/** 表单重置 */
function reset() {
form.value = {
postId: undefined,
id: undefined,
postCode: undefined,
postName: undefined,
postSort: 0,
status: "0",
orderNum: 0,
isDeleted: false,
remark: undefined
};
proxy.resetForm("postRef");
@@ -224,7 +224,7 @@ function resetQuery() {
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.postId);
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@@ -237,7 +237,7 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const postId = row.postId || ids.value;
const postId = row.id || ids.value;
getPost(postId).then(response => {
form.value = response.data;
open.value = true;
@@ -248,7 +248,7 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["postRef"].validate(valid => {
if (valid) {
if (form.value.postId != undefined) {
if (form.value.id != undefined) {
updatePost(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
@@ -266,7 +266,7 @@ function submitForm() {
}
/** 删除按钮操作 */
function handleDelete(row) {
const postIds = row.postId || ids.value;
const postIds = row.id || ids.value;
proxy.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() {
return delPost(postIds);
}).then(() => {