123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Microsoft.AspNetCore.Components.Authorization;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Threading.Tasks;
- using wispro.sp.entity;
- using wispro.sp.share;
- using wispro.sp.web.Auth;
- namespace wispro.sp.web.Services
- {
- public class PerformanceItemServices
- {
- private readonly HttpClient _httpClient;
- private readonly JwtAuthenticationStateProvider _jwt;
- public PerformanceItemServices(HttpClient httpClient, AuthenticationStateProvider jwt)
- {
- _httpClient = httpClient;
- _jwt = (JwtAuthenticationStateProvider)jwt;
- }
- public async Task<ListApiResponse<PerformanceItem>> GetItems(int _pageIndex,int _pageSize)
- {
- ListApiResponse<PerformanceItem> data = await _httpClient.GetFromJsonAsync<ListApiResponse<PerformanceItem>>($"http://localhost:39476/api/PerformanceItem/Query?pageIndex={_pageIndex}&pageSize={_pageSize}");
- return data;
- }
- public async Task<ApiSaveResponse> SaveFieldChange(int id,string Field,string value)
- {
- ApiSaveResponse data = await _httpClient.GetFromJsonAsync<ApiSaveResponse>($"http://localhost:39476/api/PerformanceItem/UpdateFieldValue?id={id}&field={Field}&value={value}");
- return data;
- }
- public async Task<ListApiResponse<PerformanceItem>> GetMyList(int userid,jxType type,int pageIndex=1,int pageSize=5)
- {
- ListApiResponse<PerformanceItem> data = await _httpClient.GetFromJsonAsync<ListApiResponse<PerformanceItem>>($"http://localhost:39476/api/PerformanceItem/GetMyList?userid={userid}&Type={Convert.ToInt32(type)}&pageIndex={pageIndex}&pageSize={pageSize}");
- return data;
- }
- public async Task<List<StaffStatistics>> CalMyStatistics(int year, int month, int? userid = null)
- {
- var data = await _httpClient.GetFromJsonAsync<List<StaffStatistics>>($"http://localhost:39476/api/PerformanceItem/CalMyStatistics?userid={userid}&year={year}&month={month}");
- return data;
- }
- }
- }
|