Files
VacuumPressureMembranePoreS…/Views/HistoryWindow.xaml
2026-04-11 08:51:47 +08:00

146 lines
7.3 KiB
XML

<Window x:Class="MembranePoreTester.Views.HistoryWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="历史记录" Height="600" Width="1000"
WindowStartupLocation="CenterOwner" Loaded="Window_Loaded"
Background="#F5F7FA" FontFamily="Segoe UI">
<Window.Resources>
<!-- 统一按钮样式 -->
<Style TargetType="Button">
<Setter Property="Background" Value="#2196F3"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="12,6"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1976D2"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#0D47A1"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 统一文本框样式 -->
<Style TargetType="TextBox">
<Setter Property="Height" Value="28"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#D0D3D9"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5,2"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!-- 统一组合框样式 -->
<Style TargetType="ComboBox">
<Setter Property="Height" Value="28"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#D0D3D9"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!-- 统一标签样式 -->
<Style TargetType="Label">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="#2C3E50"/>
<Setter Property="Margin" Value="5"/>
</Style>
<!-- 统一 DatePicker 样式(保持一致性) -->
<Style TargetType="DatePicker">
<Setter Property="Height" Value="28"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#D0D3D9"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<!-- DataGrid 样式 -->
<Style TargetType="DataGrid">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#E9ECF0"/>
<Setter Property="RowHeight" Value="28"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="RowBackground" Value="White"/>
<Setter Property="AlternatingRowBackground" Value="#F9F9F9"/>
</Style>
</Window.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 过滤条件区域(卡片式) -->
<Border Grid.Row="0" Background="White" CornerRadius="6" Padding="10" Margin="0,0,0,10" BorderBrush="#E9ECF0" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<Label Content="工位:"/>
<ComboBox x:Name="cmbStation" Width="80">
<ComboBoxItem Content="全部"/>
<ComboBoxItem Content="1"/>
<ComboBoxItem Content="2"/>
<ComboBoxItem Content="3"/>
</ComboBox>
<Label Content="测试类型:"/>
<ComboBox x:Name="cmbType" Width="120">
<ComboBoxItem Content="全部"/>
<ComboBoxItem Content="泡点法"/>
<ComboBoxItem Content="孔分布"/>
</ComboBox>
<Label Content="日期范围:"/>
<DatePicker x:Name="dpStart" Width="120"/>
<Label Content="-" Margin="2,0,2,0" VerticalAlignment="Center"/>
<DatePicker x:Name="dpEnd" Width="120"/>
<Button Content="🔍 查询" Click="Query_Click" Padding="15,5" Background="#2196F3"/>
<Button Content="📊 导出选中" Click="ExportSelected_Click" Padding="15,5" Background="#4CAF50"/>
</StackPanel>
</Border>
<!-- 历史记录列表(带边框) -->
<Border Grid.Row="1" Background="White" CornerRadius="6" BorderBrush="#E9ECF0" BorderThickness="1" Padding="5">
<DataGrid x:Name="dgHistory" AutoGenerateColumns="False"
IsReadOnly="True" SelectionMode="Extended" SelectionUnit="FullRow"
BorderThickness="0" HorizontalGridLinesBrush="#E9ECF0">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding Id}" Width="50"/>
<DataGridTextColumn Header="工位" Binding="{Binding StationId}" Width="50"/>
<DataGridTextColumn Header="类型" Binding="{Binding Type}" Width="80"/>
<DataGridTextColumn Header="测试日期" Binding="{Binding TestDate}" Width="150"/>
<DataGridTextColumn Header="样品类型" Binding="{Binding SampleType}" Width="100"/>
<DataGridTextColumn Header="规格" Binding="{Binding SampleSpec}" Width="100"/>
<DataGridTextColumn Header="测试者" Binding="{Binding Tester}" Width="100"/>
<DataGridTextColumn Header="结果" Binding="{Binding Result}" Width="150"/>
</DataGrid.Columns>
</DataGrid>
</Border>
<!-- 底部按钮区域 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button Content="📂 加载到当前工位" Click="LoadToCurrentStation_Click" Padding="15,5" Background="#FF9800"/>
<Button Content="❌ 关闭" Click="Close_Click" Padding="15,5" Background="#607D8B"/>
</StackPanel>
</Grid>
</Window>