新增:查询页面快照并修复筛选选框闪烁
页面快照支持勾选查询条件、指标卡片、趋势、汇总表、不良构成和细分缺陷图,复制PNG或下载;增加取消、分阶段提示和等待超时恢复。 修复公共Select弹层准备帧被opacity覆盖导致的先闪出再展开,并取消查询字段原生label的重复点击转发。 同步已经验收上线的销售订单类型映射、排除筛选及预聚合,以及其线上权限、删除确认配套源码;保留既有公式编辑和名录编码修改。源码范围按发布清单冻结,不纳入本机数据、凭据及未发布工作。 验证:前后端独立源码构建通过;10项前端检查、4项订单分类单元测试通过;实际系统剪贴板粘贴PNG验证通过;线上配置及筛选结果与发布前一致,后端未重启。
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useDeleteConfirmation } from './useDeleteConfirmation';
|
||||
import { configurationDateTime } from './configurationName';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { Alert, App, Button, Checkbox, Empty, Form, Input, InputNumber, Modal, Progress, Select, Spin, Steps, Tag } from 'antd';
|
||||
@@ -52,6 +53,7 @@ export type PendingSourceDeletion = { ids: string[]; releaseId: string | null };
|
||||
type SourceDraft = { id: string; file: File; workbook: WorkbookPreview; stage: DataStage; year: number; month: number; sheetName: string; headerRow: number; fieldMap: Record<string, string>; mode: 'ADD' | 'REPLACE'; targetId: string; scopeCode: string };
|
||||
|
||||
function SimplifiedDataWorkflow({ options, workflowStatus, pendingDeletion, onDeleted, onBusyChange, onUnauthorized, onRefresh }: { options: SourceUploadOptions; workflowStatus: DataWorkflowStatus; pendingDeletion: PendingSourceDeletion; onDeleted: (ids: string[]) => void; onBusyChange: (busy: boolean) => void; onUnauthorized: (error: unknown) => boolean; onRefresh: () => void }) {
|
||||
const confirmDelete = useDeleteConfirmation();
|
||||
const { message } = App.useApp();
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
const configured = useRef(new Map<string, { signature: string; sourceId: string }>());
|
||||
@@ -84,7 +86,7 @@ function SimplifiedDataWorkflow({ options, workflowStatus, pendingDeletion, onDe
|
||||
const duplicateSlots = new Set(slots).size !== slots.length;
|
||||
const canImport = hasImportCapability && drafts.length > 0 && drafts.every(draftReady) && !duplicateSlots && !pendingDeletion.ids.length;
|
||||
const reportError = (value: unknown) => { if (!onUnauthorized(value)) setError(failure(value)); };
|
||||
const removeDraft = (id: string) => { setDrafts(previous => previous.filter(item => item.id !== id)); configured.current.delete(id); };
|
||||
const removeDraft = (id: string) => confirmDelete({title:`移除文件“${drafts.find(item=>item.id===id)?.workbook.sourceFile || "选中的文件"}”?`,description:"仅从本次导入列表移除,此文件的字段对应设置也将移除。电脑上的原文件及已接收来源保留。",confirmText:"确认移除",onConfirm:()=>{setDrafts(previous => previous.filter(item => item.id !== id));configured.current.delete(id);}});
|
||||
const readFiles = async (files: File[]) => {
|
||||
if (!files.length || importBusy || actionLock.current) return;
|
||||
actionLock.current = true;
|
||||
@@ -136,13 +138,18 @@ function SimplifiedDataWorkflow({ options, workflowStatus, pendingDeletion, onDe
|
||||
await uploadOperation.start(() => api.importDataWorkflow({ sourceIds }));
|
||||
} catch (value) { reportError(value); } finally { actionLock.current = false; setBusy(false); }
|
||||
};
|
||||
const recalculate = async () => {
|
||||
const performRecalculation = async () => {
|
||||
if (actionLock.current) return; actionLock.current = true;
|
||||
setError('');
|
||||
try { await recalcOperation.start(() => pendingDeletion.ids.length ? api.deleteDataWorkflowSources({ sourceIds: pendingDeletion.ids, expectedCurrentReleaseId: pendingDeletion.releaseId }) : api.recalculateDataWorkflow()); }
|
||||
catch (value) { reportError(value); }
|
||||
finally { actionLock.current = false; }
|
||||
};
|
||||
const recalculate = () => {
|
||||
if (actionLock.current) return;
|
||||
if (!pendingDeletion.ids.length) return performRecalculation();
|
||||
confirmDelete({title:`删除 ${pendingDeletion.ids.length} 个来源并更新报表?`,description:<><p>将从当前查询结果移除以下来源并更新报表,原文件和处理记录保留。</p><ul>{pendingDeletion.ids.slice(0,10).map((id,index)=><li key={id}>{options.targets.find(item=>item.documentId===id)?.sourceFile || `第 ${index+1} 个待删除来源`}</li>)}</ul>{pendingDeletion.ids.length>10&&<p>另有 {pendingDeletion.ids.length-10} 个待删除来源。</p>}</>,confirmText:'确认删除并更新',onConfirm:performRecalculation});
|
||||
};
|
||||
return <div className="nc-simplified-intake">
|
||||
<section className="panel nc-simple-upload-panel">
|
||||
<div className="nc-simple-upload-heading"><div><span className="nc-eyebrow">测试数据维护</span><h2>导入来源并更新报表</h2><p>支持一次选择多个 Excel 文件,分别核对年月与阶段后统一导入。</p></div><div className="nc-simple-upload-actions">{workflowStatus.capabilities?.canRecalculate !== false && <Button icon={<ReloadOutlined />} disabled={importBusy} loading={recalcOperation.busy} onClick={() => void recalculate()}>{pendingDeletion.ids.length ? `更新报表(${pendingDeletion.ids.length}项删除)` : '更新报表'}</Button>}</div></div>
|
||||
@@ -207,8 +214,8 @@ export function DataWorkflowHub({ user, sources, currentReleaseId, pendingDeleti
|
||||
const optionsAttempted = useRef(false);
|
||||
const candidatesAttempted = useRef(false);
|
||||
const [resumeId, setResumeId] = useState('');
|
||||
const canMaintain = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_MAINTAINER']);
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_PUBLISHER']);
|
||||
const canMaintain = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_ADMIN']);
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_ADMIN']);
|
||||
const loadOptions = useCallback(() => optionsRead.run(async () => {
|
||||
try { setOptions(await api.sourceUploadOptions()); setOptionError(''); }
|
||||
catch (error) { if (!onUnauthorized(error)) setOptionError(failure(error)); }
|
||||
@@ -249,6 +256,7 @@ export function DataWorkflowHub({ user, sources, currentReleaseId, pendingDeleti
|
||||
}
|
||||
|
||||
export function SourceFilesPanel({ user, sources, sourcesLoaded, loading, pendingIds, maintenanceBusy, onToggleDelete, onClearDeletes, onUnauthorized, onRefresh }: { user: AuthUser; sources: SourceItem[]; sourcesLoaded: boolean; loading: boolean; pendingIds: string[]; maintenanceBusy: boolean; onToggleDelete: (id: string) => void; onClearDeletes: () => void; onUnauthorized: (error: unknown) => boolean; onRefresh: () => void }) {
|
||||
const confirmDelete = useDeleteConfirmation();
|
||||
const { message } = App.useApp();
|
||||
const { active } = usePageCache();
|
||||
const [showDeleted, setShowDeleted] = useState(false);
|
||||
@@ -262,7 +270,7 @@ export function SourceFilesPanel({ user, sources, sourcesLoaded, loading, pendin
|
||||
const [deletedError, setDeletedError] = useState('');
|
||||
const [workflowStatusLoaded, setWorkflowStatusLoaded] = useState(false);
|
||||
const [selected, setSelected] = useState<{ id: string; restore: boolean } | null>(() => { const id = new URLSearchParams(window.location.search).get('sourceDeleteId'); return id ? { id, restore: false } : null; });
|
||||
const canOperate = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_MAINTAINER', 'DATA_PUBLISHER']);
|
||||
const canOperate = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_ADMIN']);
|
||||
const loadDeleted = useCallback(() => deletedRead.run(async () => {
|
||||
try { const result = await api.deletedSources(); setDeleted(result.items); setDeletedLoaded(true); setDeletedError(''); }
|
||||
catch (value) { if (!onUnauthorized(value)) setDeletedError(failure(value)); }
|
||||
@@ -311,7 +319,7 @@ export function SourceFilesPanel({ user, sources, sourcesLoaded, loading, pendin
|
||||
const onCurrentRelease = currentSourceIds?.includes(row.id) ?? false;
|
||||
const permitted = !simplified || (showDeleted ? workflowStatus?.capabilities?.canRestoreSource !== false : currentSourceIds !== null && workflowStatus?.capabilities?.canDeleteSource !== false && (!onCurrentRelease || workflowStatus?.capabilities?.canDeleteCurrentSource !== false));
|
||||
if (!workflowStatusLoaded || !canOperate || !permitted) return null;
|
||||
return <Button type="link" danger={!showDeleted} icon={showDeleted ? <UndoOutlined /> : <DeleteOutlined />} disabled={sourceOperation.busy || maintenanceBusy || loading} onClick={() => simplified ? showDeleted ? void runSourceOperation(row.id, true) : onToggleDelete(row.id) : setSelected({ id: row.id, restore: showDeleted })}>{simplified ? showDeleted ? '恢复并更新报表' : pendingIds.includes(row.id) ? '撤销删除' : '删除' : showDeleted ? '恢复' : '删除'}</Button>;
|
||||
return <Button type="link" danger={!showDeleted} icon={showDeleted ? <UndoOutlined /> : <DeleteOutlined />} disabled={sourceOperation.busy || maintenanceBusy || loading} onClick={() => {if(!simplified){setSelected({id:row.id,restore:showDeleted});return;}if(showDeleted){void runSourceOperation(row.id,true);return;}if(pendingIds.includes(row.id)){onToggleDelete(row.id);return;}confirmDelete({title:`删除来源“${row.sourceFile}”?`,description:"将标记为待删除,当前报表暂不改变。点击“更新报表”后才生效,原文件和处理记录保留。",confirmText:"标记删除",onConfirm:()=>onToggleDelete(row.id)});}}>{simplified ? showDeleted ? '恢复并更新报表' : pendingIds.includes(row.id) ? '撤销删除' : '删除' : showDeleted ? '恢复' : '删除'}</Button>;
|
||||
} },
|
||||
]} locale={{ emptyText: showDeleted ? '没有已删除的来源。' : '尚无来源文件,点击“上传新数据”开始。' }} /> : null}
|
||||
</section>
|
||||
@@ -334,7 +342,7 @@ function SourceDeletionDialog({ user, sourceId, restoring, sources, onUnauthoriz
|
||||
const request = preview?.changeRequest; const requestStatus = String(request?.status || '');
|
||||
const isRequested = preview?.nextAction === 'REVIEW_WITHDRAWAL'; const isApproved = preview?.nextAction === 'BUILD_WITHDRAWAL_CANDIDATE'; const isBuilt = preview?.nextAction === 'RECONCILE_CANDIDATE';
|
||||
const withdrawing = preview?.mode === 'WITHDRAW_CURRENT' || isRequested || isApproved || isBuilt;
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_PUBLISHER']);
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_ADMIN']);
|
||||
const canReview = preview?.canReview ?? canPublish; const canBuild = preview?.canBuild ?? canPublish;
|
||||
const awaitingTask = preview?.nextAction === 'WAIT_FOR_TASK';
|
||||
const canStart = Boolean(preview?.canDelete && !awaitingTask && !preview.hidden && !isRequested && !isApproved && !isBuilt);
|
||||
@@ -422,7 +430,7 @@ function DataUploadWizard({ user, mode, purpose, handoffSourceId, initialReason,
|
||||
const [differenceReason, setDifferenceReason] = useState(''); const [confirmDifferences, setConfirmDifferences] = useState(false); const [publishConfirmed, setPublishConfirmed] = useState(false); const [published, setPublished] = useState(false);
|
||||
const target = options.targets.find(item => item.documentId === targetId); const fields = options.fields[stage] || [];
|
||||
const headers = workbook?.preview.headers || []; const missingFields = fields.filter(field => field.required && !fieldMap[field.name]); const duplicateColumns = Object.values(fieldMap).length !== new Set(Object.values(fieldMap)).size;
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_PUBLISHER']);
|
||||
const canPublish = rolesAllow(user, ['SYSTEM_ADMIN', 'DATA_ADMIN']);
|
||||
const reportError = useCallback((value: unknown) => { if (!onUnauthorized(value)) setError(failure(value)); }, [onUnauthorized]);
|
||||
const loadCandidate = async (id: string, isCurrent: () => boolean = () => activeRef.current) => {
|
||||
if (!activeRef.current || !isCurrent()) return false;
|
||||
|
||||
Reference in New Issue
Block a user