HuNan_NOSqlSugar/DM_Weight/ViewModels/PrintPdfViewModel.cs

69 lines
1.7 KiB
C#
Raw Normal View History

2024-07-06 10:01:30 +08:00
using DM_Weight.Report;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.ViewModels
{
internal class PrintPdfViewModel: BindableBase , IDialogAware
{
private string _pdfFilePath;
public string pdfFilePath
{
get=>_pdfFilePath;
set =>SetProperty(ref _pdfFilePath, value);
}
public PrintPdfViewModel()
{
pdfFilePath = GridReportUtil.PrintReportStockNewTest(DateTime.Now.AddDays(-1),DateTime.Now).Result;
}
private string _template;
/// <summary>
/// PDF 的 html 模板
/// </summary>
public string Template
{
get => _template;
set => SetProperty(ref _template, value);
}
private ExpandoObject _data;
public event Action<IDialogResult> RequestClose;
/// <summary>
/// 传递给 pdf 的数据
/// </summary>
public ExpandoObject Data
{
get => _data;
set => SetProperty(ref _data, value);
}
public void OnDialogOpened(IDialogParameters parameters)
{
// 弹窗接收 template 和 data 两个参数
//parameters.TryGetValue("template", out _template);
//parameters.TryGetValue("data", out _data);
}
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
//throw new NotImplementedException();
}
public string Title => "预览 PDF";
}
}