12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using Microsoft.AspNetCore.Components;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using wispro.sp.entity;
- using wispro.sp.web.Services;
- namespace wispro.sp.web.Components
- {
- public partial class StaffSelect
- {
- private Staff _SelectedItem;
- private List<Staff> _ShowStaffs;
- [Parameter]
- public int? StaffId { get; set; }
- [Parameter]
- public EventCallback<int?> StaffIdChanged { get; set; }
- [Parameter]
- public List<Staff> StaffLists { get; set; }
- [Inject] IUserService _UserService { get; set; }
- protected override void OnInitialized()
- {
- _ShowStaffs = StaffLists;
- base.OnInitialized();
- }
- protected override Task OnParametersSetAsync()
- {
- _ShowStaffs = StaffLists;
- return base.OnParametersSetAsync();
- }
- private void OnSelectedItemChangedHandler(Staff value)
- {
- _SelectedItem = value;
- StaffIdChanged.InvokeAsync(_SelectedItem.Id);
- }
- private void OnSearch(string value)
- {
- _ShowStaffs = _ShowStaffs.Where<Staff>(p => p.Name.Contains(value)).ToList();
- StateHasChanged();
- }
- }
- }
|