|
|
@@ -1,6 +1,7 @@
|
|
|
<controls:ThemedUserControl xmlns="https://github.com/avaloniaui"
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
xmlns:vm="using:YZWater.Core.ViewModels"
|
|
|
+ xmlns:models="using:YZWater.Core.Models"
|
|
|
xmlns:controls="using:YZWater.Avalonia.Controls"
|
|
|
xmlns:conv="using:YZWater.Avalonia.Converters"
|
|
|
x:Class="YZWater.Avalonia.Views.ProjectView"
|
|
|
@@ -24,11 +25,41 @@
|
|
|
<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}"/>
|
|
|
+ <Border Width="10" Height="10" CornerRadius="5"
|
|
|
+ Background="{Binding IsPlcConnected, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
|
|
|
<TextBlock Text="{Binding PlcStatusText}" FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
|
|
- Foreground="{DynamicResource SuccessBrush}" VerticalAlignment="Center"/>
|
|
|
+ Foreground="{Binding IsPlcConnected, Converter={x:Static conv:BoolConverters.ToBrush}}"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
</StackPanel>
|
|
|
</Border>
|
|
|
+
|
|
|
+ <!-- 中控/屏控模式徽章 -->
|
|
|
+ <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="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
|
|
|
+ <TextBlock Text="{Binding ControlModeText}" FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
|
|
+ Foreground="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToBrush}}"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 报警汇总角标:有活跃报警时显示红标+计数 -->
|
|
|
+ <Border IsVisible="{Binding HasActiveAlarm}"
|
|
|
+ Background="{DynamicResource DangerBrush}" CornerRadius="12" Padding="9,4">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
|
|
+ <Border Width="8" Height="8" CornerRadius="4" Background="White"/>
|
|
|
+ <TextBlock Text="报警" FontFamily="{DynamicResource MonoFont}" FontSize="10"
|
|
|
+ Foreground="White" VerticalAlignment="Center"/>
|
|
|
+ <TextBlock Text="{Binding ActiveAlarmCount}" FontFamily="Consolas, monospace"
|
|
|
+ FontSize="13" FontWeight="Bold"
|
|
|
+ Foreground="White" VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <TextBlock Text="{Binding CurrentDateText}"
|
|
|
+ FontFamily="Microsoft YaHei" FontSize="11"
|
|
|
+ Foreground="{DynamicResource HeaderSubtextBrush}" VerticalAlignment="Center"/>
|
|
|
<TextBlock Text="{Binding CurrentTime, StringFormat='{}{0:HH:mm:ss}'}"
|
|
|
FontFamily="Consolas, monospace" FontSize="16" FontWeight="Bold"
|
|
|
Foreground="{DynamicResource SuccessBrush}" VerticalAlignment="Center"/>
|
|
|
@@ -36,123 +67,275 @@
|
|
|
</Grid>
|
|
|
</Border>
|
|
|
|
|
|
- <!-- ═══ 主内容区 ═══ -->
|
|
|
+ <!-- ═══ 主内容区:左侧 2D 图 + 泵控制条 | 右侧数据栏 ═══ -->
|
|
|
<Grid Grid.Row="1" ColumnDefinitions="*,300" Margin="14,12">
|
|
|
|
|
|
- <!-- 左侧:设备布局区 -->
|
|
|
- <ScrollViewer Grid.Column="0" Margin="0,0,10,0">
|
|
|
- <StackPanel Spacing="10">
|
|
|
+ <!-- 左列:2D 工艺图(占满)+ 底部泵控制条(一屏无滚动) -->
|
|
|
+ <Grid Grid.Column="0" RowDefinitions="*,Auto" Margin="0,0,10,0">
|
|
|
|
|
|
- <!-- 水箱/水池 -->
|
|
|
- <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}"/>
|
|
|
+ <!-- 2D/3D 工艺流程图 -->
|
|
|
+ <Border Grid.Row="0" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" ClipToBounds="True">
|
|
|
+ <Grid RowDefinitions="Auto,*">
|
|
|
+ <StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="8" Margin="14,10,14,6">
|
|
|
+ <Border Background="{DynamicResource SuccessBrush}" Width="3" Height="16" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="工艺流程" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ FontWeight="Bold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ <!-- 2D/3D 切换按钮组:仅在配置启用 3D 时显示 -->
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="4" Margin="8,0,0,0"
|
|
|
+ IsVisible="{Binding IsViewSwitchVisible}">
|
|
|
+ <Border Background="{DynamicResource BorderBrush}" Width="1" Height="16" Margin="0,0,4,0"/>
|
|
|
+ <Button Content="2D" Command="{Binding Set2DViewCommand}" IsEnabled="{Binding Is3DView}" Classes="view-switch"/>
|
|
|
+ <Button Content="3D" Command="{Binding Set3DViewCommand}" IsEnabled="{Binding Is2DView}" Classes="view-switch"/>
|
|
|
</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">
|
|
|
+ </StackPanel>
|
|
|
+ <Border Grid.Row="1" Background="{DynamicResource PanelBgBrush}" CornerRadius="5" Padding="8" Margin="8,0,8,8"
|
|
|
+ BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <Grid>
|
|
|
+ <controls:PumpStation2DControl
|
|
|
+ IsVisible="{Binding Is2DView}"
|
|
|
+ Profile="{Binding Profile}"
|
|
|
+ AnalogValues="{Binding AnalogValues}"
|
|
|
+ DigitalValues="{Binding DigitalValues}"
|
|
|
+ DeviceClickedCommand="{Binding OnDeviceClickedCommand}"/>
|
|
|
+ <controls:PumpStation3DControl
|
|
|
+ IsVisible="{Binding Is3DView}"
|
|
|
+ Profile="{Binding Profile}"
|
|
|
+ AnalogValues="{Binding AnalogValues}"
|
|
|
+ DigitalValues="{Binding DigitalValues}"
|
|
|
+ DeviceClickedCommand="{Binding OnDeviceClickedCommand}"/>
|
|
|
+
|
|
|
+ <!-- 泵操作浮层:点击图内泵弹出(防误触,不再直接启停) -->
|
|
|
+ <Border IsVisible="{Binding IsPumpPopupOpen}"
|
|
|
+ Background="#80000000" CornerRadius="5">
|
|
|
+ <Border Width="270" HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
|
+ Background="{DynamicResource SurfaceBgBrush}" CornerRadius="8" Padding="16,12"
|
|
|
+ BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <StackPanel Spacing="8">
|
|
|
+ <!-- 标题 + 关闭 -->
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="8">
|
|
|
+ <Border Width="10" Height="10" CornerRadius="5" VerticalAlignment="Center"
|
|
|
+ Background="{Binding SelectedPump.IsRunning, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
|
|
|
+ <TextBlock Text="{Binding SelectedPump.Name}" FontSize="15" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource TextPrimaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <Button Grid.Column="1" Content="✕" Command="{Binding ClosePumpPopupCommand}"
|
|
|
+ Padding="6,2" FontSize="11"/>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <!-- 数据 -->
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5" Padding="10,8"
|
|
|
+ BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <StackPanel Spacing="4">
|
|
|
<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}"/>
|
|
|
+ <TextBlock Text="运行状态" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="12" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}"
|
|
|
+ IsVisible="{Binding SelectedPump.IsRunning}" Text="运行中"/>
|
|
|
+ <TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}"
|
|
|
+ IsVisible="{Binding !SelectedPump.IsRunning}" Text="已停止"/>
|
|
|
</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}"/>
|
|
|
+ <TextBlock Text="电流" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding SelectedPump.Current, StringFormat='{}{0:F1} A'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="12" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
</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}"/>
|
|
|
+ <TextBlock Text="日台时" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}">
|
|
|
+ <TextBlock.Text>
|
|
|
+ <MultiBinding StringFormat="{}{0:F0}h {1:F0}m">
|
|
|
+ <Binding Path="SelectedPump.DailyHours"/>
|
|
|
+ <Binding Path="SelectedPump.DailyMinutes"/>
|
|
|
+ </MultiBinding>
|
|
|
+ </TextBlock.Text>
|
|
|
+ </TextBlock>
|
|
|
</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}"/>
|
|
|
+ <TextBlock Text="控制模式" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding SelectedPump.IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeText}}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ Foreground="{DynamicResource InfoBrush}"/>
|
|
|
</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}"/>
|
|
|
+ <TextBlock Text="手自动" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding SelectedPump.IsAutoMode, Converter={x:Static conv:BoolConverters.ToAutoModeText}}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ 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}"/>
|
|
|
+ <TextBlock Text="故障" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="故障!" FontSize="12" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource DangerBrush}"
|
|
|
+ IsVisible="{Binding SelectedPump.HasFault}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="正常" FontSize="12"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}"
|
|
|
+ IsVisible="{Binding !SelectedPump.HasFault}"/>
|
|
|
</Grid>
|
|
|
</StackPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 模式切换 -->
|
|
|
+ <Grid ColumnDefinitions="*,*" Margin="0,4,0,0" ColumnSpacing="6">
|
|
|
+ <!-- 中控/屏控 状态指示 (只读,全局切换在标题栏) -->
|
|
|
+ <Border Grid.Column="0" CornerRadius="4" Padding="0,6"
|
|
|
+ BorderBrush="{Binding SelectedPump.IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding SelectedPump.IsCentralMode, Converter={x:Static conv:BoolConverters.ToActiveBgBrush}}">
|
|
|
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="11"
|
|
|
+ Text="{Binding SelectedPump.IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeText}}"
|
|
|
+ Foreground="{Binding SelectedPump.IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
+ <!-- 手动/自动 切换 (单控件,双向切换) -->
|
|
|
+ <Border Grid.Column="1" CornerRadius="4" Padding="0,6"
|
|
|
+ BorderBrush="{Binding SelectedPump.IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding SelectedPump.IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBgBrush}}">
|
|
|
+ <Button Content="{Binding SelectedPump.IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleText}}"
|
|
|
+ Command="{Binding SelectedPump.ToggleManualModeCommand}"
|
|
|
+ FontSize="11" Padding="0" Margin="0"
|
|
|
+ Background="Transparent" BorderThickness="0"
|
|
|
+ HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
|
|
+ Foreground="{Binding SelectedPump.IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
</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 CornerRadius="5" Padding="0,8" Margin="0,4,0,0"
|
|
|
+ BorderBrush="{Binding SelectedPump.IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding SelectedPump.IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBgBrush}}">
|
|
|
+ <Button Content="{Binding SelectedPump.IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleText}}"
|
|
|
+ Command="{Binding SelectedPump.TogglePumpCommand}"
|
|
|
+ FontSize="13" Padding="0" Margin="0"
|
|
|
+ Background="Transparent" BorderThickness="0"
|
|
|
+ HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
|
|
+ Foreground="{Binding SelectedPump.IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 底部泵控制条:看板 + 数据 + 启停一体化,无需滚动 -->
|
|
|
+ <Border Grid.Row="1" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="10,8" Margin="0,10,0,0">
|
|
|
+ <Grid RowDefinitions="Auto,Auto">
|
|
|
+ <Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Margin="2,0,2,8">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
|
|
<Border Background="{DynamicResource SuccessBrush}" Width="3" Height="16" CornerRadius="1"/>
|
|
|
- <TextBlock Text="排污泵组" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
+ <TextBlock Text="泵组控制" FontFamily="Consolas, monospace" FontSize="12"
|
|
|
FontWeight="Bold" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ <!-- 运行台数概览 -->
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="8" Padding="8,2"
|
|
|
+ BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="5">
|
|
|
+ <TextBlock Text="运行" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock FontFamily="Consolas, monospace" FontSize="11" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}">
|
|
|
+ <TextBlock.Text>
|
|
|
+ <MultiBinding StringFormat="{}{0}/{1}">
|
|
|
+ <Binding Path="RunningPumpCount"/>
|
|
|
+ <Binding Path="TotalPumpCount"/>
|
|
|
+ </MultiBinding>
|
|
|
+ </TextBlock.Text>
|
|
|
+ </TextBlock>
|
|
|
+ <TextBlock Text="台" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
</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 Grid.Column="1" Margin="10,0" VerticalAlignment="Center"
|
|
|
+ IsVisible="{Binding HasSuggestedPump}"
|
|
|
+ FontFamily="Microsoft YaHei" FontSize="11"
|
|
|
+ Foreground="{DynamicResource WarningBrush}">
|
|
|
+ <TextBlock.Text>
|
|
|
+ <MultiBinding StringFormat="建议启动 {0}(按编号顺序,优先启动)">
|
|
|
+ <Binding Path="SuggestedPumpName"/>
|
|
|
+ </MultiBinding>
|
|
|
+ </TextBlock.Text>
|
|
|
+ </TextBlock>
|
|
|
+
|
|
|
+ <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
|
|
+ <!-- 全局中控/屏控切换 -->
|
|
|
+ <Border CornerRadius="4" Padding="6,2"
|
|
|
+ BorderBrush="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToModeToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToActiveBgBrush}}">
|
|
|
+ <Button Content="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToModeToggleText}}"
|
|
|
+ Command="{Binding ToggleControlModeCommand}"
|
|
|
+ FontSize="10" Padding="0" Margin="0"
|
|
|
+ Background="Transparent" BorderThickness="0"
|
|
|
+ Foreground="{Binding IsCentralControlMode, Converter={x:Static conv:BoolConverters.ToModeToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
+ <Button Content="日台时清零" Command="{Binding DailyResetAllCommand}"
|
|
|
+ Padding="10,4" FontSize="10" Classes="btn-warning"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Grid>
|
|
|
+
|
|
|
+ <ItemsControl Grid.Row="1" ItemsSource="{Binding Pumps}">
|
|
|
+ <ItemsControl.ItemsPanel>
|
|
|
+ <ItemsPanelTemplate>
|
|
|
+ <UniformGrid Rows="1"/>
|
|
|
+ </ItemsPanelTemplate>
|
|
|
+ </ItemsControl.ItemsPanel>
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:PumpItemViewModel">
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5"
|
|
|
+ Margin="0,0,6,0" Padding="10,8"
|
|
|
+ BorderBrush="{Binding IsSuggested, Converter={x:Static conv:BoolConverters.ToSuggestBorder}}"
|
|
|
+ BorderThickness="1.5">
|
|
|
+ <Grid ColumnDefinitions="Auto,*,Auto">
|
|
|
+ <!-- 左:状态灯 + 名称 + 模式(建议启动 → 琥珀色角标) -->
|
|
|
+ <StackPanel Orientation="Vertical" Spacing="3" VerticalAlignment="Center">
|
|
|
+ <StackPanel Orientation="Horizontal" Spacing="6">
|
|
|
+ <Border Width="10" Height="10" CornerRadius="5" VerticalAlignment="Center"
|
|
|
+ Background="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
|
|
|
<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 IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeText}}"
|
|
|
- FontFamily="Consolas, monospace" FontSize="10"
|
|
|
- Foreground="{DynamicResource InfoBrush}"/>
|
|
|
- </Grid>
|
|
|
+ <Border IsVisible="{Binding IsSuggested}" Background="#FFB300"
|
|
|
+ CornerRadius="3" Padding="4,1">
|
|
|
+ <TextBlock Text="建议" FontSize="9" FontWeight="Bold"
|
|
|
+ Foreground="#1B1F27" VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ <TextBlock Text="故障!" FontSize="10" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource DangerBrush}" VerticalAlignment="Center"
|
|
|
+ IsVisible="{Binding HasFault}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <TextBlock Text="{Binding IsCentralMode, Converter={x:Static conv:BoolConverters.ToModeText}}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="9"
|
|
|
+ Foreground="{DynamicResource InfoBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
|
|
|
- <!-- 泵信息 -->
|
|
|
- <Grid ColumnDefinitions="*,Auto">
|
|
|
- <TextBlock Text="电流" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <!-- 中:电流(带负荷条) / 日台时 -->
|
|
|
+ <StackPanel Grid.Column="1" Margin="12,0" Spacing="3" VerticalAlignment="Center">
|
|
|
+ <Grid ColumnDefinitions="*,Auto" ColumnSpacing="6">
|
|
|
+ <TextBlock Text="电流" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
<TextBlock Grid.Column="1" Text="{Binding Current, StringFormat='{}{0:F1} A'}"
|
|
|
- FontFamily="Consolas, monospace" FontSize="12"
|
|
|
- Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ FontFamily="Consolas, monospace" FontSize="12" FontWeight="Bold"
|
|
|
+ Foreground="{Binding IsOverload, Converter={x:Static conv:BoolConverters.ToOverloadBrush}}"/>
|
|
|
</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="故障!"/>
|
|
|
+ <!-- 电流负荷条:当前/额定,≥100% 超载变红+角标 -->
|
|
|
+ <Grid ColumnDefinitions="*,Auto" ColumnSpacing="6">
|
|
|
+ <ProgressBar Grid.Column="0" Height="4" Minimum="0" Maximum="1"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ Value="{Binding CurrentLoadRatio}"
|
|
|
+ Background="#2AFFFFFF"
|
|
|
+ Foreground="{Binding IsOverload, Converter={x:Static conv:BoolConverters.ToOverloadBrush}}"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="超载" FontSize="8" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource DangerBrush}" VerticalAlignment="Center"
|
|
|
+ IsVisible="{Binding IsOverload}"/>
|
|
|
</Grid>
|
|
|
- <Grid ColumnDefinitions="Auto,*,Auto">
|
|
|
- <TextBlock Text="日台时" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <Grid ColumnDefinitions="*,Auto">
|
|
|
+ <TextBlock Text="日台时" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
<TextBlock Grid.Column="1" FontFamily="Consolas, monospace" FontSize="11"
|
|
|
- Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="4,0">
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}">
|
|
|
<TextBlock.Text>
|
|
|
<MultiBinding StringFormat="{}{0:F0}h {1:F0}m">
|
|
|
<Binding Path="DailyHours"/>
|
|
|
@@ -161,34 +344,142 @@
|
|
|
</TextBlock.Text>
|
|
|
</TextBlock>
|
|
|
</Grid>
|
|
|
+ </StackPanel>
|
|
|
|
|
|
- <!-- 操作按钮 -->
|
|
|
- <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 Grid.Column="2" Orientation="Vertical" Spacing="4" VerticalAlignment="Center">
|
|
|
+ <!-- 第一行:手动/自动 切换(单控件,中控/屏控已移至全局标题栏) -->
|
|
|
+ <Border CornerRadius="4" Padding="6,2"
|
|
|
+ BorderBrush="{Binding IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBgBrush}}">
|
|
|
+ <Button Content="{Binding IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleText}}"
|
|
|
+ Command="{Binding ToggleManualModeCommand}"
|
|
|
+ FontSize="9" Padding="0" Margin="0"
|
|
|
+ Background="Transparent" BorderThickness="0"
|
|
|
+ Foreground="{Binding IsAutoMode, Converter={x:Static conv:BoolConverters.ToManualToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
+ <!-- 第二行:启停切换 (单控件,IsEnabled 由 CanExecute 驱动) -->
|
|
|
+ <Border CornerRadius="4" Padding="9,4"
|
|
|
+ BorderBrush="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBrush}}"
|
|
|
+ BorderThickness="1"
|
|
|
+ Background="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBgBrush}}">
|
|
|
+ <Button Content="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleText}}"
|
|
|
+ Command="{Binding TogglePumpCommand}"
|
|
|
+ FontSize="10" Padding="0" Margin="0"
|
|
|
+ Background="Transparent" BorderThickness="0"
|
|
|
+ Foreground="{Binding IsRunning, Converter={x:Static conv:BoolConverters.ToPumpToggleBrush}}"/>
|
|
|
+ </Border>
|
|
|
</StackPanel>
|
|
|
- </Border>
|
|
|
- </DataTemplate>
|
|
|
- </ItemsControl.ItemTemplate>
|
|
|
- </ItemsControl>
|
|
|
- <!-- 日台时统一清零(3台泵共用 M19.4) -->
|
|
|
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="8" Margin="0,8,0,0">
|
|
|
- <TextBlock Text="3台泵共用清零地址" FontSize="9" Foreground="{DynamicResource TextDisabledBrush}" VerticalAlignment="Center"/>
|
|
|
- <Button Content="日台时清零" Command="{Binding DailyResetAllCommand}" Padding="10,4" FontSize="10" Classes="btn-warning"/>
|
|
|
- </StackPanel>
|
|
|
- </StackPanel>
|
|
|
- </Border>
|
|
|
- </StackPanel>
|
|
|
- </ScrollViewer>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ </Grid>
|
|
|
|
|
|
- <!-- 右侧面板 -->
|
|
|
- <Grid Grid.Column="1" RowDefinitions="Auto,Auto,*">
|
|
|
+ <!-- 右侧数据栏:液位阈值 → 仪表 → 累计 → 故障 -->
|
|
|
+ <Grid Grid.Column="1" RowDefinitions="Auto,Auto,Auto,*">
|
|
|
|
|
|
- <!-- 仪表 -->
|
|
|
+ <!-- 液位阈值(紧凑列表,大水箱图取消——2D 图已含水池可视化) -->
|
|
|
<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 InfoBrush}" Width="3" Height="14" CornerRadius="1"/>
|
|
|
+ <TextBlock Text="液位监控" FontFamily="Consolas, monospace" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <ItemsControl ItemsSource="{Binding Tanks}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:TankItemViewModel">
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5" Padding="10,8"
|
|
|
+ Margin="0,0,0,6" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <Border.Resources>
|
|
|
+ <!-- 液位趋势曲线下方半透明填充(15% 透明的主题绿) -->
|
|
|
+ <SolidColorBrush x:Key="LocalSparkFillBrush" Color="#2600897B"/>
|
|
|
+ </Border.Resources>
|
|
|
+ <StackPanel>
|
|
|
+ <Grid ColumnDefinitions="Auto,*,Auto" Margin="0,0,0,4">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="12" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <!-- 液位工况档位徽章 -->
|
|
|
+ <Border HorizontalAlignment="Left" Margin="8,0"
|
|
|
+ CornerRadius="3" Padding="6,2"
|
|
|
+ Background="{Binding CurrentStage, Converter={x:Static conv:TankStageConverters.ToBrush}}">
|
|
|
+ <TextBlock Text="{Binding CurrentStage, Converter={x:Static conv:TankStageConverters.ToText}}"
|
|
|
+ FontSize="9" FontWeight="Bold"
|
|
|
+ Foreground="{Binding CurrentStage, Converter={x:Static conv:TankStageConverters.ToForeground}}"
|
|
|
+ VerticalAlignment="Center"/>
|
|
|
+ </Border>
|
|
|
+ <TextBlock Grid.Column="2" Text="{Binding Level, StringFormat='{}{0:F2} m'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="15" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource SuccessBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ <!-- 液位实时趋势小曲线(最近 90 秒) -->
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="3"
|
|
|
+ Padding="5,3" Margin="0,0,0,6">
|
|
|
+ <controls:SparklineControl Height="30"
|
|
|
+ Samples="{Binding Trend}"
|
|
|
+ LineBrush="{DynamicResource SuccessBrush}"
|
|
|
+ FillBrush="{StaticResource LocalSparkFillBrush}"/>
|
|
|
+ </Border>
|
|
|
+ <!-- 可编辑阈值 + 同步按钮 -->
|
|
|
+ <Grid ColumnDefinitions="*,60,Auto" Margin="0,2">
|
|
|
+ <TextBlock Text="启泵1" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditStartPump1Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Padding="4,2" Height="22"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="m" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,60,Auto" Margin="0,2">
|
|
|
+ <TextBlock Text="启泵2" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditStartPump2Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Padding="4,2" Height="22"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="m" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,60,Auto" Margin="0,2">
|
|
|
+ <TextBlock Text="启泵3" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditStartPump3Level, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Padding="4,2" Height="22"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="m" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,60,Auto" Margin="0,2">
|
|
|
+ <TextBlock Text="停泵液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditStopLevel, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Padding="4,2" Height="22"
|
|
|
+ Foreground="{DynamicResource WarningBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="m" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,60,Auto" Margin="0,2">
|
|
|
+ <TextBlock Text="保护液位" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditProtectionLevel, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="11" Padding="4,2" Height="22"
|
|
|
+ Foreground="{DynamicResource DangerBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="m" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <!-- 同步到 PLC 按钮 -->
|
|
|
+ <Button Content="同步到PLC" Command="{Binding SyncThresholdsToPlcCommand}"
|
|
|
+ IsVisible="{Binding HasWritableAddresses}"
|
|
|
+ IsEnabled="{Binding !IsSyncing}"
|
|
|
+ HorizontalAlignment="Right" Margin="0,6,0,0"
|
|
|
+ FontSize="10" Padding="10,4" Height="24"
|
|
|
+ Background="{DynamicResource InfoBrush}" Foreground="White"/>
|
|
|
+ <TextBlock Text="{Binding SyncStatusText}" FontSize="9"
|
|
|
+ Foreground="{DynamicResource TextTertiaryBrush}" Margin="0,3,0,0"
|
|
|
+ TextTrimming="CharacterEllipsis" IsVisible="{Binding SyncStatusText, Converter={x:Static conv:BoolConverters.IsNotEmpty}}"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </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 WarningBrush}" Width="3" Height="14" CornerRadius="1"/>
|
|
|
@@ -197,10 +488,39 @@
|
|
|
<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}"/>
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="5" Padding="8,6"
|
|
|
+ Margin="0,0,0,6" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
|
+ <StackPanel>
|
|
|
+ <controls:GaugeControl Width="130" Height="120" Margin="2"
|
|
|
+ Value="{Binding Value}" Title="{Binding Name}" Unit="{Binding Unit}"
|
|
|
+ MinValue="{Binding MinValue}" MaxValue="{Binding MaxValue}"
|
|
|
+ ValueColor="{DynamicResource SuccessBrush}"/>
|
|
|
+ <!-- 可编辑阈值 -->
|
|
|
+ <Grid ColumnDefinitions="*,50,Auto" Margin="0,2" IsVisible="{Binding HasWritableAddresses}">
|
|
|
+ <TextBlock Text="高压" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditHighAlarmSet, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="10" Padding="3,1" Height="20"
|
|
|
+ Foreground="{DynamicResource DangerBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="{Binding Unit}" FontSize="8" Foreground="{DynamicResource TextTertiaryBrush}" Margin="3,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Grid ColumnDefinitions="*,50,Auto" Margin="0,2" IsVisible="{Binding HasWritableAddresses}">
|
|
|
+ <TextBlock Text="低压" FontSize="9" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBox Grid.Column="1" Text="{Binding EditLowAlarmSet, StringFormat='{}{0:F2}'}"
|
|
|
+ FontFamily="Consolas, monospace" FontSize="10" Padding="3,1" Height="20"
|
|
|
+ Foreground="{DynamicResource WarningBrush}" Background="{DynamicResource PanelBgBrush}"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="{Binding Unit}" FontSize="8" Foreground="{DynamicResource TextTertiaryBrush}" Margin="3,0,0,0" VerticalAlignment="Center"/>
|
|
|
+ </Grid>
|
|
|
+ <Button Content="同步" Command="{Binding SyncThresholdsToPlcCommand}"
|
|
|
+ IsVisible="{Binding HasWritableAddresses}"
|
|
|
+ IsEnabled="{Binding !IsSyncing}"
|
|
|
+ HorizontalAlignment="Right" Margin="0,4,0,0"
|
|
|
+ FontSize="9" Padding="8,3" Height="20"
|
|
|
+ Background="{DynamicResource InfoBrush}" Foreground="White"/>
|
|
|
+ <TextBlock Text="{Binding SyncStatusText}" FontSize="8"
|
|
|
+ Foreground="{DynamicResource TextTertiaryBrush}" Margin="0,2,0,0"
|
|
|
+ TextTrimming="CharacterEllipsis" IsVisible="{Binding SyncStatusText, Converter={x:Static conv:BoolConverters.IsNotEmpty}}"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
</DataTemplate>
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
<ItemsControl.ItemsPanel>
|
|
|
@@ -212,8 +532,8 @@
|
|
|
</StackPanel>
|
|
|
</Border>
|
|
|
|
|
|
- <!-- 传感器 -->
|
|
|
- <Border Grid.Row="1" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14,12" Margin="0,0,0,8">
|
|
|
+ <!-- 累计数据 -->
|
|
|
+ <Border Grid.Row="2" 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"/>
|
|
|
@@ -234,73 +554,112 @@
|
|
|
</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>
|
|
|
+ <!-- 故障状态 -->
|
|
|
+ <Border Grid.Row="3" Classes="surface-card" Background="{DynamicResource SurfaceBgBrush}" Padding="14,12">
|
|
|
+ <ScrollViewer>
|
|
|
+ <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>
|
|
|
+ <!-- 最近报警(实时,最多 6 条,新报警置顶) -->
|
|
|
+ <Border Background="{DynamicResource PanelBgBrush}" CornerRadius="4" Padding="8,6" Margin="0,0,0,8">
|
|
|
+ <StackPanel>
|
|
|
+ <Grid ColumnDefinitions="*,Auto,Auto" Margin="0,0,0,4">
|
|
|
+ <TextBlock Text="最近报警" FontFamily="Consolas, monospace" FontSize="10" FontWeight="Bold"
|
|
|
+ Foreground="{DynamicResource DangerBrush}"/>
|
|
|
+ <Button Grid.Column="1" Content="复位" Command="{Binding ResetAllAlarmsCommand}"
|
|
|
+ FontSize="9" Padding="6,2" Height="18" Margin="0,0,4,0"
|
|
|
+ IsVisible="{Binding HasActiveAlarm}"
|
|
|
+ Background="{DynamicResource WarningBrush}" Foreground="White"/>
|
|
|
+ <TextBlock Grid.Column="2" Text="{Binding RecentAlarms.Count}"
|
|
|
+ FontFamily="Consolas,monospace" FontSize="10"
|
|
|
+ Foreground="{DynamicResource TextDisabledBrush}"/>
|
|
|
</Grid>
|
|
|
- </DataTemplate>
|
|
|
- </ItemsControl.ItemTemplate>
|
|
|
- </ItemsControl>
|
|
|
+ <TextBlock Text="暂无报警" FontSize="10" Margin="0,2"
|
|
|
+ Foreground="{DynamicResource TextDisabledBrush}"
|
|
|
+ IsVisible="{Binding RecentAlarms.Count, Converter={x:Static conv:BoolConverters.ToIsEmpty}}"/>
|
|
|
+ <ItemsControl ItemsSource="{Binding RecentAlarms}"
|
|
|
+ IsVisible="{Binding RecentAlarms.Count, Converter={x:Static conv:BoolConverters.ToHasItems}}">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="models:AlarmRecord">
|
|
|
+ <Grid ColumnDefinitions="Auto,*,Auto" Margin="0,2">
|
|
|
+ <TextBlock Grid.Column="0" Text="{Binding AlarmTime, StringFormat='{}{0:HH:mm:ss}'}"
|
|
|
+ FontFamily="Consolas,monospace" FontSize="9"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <TextBlock Grid.Column="1" Text="{Binding AlarmMessage}" Margin="6,0"
|
|
|
+ TextTrimming="CharacterEllipsis" FontSize="10"
|
|
|
+ Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ <Border Grid.Column="2" Width="7" Height="7" CornerRadius="3.5" VerticalAlignment="Center"
|
|
|
+ Background="{DynamicResource DangerBrush}"/>
|
|
|
+ </Grid>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
|
|
|
- <!-- 通用数字量输入(变频器故障等) -->
|
|
|
- <ItemsControl ItemsSource="{Binding DigitalInputs}" Margin="0,8,0,0">
|
|
|
- <ItemsControl.ItemTemplate>
|
|
|
- <DataTemplate x:DataType="vm:DigitalInputItemViewModel">
|
|
|
- <Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
|
|
- <StackPanel Orientation="Horizontal" Spacing="4">
|
|
|
- <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
- <TextBlock Text="{Binding Address}" FontSize="9" FontFamily="Consolas, monospace"
|
|
|
- Foreground="{DynamicResource TextDisabledBrush}" VerticalAlignment="Center"/>
|
|
|
- </StackPanel>
|
|
|
- <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4">
|
|
|
- <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource DangerBrush}"
|
|
|
- IsVisible="{Binding IsActive}"/>
|
|
|
- <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource SuccessBrush}"
|
|
|
- IsVisible="{Binding !IsActive}"/>
|
|
|
- <TextBlock Text="{Binding IsActive, Converter={x:Static conv:BoolConverters.ToText}}"
|
|
|
- FontSize="10" FontFamily="Consolas, monospace"
|
|
|
- Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center"/>
|
|
|
- </StackPanel>
|
|
|
- </Grid>
|
|
|
- </DataTemplate>
|
|
|
- </ItemsControl.ItemTemplate>
|
|
|
- </ItemsControl>
|
|
|
+ <!-- 泵故障 -->
|
|
|
+ <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>
|
|
|
|
|
|
- <!-- 通用数字量输出(复位按钮等) -->
|
|
|
- <ItemsControl ItemsSource="{Binding DigitalOutputs}" Margin="0,8,0,0">
|
|
|
- <ItemsControl.ItemTemplate>
|
|
|
- <DataTemplate x:DataType="vm:DigitalOutputItemViewModel">
|
|
|
- <Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
|
|
- <StackPanel Orientation="Horizontal" Spacing="4">
|
|
|
- <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}" VerticalAlignment="Center"/>
|
|
|
- <TextBlock Text="{Binding Address}" FontSize="9" FontFamily="Consolas, monospace"
|
|
|
- Foreground="{DynamicResource TextDisabledBrush}" VerticalAlignment="Center"/>
|
|
|
- </StackPanel>
|
|
|
- <Button Grid.Column="1" Content="执行" Command="{Binding PulseCommand}"
|
|
|
- IsEnabled="{Binding !IsPulsing}"
|
|
|
- Padding="8,2" FontSize="9" Classes="btn-warning"/>
|
|
|
- </Grid>
|
|
|
- </DataTemplate>
|
|
|
- </ItemsControl.ItemTemplate>
|
|
|
- </ItemsControl>
|
|
|
- </StackPanel>
|
|
|
+ <!-- 通用数字量输入(变频器故障等) -->
|
|
|
+ <ItemsControl ItemsSource="{Binding DigitalInputs}" Margin="0,8,0,0">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:DigitalInputItemViewModel">
|
|
|
+ <Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
|
|
+ <StackPanel Orientation="Vertical">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Text="{Binding Address}" FontSize="9" FontFamily="Consolas, monospace"
|
|
|
+ Foreground="{DynamicResource TextDisabledBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4" VerticalAlignment="Center">
|
|
|
+ <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource DangerBrush}"
|
|
|
+ IsVisible="{Binding IsActive}"/>
|
|
|
+ <Border Width="8" Height="8" CornerRadius="4" Background="{DynamicResource SuccessBrush}"
|
|
|
+ IsVisible="{Binding !IsActive}"/>
|
|
|
+ <TextBlock Text="{Binding IsActive, Converter={x:Static conv:BoolConverters.ToText}}"
|
|
|
+ FontSize="10" FontFamily="Consolas, monospace"
|
|
|
+ Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center"/>
|
|
|
+ </StackPanel>
|
|
|
+ </Grid>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+
|
|
|
+ <!-- 通用数字量输出(复位按钮等) -->
|
|
|
+ <ItemsControl ItemsSource="{Binding DigitalOutputs}" Margin="0,8,0,0">
|
|
|
+ <ItemsControl.ItemTemplate>
|
|
|
+ <DataTemplate x:DataType="vm:DigitalOutputItemViewModel">
|
|
|
+ <Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
|
|
+ <StackPanel Orientation="Vertical">
|
|
|
+ <TextBlock Text="{Binding Name}" FontSize="11" Foreground="{DynamicResource TextTertiaryBrush}"/>
|
|
|
+ <TextBlock Text="{Binding Address}" FontSize="9" FontFamily="Consolas, monospace"
|
|
|
+ Foreground="{DynamicResource TextDisabledBrush}"/>
|
|
|
+ </StackPanel>
|
|
|
+ <Button Grid.Column="1" Content="执行" Command="{Binding PulseCommand}"
|
|
|
+ IsEnabled="{Binding !IsPulsing}" VerticalAlignment="Center"
|
|
|
+ Padding="8,2" FontSize="9" Classes="btn-warning"/>
|
|
|
+ </Grid>
|
|
|
+ </DataTemplate>
|
|
|
+ </ItemsControl.ItemTemplate>
|
|
|
+ </ItemsControl>
|
|
|
+ </StackPanel>
|
|
|
+ </ScrollViewer>
|
|
|
</Border>
|
|
|
</Grid>
|
|
|
</Grid>
|