140 lines
4.3 KiB
Plaintext
140 lines
4.3 KiB
Plaintext
@page "/stock/list"
|
|
<style>
|
|
@@keyframes shake {
|
|
0% { opacity:1;color:red; }
|
|
25%{opacity:1;color:orange;}
|
|
50% { opacity:0;color:yellow;}
|
|
75%{opacity:1;color:crimson;}
|
|
100% { opacity:1;color:red; }
|
|
}
|
|
.rz-custom-header {
|
|
width: 100%;
|
|
}
|
|
.shaky-text {
|
|
animation: shake 2s infinite ease-in-out;
|
|
/* 你可以根据需要调整动画的持续时间和迭代次数 */
|
|
transition:color 0.5s linear,opacity 0.5s linear;
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="container-fluid">
|
|
|
|
<RadzenDataGrid @ref="grid"
|
|
IsLoading="@isLoading"
|
|
RowRender="@RowRender"
|
|
EmptyText="无数据"
|
|
Data="@_forecasts"
|
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
|
SelectionMode="DataGridSelectionMode.Single"
|
|
ExpandMode="DataGridExpandMode.Multiple">
|
|
<HeaderTemplate>
|
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
|
<RadzenButton Icon="download" Text="库存导出" Variant="Variant.Outlined" Click="StockExport" />
|
|
<RadzenButton Icon="download" Text="专用账册导出" Variant="Variant.Outlined" Click="AccountBookExport" />
|
|
</RadzenRow>
|
|
</HeaderTemplate>
|
|
<Template Context="di">
|
|
<RadzenDataGrid Data="@di.Stocks" EmptyText="无数据">
|
|
<Columns>
|
|
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
|
<Template Context="s">
|
|
@s.DrawerNo - @s.ColNo
|
|
</Template>
|
|
</RadzenDataGridColumn>
|
|
<RadzenDataGridColumn Title="数量" Property="Quantity">
|
|
</RadzenDataGridColumn>
|
|
<RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
|
<RadzenDataGridColumn Title="效期" Property="EffDate">
|
|
<Template Context="s">
|
|
@{
|
|
DateTime dateTime;
|
|
bool success = DateTime.TryParse(s.EffDate, out dateTime);
|
|
if(success&&dateTime<=DateTime.Now.AddMonths(3))
|
|
{
|
|
@s.EffDate<p class="shaky-text">近效期药品!</p>
|
|
}
|
|
else
|
|
{
|
|
@s.EffDate
|
|
}
|
|
}
|
|
</Template>
|
|
</RadzenDataGridColumn>
|
|
</Columns>
|
|
</RadzenDataGrid>
|
|
</Template>
|
|
<Columns>
|
|
<RadzenDataGridColumn Frozen="true" Width="200px" Title="药品名称" Property="DrugName"></RadzenDataGridColumn>
|
|
<RadzenDataGridColumn Title="规格" Property="DrugSpec"></RadzenDataGridColumn>
|
|
<RadzenDataGridColumn Title="总库存" Property="StockQuantity">
|
|
<Template Context="s">
|
|
@if(s.StockQuantity<10)
|
|
{
|
|
@s.StockQuantity<p class="shaky-text">库存预警!</p>
|
|
}
|
|
else
|
|
{
|
|
@s.StockQuantity
|
|
}
|
|
</Template>
|
|
</RadzenDataGridColumn>
|
|
|
|
</Columns>
|
|
</RadzenDataGrid>
|
|
</div>
|
|
|
|
@code {
|
|
@inject IDrugInfoDao drugInfoDao;
|
|
@inject DialogService dialogService;
|
|
RadzenDataGrid<DrugInfo> grid;
|
|
bool isLoading;
|
|
int count;
|
|
private IEnumerable<DrugInfo>? _forecasts;
|
|
DateTime start;
|
|
DateTime end;
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await base.OnInitializedAsync();
|
|
isLoading = true;
|
|
|
|
var result = await drugInfoDao.GetAllDrugAndStock();
|
|
// Update the Data property
|
|
_forecasts = result;
|
|
isLoading = false;
|
|
}
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
base.OnAfterRender(firstRender);
|
|
|
|
if (firstRender)
|
|
{
|
|
await grid.ExpandRows(grid.PagedView.Where(di => di.Stocks.Count > 0));
|
|
}
|
|
}
|
|
|
|
void RowRender(RowRenderEventArgs<DrugInfo> args)
|
|
{
|
|
args.Expandable = args.Data.Stocks.Count > 0;
|
|
}
|
|
|
|
|
|
|
|
async void StockExport()
|
|
{
|
|
|
|
}
|
|
|
|
async void AccountBookExport()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|