新增打印模板管理功能,包含免密接口和实时通知机制,支持桌面端打印模板的查询和列表展示。更新相关控制器、服务和视图,优化用户体验并增强系统的实时数据同步能力。

This commit is contained in:
geht
2026-05-12 18:29:03 +08:00
parent f5ba828eff
commit fcedc66f7a
32 changed files with 2788 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public class PrintTemplateChangedPayload
{
public string Action { get; set; } = string.Empty; // add/edit/delete/reconnect/pull
public string? TemplateId { get; set; }
}
public class PrintTemplateChangedEvent : PubSubEvent<PrintTemplateChangedPayload> { }

View File

@@ -0,0 +1,12 @@
namespace YY.Admin.Core.Services;
public record PrintDotPrinter(string Name, bool IsDefault);
public interface IPrintDotService
{
/// <summary>获取 PrintDot 打印机列表,同时验证连通性。</summary>
Task<IReadOnlyList<PrintDotPrinter>> GetPrintersAsync(CancellationToken ct = default);
/// <summary>发送 PDF base64 打印任务content 可含或不含 data:application/pdf;base64, 前缀)。</summary>
Task PrintAsync(string printerName, string pdfBase64, string jobName = "QH-MES", int copies = 1, CancellationToken ct = default);
}

View File

@@ -0,0 +1,11 @@
using YY.Admin.Core.Entity;
namespace YY.Admin.Core.Services;
public interface IPrintTemplateService
{
Task<PrintTemplate?> GetByCodeAsync(string templateCode, CancellationToken ct = default);
Task<IReadOnlyList<PrintTemplate>> ListAsync(CancellationToken ct = default);
Task<IReadOnlyList<PrintTemplate>> RefreshCacheAsync(CancellationToken ct = default);
IReadOnlyList<PrintTemplate> GetCached();
}

View File

@@ -0,0 +1,20 @@
namespace YY.Admin.Core.Entity;
/// <summary>打印模板(映射后端 print_template 表,桌面端只读)</summary>
public class PrintTemplate
{
public string? Id { get; set; }
public string? TemplateCode { get; set; }
public string? TemplateName { get; set; }
public string? Category { get; set; }
public double? PaperWidthMm { get; set; }
public double? PaperHeightMm { get; set; }
public string? PaperOrientation { get; set; }
/// <summary>原生设计器 JSONengine=native</summary>
public string? TemplateJson { get; set; }
public string? Remark { get; set; }
public string? CreateBy { get; set; }
public DateTime? CreateTime { get; set; }
public string? UpdateBy { get; set; }
public DateTime? UpdateTime { get; set; }
}

View File

@@ -77,6 +77,8 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
// 登录设置(桌面端会话与检查间隔)
new SysMenu{ Id=1300200013001, Pid=1300200000101, Title="登录设置", Path="LoginSettingsView", Name="loginSettings", Component="LoginSettingsView", Icon="&#xe7c1;", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=107 },
// 打印设置PrintDot 桥接器配置)
new SysMenu{ Id=1300200013101, Pid=1300200000101, Title="打印设置", Path="PrintSettingsView", Name="printSettings", Component="PrintSettingsView", Icon="&#xe7c0;", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=108 },
// 角色管理
new SysMenu{ Id=1300200020101, Pid=1300200000101, Title="角色管理", Path="RoleManagementView", Name="sysRole", Component="/system/role/index", Icon="&#xe7e0;", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=110 },

View File

@@ -218,6 +218,7 @@ public class SysTenantMenuSeedData : ISqlSugarEntitySeedData<SysTenantMenu>
new SysTenantMenu(){ TenantId=1300000000001,MenuId = 1300200010201},
new SysTenantMenu() { TenantId = 1300000000001,MenuId = 1300600040101},
new SysTenantMenu(){ TenantId=1300000000001, MenuId=1300150010901 },
new SysTenantMenu(){ TenantId=1300000000001, MenuId=1300200013101 },
};
}