收口报销详情返回与金额展示(07-27-yang-jun-reimbursement-readiness)
这个提交包含在:
@@ -1,5 +1,5 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { Link, useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { Link, useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { isApiError } from "../api/types";
|
||||
import { mapApiErrorMessage } from "../api/errorMessages";
|
||||
@@ -20,6 +20,7 @@ import { hasPermission } from "../auth/permissions";
|
||||
import { toast } from "sonner";
|
||||
import { downloadBlob } from "../lib/download";
|
||||
import { resolveReimbursementDisplayCode } from "../lib/reimbursementDisplay";
|
||||
import { buildPcDetailSource } from "../lib/pcDetailNavigation";
|
||||
import { Pagination } from "../components/common/Pagination";
|
||||
import { ActionConfirmDialog } from "../components/common/ActionConfirmDialog";
|
||||
import { StatusBadge } from "../components/common/StatusBadge";
|
||||
@@ -146,6 +147,7 @@ function resolveListAction(item: ReimbursementListItem) {
|
||||
|
||||
export function ReimbursementsPage() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const { permissions, me } = useAuth();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -171,6 +173,7 @@ export function ReimbursementsPage() {
|
||||
const canShowListActions = canViewAll || showProxyOwnerSelector || canUseFinanceTools;
|
||||
const showAdvancedTools = scope === "all" || showProxyOwnerSelector;
|
||||
const shouldLoadCreateOptions = canCreateExpense;
|
||||
const currentListSource = buildPcDetailSource(location.pathname, location.search);
|
||||
|
||||
const listQuery = useQuery({
|
||||
queryKey: ["reimbursements", "list", status, page, scope],
|
||||
@@ -230,7 +233,7 @@ export function ReimbursementsPage() {
|
||||
} else {
|
||||
toast.success("报销单已创建");
|
||||
}
|
||||
navigate(`/reimbursements/${response.id}`);
|
||||
navigate(`/reimbursements/${response.id}`, { state: { from: currentListSource } });
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(resolveErrorMessage(error, "创建报销单失败"));
|
||||
@@ -571,6 +574,7 @@ export function ReimbursementsPage() {
|
||||
>
|
||||
<Link
|
||||
to={listAction.to}
|
||||
state={{ from: currentListSource }}
|
||||
data-testid="reimbursement-mobile-detail-link"
|
||||
>
|
||||
{listAction.mobileLabel}
|
||||
@@ -672,6 +676,7 @@ export function ReimbursementsPage() {
|
||||
>
|
||||
<Link
|
||||
to={listAction.to}
|
||||
state={{ from: currentListSource }}
|
||||
data-testid="reimbursement-detail-link"
|
||||
>
|
||||
{listAction.label}
|
||||
|
||||
在新工单中引用
屏蔽一个用户