123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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;
- if(_ShowStaffs !=null && _ShowStaffs.Count > 0)
- {
- StaffId = _ShowStaffs[0].Id;
- }
- base.OnInitialized();
- }
- protected override Task OnParametersSetAsync()
- {
- _ShowStaffs = StaffLists;
- if (_ShowStaffs != null && _ShowStaffs.Count > 0)
- {
- StaffId = _ShowStaffs[0].Id;
- }
- return base.OnParametersSetAsync();
- }
- private void OnSelectedItemChangedHandler(Staff value)
- {
- _SelectedItem = value;
- StaffIdChanged.InvokeAsync(_SelectedItem.Id);
- }
- private void OnSearch(string value)
- {
- //_ShowStaffs = StaffLists.Where<Staff>(p => p.Name.Contains(value)).ToList();
- //StateHasChanged();
- }
- }
- }
|