字典前端问题

booking_auth_dev
wanghaomei 2 years ago
parent 3fedb785cd
commit 57e66259a2

@ -42,4 +42,9 @@ public class SysDictType : DEntityBase
/// </summary>
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 是否前端使用
/// </summary>
public bool IsFront { get; set; }
}

@ -2570,6 +2570,11 @@
状态(字典 0正常 1停用 2删除
</summary>
</member>
<member name="P:Myshipping.Core.Entity.SysDictType.IsFront">
<summary>
是否前端使用
</summary>
</member>
<member name="T:Myshipping.Core.Entity.SysEmp">
<summary>
员工表
@ -8176,6 +8181,11 @@
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.DictTypeInput.IsFront">
<summary>
前端
</summary>
</member>
<member name="P:Myshipping.Core.Service.DictTypeInput.Remark">
<summary>
备注
@ -8229,6 +8239,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysDictDataService.GetDictDataFrontList(System.String)">
<summary>
获取某个字典类型下字典值列表(前端专用)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysDictDataService.AddDictData(Myshipping.Core.Service.AddDictDataInput)">
<summary>
增加字典值

@ -20,5 +20,7 @@ namespace Myshipping.Core.Service.Dict.Dto
public int Sort { get; set; }
public string Remark { get; set; }
public bool IsFront { get; set; }
}
}

@ -23,6 +23,11 @@ public class DictTypeInput : PageInputBase
/// </summary>
public virtual int Sort { get; set; }
/// <summary>
/// 前端
/// </summary>
public virtual bool IsFront { get; set; }
/// <summary>
/// 备注
/// </summary>

@ -64,6 +64,22 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
.Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.Sort).ToListAsync();
}
/// <summary>
/// 获取某个字典类型下字典值列表(前端专用)
/// </summary>
/// <returns></returns>
[HttpGet("/sysDictData/frontList")]
public async Task<dynamic> GetDictDataFrontList(string typeCode)
{
return (await _cache.GetAllDictData())
.Where(u => u.TypeCode == typeCode)
.Where(u => u.IsFront)
.OrderBy(u => u.Sort)
.ToList();
}
/// <summary>
/// 增加字典值
/// </summary>
@ -211,7 +227,8 @@ public class SysDictDataService : ISysDictDataService, IDynamicApiController, IT
Value = d.Value,
Code = d.Code,
Sort = d.Sort,
Remark = d.Remark
Remark = d.Remark,
IsFront = t.IsFront
}).ToListAsync();
await _cache.SetAllDictData(list);
}

@ -6,6 +6,7 @@ using Myshipping.Core.Service;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using Furion.Logging;
namespace Myshipping.Web.Core;
@ -51,6 +52,9 @@ public class JwtHandler : AppAuthorizeHandler
// 路由名称
var routeName = httpContext.Request.Path.Value.Substring(1).Replace("/", ":");
//字典数据前端需要,允许获取
if (routeName == "sysDictData:frontList") return true;
var allPermission = await App.GetService<ISysMenuService>().GetAllPermission();
if (!allPermission.Contains(routeName))

Loading…
Cancel
Save