1、营业查询介绍

本模块是最后一个模块,该板块需要的功能有:营业数据列表,查询数据,导出数据,数据统计。

2、UI设计布局

TabControl 是 WPF 中用于创建多页标签式界面的控件,常用于组织多个子内容区域。每个子内容通过 TabItem 定义,用户可以通过点击标签头切换内容,通过修改样式和模板,可以完全自定义 TabControl 的外观。可以通过代码动态管理 TabControl 中的 TabItem,TabControl 支持数据绑定,可以通过 ItemsSource 属性绑定到一个集合,并使用 ItemTemplate 定义标签头的显示方式,TabControl 提供了多个有用的事件,例如 SelectionChanged,可以在用户切换标签页时执行自定义逻辑:通过设置 TabStripPlacement 属性,可以改变标签头的位置,使其显示在左侧、右侧或底部。

<UserControlx:Class="HQ.fResApp.UControls.BusinessInquiry"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:MetroChart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"xmlns:vm="clr-namespace:HQ.fResApp.ViewModel"d:DesignHeight="450"d:DesignWidth="1000"Background="#f6f9ff"mc:Ignorable="d"><UserControl.DataContext><vm:BusinessInquiryListVModel /></UserControl.DataContext><TabControlMargin="20"VerticalAlignment="Stretch"pu:TabControlHelper.HeaderPanelBackground="#fcfcfc"pu:TabControlHelper.ItemHeight="50"pu:TabControlHelper.ItemPadding="20,0"pu:TabControlHelper.ItemsAlignment="LeftOrTop"pu:TabControlHelper.SelectedBackground="#FF009BFF"pu:TabControlHelper.SelectedForeground="#ffffff"pu:TabControlHelper.TabControlStyle="Card"><TabItemBackground="BlanchedAlmond"BorderBrush="AliceBlue"BorderThickness="1"Cursor="Hand"FontFamily="雅黑"FontSize="20"Header="营业订单数据"><Grid Margin="10"><Grid.ColumnDefinitions><ColumnDefinition Width="56*" /><ColumnDefinition Width="411*" /></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition /></Grid.RowDefinitions><Grid Grid.ColumnSpan="2"><Grid.RowDefinitions><RowDefinition Height="80" /><RowDefinition /><RowDefinition Height="60" /></Grid.RowDefinitions><Grid Background="#ffffff"><Grid.ColumnDefinitions><ColumnDefinition /></Grid.ColumnDefinitions><StackPanel Orientation="Horizontal"><TextBoxWidth="280"Height="40"Margin="0,0,20,0"pu:TextBoxHelper.Watermark="输入订单号搜索"FontSize="15"Foreground="#909399"Text="{Binding BillHistoryKey}" /><Buttonx:Name="btnSearch"Width="100"Height="40"Margin="0,0,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#009BFF"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/search.png"pu:IconHelper.Width="40"Background="#FF009BFF"BorderBrush="#FF009BFF"Command="{Binding FindCommand}"Content="查询"Cursor="Hand"FontSize="16"Foreground="#ffffff"IsDefault="true" /><ButtonWidth="100"Height="40"Margin="0,0,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#009BFF"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/Refresh.png"pu:IconHelper.Width="40"Background="LightSlateGray"BorderBrush="#FF009BFF"Command="{Binding ResetCommand}"Content="重置"Cursor="Hand"FontSize="16"Foreground="#ffffff" /><ButtonWidth="140"Height="40"Margin="0,0,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#65d17f"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/openorder.png"pu:IconHelper.Width="35"Background="#ab4321"BorderBrush="#65d17f"Command="{Binding BackUpAllCommand}"Content="导出全部数据"Cursor="Hand"FontSize="16"Foreground="#ffffff" /><ButtonWidth="140"Height="40"Margin="0,0,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#65d17f"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/openorder.png"pu:IconHelper.Width="35"Background="#65d17f"BorderBrush="#65d17f"Command="{Binding BackUpPageCommand}"Content="导出本页数据"Cursor="Hand"FontSize="16"Foreground="#ffffff" /></StackPanel></Grid><DataGridx:Name="tableList"Grid.Row="1"pu:DataGridHelper.ColumnHorizontalContentAlignment="Center"pu:DataGridHelper.HeaderBackground="#FF009BFF"pu:DataGridHelper.HeaderForeground="#ffffff"pu:DataGridHelper.HeaderMinHeight="50"pu:DataGridHelper.HoverBackground="#FF009BFF"pu:DataGridHelper.ResizeThumbThickness="0.5"pu:DataGridHelper.SelectedBackground="Transparent"pu:DataGridHelper.SelectedForeground="Red"AlternatingRowBackground="#f7faff"AutoGenerateColumns="False"CanUserAddRows="False"CanUserDeleteRows="False"CanUserReorderColumns="False"CanUserResizeRows="False"Cursor="Pen"FontSize="16"ItemsSource="{Binding BillHistoryDataList}"SelectionMode="Extended"SelectionUnit="FullRow"><DataGrid.RowStyle><Style TargetType="DataGridRow"><!--  Event绑定MouseLeftButtonUp表示鼠标点击事件,Handler表示具体的事件处理程序  --><Setter Property="Height" Value="40" /><!--  样式触发器,IsMouseOver表示鼠标滑过时事件  --><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background"><Setter.Value><LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"><GradientStop Offset="0.98" Color="#FF73BCE8" /><GradientStop Offset="0" Color="White" /></LinearGradientBrush></Setter.Value></Setter></Trigger></Style.Triggers></Style></DataGrid.RowStyle><DataGrid.Columns><DataGridTextColumnWidth="2*"Binding="{Binding tName}"FontSize="18"Header="餐桌号"IsReadOnly="True" /><DataGridTextColumnWidth="3*"Binding="{Binding obId}"FontSize="18"Header="订单号"IsReadOnly="True" /><DataGridTextColumnWidth="4*"Binding="{Binding obDate, StringFormat='{}{0:yyyy年MM月dd日 dddd HH时mm分}', ConverterCulture=zh-CN}"FontSize="18"Header="开单时间"IsReadOnly="True" /><DataGridTextColumnWidth="2*"Binding="{Binding obNumber}"FontSize="18"Header="消费人数"IsReadOnly="True" /><DataGridTextColumnWidth="2*"Binding="{Binding opConsumeMoney}"FontSize="18"Header="消费金额"IsReadOnly="True" /><DataGridTextColumnWidth="2*"Binding="{Binding opClientMoney}"FontSize="18"Header="支付金额"IsReadOnly="True" /><DataGridTextColumnWidth="4*"Binding="{Binding obDate, StringFormat='{}{0:yyyy年MM月dd日 dddd HH时mm分}', ConverterCulture=zh-CN}"FontSize="18"Header="创建时间"IsReadOnly="True" /><DataGridTextColumnWidth="3*"Binding="{Binding opRemark}"FontSize="18"Header="备注"IsReadOnly="True" /></DataGrid.Columns></DataGrid><Grid Grid.Row="2"><Grid.ColumnDefinitions><ColumnDefinition /><ColumnDefinition Width="250" /></Grid.ColumnDefinitions><pu:Paginationx:Name="tabPagination"Height="45"Margin="0,0,20,0"HorizontalAlignment="Left"Background="#963F3F3F"CurrentIndex="{Binding BillHistoryCurrentIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"CurrentIndexChanged="tabPageActiveChanged"Cursor="Hand"HoverBrush="#FF009BFF"Spacing="15"TotalIndex="{Binding BillHistoryTotalIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /><StackPanelGrid.Column="1"HorizontalAlignment="Right"Orientation="Horizontal"><ButtonWidth="20"Height="45"Padding="-35,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.HoverBrush="Transparent"pu:IconHelper.Width="35"Background="Transparent"BorderBrush="Transparent"Content="共"FontSize="17"FontWeight="ExtraBold"Foreground="#2F4056" /><Buttonx:Name="txtTotalNum"Height="45"Padding="-35,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.HoverBrush="Transparent"pu:IconHelper.Width="35"Background="Transparent"BorderBrush="Transparent"Content="{Binding BillHistoryTotalNum, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"FontSize="17"FontWeight="ExtraBold"Foreground="#FF009BFF" /><ButtonWidth="100"Height="45"Padding="-35,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.HoverBrush="Transparent"pu:IconHelper.Width="35"Background="Transparent"BorderBrush="Transparent"Content="条数据/每页"FontSize="17"FontWeight="ExtraBold"Foreground="#2F4056" /><TextBoxx:Name="txtPageSize"Grid.Row="2"Width="50"Height="30"HorizontalAlignment="Center"pu:TextBoxHelper.CornerRadius="0"Text="{Binding BillHistoryPageSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /><ButtonWidth="20"Height="45"Padding="-35,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.HoverBrush="Transparent"pu:IconHelper.Width="35"Background="Transparent"BorderBrush="Transparent"Content="条"FontSize="17"FontWeight="ExtraBold"Foreground="#2F4056" /></StackPanel></Grid></Grid></Grid></TabItem><TabItemBackground="BlanchedAlmond"BorderBrush="AliceBlue"BorderThickness="1"Cursor="Hand"FontFamily="雅黑"FontSize="20"FontWeight="Bold"Header="最近一周"><Grid><Grid.RowDefinitions><RowDefinition Height="1*" /><RowDefinition Height="9*" /></Grid.RowDefinitions><StackPanel HorizontalAlignment="Right" Orientation="Horizontal"><ButtonWidth="100"Height="40"Margin="0,-10,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#009BFF"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/Refresh.png"pu:IconHelper.Width="40"Background="#65d17f"BorderBrush="#65d17f"Content="刷新"Cursor="Hand"FontSize="16"Foreground="#ffffff" /></StackPanel><MetroChart:ClusteredColumnChartGrid.Row="1"Margin="0,-10,20,0"ChartLegendVisibility="Collapsed"ChartSubTitle="额度"ChartTitle="最近一周营业情况统计"ChartTitleVisibility="Visible"IsRowColumnSwitched="True"ToolTipFormat="{Binding Path=ToolTipFormat}"><MetroChart:ClusteredColumnChart.Series><MetroChart:ChartSeriesDisplayMember="Name"ItemsSource="{Binding Path=WeekDatas}"SeriesTitle="日期"ValueMember="Count" /></MetroChart:ClusteredColumnChart.Series></MetroChart:ClusteredColumnChart></Grid></TabItem><TabItemBackground="BlanchedAlmond"BorderBrush="AliceBlue"BorderThickness="1"Cursor="Hand"FontFamily="雅黑"FontSize="20"FontWeight="Bold"Header="最近一个月"><Grid><Grid.RowDefinitions><RowDefinition Height="1*" /><RowDefinition Height="9*" /></Grid.RowDefinitions><StackPanel HorizontalAlignment="Right" Orientation="Horizontal"><ButtonWidth="100"Height="40"Margin="0,-10,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#009BFF"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/Refresh.png"pu:IconHelper.Width="40"Background="#65d17f"BorderBrush="#65d17f"Content="刷新"Cursor="Hand"FontSize="16"Foreground="#ffffff" /></StackPanel><MetroChart:ClusteredColumnChartGrid.Row="1"Margin="0,-10,20,0"ChartLegendVisibility="Collapsed"ChartSubTitle="额度"ChartTitle="最近一个月营业情况统计"ChartTitleVisibility="Visible"IsRowColumnSwitched="True"ToolTipFormat="{Binding Path=ToolTipFormat}"><MetroChart:ClusteredColumnChart.Series><MetroChart:ChartSeriesDisplayMember="Name"ItemsSource="{Binding Path=MonthDatas}"SeriesTitle="日期"ValueMember="Count" /></MetroChart:ClusteredColumnChart.Series></MetroChart:ClusteredColumnChart></Grid></TabItem><TabItemBackground="BlanchedAlmond"BorderBrush="AliceBlue"BorderThickness="1"Cursor="Hand"FontFamily="雅黑"FontSize="20"FontWeight="Bold"Header="按年份统计"><Grid><Grid.RowDefinitions><RowDefinition Height="1*" /><RowDefinition Height="9*" /></Grid.RowDefinitions><StackPanel HorizontalAlignment="Right" Orientation="Horizontal"><ButtonWidth="100"Height="40"Margin="0,-10,20,0"Padding="-10,0,0,0"pu:ButtonHelper.ButtonStyle="Standard"pu:ButtonHelper.ClickStyle="Sink"pu:ButtonHelper.CornerRadius="20"pu:ButtonHelper.HoverBrush="#009BFF"pu:ButtonHelper.Icon="/HQ.fResApp;component/Resources/icon/Refresh.png"pu:IconHelper.Width="40"Background="#65d17f"BorderBrush="#65d17f"Content="刷新"Cursor="Hand"FontSize="16"Foreground="#ffffff" /></StackPanel><MetroChart:ClusteredColumnChartGrid.Row="1"Margin="0,-10,20,0"ChartLegendVisibility="Collapsed"ChartSubTitle="额度"ChartTitle="各年份营业情况统计"ChartTitleVisibility="Visible"IsRowColumnSwitched="True"ToolTipFormat="{Binding Path=ToolTipFormat}"><MetroChart:ClusteredColumnChart.Series><MetroChart:ChartSeriesDisplayMember="Name"ItemsSource="{Binding Path=YearDatas}"SeriesTitle="年份"ValueMember="Count" /></MetroChart:ClusteredColumnChart.Series></MetroChart:ClusteredColumnChart></Grid></TabItem></TabControl>
</UserControl>

