Skip to content

Commit fd0cd0a

Browse files
committed
feat: Add sort by location and refine export options UI
- Add 'Sort by Location' option to export settings - Redesign Export Options dialog layout for better organization - Group output settings into a dedicated section - Improve alignment of separator input and options
1 parent 8f8e7b2 commit fd0cd0a

3 files changed

Lines changed: 25 additions & 14 deletions

File tree

Dialogs/Models/ExportOptionsModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public partial class ExportOptionsModel : ObservableObject, IDialogContext
1919
[ObservableProperty] private bool _includeResponseTime = false;
2020
[ObservableProperty] private bool _includeOriginalLine = false;
2121
[ObservableProperty] private string _separator = ",";
22+
[ObservableProperty] private bool _sortByLocation = false;
2223
[ObservableProperty] private bool _onlySuccess = true;
2324

2425
public void Close()

Dialogs/Views/ExportOptionsDialog.axaml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</Grid>
2424

2525
<!-- Options Groups -->
26-
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,8,*" Margin="0,8">
26+
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="*,8,*" Margin="0,8">
2727
<!-- Proxy Info Group -->
2828
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
2929
Background="{DynamicResource SemiColorFill0}"
@@ -54,19 +54,24 @@
5454
</UniformGrid>
5555
</StackPanel>
5656
</Border>
57-
</Grid>
58-
59-
<u:Divider Margin="0,4"/>
6057

61-
<Grid ColumnDefinitions="Auto,*,Auto" Margin="0,4">
62-
<CheckBox Grid.Column="0" Content="仅导出成功的代理" IsChecked="{Binding OnlySuccess}"
63-
FontWeight="Bold"
64-
VerticalAlignment="Center"/>
65-
66-
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8">
67-
<TextBlock Text="分隔符" VerticalAlignment="Center"/>
68-
<TextBox Text="{Binding Separator}" Width="60" TextAlignment="Center"/>
69-
</StackPanel>
58+
<!-- Output Settings Group -->
59+
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
60+
Background="{DynamicResource SemiColorFill0}"
61+
CornerRadius="6" Padding="12" Margin="0,8,0,0">
62+
<StackPanel Spacing="8">
63+
<TextBlock Text="输出设置" Foreground="{DynamicResource SemiColorText2}" FontWeight="Bold"/>
64+
<Grid ColumnDefinitions="*,16,Auto" RowDefinitions="Auto,Auto">
65+
<CheckBox Grid.Row="0" Grid.Column="0" Content="仅导出成功的代理" IsChecked="{Binding OnlySuccess}" VerticalAlignment="Center"/>
66+
<CheckBox Grid.Row="1" Grid.Column="0" Content="按归属地排序" IsChecked="{Binding SortByLocation}" Margin="0,12,0,0" VerticalAlignment="Center"/>
67+
68+
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
69+
<TextBlock Text="分隔符" VerticalAlignment="Center"/>
70+
<TextBox Text="{Binding Separator}" Width="60" TextAlignment="Center"/>
71+
</StackPanel>
72+
</Grid>
73+
</StackPanel>
74+
</Border>
7075
</Grid>
7176

7277
<StackPanel Orientation="Horizontal" Spacing="12" HorizontalAlignment="Right" Margin="0,8,0,0">

ViewModels/MainViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,12 @@ private async Task ExportAllAsync()
568568
return;
569569

570570
// 过滤数据
571-
var query = optionsModel.OnlySuccess ? Results.Where(r => r.Success) : Results;
571+
var query = optionsModel.OnlySuccess ? Results.Where(r => r.Success) : Results.AsEnumerable();
572+
573+
if (optionsModel.SortByLocation)
574+
{
575+
query = query.OrderBy(r => r.Location ?? string.Empty);
576+
}
572577

573578
// 生成导出内容
574579
var lines = query.Select(r =>

0 commit comments

Comments
 (0)