From 15a39c07a032cd54b1e1af2446fbd31fe1ab1332 Mon Sep 17 00:00:00 2001 From: mfnefd Date: Tue, 10 Dec 2024 18:22:11 +0400 Subject: [PATCH] =?UTF-8?q?add:=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=84=D1=80=D0=BE=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/core/api/Api.ts | 41 ++++++++++++++++++++++- front/src/core/api/data-contracts.ts | 9 ++--- front/src/core/api/http-client.ts | 2 +- front/src/core/services/report-service.ts | 25 ++++++++++++++ front/src/main.ts | 2 ++ 5 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 front/src/core/services/report-service.ts diff --git a/front/src/core/api/Api.ts b/front/src/core/api/Api.ts index 6e6cab0..b8a13a6 100644 --- a/front/src/core/api/Api.ts +++ b/front/src/core/api/Api.ts @@ -165,6 +165,45 @@ export class Api extends HttpClient + this.request({ + path: `/api/Report/period`, + method: "GET", + query: query, + format: "json", + ...params, + }); + /** + * No description + * + * @tags Report + * @name ReportPlanDetail + * @request GET:/api/Report/plan/{id} + * @response `200` `SpendingGroupViewModel` Success + */ + reportPlanDetail = (id: string, params: RequestParams = {}) => + this.request({ + path: `/api/Report/plan/${id}`, + method: "GET", + format: "json", + ...params, + }); /** * No description * @@ -412,7 +451,7 @@ export class Api extends HttpClient { - public baseUrl: string = import.meta.env.VITE_API_URL; + public baseUrl: string = "http://172.29.224.204:5215"; private securityData: SecurityDataType | null = null; private securityWorker?: ApiConfig["securityWorker"]; private abortControllers = new Map(); diff --git a/front/src/core/services/report-service.ts b/front/src/core/services/report-service.ts new file mode 100644 index 0000000..14ddd51 --- /dev/null +++ b/front/src/core/services/report-service.ts @@ -0,0 +1,25 @@ +import { Dayjs } from "dayjs"; +import { Api } from "../api/Api"; +import { SpendingGroupViewModel } from "../api/data-contracts"; + +export class ReportService { + private readonly _api: Api + constructor(api: Api) { + this._api = api; + } + + public async getOffsetFromPlanData(Id: string): Promise { + let res = await this._api.reportPlanDetail(Id); + console.log(res); + return res.data; + } + + public async getPeriodData(from: Dayjs, to: Dayjs): Promise { + let res = await this._api.reportPeriodList({ + from: from.toISOString(), + to: to.toISOString() + }); + console.log(res); + return res.data; + } +} \ No newline at end of file diff --git a/front/src/main.ts b/front/src/main.ts index f18efa1..ff4a586 100644 --- a/front/src/main.ts +++ b/front/src/main.ts @@ -8,6 +8,7 @@ import { AuthService } from './core/services/auth-service' import { ChangeRecordService } from './core/services/change-record-service' import { GroupService } from './core/services/group-service' import { PlanService } from './core/services/plans-service' +import { ReportService } from './core/services/report-service' const app = createApp(App) @@ -20,5 +21,6 @@ app.provide(AuthService.name, new AuthService(api)); app.provide(ChangeRecordService.name, new ChangeRecordService(api)); app.provide(GroupService.name, new GroupService(api)); app.provide(PlanService.name, new PlanService(api)); +app.provide(ReportService.name, new ReportService(api)); app.mount('#app')