From a346fae7a4429ee934f9dec8712ee193f7e364dc Mon Sep 17 00:00:00 2001 From: jacy <18049821889@163.com> Date: Thu, 6 Aug 2026 00:23:33 +0800 Subject: [PATCH] fix(admin-web): show Chinese labels for ticket center status Add TICKET_STATUS_LABELS and use Tag in list, detail and filter on TicketsPage. Co-authored-by: Cursor --- apps/admin-web/src/pages/TicketsPage.tsx | 41 +++++++++++++++++++++--- packages/shared-types/src/ticket.ts | 24 ++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/apps/admin-web/src/pages/TicketsPage.tsx b/apps/admin-web/src/pages/TicketsPage.tsx index 6659924..bf55dd7 100644 --- a/apps/admin-web/src/pages/TicketsPage.tsx +++ b/apps/admin-web/src/pages/TicketsPage.tsx @@ -10,11 +10,18 @@ import { Select, Space, Table, + Tag, Typography, message, } from 'antd'; import type { ColumnsType } from 'antd/es/table'; -import { TICKET_TYPE_LABELS, type TicketTypeDto } from '@dukang/shared-types'; +import { + TICKET_STATUS_LABELS, + TICKET_TYPE_LABELS, + ticketStatusLabel, + type TicketStatusDto, + type TicketTypeDto, +} from '@dukang/shared-types'; import { request } from '../lib/api'; import { fmtTime } from '../lib/constants'; import { useAdminList } from '../lib/useAdminList'; @@ -31,6 +38,21 @@ type Row = { createdAt: string; }; +const STATUS_COLOR: Partial> = { + PENDING: 'orange', + OPEN: 'blue', + COLLABORATING: 'cyan', + RESOLVED: 'green', + REJECTED: 'red', + COMPLETED: 'green', + CLOSED: 'default', +}; + +const STATUS_OPTIONS = (Object.keys(TICKET_STATUS_LABELS) as TicketStatusDto[]).map((value) => ({ + value, + label: TICKET_STATUS_LABELS[value], +})); + export default function TicketsPage() { const [filters, setFilters] = useState>({}); const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList( @@ -101,7 +123,14 @@ export default function TicketsPage() { width: 110, render: (t: TicketTypeDto) => TICKET_TYPE_LABELS[t] ?? t, }, - { title: '状态', dataIndex: 'status', width: 90 }, + { + title: '状态', + dataIndex: 'status', + width: 100, + render: (s: string) => ( + {ticketStatusLabel(s)} + ), + }, { title: '关联', width: 140, render: (_, r) => `${r.refType}#${r.refId}` }, { title: '备注', dataIndex: 'remark', ellipsis: true }, { title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime }, @@ -165,7 +194,7 @@ export default function TicketsPage() { /> - +