diff --git a/frontend/src/api/finance.ts b/frontend/src/api/finance.ts new file mode 100644 index 00000000..705706da --- /dev/null +++ b/frontend/src/api/finance.ts @@ -0,0 +1,64 @@ +import { apiGet, apiPatch, apiPost } from "./axios"; +import type { AxiosResponse } from "axios"; +import type { ApiListResponse } from "../types/api"; + +export interface FinanceItem { + id: string; + study_id: string; + site_id?: string | null; + subject_id?: string | null; + visit_id?: string | null; + category: string; + title: string; + description?: string | null; + currency: string; + amount: number | string; + occur_date: string; + status: string; + submitted_at?: string | null; + approved_at?: string | null; + rejected_at?: string | null; + paid_at?: string | null; + approver_id?: string | null; + payer_id?: string | null; + reject_reason?: string | null; + created_by: string; + created_at: string; + updated_at?: string | null; +} + +export interface FinanceSummary { + total_amount: number | string; + approved_amount: number | string; + paid_amount: number | string; + submitted_amount?: number | string; + count_total: number; + count_paid: number; +} + +export const fetchFinanceItems = ( + studyId: string, + params?: Record +): Promise>> => + apiGet(`/api/v1/studies/${studyId}/finance/items/`, { params }); + +export const fetchFinanceItem = (studyId: string, itemId: string) => + apiGet(`/api/v1/studies/${studyId}/finance/items/${itemId}`); + +export const createFinanceItem = (studyId: string, payload: Record) => + apiPost(`/api/v1/studies/${studyId}/finance/items`, payload); + +export const updateFinanceItem = (studyId: string, itemId: string, payload: Record) => + apiPatch(`/api/v1/studies/${studyId}/finance/items/${itemId}`, payload); + +export const changeFinanceStatus = ( + studyId: string, + itemId: string, + payload: { status: string; reject_reason?: string } +) => apiPost(`/api/v1/studies/${studyId}/finance/items/${itemId}/status`, payload); + +export const fetchFinanceSummary = (studyId: string, params?: Record) => + apiGet>( + `/api/v1/studies/${studyId}/finance/summary`, + { params } + ); diff --git a/frontend/src/components/FinanceForm.vue b/frontend/src/components/FinanceForm.vue new file mode 100644 index 00000000..ff14a1e0 --- /dev/null +++ b/frontend/src/components/FinanceForm.vue @@ -0,0 +1,138 @@ + + + diff --git a/frontend/src/components/FinanceStatusActions.vue b/frontend/src/components/FinanceStatusActions.vue new file mode 100644 index 00000000..b4d43329 --- /dev/null +++ b/frontend/src/components/FinanceStatusActions.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/frontend/src/components/FinanceSummary.vue b/frontend/src/components/FinanceSummary.vue new file mode 100644 index 00000000..31332077 --- /dev/null +++ b/frontend/src/components/FinanceSummary.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 47f7dbe9..a03f2df3 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -20,6 +20,7 @@ import ImpBatches from "../views/ImpBatches.vue"; import ImpInventory from "../views/ImpInventory.vue"; import ImpTransactions from "../views/ImpTransactions.vue"; import Finance from "../views/Finance.vue"; +import FinanceDetail from "../views/FinanceDetail.vue"; import Faq from "../views/Faq.vue"; import Issues from "../views/Issues.vue"; import IssueDetail from "../views/IssueDetail.vue"; @@ -145,6 +146,12 @@ const routes: RouteRecordRaw[] = [ component: Finance, meta: { title: "费用", requiresStudy: true }, }, + { + path: "study/finance/:itemId", + name: "StudyFinanceDetail", + component: FinanceDetail, + meta: { title: "费用详情", requiresStudy: true }, + }, { path: "study/faq", name: "StudyFaq", diff --git a/frontend/src/views/Finance.vue b/frontend/src/views/Finance.vue index 4668650b..9dcd6429 100644 --- a/frontend/src/views/Finance.vue +++ b/frontend/src/views/Finance.vue @@ -1,13 +1,196 @@ - + diff --git a/frontend/src/views/FinanceDetail.vue b/frontend/src/views/FinanceDetail.vue new file mode 100644 index 00000000..41c636e2 --- /dev/null +++ b/frontend/src/views/FinanceDetail.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/pg_data/base/16384/24576 b/pg_data/base/16384/24576 index e2490e63..691daa8e 100644 Binary files a/pg_data/base/16384/24576 and b/pg_data/base/16384/24576 differ diff --git a/pg_data/base/16384/24584 b/pg_data/base/16384/24584 index 27978392..026d272f 100644 Binary files a/pg_data/base/16384/24584 and b/pg_data/base/16384/24584 differ diff --git a/pg_data/base/16384/24653 b/pg_data/base/16384/24653 index 66ddbeb0..aee0b989 100644 Binary files a/pg_data/base/16384/24653 and b/pg_data/base/16384/24653 differ diff --git a/pg_data/base/16384/24659 b/pg_data/base/16384/24659 index 1071a1a8..9f306113 100644 Binary files a/pg_data/base/16384/24659 and b/pg_data/base/16384/24659 differ diff --git a/pg_data/base/16384/25066 b/pg_data/base/16384/25066 index 3339dc87..67f2ddc2 100644 Binary files a/pg_data/base/16384/25066 and b/pg_data/base/16384/25066 differ diff --git a/pg_data/base/16384/25073 b/pg_data/base/16384/25073 index 48f4fb04..6c6375a6 100644 Binary files a/pg_data/base/16384/25073 and b/pg_data/base/16384/25073 differ diff --git a/pg_data/base/16384/25105 b/pg_data/base/16384/25105 index 7687dd61..bc1141d4 100644 Binary files a/pg_data/base/16384/25105 and b/pg_data/base/16384/25105 differ diff --git a/pg_data/base/16384/25106 b/pg_data/base/16384/25106 index 179abbf8..458c89e9 100644 Binary files a/pg_data/base/16384/25106 and b/pg_data/base/16384/25106 differ diff --git a/pg_data/base/16384/25107 b/pg_data/base/16384/25107 index a15035c7..09a747ec 100644 Binary files a/pg_data/base/16384/25107 and b/pg_data/base/16384/25107 differ diff --git a/pg_data/global/pg_control b/pg_data/global/pg_control index 7dbaa0a8..d3aaf337 100644 Binary files a/pg_data/global/pg_control and b/pg_data/global/pg_control differ diff --git a/pg_data/pg_subtrans/0000 b/pg_data/pg_subtrans/0000 index 86e2f0bf..6d17cf9d 100644 Binary files a/pg_data/pg_subtrans/0000 and b/pg_data/pg_subtrans/0000 differ diff --git a/pg_data/pg_wal/000000010000000000000001 b/pg_data/pg_wal/000000010000000000000001 index cb1d0555..bff5effe 100644 Binary files a/pg_data/pg_wal/000000010000000000000001 and b/pg_data/pg_wal/000000010000000000000001 differ diff --git a/pg_data/pg_xact/0000 b/pg_data/pg_xact/0000 index 3a30c261..6f73d0ee 100644 Binary files a/pg_data/pg_xact/0000 and b/pg_data/pg_xact/0000 differ