|
|
@@ -0,0 +1,262 @@
|
|
|
+<UserControl xmlns="https://github.com/avaloniaui"
|
|
|
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
+ xmlns:vm="using:YZWater.Core.ViewModels"
|
|
|
+ xmlns:controls="using:YZWater.Avalonia.Controls"
|
|
|
+ xmlns:conv="using:YZWater.Avalonia.Converters"
|
|
|
+ x:Class="YZWater.Avalonia.Views.ProjectView"
|
|
|
+ x:DataType="vm:ProjectViewModel">
|
|
|
+
|
|
|
+ <Border x:Name="RootBorder" Background="{DynamicResource AppBgBrush}">
|
|
|
+ <Grid RowDefinitions="56,*,36">
|
|
|
+
|
|
|
+ <!-- ═══ 顶部标题栏 ═══ -->
|
|
|
+ <Border x:Name="TitleBar" Grid.Row="0" Background="{DynamicResource HeaderBgBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
|
|
|
+ <Grid ColumnDefinitions="Auto,*,Auto" Margin="20,0">
|
|
|
+ <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="12" VerticalAlignment="Center">
|
|
|
+ <Border Background="{DynamicResource SuccessBrush}" Width="4" Height="28" CornerRadius="2"/>
|
|
|
+ <TextBlock Text="{Binding Title}" FontSize="17" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource HeaderTextBrush}" FontFamily="{DynamicResource MonoFont}"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ <TextBlock Text="{Binding SubtitleText}" FontSize="12"
|
|
|
+ Foreground="{DynamicResource HeaderSubtextBrush}" VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+
|
|
|
+ <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
|
|
+ <Border Background="{DynamicResource ToggleBgBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="12" Padding="10,5">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="7">
|
|
|
+ <Border Width="10" Height="10" CornerRadius="5" Background="{DynamicResource SuccessBrush}"/>
|
|
|
+ <TextBlock Text="{Binding PlcStatusText}" FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}" VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ <TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:HH:mm:ss}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="16" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}" VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- ═══ 主内容区 ═══ -->
|
|
|
+ <Grid Grid.Row="1" ColumnDefinitions="*,300" Margin="14,12">
|
|
|
+
|
|
|
+ <!-- 左侧:设备布局区 -->
|
|
|
+ <ScrollViewer Grid.Column="0" Margin="0,0,10,0">
|
|
|
+ <StackPanel Spacing="10">
|
|
|
+
|
|
|
+ <!-- 水箱/水池 -->
|
|
|
+ <Border Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14">
|
|
|
+ <StackPanel>
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,10">
|
|
|
+ <Border Background="{DynamicResource InfoBrush}" Width="3" Height="16" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="液位监控" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ FontWeight="Bold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Tanks}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:TankItemViewModel">
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5"
|
|
|
+ Padding="12" Margin="0,0,0,8" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <Grid ColumnDefinitions="140,*">
|
|
|
+ <controls:WaterTankControl Grid.Column="0" Width="120" Height="140"
|
|
|
+ WaterLevel="{Binding Level}" Text="{Binding Name}"/>
|
|
|
+ <StackPanel Grid.Column="1" Margin="14,0,0,0" Spacing="4" VerticalAlignment="Center">
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="即时液位" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding Level, StringFormat='{}{0:F2} m'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="14" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="启泵1液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding StartPump1Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="启泵2液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding StartPump2Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="启泵3液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding StartPump3Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="停泵液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding StopLevel, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource WarningBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="保护液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding ProtectionLevel, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource DangerBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ </StackPanel>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 泵组 -->
|
|
|
+ <Border Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14">
|
|
|
+ <StackPanel>
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="8" Margin="0,0,0,10">
|
|
|
+ <Border Background="{DynamicResource SuccessBrush}" Width="3" Height="16" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="排污泵组" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ FontWeight="Bold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Pumps}">
|
|
|
+ <ItemsControl.ItemsPanel>
|
|
|
+ <ItemsPanelTemplate>
|
|
|
+ <WrapPanel/>
|
|
|
+ </ItemsPanelTemplate>
|
|
|
+ </ItemsControl.ItemsPanel>
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:PumpItemViewModel">
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5"
|
|
|
+ Width="200" Margin="4" Padding="12"
|
|
|
+ BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <StackPanel Spacing="6">
|
|
|
+ <!-- 泵名称 + 状态指示灯 -->
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="13" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <Border Grid.Column="1" Width="12" Height="12" CornerRadius="6"
|
|
|
+ Background="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <!-- 泵信息 -->
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="电流" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding Current, StringFormat='{}{0:F1} A'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="故障" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="11"
|
|
|
+ Foreground="{DynamicResource DangerBrush}"
|
|
|
+ IsVisible="{Binding HasFault}" Text="故障!"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="日台时" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding DailyHours, StringFormat='{}{0:F0} h'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6" Margin="0,4,0,0">
|
|
|
+ <Button Content="启动" Command="{Binding StartCommand}" Padding="10,4" FontSize="10"
|
|
|
+ Classes="btn-success"/>
|
|
|
+ <Button Content="停止" Command="{Binding StopCommand}" Padding="10,4" FontSize="10"
|
|
|
+ Classes="btn-danger"/>
|
|
|
+ </StackPanel>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ </StackPanel>
|
|
|
+ </ScrollViewer>
|
|
|
+
|
|
|
+ <!-- 右侧面板 -->
|
|
|
+ <Grid Grid.Column="1" RowDefinitions="Auto,Auto,*">
|
|
|
+
|
|
|
+ <!-- 仪表 -->
|
|
|
+ <Border Grid.Row="0" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14,12" Margin="0,0,0,8">
|
|
|
+ <StackPanel>
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="6" Margin="0,0,0,8">
|
|
|
+ <Border Background="{DynamicResource WarningBrush}" Width="3" Height="14" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="仪表监控" FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Gauges}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:GaugeItemViewModel">
|
|
|
+ <controls:GaugeControl Width="130" Height="150" Margin="2"
|
|
|
+ Value="{Binding Value}" Title="{Binding Name}" Unit="{Binding Unit}"
|
|
|
+ MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}"
|
|
|
+ ValueColor="{DynamicResource SuccessBrush}"/>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ <ItemsControl.ItemsPanel>
|
|
|
+ <ItemsPanelTemplate>
|
|
|
+ <WrapPanel HorizontalAlignment="Center"/>
|
|
|
+ </ItemsPanelTemplate>
|
|
|
+ </ItemsControl.ItemsPanel>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 传感器 -->
|
|
|
+ <Border Grid.Row="1" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14,12" Margin="0,0,0,8">
|
|
|
+ <StackPanel>
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="6" Margin="0,0,0,8">
|
|
|
+ <Border Background="{DynamicResource InfoBrush}" Width="3" Height="14" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="累计数据" FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Sensors}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:SensorItemViewModel">
|
|
|
+ <Grid ColumnDefinitions="*,Auto" Margin="0,4">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="14" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}" VerticalAlignment="Center"
|
|
|
+ Text="{Binding Value, StringFormat='{}{0:F1}'}"/>
|
|
|
+ </Grid>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 故障信息 -->
|
|
|
+ <Border Grid.Row="2" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14,12">
|
|
|
+ <StackPanel>
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="6" Margin="0,0,0,8">
|
|
|
+ <Border Background="{DynamicResource DangerBrush}" Width="3" Height="14" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="故障状态" FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource DangerBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Pumps}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:PumpItemViewModel">
|
|
|
+ <Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4">
|
|
|
+ <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource DangerBrush}"
|
|
|
+ IsVisible="{Binding HasFault}"/>
|
|
|
+ <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource SuccessBrush}"
|
|
|
+ IsVisible="{Binding !HasFault}"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Grid>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <!-- ═══ 底部状态栏 ═══ -->
|
|
|
+ <Border x:Name="StatusBar" Grid.Row="2" Background="{DynamicResource NavBgBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0">
|
|
|
+ <Grid ColumnDefinitions="*,Auto,Auto" Margin="20,0">
|
|
|
+ <TextBlock Grid.Column="0" VerticalAlignment="Center"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextDisabledBrush}">
|
|
|
+ <Run Text="PROJECT: "/><Run Text="{Binding Title}" Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ </TextBlock>
|
|
|
+ <TextBlock Grid.Column="1" VerticalAlignment="Center" Margin="24,0"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextDisabledBrush}">
|
|
|
+ <Run Text="PUMPS: "/><Run Text="{Binding Pumps.Count}" Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ </TextBlock>
|
|
|
+ <TextBlock Grid.Column="2" VerticalAlignment="Center"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextDisabledBrush}" Text="v3.0.0"/>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+</UserControl>
|