feat: 添加用户明细详情
parent
20158c37d6
commit
4d3b25c5e4
|
|
@ -41,10 +41,31 @@
|
||||||
Loading="_loading"
|
Loading="_loading"
|
||||||
PageIndex="@_pageIndex"
|
PageIndex="@_pageIndex"
|
||||||
PageSize="@_pageSize"
|
PageSize="@_pageSize"
|
||||||
|
OnExpand="OnRowExpand"
|
||||||
OnPageIndexChange="OnPageIndexChanged"
|
OnPageIndexChange="OnPageIndexChanged"
|
||||||
OnPageSizeChange="OnPageSizeChange">
|
OnPageSizeChange="OnPageSizeChange">
|
||||||
|
<ChildContent Context="data">
|
||||||
<PropertyColumn Property="c => c.Name" title="用户姓名"/>
|
<PropertyColumn Property="c => c.Name" title="用户姓名"/>
|
||||||
<PropertyColumn Property="c => c.TotalPoint" title="总积分"/>
|
<PropertyColumn Property="c => c.TotalPoint" title="总积分"/>
|
||||||
|
<ActionColumn Title="操作" Width="220">
|
||||||
|
<Button Type="Primary" OnClick="() => Add(data.UserId)">新增积分</Button>
|
||||||
|
</ActionColumn>
|
||||||
|
</ChildContent>
|
||||||
|
<ExpandTemplate Context="rowData">
|
||||||
|
<Table DataSource="rowData.Data.Items" Loading="rowData.Data.Items == null" HidePagination>
|
||||||
|
<ChildContent Context="data">
|
||||||
|
<PropertyColumn Property="c => c.Point" title="积分"/>
|
||||||
|
<PropertyColumn Property="c => c.CreateTime" title="新增时间" Format="yyyy-MM-dd HH:mm"/>
|
||||||
|
<ActionColumn Title="Action">
|
||||||
|
<Space Size="@("middle")">
|
||||||
|
<SpaceItem>
|
||||||
|
<Button Danger OnClick="() => Delete(data.UserPointId)">删除积分</Button>
|
||||||
|
</SpaceItem>
|
||||||
|
</Space>
|
||||||
|
</ActionColumn>
|
||||||
|
</ChildContent>
|
||||||
|
</Table>
|
||||||
|
</ExpandTemplate>
|
||||||
</Table>
|
</Table>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|
||||||
|
|
@ -60,7 +81,7 @@
|
||||||
@ref="@_form">
|
@ref="@_form">
|
||||||
<FormItem Label="姓名">
|
<FormItem Label="姓名">
|
||||||
<Select TItem="UserDto"
|
<Select TItem="UserDto"
|
||||||
TItemValue="int"
|
TItemValue="int?"
|
||||||
Mode="default"
|
Mode="default"
|
||||||
DataSource="@_users"
|
DataSource="@_users"
|
||||||
@bind-Value="@context.UserId"
|
@bind-Value="@context.UserId"
|
||||||
|
|
@ -85,10 +106,10 @@
|
||||||
public class Model
|
public class Model
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Point { get; set; }
|
public int? Point { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model model = new Model();
|
private Model model = new Model();
|
||||||
|
|
@ -115,6 +136,8 @@
|
||||||
|
|
||||||
private void HandleCancel(MouseEventArgs e)
|
private void HandleCancel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
|
model.UserId = null;
|
||||||
|
model.Point = null;
|
||||||
_visible = false;
|
_visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,10 +170,16 @@
|
||||||
_form.Submit();
|
_form.Submit();
|
||||||
await UserPointService.CreateUserPoint(new CreateUserPointDto()
|
await UserPointService.CreateUserPoint(new CreateUserPointDto()
|
||||||
{
|
{
|
||||||
UserId = model.UserId,
|
UserId = model.UserId.Value,
|
||||||
Point = model.Point
|
Point = model.Point.Value
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
await RefreshTable().ConfigureAwait(false);
|
await RefreshTable().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Add(int userId)
|
||||||
|
{
|
||||||
|
model.UserId = userId;
|
||||||
|
_visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AntDesign;
|
using AntDesign;
|
||||||
|
using AntDesign.TableModels;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using UserPointManagement.Application.Services;
|
using UserPointManagement.Application.Services;
|
||||||
using UserPointManagement.Model.Dtos.User;
|
using UserPointManagement.Model.Dtos.User;
|
||||||
|
|
@ -72,4 +74,12 @@ public class UserPointDetailBase : ComponentBase
|
||||||
await MessageService.Success("删除成功!");
|
await MessageService.Success("删除成功!");
|
||||||
await RefreshTable();
|
await RefreshTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async Task OnRowExpand(RowData<UserPointInfoDto> rowData)
|
||||||
|
{
|
||||||
|
if (rowData.Data.Items != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue