|
|
|
@@ -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<Record<TicketStatusDto, string>> = {
|
|
|
|
|
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<Record<string, string>>({});
|
|
|
|
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
|
|
|
|
@@ -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) => (
|
|
|
|
|
<Tag color={STATUS_COLOR[s as TicketStatusDto] ?? 'default'}>{ticketStatusLabel(s)}</Tag>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{ 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() {
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name="status" label="状态">
|
|
|
|
|
<Input allowClear placeholder="PENDING" />
|
|
|
|
|
<Select allowClear style={{ width: 140 }} placeholder="全部" options={STATUS_OPTIONS} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
|
|
筛选
|
|
|
|
@@ -212,7 +241,11 @@ export default function TicketsPage() {
|
|
|
|
|
<Descriptions.Item label="类型">
|
|
|
|
|
{TICKET_TYPE_LABELS[detail.ticketType] ?? detail.ticketType}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="状态">{String(detail.status)}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="状态">
|
|
|
|
|
<Tag color={STATUS_COLOR[detail.status as TicketStatusDto] ?? 'default'}>
|
|
|
|
|
{ticketStatusLabel(detail.status)}
|
|
|
|
|
</Tag>
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="关联">
|
|
|
|
|
{String(detail.refType)} #{String(detail.refId)}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|