fix: 1. 优化collabora的高亮效果,不固定主要页面。
2. 优化评查结果中的下载按钮,如果加载docx文件的话需要先保存再下载。 3. 交叉评查结果中添加返回按钮,并实现打开对应的任务的文档列表。 4. 文档类型的添加,添加绑定合同管理为入口的时候文档类型名称必须是要附带‘合同’字符。
This commit is contained in:
@@ -1502,6 +1502,7 @@ export function ReviewPointsList({
|
||||
if (mainTypeValue.page && typeof onReviewPointSelect === 'function') {
|
||||
console.log("点击了其他评查点", mainTypeValue)
|
||||
onReviewPointSelect(reviewPoint.id, Number(mainTypeValue.page), mainTypeValue.char_positions, mainTypeValue.value);
|
||||
// onReviewPointSelect(reviewPoint.id, undefined, mainTypeValue.char_positions, mainTypeValue.value);
|
||||
}else if(reviewPoint.contentPage && reviewPoint.contentPage[fieldKey]){
|
||||
onReviewPointSelect(reviewPoint.id, Number(reviewPoint.contentPage[fieldKey]), mainTypeValue.char_positions, mainTypeValue.value);
|
||||
}else{
|
||||
|
||||
@@ -28,13 +28,16 @@ interface ReviewTabsProps {
|
||||
};
|
||||
onConfirmResults: () => void;
|
||||
jwtToken?: string | null;
|
||||
/** 下载前保存文档的回调,返回 true 表示保存成功可以继续下载 */
|
||||
onSaveBeforeDownload?: () => Promise<boolean>;
|
||||
}
|
||||
|
||||
export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfirmResults, jwtToken }: ReviewTabsProps) {
|
||||
export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfirmResults, jwtToken, onSaveBeforeDownload }: ReviewTabsProps) {
|
||||
const [isNavigating, setIsNavigating] = useState(false);
|
||||
const [isReuploadModalOpen, setIsReuploadModalOpen] = useState(false);
|
||||
const [selectedTemplateFiles, setSelectedTemplateFiles] = useState<File[]>([]);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [isSaving, setIsSaving] = useState(false); // 下载前保存文档的状态
|
||||
const uploadAreaRef = useRef<UploadAreaRef>(null);
|
||||
const navigate = useNavigate();
|
||||
const revalidator = useRevalidator();
|
||||
@@ -64,6 +67,23 @@ export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfi
|
||||
// 下载原文件
|
||||
const handleDownloadFile = async () => {
|
||||
try {
|
||||
// 如果有保存回调,先执行保存(仅对 DOCX 文件有效)
|
||||
if (onSaveBeforeDownload) {
|
||||
setIsSaving(true);
|
||||
toastService.info('正在保存文档...');
|
||||
|
||||
const saveSuccess = await onSaveBeforeDownload();
|
||||
|
||||
setIsSaving(false);
|
||||
|
||||
if (!saveSuccess) {
|
||||
toastService.error('保存失败,下载已取消');
|
||||
return;
|
||||
}
|
||||
|
||||
toastService.success('文档已保存,开始下载...');
|
||||
}
|
||||
|
||||
// 使用 PDF 代理路由获取文件,自动添加 JWT 认证
|
||||
const downloadUrl = `/api/pdf-proxy?path=${encodeURIComponent(fileInfo.path || '')}`;
|
||||
|
||||
@@ -95,7 +115,7 @@ export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfi
|
||||
}, 100);
|
||||
} catch (error) {
|
||||
console.error('下载文件失败:', error);
|
||||
alert(`下载文件失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
||||
toastService.error(`下载文件失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -279,8 +299,17 @@ export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfi
|
||||
<button
|
||||
className="ant-btn ant-btn-default inline-flex items-center my-2"
|
||||
onClick={handleDownloadFile}
|
||||
disabled={isSaving}
|
||||
>
|
||||
<i className="ri-file-download-line mr-1"></i> 下载
|
||||
{isSaving ? (
|
||||
<>
|
||||
<i className="ri-loader-4-line mr-1 animate-spin"></i> 保存中...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<i className="ri-file-download-line mr-1"></i> 下载
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
{/* <button
|
||||
className="ant-btn ant-btn-default flex items-center"
|
||||
|
||||
Reference in New Issue
Block a user