diff --git a/client/src/pages/MobileCapturePage.tsx b/client/src/pages/MobileCapturePage.tsx
index fc31e2e3..1054abf8 100644
--- a/client/src/pages/MobileCapturePage.tsx
+++ b/client/src/pages/MobileCapturePage.tsx
@@ -196,26 +196,73 @@ export function MobileCapturePage() {
-
- {
- setSelectedFiles(Array.from(event.target.files ?? []));
- }}
- multiple
- type="file"
- />
+
当前文件:
diff --git a/client/src/pages/MobileMePage.tsx b/client/src/pages/MobileMePage.tsx
index 78c037ab..f38d9e6c 100644
--- a/client/src/pages/MobileMePage.tsx
+++ b/client/src/pages/MobileMePage.tsx
@@ -103,7 +103,7 @@ export function MobileMePage() {
{me?.id ? (
-
+
) : null}
diff --git a/client/src/pages/MobileNotificationsPage.tsx b/client/src/pages/MobileNotificationsPage.tsx
new file mode 100644
index 00000000..6581d489
--- /dev/null
+++ b/client/src/pages/MobileNotificationsPage.tsx
@@ -0,0 +1,232 @@
+import { Link, useSearchParams } from "react-router-dom";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { fetchNotifications, markAllNotificationsRead, markNotificationRead } from "../api/notifications";
+import { isApiError } from "../api/types";
+import { mapApiErrorMessage } from "../api/errorMessages";
+import { PageHeader } from "../components/common/PageHeader";
+import { Pagination } from "../components/common/Pagination";
+import { PageScaffold } from "../components/patterns/PageScaffold";
+import { Button } from "../components/ui/button";
+import { Tabs, TabsList, TabsTrigger } from "../components/ui/tabs";
+import { resolveNotificationTargetLink } from "../lib/notificationLinks";
+import { resolveMobileEquivalentPath } from "../lib/runtimeContext";
+import { resolveErrorMessage } from "../lib/resolveErrorMessage";
+
+const PAGE_SIZE = 20;
+
+const NOTIFICATION_TYPE_OPTIONS = [
+ { label: "全部", value: "" },
+ { label: "审批待办", value: "workflow.task_assigned" },
+ { label: "报销", value: "reimbursement.approved,reimbursement.rejected,reimbursement.returned,reimbursement.paid" },
+ { label: "请假", value: "leave.approved,leave.rejected" },
+ { label: "采购", value: "purchase_request.approved,purchase_request.rejected" },
+ { label: "差旅", value: "travel_request.approved,travel_request.rejected" },
+ { label: "资产", value: "asset.assigned,asset.returned,asset.transferred" },
+ { label: "盘点", value: "inventory_check.completed" },
+];
+
+function resolveNotificationError(error: unknown) {
+ if (isApiError(error)) {
+ return `${error.code}: ${mapApiErrorMessage(error.code, error.details, error.message)}`;
+ }
+ return "加载通知失败";
+}
+
+function resolveMobileNotificationTarget(item: Parameters
[0]) {
+ const targetLink = resolveNotificationTargetLink(item);
+ if (!targetLink) return null;
+ const [pathname, search = ""] = targetLink.split("?");
+ return resolveMobileEquivalentPath(pathname, search ? `?${search}` : "");
+}
+
+function formatTime(value: string) {
+ return value.slice(0, 19).replace("T", " ");
+}
+
+export function MobileNotificationsPage() {
+ const queryClient = useQueryClient();
+ const [searchParams, setSearchParams] = useSearchParams();
+
+ const unreadOnlyRaw = searchParams.get("unreadOnly") ?? "0";
+ const unreadOnly = unreadOnlyRaw === "1" || unreadOnlyRaw === "true";
+ const page = Number(searchParams.get("page") ?? "1") || 1;
+ const selectedType = searchParams.get("type") ?? "";
+
+ const updateFilters = (next: { unreadOnly?: boolean; page?: number; type?: string }) => {
+ const params = new URLSearchParams();
+ params.set("unreadOnly", (next.unreadOnly ?? unreadOnly) ? "1" : "0");
+ params.set("page", String(next.page ?? page));
+ const nextType = next.type ?? selectedType;
+ if (nextType) {
+ params.set("type", nextType);
+ }
+ setSearchParams(params);
+ };
+
+ const listQuery = useQuery({
+ queryKey: ["notifications", "list", unreadOnly, selectedType, page],
+ queryFn: () =>
+ fetchNotifications({
+ unreadOnly,
+ page,
+ pageSize: PAGE_SIZE,
+ ...(selectedType ? { type: selectedType } : {}),
+ }),
+ });
+
+ const markReadMutation = useMutation({
+ mutationFn: async (notificationId: string) => markNotificationRead(notificationId),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({ queryKey: ["notifications"] });
+ },
+ });
+
+ const markAllReadMutation = useMutation({
+ mutationFn: () => markAllNotificationsRead(),
+ onSuccess: async () => {
+ toast.success("已全部标为已读");
+ await queryClient.invalidateQueries({ queryKey: ["notifications"] });
+ },
+ onError: (error) => {
+ toast.error(resolveErrorMessage(error));
+ },
+ });
+
+ const notificationItems = listQuery.data?.items ?? [];
+ const totalPages = Math.max(1, Math.ceil((listQuery.data?.total ?? 0) / PAGE_SIZE));
+
+ return (
+
+
+
未读 {listQuery.data?.unreadCount ?? 0}}
+ actions={
+
+ }
+ />
+
+
+
+
+ updateFilters({
+ unreadOnly: value === "unread",
+ page: 1,
+ })
+ }
+ >
+
+
+ 全部
+
+
+ 未读
+
+
+
+
+
+
+
+ {listQuery.isLoading ? (
+ 加载中...
+ ) : null}
+
+ {listQuery.isError ? (
+
+ {resolveNotificationError(listQuery.error)}
+
+ ) : null}
+
+ {!listQuery.isLoading && !listQuery.isError && !notificationItems.length ? (
+ 暂无通知
+ ) : null}
+
+ {notificationItems.map((item) => {
+ const targetLink = resolveMobileNotificationTarget(item);
+ return (
+
+
+
+
{item.title}
+ {item.body ?
{item.body}
: null}
+
+
+ {item.readAt ? "已读" : "未读"}
+
+
+
+ {formatTime(item.createdAt)}
+
+ {targetLink ? (
+
+ ) : null}
+
+ {!item.readAt ? (
+
+ ) : null}
+
+
+ );
+ })}
+
+
+ updateFilters({
+ page: nextPage,
+ })
+ }
+ testIdPrefix="mobile-notifications"
+ />
+
+
+
+ );
+}
+
+export default MobileNotificationsPage;
diff --git a/client/src/pages/MobileProfilePage.tsx b/client/src/pages/MobileProfilePage.tsx
new file mode 100644
index 00000000..b3e0fe57
--- /dev/null
+++ b/client/src/pages/MobileProfilePage.tsx
@@ -0,0 +1,222 @@
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { useSearchParams } from "react-router-dom";
+import { fetchWecomConfig, startWecomBind, unbindWecom, updateNotificationPreferences } from "../api/auth";
+import { isApiError } from "../api/types";
+import { useAuth } from "../auth/AuthContext";
+import { PageHeader } from "../components/common/PageHeader";
+import { PageScaffold } from "../components/patterns/PageScaffold";
+import { SectionPanel } from "../components/patterns/SectionPanel";
+import { Button } from "../components/ui/button";
+import {
+ resolveWecomBindNotice,
+ resolveWecomEntryStatus,
+ type WecomNotice,
+} from "../lib/wecomEntry";
+
+function noticeClasses(tone: WecomNotice["tone"]) {
+ if (tone === "success") {
+ return "border-emerald-200 bg-emerald-50 text-emerald-700";
+ }
+ if (tone === "warning") {
+ return "border-amber-200 bg-amber-50 text-amber-700";
+ }
+ return "border-zinc-200 bg-zinc-50 text-zinc-700";
+}
+
+function statusTone(status?: string) {
+ if (status === "active") return "badge-success";
+ if (status === "inactive") return "badge-warning";
+ return "badge-neutral";
+}
+
+function resolveProfileError(error: unknown) {
+ if (isApiError(error)) {
+ return `${error.code}: ${error.message}`;
+ }
+ if (error instanceof Error) {
+ return error.message;
+ }
+ return "请求失败,请稍后重试。";
+}
+
+function resolveBinding(
+ binding: {
+ externalUserId?: string;
+ userId?: string;
+ createdAt?: string | null;
+ boundAt?: string | null;
+ } | null | undefined,
+) {
+ return {
+ externalUserId: binding?.externalUserId ?? binding?.userId ?? "",
+ createdAt: binding?.createdAt ?? binding?.boundAt ?? null,
+ };
+}
+
+function maskExternalUserId(value: string) {
+ if (!value) return "-";
+ if (value.length <= 8) {
+ return value;
+ }
+ return `${value.slice(0, 4)}****${value.slice(-4)}`;
+}
+
+export function MobileProfilePage() {
+ const { me, refreshMe } = useAuth();
+ const [searchParams] = useSearchParams();
+ const wecomConfigQuery = useQuery({
+ queryKey: ["auth", "wecom-config"],
+ queryFn: () => fetchWecomConfig(),
+ staleTime: 60_000,
+ });
+
+ const bindMutation = useMutation({
+ mutationFn: async () => startWecomBind("/mobile/profile"),
+ onSuccess: (payload) => {
+ window.location.assign(payload.loginUrl);
+ },
+ onError: (error) => {
+ toast.error(resolveProfileError(error));
+ },
+ });
+
+ const unbindMutation = useMutation({
+ mutationFn: () => unbindWecom(),
+ onSuccess: async () => {
+ await refreshMe();
+ toast.success("企业微信已解绑");
+ },
+ onError: (error) => {
+ toast.error(resolveProfileError(error));
+ },
+ });
+
+ const notificationPreferenceMutation = useMutation({
+ mutationFn: (notificationPushEnabled: boolean) => updateNotificationPreferences({ notificationPushEnabled }),
+ onSuccess: async () => {
+ await refreshMe();
+ toast.success("外部推送偏好已更新");
+ },
+ onError: (error) => {
+ toast.error(resolveProfileError(error));
+ },
+ });
+
+ const binding = resolveBinding(me?.wecomBinding);
+ const isBound = Boolean(binding.externalUserId);
+ const wecomStatus = resolveWecomEntryStatus(wecomConfigQuery.data);
+ const bindNotice = resolveWecomBindNotice(searchParams.get("wecomBind"));
+
+ return (
+
+
+
{me?.status === "active" ? "账号正常" : "账号待确认"}}
+ />
+
+ {bindNotice ? (
+
+
{bindNotice.title}
+
{bindNotice.description}
+
+ ) : null}
+
+
+
+
+
- 姓名
+ - {me?.name ?? "-"}
+
+
+
- 员工号
+ - {me?.employeeNo ?? "-"}
+
+
+
- 邮箱
+ - {me?.email ?? "-"}
+
+
+
- 手机号
+ - {me?.phone ?? "-"}
+
+
+
+
+
+
+
+
+
+
+
+
接入状态
+
{wecomStatus.label}
+
{wecomStatus.description}
+
+
+
+
+
+
当前绑定
+
{isBound ? "已绑定" : "未绑定"}
+
+
{isBound ? "可用" : "待绑定"}
+
+ {isBound ? (
+
+
绑定标识:{maskExternalUserId(binding.externalUserId)}
+
绑定时间:{binding.createdAt ? new Date(binding.createdAt).toLocaleString() : "-"}
+
+ ) : null}
+
+
+
+
+
+
+
+
+
+
+
+
+ {me?.status === "active" ? "active" : me?.status ?? "unknown"}
+ {(me?.roleCodes ?? []).map((role) => (
+ {role}
+ ))}
+
+
角色和权限由管理员统一维护。
+
+
+
+
+ );
+}
+
+export default MobileProfilePage;
diff --git a/client/src/pages/MobileReimbursementsPage.tsx b/client/src/pages/MobileReimbursementsPage.tsx
index cae2c3e6..9b0436cd 100644
--- a/client/src/pages/MobileReimbursementsPage.tsx
+++ b/client/src/pages/MobileReimbursementsPage.tsx
@@ -4,12 +4,14 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import {
createReimbursement,
+ deleteReimbursement,
fetchReimbursements,
type ReimbursementListItem,
type ReimbursementStatus,
} from "../api/reimbursements";
import { useAuth } from "../auth/AuthContext";
import { hasPermission } from "../auth/permissions";
+import { ConfirmDialog } from "../components/common/ConfirmDialog";
import { Button } from "../components/ui/button";
import { Tabs, TabsList, TabsTrigger } from "../components/ui/tabs";
import { PageHeader } from "../components/common/PageHeader";
@@ -48,7 +50,17 @@ function formatDate(value: string | null | undefined) {
return value || "未填写日期";
}
-function ReimbursementCard({ item }: { item: ReimbursementListItem }) {
+function ReimbursementCard({
+ item,
+ canDeleteDraft,
+ isDeleting,
+ onDelete,
+}: {
+ item: ReimbursementListItem;
+ canDeleteDraft: boolean;
+ isDeleting: boolean;
+ onDelete: (item: ReimbursementListItem) => void;
+}) {
const actionLabel = item.status === "draft" || item.status === "rejected" ? "继续编辑" : "查看详情";
const displayCode = resolveReimbursementDisplayCode(item);
@@ -75,9 +87,23 @@ function ReimbursementCard({ item }: { item: ReimbursementListItem }) {
{item.description ? {item.description}
: null}
-
+
+
+ {canDeleteDraft ? (
+
+ ) : null}
+
);
}
@@ -87,7 +113,9 @@ export function MobileReimbursementsPage() {
const queryClient = useQueryClient();
const { permissions } = useAuth();
const [status, setStatus] = useState("draft");
+ const [deleteTarget, setDeleteTarget] = useState(null);
const canCreateExpense = hasPermission(permissions, "expense.create");
+ const canDeleteExpense = hasPermission(permissions, "expense.delete_own");
const listQuery = useQuery({
queryKey: ["mobile", "reimbursements", status],
@@ -106,6 +134,21 @@ export function MobileReimbursementsPage() {
},
});
+ const deleteMutation = useMutation({
+ mutationFn: (reimbursementId: string) => deleteReimbursement(reimbursementId),
+ onSuccess: async () => {
+ await Promise.all([
+ queryClient.invalidateQueries({ queryKey: ["mobile", "reimbursements"] }),
+ queryClient.invalidateQueries({ queryKey: ["reimbursements"] }),
+ ]);
+ setDeleteTarget(null);
+ toast.success("草稿已删除");
+ },
+ onError: (error) => {
+ toast.error(resolveErrorMessage(error));
+ },
+ });
+
const items = listQuery.data?.items ?? [];
const total = listQuery.data?.total ?? 0;
const totalAmount = useMemo(
@@ -166,10 +209,35 @@ export function MobileReimbursementsPage() {
暂无报销记录
) : null}
{items.map((item) => (
-
+
))}
+
+