3、viewmodel模型

ViewModel 的主要职责是封装业务逻辑和状态,为视图提供数据绑定和命令绑定的接口。通过数据绑定,ViewModel 能够将数据从 Model 传递到 View,同时处理用户输入和界面逻辑,而无需直接操作 UI 元素,viewmodel就是一个类,这个类中包括了变量,属性,命令,其中属性和命令是最重要的,属性是动态通知属性,当属性的值发生更改时,自动更新界面元素标签,反过来也是这样的,命令来说就是响应事件,如单击,双击,右键等。

using HQ.BLL;
using HQ.COMM;
using HQ.COMM.DtoModel;
using HQ.fResApp.BaseModel;
using HQ.fResApp.Utils;
using HQ.fResApp.ViewModel.PageViewModel;
using HQ.MODEL.DBModel;
using Panuon.UI.Silver;
using Panuon.UI.Silver.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;namespace HQ.fResApp.ViewModel
{/// <summary>/// 营业查询视图模型/// </summary>public class BusinessInquiryListVModel : ViewModelBase{#region 变量BillHistoryBLL billhistoryBLL = new BillHistoryBLL();public string ToolTipFormat{get { return "当前额度是:{1},在总额中占比为:{3:P2}"; }}#endregionpublic BusinessInquiryListVModel(){BillHistoryDataList = getBillHistoryList();InitUIData();}#region 属性public ObservableCollection<Population> weekDatas = new ObservableCollection<Population>(); public ObservableCollection<Population> WeekDatas{get { return weekDatas; }set{weekDatas = value;OnPropertyChanged();}}public ObservableCollection<Population> monthDatas = new ObservableCollection<Population>();public ObservableCollection<Population> MonthDatas{get { return monthDatas; }set{monthDatas = value;OnPropertyChanged();}}public ObservableCollection<Population> yearhDatas = new ObservableCollection<Population>(); public ObservableCollection<Population> YearDatas{get { return yearhDatas; }set{yearhDatas = value;OnPropertyChanged();}}ObservableCollection<BillHistory> billHistoryDataList = new ObservableCollection<BillHistory>();/// <summary>///历史订单列表/// </summary>public ObservableCollection<BillHistory> BillHistoryDataList{get { return billHistoryDataList; }set{billHistoryDataList = value;OnPropertyChanged();}}private int billHistoryCurrentIndex = 1;/// <summary>/// 当前页,默认第1页/// </summary>public int BillHistoryCurrentIndex{get { return billHistoryCurrentIndex; }set{billHistoryCurrentIndex = value;OnPropertyChanged();}}private int billHistoryTotalIndex;/// <summary>/// 总页数/// </summary>public int BillHistoryTotalIndex{get { return billHistoryTotalIndex; }set{billHistoryTotalIndex = value;OnPropertyChanged();}}private int billHistoryTotalNum;/// <summary>/// 总条数/// </summary>public int BillHistoryTotalNum{get { return billHistoryTotalNum; }set{billHistoryTotalNum = value;OnPropertyChanged();}}private int billHistoryPageSize = 15;/// <summary>/// 每页条数,默认10条/// </summary>public int BillHistoryPageSize{get { return billHistoryPageSize; }set{billHistoryPageSize = value;OnPropertyChanged();//当改变每页条数时,触发以下事件BillHistoryDataList = getBillHistoryList(); //订单历史数据集合}}private string billHistoryKey = "";/// <summary>/// 搜索时的关键字,默认为空/// </summary>public string BillHistoryKey{get { return billHistoryKey; }set{billHistoryKey = value;OnPropertyChanged();}}#endregion#region 方法private void InitUIData(){//最近一周var _resweek = billhistoryBLL.CountBillHistoryData(new CountModelDto { _where = 7 }).Result;if (_resweek.statusCode == (int)ApiEnum.Status){foreach (var item in _resweek.data){weekDatas.Add(new Population() { Name = item.wDate, Count = item.countCost });}}//最近一月var _resmonth = billhistoryBLL.CountBillHistoryData(new CountModelDto { _where = 30 }).Result;if (_resmonth.statusCode == (int)ApiEnum.Status){foreach (var item in _resmonth.data){monthDatas.Add(new Population() { Name = item.wDate, Count = item.countCost });}}//按年份var _resyear = billhistoryBLL.CountBillHistoryData(new CountModelDto { _where = 365 }).Result;if (_resyear.statusCode == (int)ApiEnum.Status){foreach (var item in _resyear.data){yearhDatas.Add(new Population() { Name = item.wDate, Count = item.countCost });}}}/// <summary>/// 获取订单历史数据/// </summary>/// <returns></returns>public ObservableCollection<BillHistory> getBillHistoryList(){ObservableCollection<BillHistory> TableDataList = new ObservableCollection<BillHistory>();var parms = new PageParm { page = BillHistoryCurrentIndex, limit = BillHistoryPageSize, key = BillHistoryKey.Trim() };var pageRes = billhistoryBLL.GetBillHistoryPages(parms).Result;//分页查询结果if (pageRes.statusCode == (int)ApiEnum.Status){var _pageResData = pageRes.data;var tabList = _pageResData.Items;//数据集需要重新处理,将每个数据项加上复选框,用于页面数据展示if (tabList != null && tabList.Count != 0){foreach (var item in tabList){var curBill = new BillHistory{obGuid = item.obGuid,obId = item.obId,tName = item.tName,obDate = item.obDate,obNumber = item.obNumber,opConsumeMoney = item.opConsumeMoney,opClientMoney = item.opClientMoney,opRemark = item.opRemark,lastUpDate = item.lastUpDate };TableDataList.Add(curBill);}BillHistoryTotalNum = (int)_pageResData.TotalItems;BillHistoryCurrentIndex = (int)_pageResData.CurrentPage;BillHistoryTotalIndex = (int)_pageResData.TotalPages;}else{Notice.Show("没有获取到历史列表数据!", "提示", 3, MessageBoxIcon.Info);Logger.Default.ProcessError((int)ApiEnum.Error, "没有获取到历史列表数据");}}else{Notice.Show("没有获取到历史列表数据!", "提示", 3, MessageBoxIcon.Info);Logger.Default.ProcessError(pageRes.statusCode, "获取到历史列表数据异常");}return TableDataList;}/// <summary>/// 导出数据/// </summary>/// <param name="array">列表对象</param>/// <param name="filename">文件名称</param>/// <exception cref="NotImplementedException"></exception>private void Backup<T>(List<T> array, string name){var t = typeof(T);var properties = t.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);var contents = new StringBuilder();//标题foreach (var item in properties){//得到第一个自定义属性的参数的值,即属性描述var desc = item.CustomAttributes.ToList()[0].ConstructorArguments[0].Value.ToString();contents.Append(desc);contents.Append(",");}contents.Append("\r\n");//换行//内容foreach (var model in array){var row = new StringBuilder();foreach (var property in properties){var val = property.GetValue(model);row.Append(val);row.Append(",");}contents.Append(row.ToString());contents.Append("\r\n");}//finename -> 表格+日期var date = string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now);var filename = $"{name}{date}.csv";var rootImagPath = Directory.GetCurrentDirectory().Replace(@"\bin\Debug", "") + @"\Resources\proData\" + filename;//保存File.WriteAllText(rootImagPath, contents.ToString(), Encoding.UTF8);//以utf-8的格式保存成csv格式MessageBoxX.Show("数据导出成功!", "提示", Application.Current.MainWindow, MessageBoxButton.OK, new MessageBoxXConfigurations(){MessageBoxIcon = MessageBoxIcon.Success,ButtonBrush = "#F1C825".ToColor().ToBrush(),});}#endregion/// <summary>/// 查询命令/// </summary>public ICommand FindCommand{get{return new RelayCommand(o =>{BillHistoryDataList = getBillHistoryList();});}}/// <summary>/// 重置命令/// </summary>public ICommand ResetCommand{get{return new RelayCommand(o =>{BillHistoryCurrentIndex = 1;//当前页为第1页BillHistoryPageSize = 15;//每页10条BillHistoryKey = "";//关键字清空 BillHistoryDataList = getBillHistoryList();//订单数据集合 });}}/// <summary>/// 导出本页/// </summary>public ICommand BackUpPageCommand{get{return new RelayCommand(o =>{Backup(BillHistoryDataList.ToList(), "billspage");});}}/// <summary>/// 导出全部/// </summary>public ICommand BackUpAllCommand{get{return new RelayCommand(o =>{ParmString ps = new ParmString();var objdata = billhistoryBLL.QueryBillHistoryList(ps).Result.data;Backup(objdata, "billslist");});}}}
}

