@page "/stock/binding"
@*
*@
@code { @inject IChannelListDao channelListDao; @inject IDrugInfoDao drugInfoDao; @inject DialogService dialogService; @inject NotificationService _message @inject Toolbelt.Blazor.I18nText.I18nText I18nText; private I18nText.local myText = new I18nText.local(); RadzenDataList grid; bool isLoading; int count; private IEnumerable? _forecasts; List drugInfos; List drugManuNos; DrugInfo drugInfo; DrugManuNo drugManuNo; protected override async Task OnInitializedAsync() { myText = await I18nText.GetTextTableAsync(this); await base.OnInitializedAsync(); //drugInfos = await drugInfoDao.GetAllDrug(); } async Task LoadData(LoadDataArgs args) { isLoading = true; // var result = await channelListDao.GetAllChannelList(0, "", args.Top, args.Skip); var result = await channelListDao.GetAllChannelListWithDrug(0, "", args.Top, args.Skip); // Update the Data property _forecasts = result.Desserts; // Update the count count = result.TotalDesserts; isLoading = false; drugInfos = result.Other; } async Task reloadGrid() { await grid.Reload(); } async Task EditChannel(ChannelStock stock) { if(stock.drugManuNo != null) { // 说明之前有绑定并且未改变,那么就是在进行解绑 if(stock.drugManuNo.ManuNo.Equals(stock.ManuNo)) { var b = await channelListDao.UnBind(stock.Id); if(b) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Success, Summary = myText.Tips, Detail = myText.BindSuccess, Duration = 4000 } ); await reloadGrid(); } } // 否则是进行绑定 else { var b = await channelListDao.Bind(stock); if (b) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Success, Summary = myText.Tips, Detail = myText.BindSuccess, Duration = 4000 } ); await reloadGrid(); } } } else { if (stock.Drug != null) { // 说明只设置了药品 var b = await channelListDao.Bind(stock); if (b) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Success, Summary = myText.Tips, Detail = myText.BindSuccess, Duration = 4000 } ); await reloadGrid(); } } // 什么都没有选择或者么有改变,只是点击了按钮,此时不操作 else { } } } }