fix: 1. 修改dockerFile
2. 修复一些合同起草的刷新报错问题
This commit is contained in:
@@ -231,6 +231,10 @@ export default function DocumentsIndex() {
|
||||
const [attachmentRemark, setAttachmentRemark] = useState<string>("");
|
||||
const [attachmentUploading, setAttachmentUploading] = useState<boolean>(false);
|
||||
const [templateUploading, setTemplateUploading] = useState<boolean>(false);
|
||||
|
||||
// 拖拽状态
|
||||
const [isDraggingAttachment, setIsDraggingAttachment] = useState<boolean>(false);
|
||||
const [isDraggingTemplate, setIsDraggingTemplate] = useState<boolean>(false);
|
||||
|
||||
// 查询参数记忆 key 与保存/恢复方法
|
||||
const SEARCH_PARAMS_STORAGE_KEY = 'documents.searchParams';
|
||||
@@ -970,7 +974,7 @@ export default function DocumentsIndex() {
|
||||
|
||||
try {
|
||||
setTemplateUploading(true);
|
||||
|
||||
|
||||
const result = await uploadContractTemplate(
|
||||
templateFile,
|
||||
selectedDocumentId,
|
||||
@@ -994,7 +998,7 @@ export default function DocumentsIndex() {
|
||||
if (documentTypeIds && documentTypeIds.length > 0) {
|
||||
fetchData(documentTypeIds);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('【合同模板上传】上传失败:', error);
|
||||
toastService.error(error instanceof Error ? error.message : '合同模板上传失败');
|
||||
@@ -1003,6 +1007,64 @@ export default function DocumentsIndex() {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理附件拖拽事件
|
||||
const handleAttachmentDragEnter = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingAttachment(true);
|
||||
};
|
||||
|
||||
const handleAttachmentDragOver = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const handleAttachmentDragLeave = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingAttachment(false);
|
||||
};
|
||||
|
||||
const handleAttachmentDrop = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingAttachment(false);
|
||||
|
||||
const files = e.dataTransfer.files;
|
||||
if (files && files.length > 0) {
|
||||
handleAttachmentFilesSelected(files);
|
||||
}
|
||||
};
|
||||
|
||||
// 处理模板拖拽事件
|
||||
const handleTemplateDragEnter = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingTemplate(true);
|
||||
};
|
||||
|
||||
const handleTemplateDragOver = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const handleTemplateDragLeave = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingTemplate(false);
|
||||
};
|
||||
|
||||
const handleTemplateDrop = (e: React.DragEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDraggingTemplate(false);
|
||||
|
||||
const files = e.dataTransfer.files;
|
||||
if (files && files.length > 0) {
|
||||
handleTemplateFileSelected(files);
|
||||
}
|
||||
};
|
||||
|
||||
// 展开/折叠历史版本
|
||||
const handleToggleExpand = async (doc: DocumentUI) => {
|
||||
const newExpanded = new Set(expandedRows);
|
||||
@@ -1725,7 +1787,17 @@ export default function DocumentsIndex() {
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
选择附件文件 <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors">
|
||||
<div
|
||||
className={`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${
|
||||
isDraggingAttachment
|
||||
? 'border-primary bg-primary-light'
|
||||
: 'border-gray-300 hover:border-gray-400'
|
||||
}`}
|
||||
onDragEnter={handleAttachmentDragEnter}
|
||||
onDragOver={handleAttachmentDragOver}
|
||||
onDragLeave={handleAttachmentDragLeave}
|
||||
onDrop={handleAttachmentDrop}
|
||||
>
|
||||
<input
|
||||
type="file"
|
||||
multiple
|
||||
@@ -1735,8 +1807,10 @@ export default function DocumentsIndex() {
|
||||
id="attachment-file-input"
|
||||
/>
|
||||
<label htmlFor="attachment-file-input" className="cursor-pointer">
|
||||
<i className="ri-attachment-line text-3xl text-gray-400 mb-2 block"></i>
|
||||
<p className="text-sm text-gray-600">点击选择文件或拖拽文件到此处</p>
|
||||
<i className={`ri-attachment-line text-3xl mb-2 block ${isDraggingAttachment ? 'text-primary' : 'text-gray-400'}`}></i>
|
||||
<p className={`text-sm ${isDraggingAttachment ? 'text-primary font-medium' : 'text-gray-600'}`}>
|
||||
{isDraggingAttachment ? '松开鼠标上传文件' : '点击选择文件或拖拽文件到此处'}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 mt-1">支持.pdf、.docx、.zip、.rar格式,可多选</p>
|
||||
</label>
|
||||
</div>
|
||||
@@ -1885,7 +1959,17 @@ export default function DocumentsIndex() {
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
选择模板文件 <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors">
|
||||
<div
|
||||
className={`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${
|
||||
isDraggingTemplate
|
||||
? 'border-primary bg-primary-light'
|
||||
: 'border-gray-300 hover:border-gray-400'
|
||||
}`}
|
||||
onDragEnter={handleTemplateDragEnter}
|
||||
onDragOver={handleTemplateDragOver}
|
||||
onDragLeave={handleTemplateDragLeave}
|
||||
onDrop={handleTemplateDrop}
|
||||
>
|
||||
<input
|
||||
type="file"
|
||||
accept=".pdf,.docx"
|
||||
@@ -1894,8 +1978,10 @@ export default function DocumentsIndex() {
|
||||
id="template-file-input"
|
||||
/>
|
||||
<label htmlFor="template-file-input" className="cursor-pointer">
|
||||
<i className="ri-file-copy-line text-3xl text-gray-400 mb-2 block"></i>
|
||||
<p className="text-sm text-gray-600">点击选择文件或拖拽文件到此处</p>
|
||||
<i className={`ri-file-copy-line text-3xl mb-2 block ${isDraggingTemplate ? 'text-primary' : 'text-gray-400'}`}></i>
|
||||
<p className={`text-sm ${isDraggingTemplate ? 'text-primary font-medium' : 'text-gray-600'}`}>
|
||||
{isDraggingTemplate ? '松开鼠标上传文件' : '点击选择文件或拖拽文件到此处'}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 mt-1">支持.pdf、.docx格式</p>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user