using HQ.BLL;
using HQ.COMM.DtoModel;
using HQ.fResApp.BaseModel;
using HQ.fResApp.Utils;
using HQ.fResApp.ViewModel.PageViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace HQ.fResApp.ViewModel
{/// <summary>///  营业查询视图模型/// </summary>public class MetroChartVModel : ViewModelBase{BillHistoryBLL openBillsService = new BillHistoryBLL();public string ToolTipFormat{get { return "当前额度是:{1},在总额中占比为:{3:P2}"; }}private readonly ObservableCollection<Population> _weekDatas = new ObservableCollection<Population>();private readonly ObservableCollection<Population> _monthDatas = new ObservableCollection<Population>();private readonly ObservableCollection<Population> _yearhDatas = new ObservableCollection<Population>();public ObservableCollection<Population> WeekDatas { get { return _weekDatas; } }public ObservableCollection<Population> MonthDatas { get { return _monthDatas; } }public ObservableCollection<Population> YearDatas { get { return _yearhDatas; } }public MetroChartVModel(){//最近一周var _resweek = openBillsService.CountBillHistoryData(new CountModelDto { _where = 7 }).Result;if (_resweek.statusCode == (int)ApiEnum.Status){foreach (var item in _resweek.data) { _weekDatas.Add(new Population(){ Name = item.wDate, Count = item.countCost }); }}//最近一月var _resmonth = openBillsService.CountBillHistoryData(new CountModelDto { _where = 30 }).Result;if (_resmonth.statusCode == (int)ApiEnum.Status){foreach (var item in _resmonth.data) { _monthDatas.Add(new Population() { Name = item.wDate, Count = item.countCost }); }}//按年份var _resyear = openBillsService.CountBillHistoryData(new CountModelDto { _where = 365 }).Result;if (_resyear.statusCode == (int)ApiEnum.Status){foreach (var item in _resyear.data) { _yearhDatas.Add(new Population() { Name = item.wDate, Count = item.countCost }); }}}}
}

