|
|
<UserControl x:Class="Sln_Wpf.Page.DeviceInfo"
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
mc:Ignorable="d"
|
|
|
d:DesignHeight="600" d:DesignWidth="1100"
|
|
|
Background="#F5F7FA">
|
|
|
|
|
|
<UserControl.Resources>
|
|
|
<!-- 卡片样式 -->
|
|
|
<Style x:Key="CardStyle" TargetType="Border">
|
|
|
<Setter Property="Background" Value="White"/>
|
|
|
<Setter Property="CornerRadius" Value="12"/>
|
|
|
<Setter Property="Effect">
|
|
|
<Setter.Value>
|
|
|
<DropShadowEffect Color="LightGray" BlurRadius="15" ShadowDepth="2" Opacity="0.3"/>
|
|
|
</Setter.Value>
|
|
|
</Setter>
|
|
|
</Style>
|
|
|
|
|
|
<!-- 数据表格样式 -->
|
|
|
<Style x:Key="DataGridStyle" TargetType="DataGrid">
|
|
|
<Setter Property="FontSize" Value="13"/>
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
<Setter Property="RowHeight" Value="45"/>
|
|
|
<Setter Property="HeadersVisibility" Value="Column"/>
|
|
|
<Setter Property="GridLinesVisibility" Value="Horizontal"/>
|
|
|
<Setter Property="HorizontalGridLinesBrush" Value="#E9ECF1"/>
|
|
|
<Setter Property="VerticalGridLinesBrush" Value="Transparent"/>
|
|
|
<Setter Property="Background" Value="White"/>
|
|
|
<Setter Property="RowBackground" Value="White"/>
|
|
|
<Setter Property="AlternatingRowBackground" Value="#F9FAFC"/>
|
|
|
<Setter Property="SelectionMode" Value="Single"/>
|
|
|
<Setter Property="SelectionUnit" Value="FullRow"/>
|
|
|
</Style>
|
|
|
|
|
|
<!-- 按钮样式 -->
|
|
|
<Style x:Key="ActionButtonStyle" TargetType="Button">
|
|
|
<Setter Property="Height" Value="32"/>
|
|
|
<Setter Property="Width" Value="70"/>
|
|
|
<Setter Property="FontSize" Value="13"/>
|
|
|
<Setter Property="FontWeight" Value="Medium"/>
|
|
|
<Setter Property="Foreground" Value="White"/>
|
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
<Setter Property="Template">
|
|
|
<Setter.Value>
|
|
|
<ControlTemplate TargetType="Button">
|
|
|
<Border Background="{TemplateBinding Background}"
|
|
|
CornerRadius="6"
|
|
|
Padding="8,5">
|
|
|
<ContentPresenter HorizontalAlignment="Center"
|
|
|
VerticalAlignment="Center"/>
|
|
|
</Border>
|
|
|
<ControlTemplate.Triggers>
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
<Setter Property="Opacity" Value="0.85"/>
|
|
|
</Trigger>
|
|
|
</ControlTemplate.Triggers>
|
|
|
</ControlTemplate>
|
|
|
</Setter.Value>
|
|
|
</Setter>
|
|
|
</Style>
|
|
|
|
|
|
<!-- TabControl样式 -->
|
|
|
<Style TargetType="TabControl">
|
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
</Style>
|
|
|
|
|
|
<Style TargetType="TabItem">
|
|
|
<Setter Property="FontSize" Value="16"/>
|
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
|
<Setter Property="Padding" Value="30,12"/>
|
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
|
<Setter Property="Template">
|
|
|
<Setter.Value>
|
|
|
<ControlTemplate TargetType="TabItem">
|
|
|
<Border Background="{TemplateBinding Background}"
|
|
|
BorderThickness="0,0,0,3"
|
|
|
BorderBrush="Transparent"
|
|
|
CornerRadius="8,8,0,0">
|
|
|
<ContentPresenter x:Name="ContentSite"
|
|
|
HorizontalAlignment="Center"
|
|
|
VerticalAlignment="Center"
|
|
|
ContentSource="Header"/>
|
|
|
</Border>
|
|
|
<ControlTemplate.Triggers>
|
|
|
<Trigger Property="IsSelected" Value="True">
|
|
|
<Setter Property="Background" Value="White"/>
|
|
|
<Setter TargetName="ContentSite" Property="TextBlock.Foreground" Value="#3A7CA5"/>
|
|
|
<Setter Property="BorderBrush" Value="#3A7CA5"/>
|
|
|
</Trigger>
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
<Setter Property="Background" Value="#F0F2F5"/>
|
|
|
</Trigger>
|
|
|
</ControlTemplate.Triggers>
|
|
|
</ControlTemplate>
|
|
|
</Setter.Value>
|
|
|
</Setter>
|
|
|
</Style>
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
<Grid Margin="30,20,30,20">
|
|
|
<Grid.RowDefinitions>
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
<RowDefinition Height="*"/>
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
<!-- 主要内容区:TabControl 包含设备信息和设备参数 -->
|
|
|
<TabControl Grid.Row="1" Background="Transparent">
|
|
|
<!-- Tab 1: 设备信息 -->
|
|
|
<TabItem Header="📊 设备信息">
|
|
|
<Grid Margin="0,20,0,0">
|
|
|
<Grid.RowDefinitions>
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
<RowDefinition Height="*"/>
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
<!-- 操作栏:增删改查按钮 -->
|
|
|
<Border Grid.Row="0" Style="{StaticResource CardStyle}" Padding="15,12" Margin="0,0,0,20">
|
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
|
|
<Button x:Name="BtnAdd" Style="{StaticResource ActionButtonStyle}" Background="#27AE60" Content="➕ 新增" Click="BtnAdd_Click" Margin="0,0,10,0"/>
|
|
|
<Button x:Name="BtnEdit" Style="{StaticResource ActionButtonStyle}" Background="#F39C12" Content="✏️ 编辑" Click="BtnEdit_Click" Margin="0,0,10,0"/>
|
|
|
<Button x:Name="BtnDelete" Style="{StaticResource ActionButtonStyle}" Background="#E74C3C" Content="🗑️ 删除" Click="BtnDelete_Click" Margin="0,0,10,0"/>
|
|
|
<Button x:Name="BtnQuery" Style="{StaticResource ActionButtonStyle}" Background="#3498DB" Content="🔍 查询" Click="BtnQuery_Click" Margin="0,0,10,0"/>
|
|
|
|
|
|
<Border Width="1" Background="#E9ECF1" Margin="15,0,15,0"/>
|
|
|
|
|
|
<TextBlock Text="快速筛选:" FontSize="13" Foreground="#5A6E7A" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
|
|
<ComboBox x:Name="FilterType" Width="120" Height="32" VerticalAlignment="Center" Margin="0,0,10,0" SelectedIndex="0">
|
|
|
<ComboBoxItem Content="全部设备"/>
|
|
|
<ComboBoxItem Content="提升机"/>
|
|
|
<ComboBoxItem Content="AGV"/>
|
|
|
</ComboBox>
|
|
|
<TextBox x:Name="SearchKeyword" Width="180" Height="32" VerticalAlignment="Center" Padding="8,5"
|
|
|
Background="#F8F9FA" BorderBrush="#E0E4E8"
|
|
|
Text="请输入设备名称或ID" Foreground="#95A5A6"/>
|
|
|
</StackPanel>
|
|
|
</Border>
|
|
|
|
|
|
<!-- 设备信息表格 -->
|
|
|
<Border Grid.Row="2" Style="{StaticResource CardStyle}" Padding="0">
|
|
|
<DataGrid x:Name="DeviceDataGrid" Style="{StaticResource DataGridStyle}"
|
|
|
AutoGenerateColumns="False" CanUserAddRows="False"
|
|
|
SelectionChanged="DeviceDataGrid_SelectionChanged">
|
|
|
<DataGrid.Columns>
|
|
|
<DataGridTextColumn Header="设备ID" Width="100" Binding="{Binding EquipId}" FontWeight="SemiBold"/>
|
|
|
<DataGridTextColumn Header="设备名称" Width="150" Binding="{Binding EquipName}"/>
|
|
|
<DataGridTextColumn Header="设备类型" Width="100" Binding="{Binding EquipType}"/>
|
|
|
<DataGridTextColumn Header="IP地址" Width="130" Binding="{Binding IpAddress}"/>
|
|
|
<DataGridTextColumn Header="端口" Width="100" Binding="{Binding PortAddress}"/>
|
|
|
<DataGridTextColumn Header="运行楼层" Width="100" Binding="{Binding CurrentFloor}"/>
|
|
|
<DataGridTextColumn Header="运行状态" Width="100" Binding="{Binding RunStatus}">
|
|
|
<DataGridTextColumn.ElementStyle>
|
|
|
<Style TargetType="TextBlock">
|
|
|
<Setter Property="Foreground" Value="{Binding StatusColor}"/>
|
|
|
</Style>
|
|
|
</DataGridTextColumn.ElementStyle>
|
|
|
</DataGridTextColumn>
|
|
|
<DataGridTextColumn Header="在线状态" Width="100" Binding="{Binding OnlineStatus}"/>
|
|
|
<DataGridTextColumn Header="最后更新时间" Width="150" Binding="{Binding LastCommTime}"/>
|
|
|
</DataGrid.Columns>
|
|
|
</DataGrid>
|
|
|
</Border>
|
|
|
</Grid>
|
|
|
</TabItem>
|
|
|
|
|
|
<!-- Tab 2: 设备参数 -->
|
|
|
<TabItem Header="⚙️ 设备参数">
|
|
|
<Grid Margin="0,20,0,0">
|
|
|
<Grid.RowDefinitions>
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
<RowDefinition Height="*"/>
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
<!-- 操作栏:增删改查按钮 -->
|
|
|
<Border Grid.Row="0" Style="{StaticResource CardStyle}" Padding="15,12" Margin="0,0,0,20">
|
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
|
|
<Button x:Name="BtnParamAdd" Style="{StaticResource ActionButtonStyle}" Background="#27AE60" Content="➕ 新增" Click="BtnParamAdd_Click" Margin="0,0,20,0"/>
|
|
|
<Button x:Name="BtnParamEdit" Style="{StaticResource ActionButtonStyle}" Background="#F39C12" Content="✏️ 编辑" Click="BtnParamEdit_Click" Margin="0,0,15,0"/>
|
|
|
<Button x:Name="BtnParamDelete" Style="{StaticResource ActionButtonStyle}" Background="#E74C3C" Content="🗑️ 删除" Click="BtnParamDelete_Click" Margin="0,0,10,0"/>
|
|
|
<Button x:Name="BtnParamQuery" Style="{StaticResource ActionButtonStyle}" Background="#3498DB" Content="🔍 查询" Click="BtnParamQuery_Click" Margin="0,0,10,0"/>
|
|
|
|
|
|
<Border Width="1" Background="#E9ECF1" Margin="15,0,15,0"/>
|
|
|
|
|
|
<TextBlock Text="设备筛选:" FontSize="13" Foreground="#5A6E7A" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
|
|
<ComboBox x:Name="ParamDeviceFilter" Width="150" Height="32" VerticalAlignment="Center" SelectionChanged="ParamDeviceFilter_SelectionChanged">
|
|
|
<ComboBoxItem Content="全部设备"/>
|
|
|
<ComboBoxItem Content="AGV"/>
|
|
|
<ComboBoxItem Content="提升机"/>
|
|
|
</ComboBox>
|
|
|
</StackPanel>
|
|
|
</Border>
|
|
|
|
|
|
<!-- 设备参数表格 -->
|
|
|
<Border Grid.Row="2" Style="{StaticResource CardStyle}" Padding="0">
|
|
|
<DataGrid x:Name="ParameterDataGrid" Style="{StaticResource DataGridStyle}"
|
|
|
AutoGenerateColumns="False" CanUserAddRows="False">
|
|
|
<DataGrid.Columns>
|
|
|
<DataGridTextColumn Header="设备ID" Width="100" Binding="{Binding EquipCode}" FontWeight="SemiBold"/>
|
|
|
<DataGridTextColumn Header="设备名称" Width="120" Binding="{Binding EquipName}"/>
|
|
|
<DataGridTextColumn Header="设备类型" Width="120" Binding="{Binding EquipType}"/>
|
|
|
<DataGridTextColumn Header="参数名称" Width="150" Binding="{Binding ParamKey}"/>
|
|
|
<DataGridTextColumn Header="参数值" Width="120" Binding="{Binding ParamValue}"/>
|
|
|
<DataGridTextColumn Header="单位" Width="80" Binding="{Binding ParamUnit}"/>
|
|
|
<DataGridTextColumn Header="参数类型" Width="100" Binding="{Binding ParamType}"/>
|
|
|
<DataGridTextColumn Header="修改时间" Width="150" Binding="{Binding UpdateTime}"/>
|
|
|
</DataGrid.Columns>
|
|
|
</DataGrid>
|
|
|
</Border>
|
|
|
</Grid>
|
|
|
</TabItem>
|
|
|
</TabControl>
|
|
|
</Grid>
|
|
|
</UserControl>
|