@page "/return/byRecord"
    
        
            
        
        
            
                
                    
                        
                    
                
                
                    
                    
                    
                        
                            @mr.Drug?.DrugName
                            @mr.Drug?.DrugSpec
                        
                    
                    
                        
                            @if (mr.BoxDrawer > 0)
                            {
                                if (mr.DrawerNo == 99)
                                {
                                    @($"急诊药盒")
                                }
                                else if (mr.DrawerNo == 111)
                                {
                                    @($"恢复室药盒")
                                }
                                else
                                {
                                    @($"{mr.DrawerNo}-{(mr.ColNo == 1 ? '白' : '绿')}")
                                }
                            }
                            else
                            {
                                无
                            }
                        
                    
                    
                        
                            @mr.ManuNo
                             @mr.EffDate?.ToString("yyyy-MM-dd")
                        
                    
                    
                        
                            
                                借出
数量
                            
                        
                    
                    
                        
                            
                                已还
药品
                            
                        
                    
                    
                        
                            
                                已还
空瓶
                            
                        
                    
                    
                        
                            
                                本次
归还
                            
                        
                        
                            
                        
                    
                
            
         
     
 
@code {
    @inject IMachineRecordDao machineRecordDao;
    @inject DialogService dialogService;
    RadzenDataGrid grid;
    bool isLoading;
    int count;
    private List? _forecasts;
    DateTime start;
    DateTime end;
    async Task LoadData(LoadDataArgs args)
    {
        isLoading = true;
        var result = await machineRecordDao.GetCanReturnRecords(start, end, 0, "", args.Top, args.Skip);
        // Update the Data property
        _forecasts = result.Desserts;
        // Update the count
        count = result.TotalDesserts;
        isLoading = false;
    }
    async Task reloadGrid()
    {
        start = DateTime.MinValue;
        end = DateTime.MinValue;
        await grid.Reload();
    }
    async Task OpenReturnDialog()
    {
        var list = _forecasts.Where(mr => mr.CurrentReturnQuantity > 0).ToList();
        var b = await dialogService.OpenAsync(
                $"记录还药",
              new Dictionary() { { "records", list } },
              new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
        );
        if (b)
        {
            await reloadGrid();
        }
    }
    void OnCellClick(DataGridCellMouseEventArgs args)
    {
        grid.EditRow(args.Data);
    }
}