4、运行测试

原创不易,打字截图不易,走过路过,不要错过,欢迎点赞,收藏,转载,复制,抄袭,留言,灌水,喷火,吐槽,动动你的金手指,早日实现财务自由!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/94013.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/94013.shtml
英文地址,请注明出处:http://en.pswp.cn/bicheng/94013.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于 Java 和 MySQL 的精品课程网站

基于 Java 和 MySQL 的精品课程网站设计与实现一、 毕业设计&#xff08;论文&#xff09;任务书摘要&#xff1a;近年来&#xff0c;教育信息化发展十分迅猛&#xff0c;人们的教育观念、教育手段、学习方法、学习渠道等等都发生了重大的变化。知识性人才也已经日益成为了一个…

全球首款 8K 全景无人机影翎 A1 发布解读:航拍进入“先飞行后取景”时代

全球首款 8K 全景无人机影翎 A1 发布解读&#xff1a;航拍进入“先飞行后取景”时代 特别说明&#xff1a;本文所有图片素材来源于影翎官网 影翎官方介绍称&#xff1a;“全球首款”是指截至 2025 年&#xff0c;A1 是首台全面整合的全景无人机&#xff1a;无需外挂全景相机配件…

androidstudio内存大小配置

help->Edit Custom Vm option-Xmx8096m或者其他数值 改成-Xmx10240m然后设置里面的内存大小也要修改一下

