2025-01-03 17:45:51 +08:00
|
|
|
|
using DM_Weight.Models;
|
|
|
|
|
using DM_Weight.Report;
|
|
|
|
|
using DM_Weight.util;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
using Prism.Commands;
|
|
|
|
|
using Prism.Mvvm;
|
2025-01-03 17:45:51 +08:00
|
|
|
|
using Prism.Regions;
|
2025-07-28 15:16:43 +08:00
|
|
|
|
using Prism.Services.Dialogs;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2025-01-03 17:45:51 +08:00
|
|
|
|
using System.Configuration;
|
2025-07-28 15:16:43 +08:00
|
|
|
|
using System.DirectoryServices.ActiveDirectory;
|
2025-01-03 17:45:51 +08:00
|
|
|
|
using System.Drawing.Printing;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DM_Weight.ViewModels
|
|
|
|
|
{
|
2025-01-06 13:11:57 +08:00
|
|
|
|
public class UseAccountWindowViewModel : BindableBase, INavigationAware
|
2024-12-19 19:55:35 +08:00
|
|
|
|
{
|
2025-07-28 15:16:43 +08:00
|
|
|
|
private DateTime? _startDate =DateTime.Now;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
|
2025-07-28 15:16:43 +08:00
|
|
|
|
private DateTime? nowDate = DateTime.Now;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
|
|
|
|
|
public DateTime? StartDate
|
|
|
|
|
{
|
|
|
|
|
get => _startDate;
|
|
|
|
|
set
|
2025-07-28 15:16:43 +08:00
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _startDate, value);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
|
|
|
|
|
|
|
|
|
|
public DateTime? EndDate
|
|
|
|
|
{
|
|
|
|
|
get => _endDate;
|
|
|
|
|
set
|
2025-07-28 15:16:43 +08:00
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _endDate, value);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private string _name;
|
|
|
|
|
public string Name { get => _name; set { SetProperty(ref _name, value); } }
|
2025-01-03 17:45:51 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 麻醉医师姓名
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<UserList> _UserInfos;
|
|
|
|
|
public List<UserList> UserInfos
|
|
|
|
|
{
|
|
|
|
|
get => _UserInfos;
|
|
|
|
|
set { SetProperty(ref _UserInfos, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private UserList _User;
|
|
|
|
|
public UserList User
|
|
|
|
|
{
|
|
|
|
|
get => _User;
|
|
|
|
|
set { SetProperty(ref _User, value); }
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-22 11:33:49 +08:00
|
|
|
|
private static List<string> boxDefine =
|
|
|
|
|
new List<string> { "1号手术间", "2号手术间", "3号手术间", "4号手术间", "5号手术间", "6号手术间", "7号手术间", "8号手术间", "9号手术间", "10号手术间", "11号手术间", "12号手术间", "13号手术间", "14号手术间", "15号手术间", "16号手术间", "17号手术间", "18号手术间" };
|
|
|
|
|
|
|
|
|
|
private List<string> _Boxs = boxDefine;
|
|
|
|
|
public List<string> Boxs
|
|
|
|
|
{
|
|
|
|
|
get => _Boxs;
|
|
|
|
|
set { SetProperty(ref _Boxs, value); }
|
|
|
|
|
}
|
|
|
|
|
private string _Box;
|
|
|
|
|
public string Box
|
|
|
|
|
{
|
|
|
|
|
get => _Box;
|
|
|
|
|
set { SetProperty(ref _Box, value); }
|
|
|
|
|
}
|
2024-12-19 19:55:35 +08:00
|
|
|
|
private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
|
public long CurrentTimeMillis()
|
|
|
|
|
{
|
|
|
|
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
|
|
|
|
}
|
2025-07-28 15:16:43 +08:00
|
|
|
|
IDialogService _dialogService;
|
|
|
|
|
public UseAccountWindowViewModel(IDialogService dialogService)
|
|
|
|
|
{
|
|
|
|
|
_dialogService = dialogService;
|
|
|
|
|
}
|
2025-01-03 17:45:51 +08:00
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
|
|
{
|
|
|
|
|
//绑定用户信息
|
|
|
|
|
UserInfos = SqlSugarHelper.Db.Queryable<UserList>()
|
|
|
|
|
.Where(ul => ul.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
2025-01-06 13:11:57 +08:00
|
|
|
|
{
|
2025-01-03 17:45:51 +08:00
|
|
|
|
}
|
2024-12-19 19:55:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导出账册
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DelegateCommand DownloadAccountBook
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand(() =>
|
|
|
|
|
{
|
2025-05-22 11:33:49 +08:00
|
|
|
|
GridReportUtil.UserAccount(StartDate, EndDate, User == null ? "" : User.Nickname, Box);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool KeepAlive => true;
|
2025-07-28 15:16:43 +08:00
|
|
|
|
|
|
|
|
|
public DelegateCommand<string> SelectTimeAction
|
|
|
|
|
{
|
|
|
|
|
get=> new DelegateCommand<string>(async (s) =>
|
|
|
|
|
{
|
|
|
|
|
// 此处延时1毫秒,等待页面渲染
|
|
|
|
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
|
|
|
|
DialogParameters dialogParameters = new DialogParameters();
|
|
|
|
|
dialogParameters.Add("DateTime", StartDate);
|
|
|
|
|
dialogParameters.Add("Type", s);
|
|
|
|
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "DatetimeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private void DoDialogResult(IDialogResult dialogResult)
|
|
|
|
|
{
|
|
|
|
|
// 委托 被动执行 被子窗口执行
|
|
|
|
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
|
|
|
|
if (dialogResult.Result == ButtonResult.OK)
|
|
|
|
|
{
|
|
|
|
|
if (dialogResult.Parameters.GetValue<string?>("Type").Equals("1"))
|
|
|
|
|
{
|
|
|
|
|
StartDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EndDate= dialogResult.Parameters.GetValue<DateTime?>("DateTime");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
|
|
|
|
}
|
2024-12-19 19:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|