163 lines
6.2 KiB
Plaintext
163 lines
6.2 KiB
Plaintext
@page "/Box/BoxBindings"
|
|
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12 mb-4">
|
|
|
|
<RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" Data="@_forecasts" PageSize="6" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left"
|
|
ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
|
<Template Context="channel">
|
|
<RadzenCard class="col-3">
|
|
<RadzenRow>
|
|
<RadzenColumn Size="8" Class="rz-text-truncate">
|
|
<b class="rz-pr-3">@(channel.DrawerNo)</b>
|
|
<b>号手术间</b>
|
|
|
|
</RadzenColumn>
|
|
<RadzenColumn Size="4" Class="rz-text-align-end">
|
|
@if (channel.TotalQuantity == 0)
|
|
{
|
|
<RadzenButton ButtonStyle="ButtonStyle.Secondary" Variant="Variant.Outlined" Size="ButtonSize.Small" Click="@(() => EditChannel(channel))" Text="绑定/解绑" />
|
|
}
|
|
</RadzenColumn>
|
|
</RadzenRow>
|
|
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;" />
|
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center">
|
|
<RadzenStack Gap="0">
|
|
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-2 rz-my-0">套餐</RadzenText>
|
|
@if (channel.DrugId == null || channel.TotalQuantity == 0)
|
|
{
|
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="planName" TValue="Plan" @bind-Value="channel.PlanInfo" Data="@plans"
|
|
Style="width:100%; display: block;" AllowFilteringByAllStringColumns="true" TextProperty="Name">
|
|
|
|
<Columns>
|
|
<RadzenDropDownDataGridColumn Property="Name" Title="套餐名称" Sortable="false" />
|
|
|
|
<RadzenDropDownDataGridColumn Property="Description" Width="120px" Title="套餐描述" Sortable="false" />
|
|
</Columns>
|
|
</RadzenDropDownDataGrid>
|
|
<RadzenCustomValidator Component="planName" Validator="@(()=>(channel.PlanInfo.Id>0))" Popup=true Text="请先选择套餐再点击绑定按钮" />
|
|
|
|
}
|
|
else
|
|
{
|
|
<RadzenText TextStyle="TextStyle.Body1"><b>@(channel.PlanInfo.Name)</b></RadzenText>
|
|
}
|
|
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-4 rz-mb-0">总库存</RadzenText>
|
|
<RadzenText TextStyle="TextStyle.Body1"><b>@(channel.TotalQuantity)</b></RadzenText>
|
|
</RadzenStack>
|
|
</RadzenStack>
|
|
</RadzenCard>
|
|
</Template>
|
|
</RadzenDataList>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
@inject IChannelListDao channelListDao;
|
|
@inject IDrugInfoDao drugInfoDao;
|
|
@inject DialogService dialogService;
|
|
@inject NotificationService _message
|
|
RadzenDataList<ChannelList> grid;
|
|
bool isLoading;
|
|
int count;
|
|
private IEnumerable<ChannelList>? _forecasts;
|
|
|
|
List<DrugInfo> drugInfos;
|
|
List<DrugManuNo> drugManuNos;
|
|
|
|
DrugInfo drugInfo;
|
|
|
|
DrugManuNo drugManuNo;
|
|
|
|
|
|
List<Plan> plans;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await base.OnInitializedAsync();
|
|
|
|
//drugInfos = await drugInfoDao.GetAllDrug();
|
|
}
|
|
|
|
async Task LoadData(LoadDataArgs args)
|
|
{
|
|
isLoading = true;
|
|
|
|
var result = await channelListDao.GetAllChannelListWithPlan(args.Top, args.Skip);
|
|
|
|
// Update the Data property
|
|
_forecasts = result.Desserts;
|
|
// Update the count
|
|
count = result.TotalDesserts;
|
|
|
|
isLoading = false;
|
|
|
|
plans = result.Other;
|
|
}
|
|
|
|
async Task reloadGrid()
|
|
{
|
|
await grid.Reload();
|
|
}
|
|
|
|
async Task EditChannel(ChannelList list)
|
|
{
|
|
if (list.PlanInfo.Id > 0)
|
|
{
|
|
// 说明之前有绑定并且未改变,那么就是在进行解绑
|
|
if (list.DrugId != null && list.DrugId.Equals(list.PlanInfo.Id.ToString()))
|
|
{
|
|
var b = await channelListDao.UnBindBox(list);
|
|
if (b)
|
|
{
|
|
_message.Notify(
|
|
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"解除绑定成功", Duration = 4000 }
|
|
);
|
|
await reloadGrid();
|
|
}
|
|
|
|
}
|
|
// 否则是进行绑定
|
|
else
|
|
{
|
|
var b = await channelListDao.BindBox(list);
|
|
if (b)
|
|
{
|
|
_message.Notify(
|
|
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"绑定成功", Duration = 4000 }
|
|
);
|
|
await reloadGrid();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (list.PlanInfo != null)
|
|
{
|
|
// 说明只设置了药品
|
|
var b = await channelListDao.BindBox(list);
|
|
if (b)
|
|
{
|
|
_message.Notify(
|
|
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"绑定成功", Duration = 4000 }
|
|
);
|
|
await reloadGrid();
|
|
}
|
|
}
|
|
// 什么都没有选择或者么有改变,只是点击了按钮,此时不操作
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|