vue3和elementPlus中的el-dropdown-menu中的背景样式修改

1. 效果展示2. 代码展示在el-dropdown-menu下加载类名,class"my-dropdown-menu"<el-dropdown-menu class"my-dropdown-menu"><el-dropdown-item :command"{ action: upgrade, data }">升级</el-dropdown-item><el-dropdown…

计算机网络--HTTP协议

1. 什么是 HTTP 协议全称&#xff1a;Hyper Text Transfer Protocol&#xff08;超文本传输协议&#xff09;作用&#xff1a;用于在服务器与客户端&#xff08;通常是浏览器&#xff09;之间传输超文本数据&#xff08;如文字、图片、视频、音频&#xff09;的应用层协议。工作…

Bee1.17.25更新Bug,完善功能.不支持NOSQL,分库分表Sharding(2.X版有)

Bee 1.17.25 正常的ORM功能都有,但不支持NOSQL, 分库分表Sharding; 若需要可使用2.X版. Bee, 接口简单&#xff0c;功能齐全&#xff0c;性能好&#xff0c;支持原生分页性能更高&#xff1b;还有分库分表 (Sharding 分片) 功能&#xff0c;也支持 MongoDB ORM. Bee Hiberna…

RAG流程全解析:从数据到精准答案

Rag流程分析第一部分&#xff1a;数据处理与向量化 原始文档进入系统&#xff0c;先经过格式识别&#xff0c;把 pdf、docx、pptx、扫描图片等统一转成文字流。文字流丢进分段器&#xff0c;按固定长度或语义边界切成若干文本块&#xff0c;每个块再生成唯一 id。如果文档里有表…

