修改一版
parent
ec4b1c58ef
commit
4f4f335e89
|
@ -22,8 +22,14 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
public bool ShiftKey { get; set; }
|
public bool ShiftKey { get; set; }
|
||||||
|
|
||||||
public bool MetaKey { get; set; }
|
public bool MetaKey { get; set; }
|
||||||
|
|
||||||
|
public string KeyboardShow { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RestoreDefaultShortcutKeyInDto
|
||||||
|
{
|
||||||
|
public int ImageToolType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class SetDefaultShortcutKey
|
public class SetDefaultShortcutKey
|
||||||
{
|
{
|
||||||
|
@ -39,6 +45,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
public bool AltKey { get; set; }
|
public bool AltKey { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string KeyboardShow { get; set; }
|
||||||
|
|
||||||
public bool CtrlKey { get; set; }
|
public bool CtrlKey { get; set; }
|
||||||
|
|
||||||
public bool ShiftKey { get; set; }
|
public bool ShiftKey { get; set; }
|
||||||
|
|
|
@ -17,55 +17,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
public class ShortcutKeyService: BaseService
|
public class ShortcutKeyService: BaseService
|
||||||
{
|
{
|
||||||
private readonly IRepository<Dictionary> _dictionaryRepository;
|
private readonly IRepository<Dictionary> _dictionaryRepository;
|
||||||
private readonly IRepository<DefaultShortcutKey> _defaultShortcutKeyRepository;
|
private readonly IRepository<ShortcutKey> _shortcutKeyRepository;
|
||||||
|
|
||||||
public ShortcutKeyService(
|
public ShortcutKeyService(
|
||||||
IRepository<Dictionary> DictionaryRepository,
|
IRepository<Dictionary> DictionaryRepository,
|
||||||
IRepository<DefaultShortcutKey> defaultShortcutKeyRepository
|
IRepository<ShortcutKey> shortcutKeyRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_dictionaryRepository = DictionaryRepository;
|
_dictionaryRepository = DictionaryRepository;
|
||||||
_defaultShortcutKeyRepository = defaultShortcutKeyRepository;
|
_shortcutKeyRepository = shortcutKeyRepository;
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取默认快捷键
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inQuery"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<List<DefaultShortcutKeyView>> GetDefaultShortcutKeyList(DefaultShortcutKeyQuery inQuery)
|
|
||||||
{
|
|
||||||
var defaultShortcutKey = await _defaultShortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType).ToListAsync();
|
|
||||||
var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey")
|
|
||||||
.WhereIf(inQuery.ShortcutKeyEnum!=null,x=>x.Code==inQuery.ShortcutKeyEnum.ToString()).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
List<DefaultShortcutKeyView> result = new List<DefaultShortcutKeyView>();
|
|
||||||
|
|
||||||
shortcutKeydic.OrderBy(x => x.ShowOrder).ForEach(x =>
|
|
||||||
{
|
|
||||||
var key= defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).FirstOrDefault();
|
|
||||||
|
|
||||||
var isnull = key == null;
|
|
||||||
|
|
||||||
result.Add(new DefaultShortcutKeyView()
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
ImageToolType = inQuery.ImageToolType,
|
|
||||||
ShortcutKeyEnum = int.Parse(x.Code),
|
|
||||||
Keyboardkey = isnull ? string.Empty : key.Keyboardkey,
|
|
||||||
AltKey = isnull ? false : key.AltKey,
|
|
||||||
CtrlKey = isnull ? false : key.CtrlKey,
|
|
||||||
MetaKey = isnull ? false : key.MetaKey,
|
|
||||||
ShiftKey = isnull ? false : key.ShiftKey
|
|
||||||
}) ;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,29 +37,130 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<List<DefaultShortcutKeyView>> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery)
|
public async Task<List<DefaultShortcutKeyView>> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery)
|
||||||
{
|
{
|
||||||
return await this.GetDefaultShortcutKeyList(inQuery);
|
var shortcutKeyList = await _shortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType)
|
||||||
|
.Where(x=>x.UserId==_userInfo.Id)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var defaultshortcutKeyList = this.GetDefaultShortcutKey();
|
||||||
|
|
||||||
|
var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey")
|
||||||
|
.WhereIf(inQuery.ShortcutKeyEnum != null, x => x.Code == inQuery.ShortcutKeyEnum.ToString()).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
List<DefaultShortcutKeyView> result = new List<DefaultShortcutKeyView>();
|
||||||
|
|
||||||
|
shortcutKeydic.OrderBy(x => x.ShowOrder).ForEach(x =>
|
||||||
|
{
|
||||||
|
var key = shortcutKeyList.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).FirstOrDefault();
|
||||||
|
var defaultkey= defaultshortcutKeyList.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).FirstOrDefault();
|
||||||
|
var isnull = key == null;
|
||||||
|
|
||||||
|
result.Add(new DefaultShortcutKeyView()
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ImageToolType = inQuery.ImageToolType,
|
||||||
|
ShortcutKeyEnum = int.Parse(x.Code),
|
||||||
|
Keyboardkey = isnull ? defaultkey.Keyboardkey : key.Keyboardkey,
|
||||||
|
AltKey = isnull ? false : key.AltKey,
|
||||||
|
CtrlKey = isnull ? false : key.CtrlKey,
|
||||||
|
MetaKey = isnull ? false : key.MetaKey,
|
||||||
|
ShiftKey = isnull ? false : key.ShiftKey,
|
||||||
|
KeyboardShow = isnull ? defaultkey.KeyboardShow : key.KeyboardShow,
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取默认快捷键
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private List<ShortcutKey> GetDefaultShortcutKey()
|
||||||
|
{
|
||||||
|
List<ShortcutKey> shortcutKeys = new List<ShortcutKey>() {
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=1,Keyboardkey="right",KeyboardShow="right" },
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=2,Keyboardkey="left",KeyboardShow="left"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=3,Keyboardkey="PageUp",KeyboardShow="PageUp"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=4,Keyboardkey="pageDown",KeyboardShow="pageDown"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=5,Keyboardkey="Up",KeyboardShow="Up"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=6,Keyboardkey="Down",KeyboardShow="Down"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=7,Keyboardkey="L",KeyboardShow="L"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=8,Keyboardkey="R",KeyboardShow="R"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=9,Keyboardkey="H",KeyboardShow="H"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=10,Keyboardkey="V" ,KeyboardShow="V"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=11,Keyboardkey="+" ,KeyboardShow="+"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=12,Keyboardkey="-" ,KeyboardShow="-"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=13,Keyboardkey="=" ,KeyboardShow="="},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=14,Keyboardkey="F" ,KeyboardShow="F"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=15,Keyboardkey="S" ,KeyboardShow="S"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=16,Keyboardkey="I" ,KeyboardShow="I"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=17,Keyboardkey="C" ,KeyboardShow="C"},
|
||||||
|
new ShortcutKey (){ ShortcutKeyEnum=18,Keyboardkey="Space" ,KeyboardShow="Space"},
|
||||||
|
};
|
||||||
|
|
||||||
|
return shortcutKeys;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置默认快捷键
|
/// 重置为默认快捷键
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> RestoreDefaultShortcutKey(RestoreDefaultShortcutKeyInDto inDto)
|
||||||
|
{
|
||||||
|
var shortcutKeys = GetDefaultShortcutKey();
|
||||||
|
shortcutKeys.ForEach(x => {
|
||||||
|
x.UserId = _userInfo.Id;
|
||||||
|
});
|
||||||
|
|
||||||
|
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id);
|
||||||
|
|
||||||
|
await _shortcutKeyRepository.AddRangeAsync(shortcutKeys.Select(x => new ShortcutKey()
|
||||||
|
{
|
||||||
|
ImageToolType = inDto.ImageToolType,
|
||||||
|
Keyboardkey = x.Keyboardkey,
|
||||||
|
ShortcutKeyEnum = x.ShortcutKeyEnum,
|
||||||
|
UserId = _userInfo.Id,
|
||||||
|
AltKey = x.AltKey,
|
||||||
|
CtrlKey = x.CtrlKey,
|
||||||
|
MetaKey = x.MetaKey,
|
||||||
|
ShiftKey = x.ShiftKey,
|
||||||
|
KeyboardShow = x.KeyboardShow,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return await _shortcutKeyRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置快捷键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<bool> SetDefaultShortcutKey(SetDefaultShortcutKey inDto)
|
public async Task<bool> SetShortcutKey(SetDefaultShortcutKey inDto)
|
||||||
{
|
{
|
||||||
await _defaultShortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType);
|
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType&&x.UserId==_userInfo.Id);
|
||||||
|
|
||||||
await _defaultShortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new DefaultShortcutKey()
|
await _shortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new ShortcutKey()
|
||||||
{
|
{
|
||||||
ImageToolType = inDto.ImageToolType,
|
ImageToolType = inDto.ImageToolType,
|
||||||
Keyboardkey = x.Keyboardkey,
|
Keyboardkey = x.Keyboardkey,
|
||||||
ShortcutKeyEnum = x.ShortcutKeyEnum
|
ShortcutKeyEnum = x.ShortcutKeyEnum,
|
||||||
|
UserId=_userInfo.Id,
|
||||||
|
AltKey=x.AltKey,
|
||||||
|
CtrlKey=x.CtrlKey,
|
||||||
|
MetaKey=x.MetaKey,
|
||||||
|
ShiftKey=x.ShiftKey,
|
||||||
|
KeyboardShow=x.KeyboardShow,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return await _defaultShortcutKeyRepository.SaveChangesAsync();
|
return await _shortcutKeyRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
namespace IRaCIS.Core.Domain.Models
|
namespace IRaCIS.Core.Domain.Models
|
||||||
{
|
{
|
||||||
///<summary>
|
///<summary>
|
||||||
///DefaultShortcutKey
|
///ShortcutKey
|
||||||
///</summary>
|
///</summary>
|
||||||
[Table("DefaultShortcutKey")]
|
[Table("ShortcutKey")]
|
||||||
public class DefaultShortcutKey : Entity, IAuditAdd
|
public class ShortcutKey : Entity, IAuditAdd
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 对应的键盘按键
|
/// 对应的键盘按键
|
||||||
|
@ -40,13 +40,17 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid CreateUserId { get; set; }
|
public Guid CreateUserId { get; set; }
|
||||||
|
|
||||||
public bool AltKey { get; set; }
|
public Guid UserId { get; set; }
|
||||||
|
|
||||||
public bool CtrlKey { get; set; }
|
public bool AltKey { get; set; } = false;
|
||||||
|
|
||||||
public bool ShiftKey { get; set; }
|
public bool CtrlKey { get; set; } = false;
|
||||||
|
|
||||||
public bool MetaKey { get; set; }
|
public bool ShiftKey { get; set; } = false;
|
||||||
|
|
||||||
|
public bool MetaKey { get; set; } = false;
|
||||||
|
|
||||||
|
public string KeyboardShow { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public virtual DbSet<DefaultShortcutKey> DefaultShortcutKey { get; set; }
|
public virtual DbSet<ShortcutKey> ShortcutKey { get; set; }
|
||||||
public virtual DbSet<EmailNoticeConfig> EmailNoticeConfig { get; set; }
|
public virtual DbSet<EmailNoticeConfig> EmailNoticeConfig { get; set; }
|
||||||
public virtual DbSet<SystemBasicData> SystemBasicData { get; set; }
|
public virtual DbSet<SystemBasicData> SystemBasicData { get; set; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue