修复:项目组分类仅补齐未分类并在完成后刷新列表
This commit is contained in:
@@ -742,7 +742,6 @@ function MappingIssueResolutionPanel({ onUnauthorized, onEdit }: { onUnauthorize
|
||||
const [items, setItems] = useState<Record<string, unknown>[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
const [status, setStatus] = useState('OPEN');
|
||||
const [customerCode, setCustomerCode] = useState<string>();
|
||||
const [businessGroup, setBusinessGroup] = useState<string>();
|
||||
const [department, setDepartment] = useState<string>();
|
||||
@@ -752,15 +751,15 @@ function MappingIssueResolutionPanel({ onUnauthorized, onEdit }: { onUnauthorize
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const { refreshKey } = usePageCache();
|
||||
const pages = useRef(new Map<string, ReturnType<typeof api.mappingIssues>>());
|
||||
const pages = useRef(new Map<string, ReturnType<typeof api.unclassifiedProjects>>());
|
||||
const load = async (force = false) => {
|
||||
const revision = ++loadRevision.current;
|
||||
const key = JSON.stringify([refreshKey, page, status, customerCode, businessGroup, department]);
|
||||
const key = JSON.stringify([refreshKey, page, customerCode, businessGroup, department]);
|
||||
if (force) pages.current.clear();
|
||||
setLoading(true);
|
||||
let request: ReturnType<typeof api.mappingIssues> | undefined;
|
||||
let request: ReturnType<typeof api.unclassifiedProjects> | undefined;
|
||||
try {
|
||||
request = pages.current.get(key) ?? api.mappingIssues({ status: status || undefined, page, pageSize: TABLE_PAGE_SIZE, customerCode, businessGroup, department, mappingType: 'PROJECT_GROUP' });
|
||||
request = pages.current.get(key) ?? api.unclassifiedProjects({ page, pageSize: TABLE_PAGE_SIZE, customerCode, businessGroup, department });
|
||||
pages.current.set(key, request);
|
||||
if (pages.current.size > 12) pages.current.delete(pages.current.keys().next().value!);
|
||||
const result = await request;
|
||||
@@ -771,7 +770,7 @@ function MappingIssueResolutionPanel({ onUnauthorized, onEdit }: { onUnauthorize
|
||||
} catch (value) { if (pages.current.get(key) === request) pages.current.delete(key); if (revision === loadRevision.current && !onUnauthorized(value)) setError(apiMessage(value)); }
|
||||
finally { if (revision === loadRevision.current) setLoading(false); }
|
||||
};
|
||||
useEffect(() => { void load(); }, [page, status, customerCode, businessGroup, department]);
|
||||
useEffect(() => { void load(); }, [page, customerCode, businessGroup, department]);
|
||||
const columns: ColumnsType<Record<string, unknown>> = [
|
||||
{ title: '客户代码', dataIndex: 'customerCode', key: 'customerCode', fixed: 'left', width: 120, render: toText },
|
||||
{ title: '业务分组', dataIndex: 'businessGroup', key: 'businessGroup', width: 190, render: toText },
|
||||
@@ -780,19 +779,19 @@ function MappingIssueResolutionPanel({ onUnauthorized, onEdit }: { onUnauthorize
|
||||
{ title: '涉及行数', dataIndex: 'rowCount', key: 'rowCount', align: 'right', width: 110 },
|
||||
{ title: '涉及总重量', dataIndex: 'totalWeight', key: 'totalWeight', align: 'right', width: 130 },
|
||||
{ title: '问题期间', key: 'periods', width: 170, render: (_, row) => { const details = row.details && typeof row.details === 'object' ? row.details as Record<string, unknown> : {}; return Array.isArray(details.periods) ? (details.periods as unknown[]).map(toText).join('、') : '—'; } },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', width: 120, render: value => <Tag color={value === 'OPEN' ? 'orange' : value === 'REVALIDATED' ? 'green' : 'blue'}>{toText(value)}</Tag> },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', width: 120, render: value => <Tag color={value === 'OPEN' ? 'orange' : value === 'REVALIDATED' ? 'green' : 'blue'}>{value==='OPEN'?'待处理':toText(value)}</Tag> },
|
||||
{ title: '操作', key: 'action', width: 120, fixed: 'right', render: (_, row) => <Button type="link" disabled={!onEdit} onClick={() => onEdit?.({ kind: 'projectGroup', row })}>编辑分类</Button> },
|
||||
];
|
||||
useMaintenanceRefresh(() => { void load(true); });
|
||||
return <div className="management-page">
|
||||
{error && <Alert showIcon type="error" message="映射问题操作失败" description={error} />}
|
||||
<section className="panel section-panel"><div className="resource-toolbar"><strong>项目组未分类汇总</strong><div className="completion-actions"><span>共 {total} 条</span><div className="completion-actions"><Select aria-label="映射问题状态" value={status} options={[{ label: '待处理', value: 'OPEN' }, { label: '已裁决', value: 'DECIDED' }, { label: '已退回', value: 'RETURNED' }, { label: '已重验', value: 'REVALIDATED' }, { label: '全部状态', value: '' }]} onChange={value => { setStatus(value); setPage(1); }} /><Button icon={<ReloadOutlined />} onClick={() => void load(true)}>刷新</Button></div></div></div>
|
||||
<section className="panel section-panel"><div className="resource-toolbar"><strong>项目组未分类汇总</strong><div className="completion-actions"><span>共 {total} 条</span><div className="completion-actions"><Button icon={<ReloadOutlined />} onClick={() => void load(true)}>刷新</Button></div></div></div>
|
||||
<div className="resource-toolbar mapping-issue-filters">
|
||||
<Select {...readableSelectPopup} showSearch allowClear aria-label="筛选客户代码" placeholder="客户代码" value={customerCode} options={filterOptions.customerCodes.map(value => ({ label: value, value }))} onChange={value => { setCustomerCode(value); setPage(1); }} />
|
||||
<Select {...readableSelectPopup} showSearch allowClear aria-label="筛选业务分组" placeholder="业务分组" value={businessGroup} options={filterOptions.businessGroups.map(value => ({ label: value, value }))} onChange={value => { setBusinessGroup(value); setPage(1); }} />
|
||||
<Select {...readableSelectPopup} showSearch allowClear aria-label="筛选产业部" placeholder="产业部" value={department} options={filterOptions.departments.map(value => ({ label: value, value }))} onChange={value => { setDepartment(value); setPage(1); }} />
|
||||
<Button onClick={() => { setCustomerCode(undefined); setBusinessGroup(undefined); setDepartment(undefined); setPage(1); }}>重置</Button>
|
||||
</div>{loading ? <div className="loading-panel"><Spin />正在读取未命中问题…</div> : items.length ? <div className="resource-table"><Table size="small" bordered columns={columns} dataSource={items} rowKey={row => String(row.id)} pagination={false} indexOffset={(page - 1) * TABLE_PAGE_SIZE} scroll={{ x: 1320 }} /></div> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前状态没有项目组未分类记录" />}{total > TABLE_PAGE_SIZE && <Pagination className="records-pagination" current={page} pageSize={TABLE_PAGE_SIZE} total={total} showTotal={count => `共 ${count} 条问题`} onChange={setPage} />}</section>
|
||||
</div>{loading ? <div className="loading-panel"><Spin />正在读取未命中问题…</div> : items.length ? <div className="resource-table"><Table size="small" bordered columns={columns} dataSource={items} rowKey={row => String(row.id)} pagination={false} indexOffset={(page - 1) * TABLE_PAGE_SIZE} scroll={{ x: 1320 }} /></div> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="没有项目组未分类记录" />}{total > TABLE_PAGE_SIZE && <Pagination className="records-pagination" current={page} pageSize={TABLE_PAGE_SIZE} total={total} showTotal={count => `共 ${count} 条问题`} onChange={setPage} />}</section>
|
||||
</div>;
|
||||
}
|
||||
|
||||
@@ -919,7 +918,7 @@ function TaskTable({ items, importOnly, user, onUnauthorized, onRefresh }: { ite
|
||||
{ title: '处理阶段', dataIndex: 'stage', key: 'stage', width: 150 },
|
||||
{ title: importOnly ? '进度' : '进度', dataIndex: 'progress', key: 'progress', width: 145, align: 'right', render: value => importOnly ? `${toText(value)}%` : toText(value) },
|
||||
{ title: '已处理 / 总数', key: 'processed', width: 140, align: 'right', render: (_, row) => `${toText(row.processed)} / ${toText(row.total)}` },
|
||||
{ title: '错误码', dataIndex: 'errorCode', key: 'errorCode', width: 150, render: value => value ? <Tag color="red">{toText(value)}</Tag> : '—' },
|
||||
{ title: '错误码', dataIndex: 'errorCode', key: 'errorCode', width: 150, render: value => value ? <Tag color="red">{value==='OPEN'?'待处理':toText(value)}</Tag> : '—' },
|
||||
{ title: '错误信息', dataIndex: 'errorMessage', key: 'errorMessage', width: 300, ellipsis: true, render: value => value ? <span className="task-error">{toText(value)}</span> : '—' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', key: 'createdAt', width: 205 },
|
||||
{ title: '操作', key: 'detail', fixed: 'right', width: importOnly ? 240 : 150, align: 'center', render: (_, row) => <span className="task-actions">
|
||||
|
||||
Reference in New Issue
Block a user