Matplotlib数据可视化实战:Matplotlib图表注释与美化入门

图表注释与标签&#xff1a;提升数据可视化效果 学习目标 通过本课程的学习&#xff0c;学员将掌握如何使用Matplotlib在图表中添加文本注释、图例、标题和轴标签&#xff0c;从而提高图表的可读性和信息传达能力。本课程将通过实际案例&#xff0c;帮助学员理解每个元素的作用…

GitLab 安全漏洞 CVE-2025-7739 解决方案

本分分享极狐GitLab 补丁版本 18.2.2, 18.1.4, 18.0.6 的详细内容。这几个版本包含重要的缺陷和安全修复代码&#xff0c;我们强烈建议所有私有化部署用户应该立即升级到上述的某一个版本。对于极狐GitLab SaaS&#xff0c;技术团队已经进行了升级&#xff0c;无需用户采取任何…

C端高并发项目都有哪些

C端&#xff08;用户端&#xff09;高并发项目通常涉及大规模用户直接访问的服务&#xff0c;其核心挑战是如何在海量用户同时请求下&#xff0c;保证系统的稳定性、高性能、高可用和一致性。以下是一些典型的C端高并发项目类型和具体案例&#xff1a;​核心类型与典型案例&…

OSCP - Proving Grounds - Shenzi

