添加分页功能
This commit is contained in:
parent
88fe6947b8
commit
dba151304d
@ -48,7 +48,7 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<!--行头模版-->
|
||||
<Setter Property="HeaderTemplate">
|
||||
<!--<Setter Property="HeaderTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid Margin="5,0">
|
||||
@ -57,9 +57,9 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Setter>-->
|
||||
<!--行右键菜单-->
|
||||
<Setter Property="ContextMenu">
|
||||
<!--<Setter Property="ContextMenu">
|
||||
<Setter.Value>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="复制" Command="{Binding MenuItemCommand}" CommandParameter="{Binding}"/>
|
||||
@ -67,7 +67,7 @@
|
||||
<MenuItem Header="粘贴" Command="{Binding MenuItemCommand}" CommandParameter="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Setter>-->
|
||||
|
||||
|
||||
<Style.Triggers>
|
||||
|
||||
271
InSituLaboratory.Controls/Pagination.xaml
Normal file
271
InSituLaboratory.Controls/Pagination.xaml
Normal file
@ -0,0 +1,271 @@
|
||||
<UserControl x:Class="InSituLaboratory.Controls.Pagination"
|
||||
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"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Controls"
|
||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<x:Array Type="sys:Int32" x:Key="counts">
|
||||
<sys:Int32>10</sys:Int32>
|
||||
<sys:Int32>15</sys:Int32>
|
||||
<sys:Int32>20</sys:Int32>
|
||||
<sys:Int32>30</sys:Int32>
|
||||
<sys:Int32>50</sys:Int32>
|
||||
</x:Array>
|
||||
|
||||
|
||||
<LinearGradientBrush x:Key="MouseOver.Background"
|
||||
EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FFECF4FC" Offset="0.0"/>
|
||||
<GradientStop Color="#FFDCECFC" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<Style TargetType="Button" x:Key="FlipButtonStyle">
|
||||
<Setter Property="Foreground" Value="#555"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Width" Value="33"/>
|
||||
<Setter Property="Height" Value="27"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="#EEE" BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="5"
|
||||
Name="back">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Name="content"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="#FF7EB4EA"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="#CCC"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="CheckBox" x:Key="PageNumberButtonStyle">
|
||||
<Setter Property="Margin" Value="1,0"/>
|
||||
<Setter Property="Foreground" Value="#888"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="CheckBox">
|
||||
<Border Background="{TemplateBinding Background}" Name="root" CornerRadius="5"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="#EEE"
|
||||
Height="27" Width="27">
|
||||
<TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#EEE"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" Value="#409EFE"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="ClickMode" Value="Press"/>
|
||||
<Setter Property="Height" Value="27"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border x:Name="templateRoot" SnapsToDevicePixels="true" Background="Transparent"
|
||||
BorderBrush="#EEE" BorderThickness="1" CornerRadius="5">
|
||||
<Border x:Name="splitBorder" Width="25" SnapsToDevicePixels="true" Margin="0"
|
||||
HorizontalAlignment="Right" BorderThickness="1" BorderBrush="Transparent">
|
||||
<Path x:Name="arrow" VerticalAlignment="Center" Margin="0" HorizontalAlignment="Center"
|
||||
Stroke="Gray" StrokeThickness="1"
|
||||
Data="M0 0 4 4 8 0"/>
|
||||
</Border>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#FF7EB4EA"/>
|
||||
</MultiDataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
||||
<Border Background="Transparent" CornerRadius="0,10,10,0">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="20"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2"
|
||||
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
|
||||
Placement="Bottom">
|
||||
|
||||
<Border x:Name="dropDownBorder" BorderBrush="#EEE" BorderThickness="1"
|
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
MinWidth="{Binding ActualWidth,ElementName=templateRoot}"
|
||||
CornerRadius="5" Margin="3">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="5" Color="Gray" ShadowDepth="0" Opacity="0.2"/>
|
||||
</Border.Effect>
|
||||
<ScrollViewer x:Name="DropDownScrollViewer" Background="Transparent">
|
||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}"
|
||||
Height="{Binding ActualHeight, ElementName=dropDownBorder}"
|
||||
Width="{Binding ActualWidth, ElementName=dropDownBorder}"
|
||||
RadiusX="5" RadiusY="5"/>
|
||||
</Canvas>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
<ToggleButton x:Name="toggleButton" BorderThickness="0" Background="Transparent"
|
||||
Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource ComboBoxToggleButton}"/>
|
||||
<ContentControl x:Name="contentPresenter" Margin="5,0"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
IsHitTestVisible="false"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock>
|
||||
<Run Text="{Binding SelectionBoxItem,RelativeSource={RelativeSource AncestorType=ComboBox,Mode=FindAncestor},Mode=OneWay}"/>
|
||||
<Run Text="条/页"/>
|
||||
</TextBlock>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasItems" Value="false">
|
||||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
|
||||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="PagesComboBoxStyle" TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="#777"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Padding" Value="6,3,5,3"/>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||
<Setter Property="Margin" Value="1,0"/>
|
||||
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="4">
|
||||
<TextBlock VerticalAlignment="Center" Margin="5,0">
|
||||
<Run Text="{Binding Path=.,Mode=OneWay}"/>
|
||||
<Run Text="条/页"/>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#22409EFE"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#409EFE"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Style="{StaticResource FlipButtonStyle}"
|
||||
IsEnabled="{Binding IsCanPrevious}"
|
||||
Command="{Binding NavCommand}"
|
||||
CommandParameter="{Binding PreviousIndex}">
|
||||
<Path Data="M5,0 0 5 5 10" Stroke="{Binding Foreground,RelativeSource={RelativeSource AncestorType=Button}}" StrokeThickness="1"
|
||||
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Style="{StaticResource FlipButtonStyle}"
|
||||
IsEnabled="{Binding IsCanNext}"
|
||||
Command="{Binding NavCommand}"
|
||||
CommandParameter="{Binding NextIndex}">
|
||||
<Path Data="M5,0 0 5 5 10" Stroke="{Binding Foreground,RelativeSource={RelativeSource AncestorType=Button}}" StrokeThickness="1"
|
||||
StrokeStartLineCap="Round" StrokeEndLineCap="Round" RenderTransformOrigin="0.5,0.5">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="180"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Button>
|
||||
<ComboBox Grid.Column="3" SelectedItem="{Binding PageSize}"
|
||||
ItemsSource="{Binding Source={StaticResource counts}}"
|
||||
Style="{StaticResource PagesComboBoxStyle}"
|
||||
Width="80"/>
|
||||
|
||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding PageNumList}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Rows="1"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!--1、页码 2、是否选中-->
|
||||
<CheckBox Content="{Binding Index}"
|
||||
IsChecked="{Binding IsCurrent}"
|
||||
Style="{StaticResource PageNumberButtonStyle}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
Command="{Binding DataContext.NavCommand,RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding Index}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
InSituLaboratory.Controls/Pagination.xaml.cs
Normal file
28
InSituLaboratory.Controls/Pagination.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace InSituLaboratory.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Pagination.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Pagination : UserControl
|
||||
{
|
||||
public Pagination()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
185
InSituLaboratory.Controls/PaginationModel.cs
Normal file
185
InSituLaboratory.Controls/PaginationModel.cs
Normal file
@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace InSituLaboratory.Controls
|
||||
{
|
||||
public class PaginationModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
|
||||
public ICommand NavCommand { get; set; }
|
||||
|
||||
public ObservableCollection<PageNumberModel> PageNumList { get; set; } =
|
||||
new ObservableCollection<PageNumberModel>();
|
||||
|
||||
//public int PerPageCount { get; set; } = 20;
|
||||
private int _pageSize = 20;
|
||||
|
||||
public int PageSize
|
||||
{
|
||||
get { return _pageSize; }
|
||||
set
|
||||
{
|
||||
_pageSize = value;
|
||||
NavCommand?.Execute(PageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int _pageIndex = 1;
|
||||
|
||||
public int PageIndex
|
||||
{
|
||||
get { return _pageIndex; }
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
_pageIndex = 1;
|
||||
else
|
||||
_pageIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool _isCanPrevious = true;
|
||||
public bool IsCanPrevious
|
||||
{
|
||||
get => _isCanPrevious;
|
||||
set
|
||||
{
|
||||
this._isCanPrevious = value;
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsCanPrevious"));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isCanNext = true;
|
||||
public bool IsCanNext
|
||||
{
|
||||
get => _isCanNext;
|
||||
set
|
||||
{
|
||||
this._isCanNext = value;
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsCanNext"));
|
||||
}
|
||||
}
|
||||
|
||||
private int _previousIndex;
|
||||
/// <summary>
|
||||
/// 前一条数据的Index 如果当前Index=2 1 3
|
||||
/// </summary>
|
||||
public int PreviousIndex
|
||||
{
|
||||
get => _previousIndex;
|
||||
set
|
||||
{
|
||||
this._previousIndex = value;
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousIndex"));
|
||||
}
|
||||
}
|
||||
|
||||
private int _nextIndex;
|
||||
public int NextIndex
|
||||
{
|
||||
get => _nextIndex;
|
||||
set
|
||||
{
|
||||
this._nextIndex = value;
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextIndex"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充刷新页码
|
||||
/// </summary>
|
||||
/// <param name="sumCount">数据总条目数</param>
|
||||
public void FillPageNumbers(int sumCount)
|
||||
{
|
||||
// 总条目数:100 per 20 num=5
|
||||
// 第一次刷新:pageIndex=1
|
||||
// 第二次刷新:点击了页码:5
|
||||
// 第三次刷新:因为重新选择了每页数量 per 30 num=4
|
||||
// 简单点的话:当重新选择了每页数量后,直接从1页开始
|
||||
// 算法处理一下的话:页码超出范围,显示最后一页
|
||||
|
||||
|
||||
// 这里进行PageNumList的修改 3.0 2 =1.5 == 2
|
||||
int num_count = (int)Math.Ceiling(sumCount * 1.0 / PageSize);
|
||||
if (PageIndex > num_count) PageIndex = num_count;
|
||||
|
||||
this.PreviousIndex = PageIndex - 1;
|
||||
this.NextIndex = PageIndex + 1;
|
||||
|
||||
// 处理前一页和后一页按钮的可用性
|
||||
//if (PageIndex == 1)
|
||||
IsCanPrevious = PageIndex != 1;
|
||||
//if (PageIndex == num_count)
|
||||
IsCanNext = PageIndex != num_count;
|
||||
|
||||
|
||||
// 页面的显示
|
||||
// 20 30 40 导致页面显示不了
|
||||
// 1 2 3 4 5 6 ... 16
|
||||
// 1 ... 7 8 9 10 11 12 13 ... 16
|
||||
// 1 ... 11 12 13 14 15 16
|
||||
|
||||
int min = PageIndex - 4;
|
||||
if (min <= 1) min = 1;
|
||||
else min = PageIndex - 3;
|
||||
|
||||
int max = PageIndex + 4;
|
||||
if (PageIndex <= 5)
|
||||
max = Math.Min(9, num_count);
|
||||
else
|
||||
{
|
||||
if (max >= num_count) max = num_count;
|
||||
else max = PageIndex + 3;
|
||||
}
|
||||
|
||||
if (PageIndex >= num_count - 4)
|
||||
min = Math.Max(1, num_count - 8);
|
||||
|
||||
|
||||
List<string> temp = new List<string>();
|
||||
if (min > 1)
|
||||
{
|
||||
temp.Add("1");
|
||||
temp.Add("···");
|
||||
}
|
||||
for (int i = min; i <= max; i++)
|
||||
temp.Add(i.ToString());
|
||||
if (max < num_count)
|
||||
{
|
||||
temp.Add("···");
|
||||
temp.Add(num_count.ToString());
|
||||
}
|
||||
|
||||
PageNumList.Clear();
|
||||
//for (int i = 1; i <= num_count; i++)
|
||||
foreach (string str in temp)
|
||||
{
|
||||
bool state = int.TryParse(str, out int index);
|
||||
PageNumList.Add(new PageNumberModel
|
||||
{
|
||||
Index = str,
|
||||
IsCurrent = (index == PageIndex),
|
||||
IsEnabled = state
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class PageNumberModel
|
||||
{
|
||||
public string Index { get; set; }
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
public bool IsCurrent { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityBatteryLevelService : IBaseService
|
||||
{
|
||||
IEnumerable<cavitybatterylevel> GetCavityBatteryLevel(string key);
|
||||
IEnumerable<cavitybatterylevel> GetCavityBatteryLevel(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityEnergyConversionService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityenergyconversion> GetCavityEnergyConversion(string key);
|
||||
IEnumerable<cavityenergyconversion> GetCavityEnergyConversion(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,6 @@ namespace InSituLaboratory.IService.History
|
||||
{
|
||||
public interface ICavityEnvironmentService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityenvironment> GetCavityEnvironment(string key);
|
||||
IEnumerable<cavityenvironment> GetCavityEnvironment(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityOperationService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityoperationstatus> GetCavityOperationStatus(string key);
|
||||
IEnumerable<cavityoperationstatus> GetCavityOperationStatus(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityOtputFeedBackService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityoutputfeedback> GetCavityOtputFeedBack(string key);
|
||||
IEnumerable<cavityoutputfeedback> GetCavityOtputFeedBack(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityOtputStatusService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityoutputstatus> GetCavityOtputStatus(string key);
|
||||
IEnumerable<cavityoutputstatus> GetCavityOtputStatus(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ namespace InSituLaboratory.IService.History
|
||||
/// </summary>
|
||||
public interface ICavityOutputCurrentService : IBaseService
|
||||
{
|
||||
IEnumerable<cavityoutputcurrent> GetCavityOtputCurrent(string key);
|
||||
IEnumerable<cavityoutputcurrent> GetCavityOtputCurrent(string key, int pageSize, int pageIndex, out int totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,13 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityBatteryLevelService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavitybatterylevel> GetCavityBatteryLevel(string key)
|
||||
public IEnumerable<cavitybatterylevel> GetCavityBatteryLevel(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavitybatterylevel>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
var pResult = this.QueryPage<cavitybatterylevel, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,10 +16,13 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityEnergyConversionService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityenergyconversion> GetCavityEnergyConversion(string key)
|
||||
public IEnumerable<cavityenergyconversion> GetCavityEnergyConversion(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityenergyconversion>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
var pResult = this.QueryPage<cavityenergyconversion, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,11 +16,13 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityEnvironmentService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityenvironment> GetCavityEnvironment(string key)
|
||||
public IEnumerable<cavityenvironment> GetCavityEnvironment(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityenvironment>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
}
|
||||
var pResult = this.QueryPage<cavityenvironment, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,15 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityOperationService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityoperationstatus> GetCavityOperationStatus(string key)
|
||||
public IEnumerable<cavityoperationstatus> GetCavityOperationStatus(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityoperationstatus>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
|
||||
var pResult = this.QueryPage<cavityoperationstatus, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize,pageIndex, order => order.RecordTime.ToString(), false );
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,11 +13,13 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityOtputFeedBackService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityoutputfeedback> GetCavityOtputFeedBack(string key)
|
||||
public IEnumerable<cavityoutputfeedback> GetCavityOtputFeedBack(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityoutputfeedback>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
}
|
||||
var pResult = this.QueryPage<cavityoutputfeedback, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,11 +13,14 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityOtputStatusService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityoutputstatus> GetCavityOtputStatus(string key)
|
||||
public IEnumerable<cavityoutputstatus> GetCavityOtputStatus(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityoutputstatus>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
}
|
||||
var pResult = this.QueryPage<cavityoutputstatus, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,13 @@ namespace InSituLaboratory.Service.History
|
||||
{
|
||||
public CavityOutputCurrentService(DbContext context) : base(context) { }
|
||||
|
||||
public IEnumerable<cavityoutputcurrent> GetCavityOtputCurrent(string key)
|
||||
public IEnumerable<cavityoutputcurrent> GetCavityOtputCurrent(string key, int pageSize, int pageIndex, out int totalCount)
|
||||
{
|
||||
return Set<cavityoutputcurrent>().OrderByDescending(p => p.RecordTime)
|
||||
.Where(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key));
|
||||
var pResult = this.QueryPage<cavityoutputcurrent, string>(m => string.IsNullOrEmpty(key) || m.RecordTime.ToString().Contains(key), pageSize, pageIndex, order => order.RecordTime.ToString(), false);
|
||||
|
||||
totalCount = pResult.TotalCount;
|
||||
|
||||
return pResult.DataList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using InSituLaboratory.Service;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -15,8 +18,10 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// <summary>
|
||||
/// 电池电量
|
||||
/// </summary>
|
||||
public class CavityBatteryLevelViewModel : ViewModelBase
|
||||
public class CavityBatteryLevelViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
IDialogService _dialogService;
|
||||
ICavityBatteryLevelService _cavityBatteryLevelService;
|
||||
|
||||
@ -27,6 +32,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_cavityBatteryLevelService = icavityBatteryLevelService;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
@ -35,19 +46,23 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavitybatterylevel.Clear();
|
||||
var cavitybatterylevellist = _cavityBatteryLevelService.GetCavityBatteryLevel(SearchKey).ToList();
|
||||
var cavitybatterylevellist = _cavityBatteryLevelService.GetCavityBatteryLevel(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavitybatterylevellist)
|
||||
{
|
||||
cavitybatterylevel model = new cavitybatterylevel
|
||||
index++;
|
||||
cavitybatterylevel.Add(new cavitybatterylevel
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
Voltage = item.Voltage
|
||||
};
|
||||
cavitybatterylevel.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -16,6 +18,8 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityEnergyConversionViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
IDialogService _dialogService;
|
||||
ICavityEnergyConversionService _cavityEnergyConversionService;
|
||||
|
||||
@ -27,6 +31,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_cavityEnergyConversionService = icavityEnergyConversion;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
@ -35,13 +45,15 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityenergyconversion.Clear();
|
||||
var cavityenergyconversionlist = _cavityEnergyConversionService.GetCavityEnergyConversion(SearchKey).ToList();
|
||||
var cavityenergyconversionlist = _cavityEnergyConversionService.GetCavityEnergyConversion(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityenergyconversionlist)
|
||||
{
|
||||
cavityenergyconversion model = new cavityenergyconversion
|
||||
index++;
|
||||
cavityenergyconversion.Add(new cavityenergyconversion
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
Enable1Of24V = item.Enable1Of24V,
|
||||
@ -52,11 +64,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
Enable3Of12V = item.Enable3Of12V,
|
||||
Enable4Of24V = item.Enable4Of24V,
|
||||
Enable4Of12V = item.Enable4Of12V
|
||||
};
|
||||
cavityenergyconversion.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using InSituLaboratory.Service;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -18,6 +20,9 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityEnvironmentViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
|
||||
ICavityEnvironmentService _icavityEnvironment;
|
||||
IDialogService _dialogService;
|
||||
public CavityEnvironmentViewModel(IRegionManager regionManager, ICavityEnvironmentService icavityEnvironment, IDialogService dialogService) : base(regionManager)
|
||||
@ -27,6 +32,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_icavityEnvironment = icavityEnvironment;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
@ -35,12 +46,16 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityenvironment.Clear();
|
||||
var cavityenvironmentlist = _icavityEnvironment.GetCavityEnvironment(SearchKey).ToList();
|
||||
var cavityenvironmentlist = _icavityEnvironment.GetCavityEnvironment(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityenvironmentlist)
|
||||
{
|
||||
cavityenvironment model = new cavityenvironment
|
||||
index++;
|
||||
|
||||
cavityenvironment.Add(new cavityenvironment
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
Temperature1 = item.Temperature1,
|
||||
@ -49,9 +64,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
HumDataIdNumity2 = item.HumDataIdNumity2,
|
||||
Leak1 = item.Leak1,
|
||||
Leak2 = item.Leak2,
|
||||
};
|
||||
cavityenvironment.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using InSituLaboratory.Models;
|
||||
using InSituLaboratory.Service;
|
||||
@ -21,6 +22,8 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityOperationViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
ICavityOperationService _cavityOperationService;
|
||||
IDialogService _dialogService;
|
||||
public CavityOperationViewModel(IRegionManager regionManager, IDialogService dialogService, ICavityOperationService cavityOperationService)
|
||||
@ -32,6 +35,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_cavityOperationService= cavityOperationService;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
@ -40,12 +49,16 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityoperationstatus.Clear();
|
||||
var cavityoperationslist = _cavityOperationService.GetCavityOperationStatus(SearchKey).ToList();
|
||||
|
||||
var cavityoperationslist = _cavityOperationService.GetCavityOperationStatus(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityoperationslist)
|
||||
{
|
||||
cavityoperationstatus model = new cavityoperationstatus
|
||||
index++;
|
||||
cavityoperationstatus.Add( new cavityoperationstatus
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
Voltage48V1 = item.Voltage48V1,
|
||||
@ -61,9 +74,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
LeakageCurrent2 = item.LeakageCurrent2,
|
||||
LeakageCurrent3 = item.LeakageCurrent3,
|
||||
LeakageCurrent4 = item.LeakageCurrent4
|
||||
};
|
||||
cavityoperationstatus.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using InSituLaboratory.Service;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -17,6 +19,8 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityOtputFeedBackViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
IDialogService _dialogService;
|
||||
ICavityOtputFeedBackService _cavityOtputFeedBackService;
|
||||
public CavityOtputFeedBackViewModel(IRegionManager regionManager, ICavityOtputFeedBackService cavityOtputFeedBackService, IDialogService dialogService) : base(regionManager)
|
||||
@ -26,6 +30,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_cavityOtputFeedBackService = cavityOtputFeedBackService;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@ -34,10 +44,14 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityoutputfeedback.Clear();
|
||||
var cavityoutputfeedbacklist = _cavityOtputFeedBackService.GetCavityOtputFeedBack(SearchKey).ToList();
|
||||
var cavityoutputfeedbacklist = _cavityOtputFeedBackService.GetCavityOtputFeedBack(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityoutputfeedbacklist)
|
||||
{
|
||||
cavityoutputfeedback model = new cavityoutputfeedback
|
||||
index++;
|
||||
|
||||
cavityoutputfeedback.Add(new cavityoutputfeedback
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
RecordTime = item.RecordTime,
|
||||
@ -60,11 +74,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
OutputFeedbackOfVDataIdNumeo1 = item.OutputFeedbackOfVDataIdNumeo1,
|
||||
OutputFeedbackOfVDataIdNumeo2 = item.OutputFeedbackOfVDataIdNumeo2,
|
||||
OutputFeedbackOfSwichBoard = item.OutputFeedbackOfSwichBoard
|
||||
};
|
||||
cavityoutputfeedback.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -16,6 +18,8 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityOtputCurrentViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
IDialogService _dialogService;
|
||||
ICavityOutputCurrentService _cavityOutputCurrentService;
|
||||
public CavityOtputCurrentViewModel(IRegionManager regionManager,ICavityOutputCurrentService cavityOutputCurrentService, IDialogService dialogService) : base(regionManager)
|
||||
@ -25,22 +29,29 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_cavityOutputCurrentService = cavityOutputCurrentService;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public ObservableCollection<cavityoutputcurrent> cavityoutputcurrent { get; set; } = new ObservableCollection<cavityoutputcurrent>();
|
||||
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityoutputcurrent.Clear();
|
||||
var cavityoutputcurrentlist = _cavityOutputCurrentService.GetCavityOtputCurrent(SearchKey).ToList();
|
||||
var cavityoutputcurrentlist = _cavityOutputCurrentService.GetCavityOtputCurrent(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityoutputcurrentlist)
|
||||
{
|
||||
cavityoutputcurrent model = new cavityoutputcurrent
|
||||
index++;
|
||||
cavityoutputcurrent.Add(new cavityoutputcurrent
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
CurrentOfGC_MS = item.CurrentOfGC_MS,
|
||||
@ -61,9 +72,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
CurrrentOfVDataIdNumeo1 = item.CurrrentOfVDataIdNumeo1,
|
||||
CurrentOfVDataIdNumeo2 = item.CurrentOfVDataIdNumeo2,
|
||||
CurrentOfSwichBoard = item.CurrentOfSwichBoard
|
||||
};
|
||||
cavityoutputcurrent.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Controls;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.IService.History;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -16,6 +18,8 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
/// </summary>
|
||||
public class CavityOutputStatusViewModel : ViewModelBase
|
||||
{
|
||||
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
|
||||
|
||||
IDialogService _dialogService;
|
||||
ICavityOtputStatusService _icavityOtputStatus;
|
||||
public CavityOutputStatusViewModel(IRegionManager regionManager, ICavityOtputStatusService icavityOtputStatusService, IDialogService dialogService) : base(regionManager)
|
||||
@ -25,6 +29,12 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
_dialogService = dialogService;
|
||||
_icavityOtputStatus = icavityOtputStatusService;
|
||||
|
||||
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
|
||||
{
|
||||
PaginationModel.PageIndex = int.Parse(index.ToString());
|
||||
this.Refresh();
|
||||
});
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@ -33,13 +43,15 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
public override void Refresh()
|
||||
{
|
||||
cavityoutputstatus.Clear();
|
||||
var cavityoutputstatuslist = _icavityOtputStatus.GetCavityOtputStatus(SearchKey).ToList();
|
||||
var cavityoutputstatuslist = _icavityOtputStatus.GetCavityOtputStatus(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in cavityoutputstatuslist)
|
||||
{
|
||||
cavityoutputstatus model = new cavityoutputstatus
|
||||
index++;
|
||||
cavityoutputstatus.Add(new cavityoutputstatus
|
||||
{
|
||||
DataIdNum = item.DataIdNum,
|
||||
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
|
||||
RecordTime = item.RecordTime,
|
||||
CavityPIN = item.CavityPIN,
|
||||
OutputStateOfGC_MS = item.OutputStateOfGC_MS,
|
||||
@ -60,9 +72,11 @@ namespace InSituLaboratory.ViewModels.Pages.History
|
||||
OutputStateOfVDataIdNumeo1 = item.OutputStateOfVDataIdNumeo1,
|
||||
OutputStateOfVDataIdNumeo2 = item.OutputStateOfVDataIdNumeo2,
|
||||
OutputStateOfSwichBoard = item.OutputStateOfSwichBoard
|
||||
};
|
||||
cavityoutputstatus.Add(model);
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新分页组件的页码
|
||||
PaginationModel.FillPageNumbers(totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavitybatterylevel }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -17,5 +23,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,9 +4,14 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityenergyconversion }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -24,5 +29,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,10 +4,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityenvironment }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -23,5 +28,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,11 +4,16 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}"
|
||||
>
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityoperationstatus }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid ItemsSource="{Binding cavityoperationstatus }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" Width="40" Binding="{Binding DataIdNum}" />
|
||||
<DataGridTextColumn Header="记录时间" Width="140" Binding="{Binding RecordTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
|
||||
@ -29,5 +34,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,9 +4,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityoutputcurrent }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -34,5 +40,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,9 +4,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityoutputfeedback }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -34,5 +40,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@ -4,9 +4,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
|
||||
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
|
||||
|
||||
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<DataGrid ItemsSource="{Binding cavityoutputstatus }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
|
||||
<DataGrid.Columns>
|
||||
@ -34,5 +40,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ScrollViewer>
|
||||
|
||||
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user