feat: 1. 完善交叉评查上传创建任务,改成动态加载文档类型。
2. 重新对齐交叉评查的接口。
This commit is contained in:
@@ -14,7 +14,8 @@ import {
|
||||
type CrossCheckingUploadedFile,
|
||||
generateFileId,
|
||||
formatFileSize,
|
||||
batchUploadAndAssignCrossCheckingFiles
|
||||
batchUploadAndAssignCrossCheckingFiles,
|
||||
createCrossReviewTask
|
||||
} from "~/api/cross-checking/cross-files-upload";
|
||||
import {
|
||||
getCrossCheckingDocumentTypes,
|
||||
@@ -147,48 +148,6 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建交叉评查任务
|
||||
* @param taskData 任务数据
|
||||
* @param token JWT Token
|
||||
* @returns 创建结果
|
||||
*/
|
||||
export async function createCrossReviewTask(taskData: {
|
||||
documentIds: number[];
|
||||
userIds: number[];
|
||||
assignerId: number;
|
||||
taskName: string;
|
||||
docType: string;
|
||||
}, token: string) {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/admin/cross_review/tasks/assign`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
document_ids: taskData.documentIds,
|
||||
user_ids: taskData.userIds,
|
||||
assigner_id: taskData.assignerId,
|
||||
task_name: taskData.taskName,
|
||||
doc_type: taskData.docType
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log('任务创建成功:', result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('创建任务失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export const action = async ({ request }: ActionFunctionArgs) => {
|
||||
const formData = await request.formData();
|
||||
const caseType = formData.get("caseType") as string;
|
||||
@@ -217,7 +176,7 @@ export default function CrossCheckingUpload() {
|
||||
const [taskInfo, setTaskInfo] = useState({
|
||||
name: '',
|
||||
date: '',
|
||||
type: '市局间交叉评查',
|
||||
type: 'CITY', // 使用枚举值,默认为市局间交叉评查
|
||||
});
|
||||
// 步骤2状态
|
||||
const [groupChecked, setGroupChecked] = useState<string[]>(userInfo?.user_id ? [`user_${userInfo.user_id}`] : []);
|
||||
@@ -441,6 +400,7 @@ export default function CrossCheckingUpload() {
|
||||
try {
|
||||
// 获取选中的文档类型信息
|
||||
const selectedDocType = documentTypes?.find((dt: DocumentType) => dt.id === selectedDocTypeId);
|
||||
|
||||
if (!selectedDocType) {
|
||||
toastService.error("无效的案卷类型");
|
||||
return;
|
||||
@@ -460,6 +420,23 @@ export default function CrossCheckingUpload() {
|
||||
return;
|
||||
}
|
||||
|
||||
// const requireParam = {
|
||||
// filesToUpload: filesToUpload,
|
||||
// selectedDocTypeId: selectedDocTypeId,
|
||||
// priority: priority,
|
||||
// documentNumber: documentNumber,
|
||||
// remark: remark,
|
||||
// isTestDocument: isTestDocument,
|
||||
// userIds: userIds,
|
||||
// taskInfo_name: taskInfo.name,
|
||||
// selectedDocType_name: selectedDocType.code,
|
||||
// taskInfo_type: taskInfo.type,
|
||||
// frontendJWT
|
||||
// }
|
||||
|
||||
// console.log("requireParam", requireParam)
|
||||
// return;
|
||||
|
||||
// 使用文档类型名称作为 doc_type
|
||||
const uploadResult = await batchUploadAndAssignCrossCheckingFiles(
|
||||
filesToUpload,
|
||||
@@ -470,10 +447,14 @@ export default function CrossCheckingUpload() {
|
||||
isTestDocument,
|
||||
userIds,
|
||||
taskInfo.name,
|
||||
selectedDocType.name, // 使用文档类型名称
|
||||
selectedDocType.code, // 使用文档类型code
|
||||
taskInfo.type, // 使用任务类型(市局间交叉评查 或 区局间交叉评查)
|
||||
frontendJWT
|
||||
);
|
||||
|
||||
|
||||
// return;
|
||||
|
||||
const { successes, failures } = uploadResult;
|
||||
|
||||
if (failures.length > 0) {
|
||||
@@ -710,8 +691,8 @@ export default function CrossCheckingUpload() {
|
||||
value={taskInfo.type}
|
||||
onChange={e => setTaskInfo({ ...taskInfo, type: e.target.value })}
|
||||
>
|
||||
<option value="市局间交叉评查">市局间交叉评查</option>
|
||||
<option value="区局间交叉评查">区局间交叉评查</option>
|
||||
<option value="CITY">市局间交叉评查</option>
|
||||
<option value="DISTRICT">区局间交叉评查</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="flex justify-between items-center mt-6">
|
||||
|
||||
Reference in New Issue
Block a user