主要知识点 路径爆破小技巧 windows AlwaysInstallElevated 提权 具体步骤 依旧是nmap开始&#xff0c;其中80/443/139/445端口值得关注一下 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-01 15:06 UTC Nmap scan report for 192.168.53.55 Host is up (0.0008…

结合BI多维度异常分析(日期-> 商家/渠道->日期(商家/渠道))

技术手段&#xff1a; BI工具&#xff08;finereport &#xff09;、python、sql 数据更新&#xff1a; 每日零点更新数据。&#xff08;独立开发&#xff09; 商业智能分析平台 | Python/FineReport/SQLAlchemy 项目描述 业务价值 &#xff1a;解决原有系统无法快速定位佣金异…

计算机毕设Spark项目实战:基于大数据技术的就业数据分析系统Django+Vue开发指南

&#x1f393; 作者&#xff1a;计算机毕设小月哥 | 软件开发专家 &#x1f5a5;️ 简介&#xff1a;8年计算机软件程序开发经验。精通Java、Python、微信小程序、安卓、大数据、PHP、.NET|C#、Golang等技术栈。 &#x1f6e0;️ 专业服务 &#x1f6e0;️ 需求定制化开发源码提…

如何让FastAPI任务系统在失败时自动告警并自我修复?

url: /posts/2f104637ecc916e906c002fa79ab8c80/ title: 如何让FastAPI任务系统在失败时自动告警并自我修复? date: 2025-08-20T08:18:42+08:00 lastmod: 2025-08-20T08:18:42+08:00 author: cmdragon summary: FastAPI 和 Celery 结合提供了强大的异步任务处理能力,但在分布…

