曲线回读+测试报告导出前期工作
This commit is contained in:
@@ -64,10 +64,15 @@ namespace MonitorModule.ViewModels
|
||||
}
|
||||
|
||||
/// <summary>查询日期(null = 全部日期)</summary>
|
||||
public DateTime? SelectedDate
|
||||
public DateTime? SelectedStartDate
|
||||
{
|
||||
get => _selectedDate;
|
||||
set => SetProperty(ref _selectedDate, value);
|
||||
get => _selectedStartDate;
|
||||
set => SetProperty(ref _selectedStartDate, value);
|
||||
}
|
||||
public DateTime? SelectedEndDate
|
||||
{
|
||||
get => _selectedEndDate;
|
||||
set => SetProperty(ref _selectedEndDate, value);
|
||||
}
|
||||
|
||||
public DataTable ResultTable
|
||||
@@ -142,7 +147,8 @@ namespace MonitorModule.ViewModels
|
||||
private string? _selectedMonitorName;
|
||||
private ObservableCollection<string> _scopeNames = new(new[] { "全部", "TestCell1", "TestCell2", "TestCell3", "TestCell4", "TestCell5", "TestCell6", "TestCell7", "TestCell8" });
|
||||
private string? _selectedScope = "全部";
|
||||
private DateTime? _selectedDate;
|
||||
private DateTime? _selectedStartDate;
|
||||
private DateTime? _selectedEndDate;
|
||||
private DataTable _resultTable = new();
|
||||
private string _statusMessage = "未连接";
|
||||
private int _pageIndex = 1;
|
||||
@@ -257,7 +263,8 @@ namespace MonitorModule.ViewModels
|
||||
{
|
||||
SelectedMonitorName = null;
|
||||
SelectedScope = "全部";
|
||||
SelectedDate = null;
|
||||
SelectedStartDate = null;
|
||||
SelectedEndDate = null;
|
||||
PageIndex = 1;
|
||||
Query();
|
||||
}
|
||||
@@ -274,8 +281,8 @@ namespace MonitorModule.ViewModels
|
||||
var db = SqlSugarContext.DbContext;
|
||||
|
||||
// 预计算日期范围,避免在表达式树中访问可空属性
|
||||
DateTime? dateStart = SelectedDate?.Date;
|
||||
DateTime? dateEnd = dateStart?.AddDays(1);
|
||||
DateTime? dateStart = SelectedStartDate?.Date;
|
||||
DateTime? dateEnd = SelectedEndDate?.Date.AddDays(1);
|
||||
|
||||
var query = db.Queryable<MonitorValueEntity>()
|
||||
.WhereIF(!string.IsNullOrEmpty(SelectedMonitorName), x => x.MonitorName == SelectedMonitorName)
|
||||
@@ -317,8 +324,8 @@ namespace MonitorModule.ViewModels
|
||||
{
|
||||
var db = SqlSugarContext.DbContext;
|
||||
|
||||
DateTime? dateStart = SelectedDate?.Date;
|
||||
DateTime? dateEnd = dateStart?.AddDays(1);
|
||||
DateTime? dateStart = SelectedStartDate?.Date;
|
||||
DateTime? dateEnd = SelectedEndDate?.Date.AddDays(1);
|
||||
|
||||
var query = db.Queryable<MonitorValueEntity>()
|
||||
.WhereIF(!string.IsNullOrEmpty(SelectedMonitorName), x => x.MonitorName == SelectedMonitorName)
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -88,20 +89,25 @@
|
||||
VerticalAlignment="Center"
|
||||
Margin="12,0,4,0"/>
|
||||
<DatePicker Grid.Column="5"
|
||||
SelectedDate="{Binding SelectedDate}"
|
||||
materialDesign:HintAssist.Hint="全部"
|
||||
SelectedDate="{Binding SelectedStartDate}"
|
||||
materialDesign:HintAssist.Hint="开始时间"
|
||||
VerticalAlignment="Center"/>
|
||||
<DatePicker Grid.Column="6"
|
||||
Margin=" 5 0 0 0"
|
||||
SelectedDate="{Binding SelectedEndDate}"
|
||||
materialDesign:HintAssist.Hint="结束时间"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<Button Grid.Column="6"
|
||||
<Button Grid.Column="7"
|
||||
Content="查询"
|
||||
Command="{Binding QueryCommand}"
|
||||
Padding="12,4" Margin="12,0,0,0"/>
|
||||
<Button Grid.Column="7"
|
||||
<Button Grid.Column="8"
|
||||
Content="清除"
|
||||
Command="{Binding ClearFilterCommand}"
|
||||
Padding="12,4" Margin="6,0,0,0"/>
|
||||
<Button Grid.Column="8"
|
||||
<Button Grid.Column="9"
|
||||
Content="导出 CSV"
|
||||
Command="{Binding ExportCsvCommand}"
|
||||
Padding="12,4" Margin="6,0,0,0"/>
|
||||
|
||||
Reference in New Issue
Block a user