65 changed files with 2477 additions and 4877 deletions
@ -0,0 +1,56 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
||||
|
{ |
||||
|
public class PagingNotificationInput : PagingBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 标题
|
||||
|
/// </summary>
|
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 内容
|
||||
|
/// </summary>
|
||||
|
public string Content { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送者Id
|
||||
|
/// </summary>
|
||||
|
public Guid? SenderUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送者名称
|
||||
|
/// </summary>
|
||||
|
public string SenderUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接受者Id
|
||||
|
/// </summary>
|
||||
|
public Guid? ReceiverUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接受者名称
|
||||
|
/// </summary>
|
||||
|
public string ReceiverUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool? Read { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读开始时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? StartReadTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读结束时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? EndReadTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息类型
|
||||
|
/// </summary>
|
||||
|
public MessageType? MessageType { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,8 +0,0 @@ |
|||||
|
|
||||
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
|
||||
{ |
|
||||
public class PagingNotificationListInput:PagingBase |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,46 +0,0 @@ |
|||||
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
|
||||
{ |
|
||||
public class PagingNotificationListOutput |
|
||||
{ |
|
||||
public Guid Id { get; set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 消息标题
|
|
||||
/// </summary>
|
|
||||
public string Title { get; set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 消息内容
|
|
||||
/// </summary>
|
|
||||
public string Content { get; set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 消息类型
|
|
||||
/// </summary>
|
|
||||
public MessageType MessageType { get; set; } |
|
||||
|
|
||||
public string MessageTypeDescription => MessageType.ToDescription(); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 消息等级
|
|
||||
/// </summary>
|
|
||||
public MessageLevel MessageLevel { get; set; } |
|
||||
|
|
||||
public string MessageLevelDescription => MessageLevel.ToDescription(); |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 发送人
|
|
||||
/// </summary>
|
|
||||
public Guid SenderId { get; set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 创建时间
|
|
||||
/// </summary>
|
|
||||
public DateTime CreationTime { get; set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 是否已读
|
|
||||
/// </summary>
|
|
||||
public bool Read { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,70 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
||||
|
{ |
||||
|
public class PagingNotificationOutput |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 租户id
|
||||
|
/// </summary>
|
||||
|
public Guid? TenantId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息标题
|
||||
|
/// </summary>
|
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息内容
|
||||
|
/// </summary>
|
||||
|
public string Content { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息类型
|
||||
|
/// </summary>
|
||||
|
public MessageType MessageType { get; set; } |
||||
|
|
||||
|
public string MessageTypeName => MessageType.ToDescription(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息等级
|
||||
|
/// </summary>
|
||||
|
public MessageLevel MessageLevel { get; set; } |
||||
|
public string MessageLevelName => MessageLevel.ToDescription(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人
|
||||
|
/// </summary>
|
||||
|
public Guid SenderUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人用户名
|
||||
|
/// </summary>
|
||||
|
public string SenderUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订阅人
|
||||
|
/// 消息类型是广播消息时,订阅人为空
|
||||
|
/// </summary>
|
||||
|
public Guid? ReceiveUserId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人用户名
|
||||
|
/// 消息类型是广播消息时,订接收人用户名为空
|
||||
|
/// </summary>
|
||||
|
public string ReceiveUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool Read { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? ReadTime { get; set; } |
||||
|
|
||||
|
public DateTime CreationTime { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
||||
|
{ |
||||
|
public class PagingNotificationSubscriptionInput : PagingBase |
||||
|
{ |
||||
|
|
||||
|
public Guid NotificationId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接受者Id
|
||||
|
/// </summary>
|
||||
|
public Guid? ReceiverUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接受者名称
|
||||
|
/// </summary>
|
||||
|
public string ReceiverUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool? Read { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读开始时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? StartReadTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读结束时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? EndReadTime { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
||||
|
{ |
||||
|
public class PagingNotificationSubscriptionOutput |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 租户id
|
||||
|
/// </summary>
|
||||
|
public Guid? TenantId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息Id
|
||||
|
/// </summary>
|
||||
|
public Guid NotificationId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人id
|
||||
|
/// </summary>
|
||||
|
public Guid ReceiveUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人用户名
|
||||
|
/// </summary>
|
||||
|
public string ReceiveUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool Read { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读时间
|
||||
|
/// </summary>
|
||||
|
public DateTime ReadTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息标题
|
||||
|
/// </summary>
|
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息内容
|
||||
|
/// </summary>
|
||||
|
public string Content { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息类型
|
||||
|
/// </summary>
|
||||
|
public MessageType MessageType { get; set; } |
||||
|
|
||||
|
public string MessageTypeName => MessageType.ToDescription(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息等级
|
||||
|
/// </summary>
|
||||
|
public MessageLevel MessageLevel { get; set; } |
||||
|
public string MessageLevelName => MessageLevel.ToDescription(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人
|
||||
|
/// </summary>
|
||||
|
public Guid SenderUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人用户名
|
||||
|
/// </summary>
|
||||
|
public string SenderUserName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
using Lion.AbpPro.NotificationManagement.Notifications.Enums; |
||||
|
|
||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos |
||||
|
{ |
||||
|
public class NotificationDto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 租户id
|
||||
|
/// </summary>
|
||||
|
public Guid? TenantId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息标题
|
||||
|
/// </summary>
|
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息内容
|
||||
|
/// </summary>
|
||||
|
public string Content { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息类型
|
||||
|
/// </summary>
|
||||
|
public MessageType MessageType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息等级
|
||||
|
/// </summary>
|
||||
|
public MessageLevel MessageLevel { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人
|
||||
|
/// </summary>
|
||||
|
public Guid SenderUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发送人用户名
|
||||
|
/// </summary>
|
||||
|
public string SenderUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订阅人
|
||||
|
/// 消息类型是广播消息时,订阅人为空
|
||||
|
/// </summary>
|
||||
|
public Guid? ReceiveUserId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人用户名
|
||||
|
/// 消息类型是广播消息时,订接收人用户名为空
|
||||
|
/// </summary>
|
||||
|
public string ReceiveUserName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool Read { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读时间
|
||||
|
/// </summary>
|
||||
|
public DateTime? ReadTime { get; set; } |
||||
|
|
||||
|
public DateTime CreationTime { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos; |
||||
|
|
||||
|
public class NotificationSubscriptionDto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 租户id
|
||||
|
/// </summary>
|
||||
|
public Guid? TenantId { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 消息Id
|
||||
|
/// </summary>
|
||||
|
public Guid NotificationId { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人id
|
||||
|
/// </summary>
|
||||
|
public Guid ReceiveUserId { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 接收人用户名
|
||||
|
/// </summary>
|
||||
|
public string ReceiveUserName { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否已读
|
||||
|
/// </summary>
|
||||
|
public bool Read { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已读时间
|
||||
|
/// </summary>
|
||||
|
public DateTime ReadTime { get; private set; } |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
using Lion.AbpPro.NotificationManagement.Notifications.Dtos; |
||||
|
|
||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications; |
||||
|
|
||||
|
public interface INotificationSubscriptionManager |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 设置已读
|
||||
|
/// </summary>
|
||||
|
Task SetReadAsync(Guid receiveUserId, string receiveUserName, Guid notificationId); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 分页获取消息
|
||||
|
/// </summary>
|
||||
|
Task<List<NotificationSubscriptionDto>> GetPagingListAsync( |
||||
|
Guid notificationId, |
||||
|
Guid? receiverUserId, |
||||
|
string receiverUserName, |
||||
|
DateTime? startReadTime, |
||||
|
DateTime? endReadTime, |
||||
|
int maxResultCount = 10, |
||||
|
int skipCount = 0, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取消息总条数
|
||||
|
/// </summary>
|
||||
|
Task<long> GetPagingCountAsync( |
||||
|
Guid notificationId, |
||||
|
Guid? receiverUserId, |
||||
|
string receiverUserName, |
||||
|
DateTime? startReadTime, |
||||
|
DateTime? endReadTime, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 消息通知 仓储接口
|
||||
|
/// </summary>
|
||||
|
public interface INotificationSubscriptionRepository : IBasicRepository<NotificationSubscription, Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 分页获取消息
|
||||
|
/// </summary>
|
||||
|
Task<List<NotificationSubscription>> GetPagingListAsync( |
||||
|
Guid notificationId, |
||||
|
Guid? receiverUserId, |
||||
|
string receiverUserName, |
||||
|
DateTime? startReadTime, |
||||
|
DateTime? endReadTime, |
||||
|
int maxResultCount = 10, |
||||
|
int skipCount = 0, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取消息总条数
|
||||
|
/// </summary>
|
||||
|
Task<long> GetPagingCountAsync( |
||||
|
Guid notificationId, |
||||
|
Guid? receiverUserId, |
||||
|
string receiverUserName, |
||||
|
DateTime? startReadTime, |
||||
|
DateTime? endReadTime, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<NotificationSubscription> FindAsync(Guid receiverUserId, Guid notificationId, CancellationToken cancellationToken = default); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
using Lion.AbpPro.NotificationManagement.Notifications.Dtos; |
||||
|
|
||||
|
namespace Lion.AbpPro.NotificationManagement.Notifications; |
||||
|
|
||||
|
public class NotificationSubscriptionManager : NotificationManagementDomainService, INotificationSubscriptionManager |
||||
|
{ |
||||
|
private readonly INotificationSubscriptionRepository _notificationSubscriptionRepository; |
||||
|
|
||||
|
public NotificationSubscriptionManager(INotificationSubscriptionRepository notificationSubscriptionRepository) |
||||
|
{ |
||||
|
_notificationSubscriptionRepository = notificationSubscriptionRepository; |
||||
|
} |
||||
|
|
||||
|
public async Task SetReadAsync(Guid receiveUserId, string receiveUserName, Guid notificationId) |
||||
|
{ |
||||
|
var subscription = await _notificationSubscriptionRepository.FindAsync(receiveUserId, notificationId); |
||||
|
if (subscription != null) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
subscription = new NotificationSubscription(GuidGenerator.Create(), notificationId, receiveUserId, receiveUserName, Clock.Now, true, CurrentTenant?.Id); |
||||
|
await _notificationSubscriptionRepository.InsertAsync(subscription); |
||||
|
} |
||||
|
|
||||
|
public async Task<List<NotificationSubscriptionDto>> GetPagingListAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
var list = await _notificationSubscriptionRepository.GetPagingListAsync(notificationId, receiverUserId, receiverUserName, startReadTime, endReadTime, maxResultCount, skipCount, cancellationToken); |
||||
|
return ObjectMapper.Map<List<NotificationSubscription>, List<NotificationSubscriptionDto>>(list); |
||||
|
} |
||||
|
|
||||
|
public async Task<long> GetPagingCountAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await _notificationSubscriptionRepository.GetPagingCountAsync(notificationId, receiverUserId, receiverUserName, startReadTime, endReadTime, cancellationToken); |
||||
|
} |
||||
|
} |
||||
@ -1,10 +0,0 @@ |
|||||
namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications |
|
||||
{ |
|
||||
public static class EfCoreNotificationQueryableExtensions |
|
||||
{ |
|
||||
public static IQueryable<Notification> IncludeDetails(this IQueryable<Notification> queryable, bool include = true) |
|
||||
{ |
|
||||
return !include ? queryable : queryable.Include(e => e.NotificationSubscriptions); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,39 @@ |
|||||
|
namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications; |
||||
|
|
||||
|
public class EfCoreNotificationSubscriptionRepository : EfCoreRepository<INotificationManagementDbContext, NotificationSubscription, Guid>, INotificationSubscriptionRepository |
||||
|
{ |
||||
|
public EfCoreNotificationSubscriptionRepository([NotNull] IDbContextProvider<INotificationManagementDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public async Task<List<NotificationSubscription>> GetPagingListAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetDbSetAsync()) |
||||
|
.Where(e => e.NotificationId == notificationId) |
||||
|
.WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) |
||||
|
.WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) |
||||
|
.WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) |
||||
|
.WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) |
||||
|
.OrderByDescending(e => e.CreationTime) |
||||
|
.PageBy(skipCount, maxResultCount) |
||||
|
.ToListAsync(GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
|
||||
|
public async Task<long> GetPagingCountAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetDbSetAsync()) |
||||
|
.Where(e => e.NotificationId == notificationId) |
||||
|
.WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) |
||||
|
.WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) |
||||
|
.WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) |
||||
|
.WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) |
||||
|
.OrderByDescending(e => e.CreationTime) |
||||
|
.CountAsync(GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
|
||||
|
public async Task<NotificationSubscription> FindAsync(Guid receiverUserId, Guid notificationId, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetDbSetAsync()).FirstOrDefaultAsync(e => e.ReceiveUserId == receiverUserId && e.NotificationId == notificationId, GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,104 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Lion.AbpPro.Migrations |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
public partial class AddTenantId : Migration |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AlterColumn<string>( |
|
||||
name: "Providers", |
|
||||
table: "AbpSettingDefinitions", |
|
||||
type: "varchar(1024)", |
|
||||
maxLength: 1024, |
|
||||
nullable: true, |
|
||||
oldClrType: typeof(string), |
|
||||
oldType: "varchar(128)", |
|
||||
oldMaxLength: 128, |
|
||||
oldNullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.AlterColumn<string>( |
|
||||
name: "DefaultValue", |
|
||||
table: "AbpSettingDefinitions", |
|
||||
type: "varchar(2048)", |
|
||||
maxLength: 2048, |
|
||||
nullable: true, |
|
||||
oldClrType: typeof(string), |
|
||||
oldType: "varchar(256)", |
|
||||
oldMaxLength: 256, |
|
||||
oldNullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.AddColumn<Guid>( |
|
||||
name: "TenantId", |
|
||||
table: "AbpNotificationSubscriptions", |
|
||||
type: "char(36)", |
|
||||
nullable: true, |
|
||||
collation: "ascii_general_ci"); |
|
||||
|
|
||||
migrationBuilder.AddColumn<Guid>( |
|
||||
name: "TenantId", |
|
||||
table: "AbpNotifications", |
|
||||
type: "char(36)", |
|
||||
nullable: true, |
|
||||
collation: "ascii_general_ci"); |
|
||||
|
|
||||
migrationBuilder.AddColumn<Guid>( |
|
||||
name: "TenantId", |
|
||||
table: "AbpLanguages", |
|
||||
type: "char(36)", |
|
||||
nullable: true, |
|
||||
collation: "ascii_general_ci"); |
|
||||
} |
|
||||
|
|
||||
/// <inheritdoc />
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "TenantId", |
|
||||
table: "AbpNotificationSubscriptions"); |
|
||||
|
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "TenantId", |
|
||||
table: "AbpNotifications"); |
|
||||
|
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "TenantId", |
|
||||
table: "AbpLanguages"); |
|
||||
|
|
||||
migrationBuilder.AlterColumn<string>( |
|
||||
name: "Providers", |
|
||||
table: "AbpSettingDefinitions", |
|
||||
type: "varchar(128)", |
|
||||
maxLength: 128, |
|
||||
nullable: true, |
|
||||
oldClrType: typeof(string), |
|
||||
oldType: "varchar(1024)", |
|
||||
oldMaxLength: 1024, |
|
||||
oldNullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|
||||
|
|
||||
migrationBuilder.AlterColumn<string>( |
|
||||
name: "DefaultValue", |
|
||||
table: "AbpSettingDefinitions", |
|
||||
type: "varchar(256)", |
|
||||
maxLength: 256, |
|
||||
nullable: true, |
|
||||
oldClrType: typeof(string), |
|
||||
oldType: "varchar(2048)", |
|
||||
oldMaxLength: 2048, |
|
||||
oldNullable: true) |
|
||||
.Annotation("MySql:CharSet", "utf8mb4") |
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,37 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Lion.AbpPro.Migrations |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
public partial class RemoveLanguageIndex : Migration |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropIndex( |
|
||||
name: "IX_AbpLanguages_CultureName", |
|
||||
table: "AbpLanguages"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_AbpLanguages_CultureName", |
|
||||
table: "AbpLanguages", |
|
||||
column: "CultureName"); |
|
||||
} |
|
||||
|
|
||||
/// <inheritdoc />
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropIndex( |
|
||||
name: "IX_AbpLanguages_CultureName", |
|
||||
table: "AbpLanguages"); |
|
||||
|
|
||||
migrationBuilder.CreateIndex( |
|
||||
name: "IX_AbpLanguages_CultureName", |
|
||||
table: "AbpLanguages", |
|
||||
column: "CultureName", |
|
||||
unique: true); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,65 @@ |
|||||
|
<template> |
||||
|
<BasicModal |
||||
|
:title="t('common.createText')" |
||||
|
:canFullscreen="false" |
||||
|
@ok="submit" |
||||
|
@cancel="cancel" |
||||
|
@register="registerNotificationModal" |
||||
|
> |
||||
|
<BasicForm @register="registerNotificationForm" /> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts"> |
||||
|
import { defineComponent } from 'vue'; |
||||
|
import { BasicModal, useModalInner } from '/@/components/Modal'; |
||||
|
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
|
import { createFormSchema, sendNotificationAsync } from './Index'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
export default defineComponent({ |
||||
|
name: 'CreateSubscription', |
||||
|
components: { |
||||
|
BasicModal, |
||||
|
BasicForm, |
||||
|
}, |
||||
|
emits: ['reload', 'register'], |
||||
|
setup(_, { emit }) { |
||||
|
const { t } = useI18n(); |
||||
|
const [registerNotificationForm, { getFieldsValue, resetFields, validate }] = useForm({ |
||||
|
labelWidth: 120, |
||||
|
schemas: createFormSchema, |
||||
|
showActionButtonGroup: false, |
||||
|
}); |
||||
|
|
||||
|
const [registerNotificationModal, { changeOkLoading, closeModal }] = useModalInner(); |
||||
|
|
||||
|
const submit = async () => { |
||||
|
try { |
||||
|
const params = getFieldsValue(); |
||||
|
changeOkLoading(true); |
||||
|
await validate(); |
||||
|
await sendNotificationAsync({ params }); |
||||
|
await resetFields(); |
||||
|
emit('reload'); |
||||
|
closeModal(); |
||||
|
} finally { |
||||
|
changeOkLoading(false); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const cancel = () => { |
||||
|
resetFields(); |
||||
|
closeModal(); |
||||
|
}; |
||||
|
return { |
||||
|
registerNotificationModal, |
||||
|
registerNotificationForm, |
||||
|
submit, |
||||
|
cancel, |
||||
|
t |
||||
|
}; |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped></style> |
||||
@ -0,0 +1,65 @@ |
|||||
|
<template> |
||||
|
<BasicModal |
||||
|
:title="t('routes.admin.notificationManagement_sendNotificationSubscription')" |
||||
|
:canFullscreen="false" |
||||
|
@ok="submit" |
||||
|
@cancel="cancel" |
||||
|
@register="registerNotificationModal" |
||||
|
> |
||||
|
<BasicForm @register="registerNotificationForm" /> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts"> |
||||
|
import { defineComponent } from 'vue'; |
||||
|
import { BasicModal, useModalInner } from '/@/components/Modal'; |
||||
|
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
|
import { createSubscriptionFormSchema, sendNotificationSubscriptionAsync } from './Index'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
export default defineComponent({ |
||||
|
name: 'CreateNotification', |
||||
|
components: { |
||||
|
BasicModal, |
||||
|
BasicForm, |
||||
|
}, |
||||
|
emits: ['reload', 'register'], |
||||
|
setup(_, { emit }) { |
||||
|
const { t } = useI18n(); |
||||
|
const [registerNotificationForm, { getFieldsValue, resetFields, validate }] = useForm({ |
||||
|
labelWidth: 120, |
||||
|
schemas: createSubscriptionFormSchema, |
||||
|
showActionButtonGroup: false, |
||||
|
}); |
||||
|
|
||||
|
const [registerNotificationModal, { changeOkLoading, closeModal }] = useModalInner(); |
||||
|
|
||||
|
const submit = async () => { |
||||
|
try { |
||||
|
const params = getFieldsValue(); |
||||
|
changeOkLoading(true); |
||||
|
await validate(); |
||||
|
await sendNotificationSubscriptionAsync({ params }); |
||||
|
await resetFields(); |
||||
|
emit('reload'); |
||||
|
closeModal(); |
||||
|
} finally { |
||||
|
changeOkLoading(false); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const cancel = () => { |
||||
|
resetFields(); |
||||
|
closeModal(); |
||||
|
}; |
||||
|
return { |
||||
|
registerNotificationModal, |
||||
|
registerNotificationForm, |
||||
|
submit, |
||||
|
cancel, |
||||
|
t |
||||
|
}; |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped></style> |
||||
@ -0,0 +1,396 @@ |
|||||
|
import { FormSchema } from '/@/components/Table'; |
||||
|
import { BasicColumn } from '/@/components/Table'; |
||||
|
import { |
||||
|
NotificationServiceProxy, |
||||
|
PagingNotificationSubscriptionInput, |
||||
|
PagingNotificationInput, |
||||
|
PagingUserListInput, |
||||
|
UsersServiceProxy |
||||
|
} from '/@/services/ServiceProxies'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
import { formatToDateTime, dateUtil } from '/@/utils/dateUtil'; |
||||
|
const { t } = useI18n(); |
||||
|
// 分页表格消息通知 BasicColumn
|
||||
|
export const tableColumns: BasicColumn[] = [ |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_title'), |
||||
|
dataIndex: 'title', |
||||
|
width: 200, |
||||
|
}, |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_content'), |
||||
|
dataIndex: 'content', |
||||
|
}, |
||||
|
// {
|
||||
|
// title: t('routes.admin.notificationManagement_messageType'),
|
||||
|
// dataIndex: 'messageTypeName',
|
||||
|
// width: 100,
|
||||
|
// },
|
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
dataIndex: 'messageLevelName', |
||||
|
width: 100, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_senderUserName'), |
||||
|
dataIndex: 'senderUserName', |
||||
|
width: 100, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_receiveUserName'), |
||||
|
dataIndex: 'receiveUserName', |
||||
|
width: 100, |
||||
|
}, |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_read'), |
||||
|
dataIndex: 'read', |
||||
|
width: 100, |
||||
|
}, |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_readTime'), |
||||
|
dataIndex: 'readTime', |
||||
|
customRender: ({ text }) => { |
||||
|
return formatToDateTime(text); |
||||
|
}, |
||||
|
width: 250, |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
// 分页查询消息通知 FormSchema
|
||||
|
export const searchFormSchema: FormSchema[] = [ |
||||
|
{ |
||||
|
field: 'title', |
||||
|
label: t('routes.admin.notificationManagement_title'), |
||||
|
component: "Input", |
||||
|
colProps: { span: 4 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'content', |
||||
|
label: t('routes.admin.notificationManagement_content'), |
||||
|
component: "Input", |
||||
|
colProps: { span: 6 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageType', |
||||
|
label: t('routes.admin.notificationManagement_messageType'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
defaultValue: 20, |
||||
|
show: false, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageLevel', |
||||
|
component: 'Select', |
||||
|
label: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
|
||||
|
colProps: { |
||||
|
span: 2, |
||||
|
}, |
||||
|
componentProps: { |
||||
|
options: [ |
||||
|
{ |
||||
|
label: '警告', |
||||
|
value: 10, |
||||
|
}, |
||||
|
{ |
||||
|
label: '正常', |
||||
|
value: 20, |
||||
|
}, |
||||
|
{ |
||||
|
label: '错误', |
||||
|
value: 30, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
field: 'read', |
||||
|
component: 'Select', |
||||
|
label: t('routes.admin.notificationManagement_read'), |
||||
|
|
||||
|
colProps: { |
||||
|
span: 2, |
||||
|
}, |
||||
|
componentProps: { |
||||
|
options: [ |
||||
|
{ |
||||
|
label: '是', |
||||
|
value: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '否', |
||||
|
value: false, |
||||
|
} |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
]; |
||||
|
|
||||
|
// 创建消息通知 FormSchema
|
||||
|
export const createFormSchema: FormSchema[] = [ |
||||
|
{ |
||||
|
field: 'title', |
||||
|
label: t('routes.admin.notificationManagement_title'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'content', |
||||
|
label: t('routes.admin.notificationManagement_content'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageLevel', |
||||
|
component: 'Select', |
||||
|
label: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
defaultValue: 20, |
||||
|
colProps: { span: 18 }, |
||||
|
componentProps: { |
||||
|
options: [ |
||||
|
{ |
||||
|
label: '警告', |
||||
|
value: 10, |
||||
|
}, |
||||
|
{ |
||||
|
label: '正常', |
||||
|
value: 20, |
||||
|
}, |
||||
|
{ |
||||
|
label: '错误', |
||||
|
value: 30, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
field: 'receiveUserId', |
||||
|
label: t('routes.admin.notificationManagement_receiveUserName'), |
||||
|
labelWidth: 120, |
||||
|
component: 'ApiSelect', |
||||
|
colProps: { span: 18 }, |
||||
|
componentProps: ({ formModel }) => { |
||||
|
return { |
||||
|
api: getUserListAsync, |
||||
|
labelField: 'userName', |
||||
|
valueField: 'id', |
||||
|
showSearch: true, |
||||
|
optionFilterProp: 'label', |
||||
|
onChange: async (e: any, options : any) => { |
||||
|
formModel.receiveUserName = options.name; |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
field: 'receiveUserName', |
||||
|
label: 'ReceiveUserName', |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
show: false, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
// 创建消息通知 FormSchema
|
||||
|
export const createSubscriptionFormSchema: FormSchema[] = [ |
||||
|
{ |
||||
|
field: 'title', |
||||
|
label: t('routes.admin.notificationManagement_title'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'content', |
||||
|
label: t('routes.admin.notificationManagement_content'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageLevel', |
||||
|
component: 'Select', |
||||
|
label: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
defaultValue: 20, |
||||
|
colProps: { span: 18 }, |
||||
|
componentProps: { |
||||
|
options: [ |
||||
|
{ |
||||
|
label: '警告', |
||||
|
value: 10, |
||||
|
}, |
||||
|
{ |
||||
|
label: '正常', |
||||
|
value: 20, |
||||
|
}, |
||||
|
{ |
||||
|
label: '错误', |
||||
|
value: 30, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
// 分页查询消息通知 FormSchema
|
||||
|
export const searchSubscriptionFormSchema: FormSchema[] = [ |
||||
|
{ |
||||
|
field: 'title', |
||||
|
label: t('routes.admin.notificationManagement_title'), |
||||
|
component: "Input", |
||||
|
colProps: { span: 4 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'content', |
||||
|
label: t('routes.admin.notificationManagement_content'), |
||||
|
component: "Input", |
||||
|
colProps: { span: 6 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageType', |
||||
|
label: t('routes.admin.notificationManagement_messageType'), |
||||
|
component: "Input", |
||||
|
required: true, |
||||
|
defaultValue: 10, |
||||
|
show: false, |
||||
|
colProps: { span: 18 } |
||||
|
}, |
||||
|
{ |
||||
|
field: 'messageLevel', |
||||
|
component: 'Select', |
||||
|
label: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
|
||||
|
colProps: { |
||||
|
span: 2, |
||||
|
}, |
||||
|
componentProps: { |
||||
|
options: [ |
||||
|
{ |
||||
|
label: '警告', |
||||
|
value: 10, |
||||
|
}, |
||||
|
{ |
||||
|
label: '正常', |
||||
|
value: 20, |
||||
|
}, |
||||
|
{ |
||||
|
label: '错误', |
||||
|
value: 30, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}, |
||||
|
]; |
||||
|
// 分页表格消息通知 BasicColumn
|
||||
|
export const tableSubscriptionColumns: BasicColumn[] = [ |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_title'), |
||||
|
dataIndex: 'title', |
||||
|
width: 200, |
||||
|
}, |
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_content'), |
||||
|
dataIndex: 'content', |
||||
|
}, |
||||
|
// {
|
||||
|
// title: t('routes.admin.notificationManagement_messageType'),
|
||||
|
// dataIndex: 'messageTypeName',
|
||||
|
// width: 100,
|
||||
|
// },
|
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_messageLevel'), |
||||
|
dataIndex: 'messageLevelName', |
||||
|
width: 100, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: t('routes.admin.notificationManagement_senderUserName'), |
||||
|
dataIndex: 'senderUserName', |
||||
|
width: 100, |
||||
|
}, |
||||
|
{ |
||||
|
title: t('routes.admin.userManagement_createTime'), |
||||
|
dataIndex: 'creationTime', |
||||
|
customRender: ({ text }) => { |
||||
|
return dateUtil(text).format('YYYY-MM-DD HH:mm:ss'); |
||||
|
}, |
||||
|
width: 250, |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
/** |
||||
|
* 分页查询消息通知 |
||||
|
*/ |
||||
|
export async function notificationPageAsync(params: PagingNotificationInput, |
||||
|
) { |
||||
|
const notificationServiceProxy = new NotificationServiceProxy(); |
||||
|
return notificationServiceProxy.notificationPage(params); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 分页查询消息通知 |
||||
|
*/ |
||||
|
export async function notificationSubscriptionPageAsync(params: PagingNotificationSubscriptionInput, |
||||
|
) { |
||||
|
const notificationServiceProxy = new NotificationServiceProxy(); |
||||
|
return notificationServiceProxy.notificationSubscriptionPage(params); |
||||
|
} |
||||
|
|
||||
|
export async function setReadAsync(request) { |
||||
|
const _notificationServiceProxy = new NotificationServiceProxy(); |
||||
|
await _notificationServiceProxy.read(request); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 创建消息通知 |
||||
|
*/ |
||||
|
export async function sendNotificationAsync({ params }) { |
||||
|
const notificationServiceProxy = new NotificationServiceProxy(); |
||||
|
if (params.messageLevel == 10) { |
||||
|
await notificationServiceProxy.sendCommonWarningMessage(params); |
||||
|
} |
||||
|
if (params.messageLevel == 20) { |
||||
|
await notificationServiceProxy.sendCommonInformationMessage(params); |
||||
|
} |
||||
|
if (params.messageLevel == 30) { |
||||
|
await notificationServiceProxy.sendCommonErrorMessage(params); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 创建消息通知 |
||||
|
*/ |
||||
|
export async function sendNotificationSubscriptionAsync({ params }) { |
||||
|
const notificationServiceProxy = new NotificationServiceProxy(); |
||||
|
if (params.messageLevel == 10) { |
||||
|
await notificationServiceProxy.sendBroadCastWarningMessage(params); |
||||
|
} |
||||
|
if (params.messageLevel == 20) { |
||||
|
await notificationServiceProxy.sendBroadCastInformationMessage(params); |
||||
|
} |
||||
|
if (params.messageLevel == 30) { |
||||
|
await notificationServiceProxy.sendBroadCastErrorMessage(params); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取用户列表 |
||||
|
* @param params |
||||
|
* @returns |
||||
|
*/ |
||||
|
export async function getUserListAsync( |
||||
|
params: PagingUserListInput, |
||||
|
) { |
||||
|
const _userServiceProxy = new UsersServiceProxy(); |
||||
|
return _userServiceProxy.list(params); |
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<BasicTable @register="registerTable" size="small"> |
||||
|
<template #toolbar> |
||||
|
<a-button |
||||
|
preIcon="ant-design:plus-circle-outlined" |
||||
|
type="primary" |
||||
|
@click="openCreateNotificationModal" |
||||
|
> |
||||
|
{{t('routes.admin.notificationManagement_sendNotification')}} |
||||
|
</a-button> |
||||
|
</template> |
||||
|
<template #bodyCell="{ column, record }"> |
||||
|
<template v-if="column.key === 'read'"> |
||||
|
<Tag color='green' v-if="record.read">{{ record.read? '已读' : '未读' }}</Tag> |
||||
|
<Tag v-if="!record.read">{{ record.read? '已读' : '未读' }}</Tag> |
||||
|
</template> |
||||
|
|
||||
|
<template v-if="column.key === 'messageLevelName'"> |
||||
|
<Tag color='yellow' v-if="record.messageLevel ===10">{{ record.messageLevelName}}</Tag> |
||||
|
<Tag color='green' v-if="record.messageLevel === 20">{{ record.messageLevelName}}</Tag> |
||||
|
<Tag color='red' v-if="record.messageLevel === 30">{{ record.messageLevelName}}</Tag> |
||||
|
</template> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<template #action="{ record }"> |
||||
|
<TableAction |
||||
|
:actions="[ |
||||
|
{ |
||||
|
icon: 'clarity:note-edit-line', |
||||
|
label: t('routes.admin.notificationManagement_setRead'), |
||||
|
onClick: handleSetRead.bind(null, record), |
||||
|
}, |
||||
|
]" |
||||
|
/> |
||||
|
</template> |
||||
|
</BasicTable> |
||||
|
<CreateNotification |
||||
|
@register="registerCreateNotificationModal" |
||||
|
@reload="reload" |
||||
|
:bodyStyle="{ 'padding-top': '0' }" |
||||
|
/> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts"> |
||||
|
import { defineComponent } from 'vue'; |
||||
|
import { BasicTable, TableAction, useTable } from '/@/components/Table'; |
||||
|
import { Tag } from 'ant-design-vue'; |
||||
|
import { tableColumns, searchFormSchema, notificationPageAsync,setReadAsync } from './Index'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
import { SetReadInput } from '/@/services/ServiceProxies'; |
||||
|
import CreateNotification from './CreateNotification.vue'; |
||||
|
import { useModal } from '/@/components/Modal'; |
||||
|
export default defineComponent({ |
||||
|
name: 'Notification', |
||||
|
components: { |
||||
|
BasicTable, |
||||
|
TableAction, |
||||
|
Tag, |
||||
|
CreateNotification |
||||
|
}, |
||||
|
setup() { |
||||
|
const { t } = useI18n(); |
||||
|
// table配置 |
||||
|
const [registerTable, { reload }] = useTable({ |
||||
|
columns: tableColumns, |
||||
|
formConfig: { |
||||
|
labelWidth: 70, |
||||
|
schemas: searchFormSchema, |
||||
|
}, |
||||
|
api: notificationPageAsync, |
||||
|
showTableSetting: true, |
||||
|
useSearchForm: true, |
||||
|
bordered: true, |
||||
|
canResize: true, |
||||
|
showIndexColumn: true, |
||||
|
immediate: true, |
||||
|
scroll: { x: true }, |
||||
|
actionColumn: { |
||||
|
width: 220, |
||||
|
title: '操作', |
||||
|
dataIndex: 'action', |
||||
|
slots: { customRender: 'action' }, |
||||
|
}, |
||||
|
}); |
||||
|
const [registerCreateNotificationModal, { openModal: openCreateNotificationModal }] = useModal(); |
||||
|
async function handleSetRead(record: Recordable) { |
||||
|
let request = new SetReadInput(); |
||||
|
request.id = record.id; |
||||
|
await setReadAsync(request); |
||||
|
await reload(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
return { |
||||
|
registerTable, |
||||
|
reload, |
||||
|
t, |
||||
|
handleSetRead, |
||||
|
registerCreateNotificationModal, |
||||
|
openCreateNotificationModal |
||||
|
}; |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
||||
@ -0,0 +1,76 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<BasicTable @register="registerTable" size="small"> |
||||
|
<template #toolbar> |
||||
|
<a-button |
||||
|
preIcon="ant-design:plus-circle-outlined" |
||||
|
type="primary" |
||||
|
@click="openCreateNotificationModal" |
||||
|
> |
||||
|
{{t('routes.admin.notificationManagement_sendNotificationSubscription')}} |
||||
|
</a-button> |
||||
|
</template> |
||||
|
<template #bodyCell="{ column, record }"> |
||||
|
|
||||
|
<template v-if="column.key === 'messageLevelName'"> |
||||
|
<Tag color='yellow' v-if="record.messageLevel ===10">{{ record.messageLevelName}}</Tag> |
||||
|
<Tag color='green' v-if="record.messageLevel === 20">{{ record.messageLevelName}}</Tag> |
||||
|
<Tag color='red' v-if="record.messageLevel === 30">{{ record.messageLevelName}}</Tag> |
||||
|
</template> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
</BasicTable> |
||||
|
<CreateSubscription |
||||
|
@register="registerCreateNotificationModal" |
||||
|
@reload="reload" |
||||
|
:bodyStyle="{ 'padding-top': '0' }" |
||||
|
/> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts"> |
||||
|
import { defineComponent } from 'vue'; |
||||
|
import { BasicTable, TableAction, useTable } from '/@/components/Table'; |
||||
|
import { Tag } from 'ant-design-vue'; |
||||
|
import { tableSubscriptionColumns, searchSubscriptionFormSchema, notificationPageAsync } from './Index'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
import CreateSubscription from './CreateSubscription.vue'; |
||||
|
import { useModal } from '/@/components/Modal'; |
||||
|
export default defineComponent({ |
||||
|
name: 'Subscription', |
||||
|
components: { |
||||
|
BasicTable, |
||||
|
TableAction, |
||||
|
Tag, |
||||
|
CreateSubscription |
||||
|
}, |
||||
|
setup() { |
||||
|
const { t } = useI18n(); |
||||
|
// table配置 |
||||
|
const [registerTable, { reload }] = useTable({ |
||||
|
columns: tableSubscriptionColumns, |
||||
|
formConfig: { |
||||
|
labelWidth: 70, |
||||
|
schemas: searchSubscriptionFormSchema, |
||||
|
}, |
||||
|
api: notificationPageAsync, |
||||
|
showTableSetting: true, |
||||
|
useSearchForm: true, |
||||
|
bordered: true, |
||||
|
canResize: true, |
||||
|
showIndexColumn: true, |
||||
|
immediate: true, |
||||
|
scroll: { x: true }, |
||||
|
}); |
||||
|
const [registerCreateNotificationModal, { openModal: openCreateNotificationModal }] = useModal(); |
||||
|
return { |
||||
|
registerTable, |
||||
|
reload, |
||||
|
t, |
||||
|
registerCreateNotificationModal, |
||||
|
openCreateNotificationModal |
||||
|
}; |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
||||
Loading…
Reference in new issue