Gitee仓库 日常操作详细步骤

新建仓库 → 上传代码 步骤1、打开Gitee仓库网站&#xff1a;开源软件 - Gitee.com 步骤2、点击右上角加号 点击新建仓库。 步骤3、设置仓库名 &#xff0c;选择是否开源 &#xff0c;点击创建。 步骤4、记住远程仓库URL 步骤5、本地新建文件夹&#xff0c;然后进行上传代码…

Python采集易贝(eBay)商品详情API接口,json数据返回

Python采集易贝(eBay)商品详情API接口要采集eBay商品详情&#xff0c;你可以使用eBay官方提供的API。以下是使用Python通过eBay Finding API获取商品详情的完整示例&#xff1a;准备工作注册账号并获取API密钥&#xff1a;选择适合的API&#xff08;如Finding API、Shopping AP…

如何将任意文件一键转为PDF?

无论你用什么软件打开文件&#xff08;Word、Excel、网页、CAD图纸、图片等&#xff09;&#xff0c;只要能打印&#xff0c;就可以通过虚拟打印机将其转为PDF&#xff0c;确保对方收到的文件看起来和你看到的一模一样。它是小巧实用的PDF虚拟打印工具&#xff0c;采用安装包形…

迁移学习+多模态融合破解跨域难题,解锁视觉感知新范式

在近期的顶会顶刊中&#xff0c;迁移学习与多模态融合的热度居高不下&#xff0c;相关成果频出&#xff0c;部分模型在特定任务里性能提升极为显著。登上顶刊 TPAMI 2025 的某篇研究&#xff0c;借助语言引导的关系迁移&#xff0c;大幅提升了少样本类增量学习中模型的泛化能力…

C语言---分隔符、常量、注释、标识符、关键字、空格

文章目录分隔符注释注意标识符标识符的定义标识符的命名要求合法与非法标识符示例关键字关键字定义关键字一览(按功能分类)空格一、空格的作用&#xff1a;分隔令牌 (Tokens)空格的使用场景必须用空格分隔的情况不能有空格的情况分隔符 分隔符名称主要用途;分号语句结束符,逗号…

创建Vue项目的不同方式及项目规范化配置

1 项目的创建与运行 1.1 基于webpack构建工具——vue-cli脚手架 1. 安装脚手架 &#xff1a;npm i -g vue/cli # 安装一次即可&#xff0c;之前安装过则无需重复安装 2. 切换到项目所在目录 &#xff1a;cd 项目所在目录 3. 创建项目 &#xff1a;vue create 项目名 4. 自定…