完善文件上传的接口对接
This commit is contained in:
@@ -37,12 +37,12 @@ export function Sidebar({ onToggle, collapsed }: SidebarProps) {
|
||||
path: '/files/upload',
|
||||
icon: 'ri-upload-cloud-line'
|
||||
},
|
||||
{
|
||||
id: 'file-list',
|
||||
title: '文件列表',
|
||||
path: '/files',
|
||||
icon: 'ri-file-list-3-line'
|
||||
},
|
||||
// {
|
||||
// id: 'file-list',
|
||||
// title: '文件列表',
|
||||
// path: '/files',
|
||||
// icon: 'ri-file-list-3-line'
|
||||
// },
|
||||
{
|
||||
id:'documents',
|
||||
title:'文档列表',
|
||||
@@ -80,15 +80,7 @@ export function Sidebar({ onToggle, collapsed }: SidebarProps) {
|
||||
title: '新增评查点',
|
||||
path: '/rules/new',
|
||||
icon: 'ri-add-circle-line'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'review-management',
|
||||
title: '评查结果',
|
||||
path: '/reviews',
|
||||
icon: 'ri-bar-chart-box-line',
|
||||
children: [
|
||||
},
|
||||
{
|
||||
id: 'review-detail',
|
||||
title: '评查详情',
|
||||
|
||||
@@ -50,7 +50,15 @@ export const UploadArea = forwardRef<UploadAreaRef, UploadAreaProps>(({
|
||||
}));
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (!disabled && !shouldPreventFileSelect && fileInputRef.current) {
|
||||
if (disabled) return;
|
||||
|
||||
if (shouldPreventFileSelect) {
|
||||
// 如果应该阻止文件选择,则触发表单提交
|
||||
const form = fileInputRef.current?.closest('form');
|
||||
if (form) {
|
||||
form.requestSubmit();
|
||||
}
|
||||
} else if (fileInputRef.current) {
|
||||
fileInputRef.current.click();
|
||||
}
|
||||
}, [disabled, shouldPreventFileSelect]);
|
||||
@@ -76,7 +84,15 @@ export const UploadArea = forwardRef<UploadAreaRef, UploadAreaProps>(({
|
||||
e.preventDefault();
|
||||
setIsDragOver(false);
|
||||
|
||||
if (!disabled && !shouldPreventFileSelect && e.dataTransfer.files.length > 0) {
|
||||
if (disabled) return;
|
||||
|
||||
if (shouldPreventFileSelect) {
|
||||
// 如果应该阻止文件选择,则触发表单提交
|
||||
const form = e.currentTarget.closest('form');
|
||||
if (form) {
|
||||
form.requestSubmit();
|
||||
}
|
||||
} else if (e.dataTransfer.files.length > 0) {
|
||||
onFilesSelected(e.dataTransfer.files);
|
||||
}
|
||||
}, [disabled, shouldPreventFileSelect, onFilesSelected]);
|
||||
|
||||
Reference in New Issue
Block a user