245 lines
8.0 KiB
XML
245 lines
8.0 KiB
XML
<UserControl
|
|
x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderTaskDialogView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:converters="clr-namespace:_29WxOrderWpf.Converters"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:wpf="clr-namespace:_29WxOrderWpf.Common"
|
|
xmlns:wpf1="WPFCommon"
|
|
d:Background="White"
|
|
d:DataContext="{d:DesignInstance Type=local:OrderTaskDialogViewModel}"
|
|
d:DesignHeight="600"
|
|
d:DesignWidth="1300"
|
|
wpf:DialogWindowProperty.Height="600"
|
|
wpf:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
|
|
wpf:DialogWindowProperty.ShowMinButton="False"
|
|
wpf:DialogWindowProperty.Width="1300"
|
|
mc:Ignorable="d">
|
|
<UserControl.Resources>
|
|
<!-- 单元格文字居中 -->
|
|
<Style x:Key="CenterCellTextStyle" TargetType="TextBlock">
|
|
<Setter Property="TextAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<!-- 面板标题 -->
|
|
<Style x:Key="PanelTitleStyle" TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="16" />
|
|
<Setter Property="FontWeight" Value="Bold" />
|
|
<Setter Property="Foreground" Value="#333333" />
|
|
</Style>
|
|
|
|
<!-- 工具栏按钮 -->
|
|
<Style x:Key="ToolBarButtonStyle" TargetType="Button">
|
|
<Setter Property="Height" Value="30" />
|
|
<Setter Property="Padding" Value="14,0" />
|
|
<Setter Property="Margin" Value="6,0,0,0" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
<Setter Property="Foreground" Value="#333333" />
|
|
<Setter Property="Background" Value="White" />
|
|
<Setter Property="BorderBrush" Value="#D9D9D9" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border
|
|
x:Name="btnBorder"
|
|
Padding="{TemplateBinding Padding}"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="4">
|
|
<ContentPresenter
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Content}"
|
|
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="btnBorder" Property="Background" Value="#F0F2F5" />
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter TargetName="btnBorder" Property="Background" Value="#E4E7ED" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Opacity" Value="0.5" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<!-- 任务状态:int (1=执行中,2=已完成,3=已人为中断) → 中文描述 -->
|
|
<converters:OrderTaskStatusConverter x:Key="OrderTaskStatusConverter" />
|
|
|
|
</UserControl.Resources>
|
|
|
|
<Grid Background="#F5F7FB">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="20" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- ============ 顶部工具栏 ============ -->
|
|
<Border
|
|
Grid.Row="0"
|
|
Padding="14,10"
|
|
Background="White"
|
|
BorderBrush="#E8EAED"
|
|
BorderThickness="0,0,0,1">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Style="{StaticResource PanelTitleStyle}" Text="订单同步任务列表" />
|
|
<CheckBox
|
|
Margin="20,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Content="查看全部"
|
|
IsChecked="{Binding IsShowAll}" />
|
|
</StackPanel>
|
|
<!--<StackPanel Grid.Column="1" Orientation="Horizontal">
|
|
<Button
|
|
Command="{Binding ClearFinishedCommand}"
|
|
Content="清空已完成"
|
|
Style="{StaticResource ToolBarButtonStyle}" />
|
|
<Button
|
|
Command="{Binding ClearAllCommand}"
|
|
Content="清空全部"
|
|
Style="{StaticResource ToolBarButtonStyle}" />
|
|
</StackPanel>-->
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- ============ 任务列表 ============ -->
|
|
<DataGrid
|
|
Grid.Row="1"
|
|
Margin="10,10,10,0"
|
|
d:ItemsSource="{d:SampleData ItemCount=10}"
|
|
AlternatingRowBackground="#FAFAFA"
|
|
AutoGenerateColumns="False"
|
|
Background="White"
|
|
BorderBrush="#E8EAED"
|
|
BorderThickness="1"
|
|
CanUserAddRows="False"
|
|
CanUserDeleteRows="False"
|
|
CanUserReorderColumns="False"
|
|
CanUserResizeRows="False"
|
|
ColumnHeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}"
|
|
FontSize="13"
|
|
Foreground="#333333"
|
|
GridLinesVisibility="Horizontal"
|
|
HeadersVisibility="Column"
|
|
HorizontalGridLinesBrush="#EEEEEE"
|
|
IsReadOnly="True"
|
|
ItemsSource="{Binding TasksView}"
|
|
RowHeight="40"
|
|
ScrollViewer.CanContentScroll="True"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
SelectionMode="Single"
|
|
SelectionUnit="FullRow">
|
|
<DataGrid.Columns>
|
|
|
|
<!-- 任务描述 -->
|
|
<DataGridTextColumn
|
|
Width="1.5*"
|
|
MinWidth="120"
|
|
Binding="{Binding TaskDescribe}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="任务描述" />
|
|
<!-- 店铺 -->
|
|
<DataGridTextColumn
|
|
Width="1*"
|
|
MinWidth="100"
|
|
Binding="{Binding ShopName}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="店铺" />
|
|
|
|
|
|
<!-- 状态 -->
|
|
<DataGridTemplateColumn
|
|
Width="1*"
|
|
MinWidth="60"
|
|
Header="状态">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontWeight="Bold"
|
|
Text="{Binding Status, Converter={StaticResource OrderTaskStatusConverter}}">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Foreground" Value="#E6A23C" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Status}" Value="2">
|
|
<Setter Property="Foreground" Value="#67C23A" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Status}" Value="3">
|
|
<Setter Property="Foreground" Value="#F56C6C" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Status}" Value="4">
|
|
<Setter Property="Foreground" Value="#F56C6C" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<!-- 失败原因 -->
|
|
<DataGridTextColumn
|
|
Width="2*"
|
|
MinWidth="150"
|
|
Binding="{Binding TaskFailReason}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="失败原因" />
|
|
|
|
|
|
<!-- 创建时间 -->
|
|
<DataGridTextColumn
|
|
Width="2*"
|
|
MinWidth="140"
|
|
Binding="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="创建时间" />
|
|
<!-- 更新时间 -->
|
|
<DataGridTextColumn
|
|
Width="2*"
|
|
MinWidth="140"
|
|
Binding="{Binding UpdateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="更新时间" />
|
|
<!-- 备注 -->
|
|
<DataGridTextColumn
|
|
Width="2*"
|
|
MinWidth="140"
|
|
Binding="{Binding Remark}"
|
|
ElementStyle="{StaticResource CenterCellTextStyle}"
|
|
Header="备注" />
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
<Border
|
|
Grid.Row="2"
|
|
Padding="10,0"
|
|
Background="White">
|
|
<Grid VerticalAlignment="Center">
|
|
<TextBlock
|
|
HorizontalAlignment="Right"
|
|
d:Text="距离下次刷新10秒"
|
|
Text="{Binding RefreshTime, StringFormat='距离下次刷新:{0}秒'}" />
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|