feat(cross-checking): 交叉评查上传支持合同类型选择

This commit is contained in:
2026-03-18 22:00:26 +08:00
parent 9fd222ef3d
commit 62a8f4b13d
2 changed files with 35 additions and 3 deletions
+5 -2
View File
@@ -1,5 +1,6 @@
import { UPLOAD_URL, API_BASE_URL } from '../../config/api-config';
import axios from 'axios';
import { CONTRACT_TYPES, DEFAULT_CONTRACT_TYPE } from '~/constants/contractTypes';
/**
* 从不同格式的 API 响应中提取数据
@@ -224,7 +225,8 @@ export async function batchUploadAndAssignCrossCheckingFiles(
docType: string,
taskType: string = '市局间交叉评查',
token: string | null = null,
principalUserIds: number[] = []
principalUserIds: number[] = [],
attributeType?: string
): Promise<{
successes: Array<{file: CrossCheckingUploadedFile; result: Record<string, unknown>}>;
failures: Array<{file: CrossCheckingUploadedFile; error: string}>;
@@ -249,7 +251,8 @@ export async function batchUploadAndAssignCrossCheckingFiles(
is_test_document: isTestDocument,
task_name: taskName,
doc_type: typeof docType === 'string' ? docType.toUpperCase() : docType,
task_type: taskType
task_type: taskType,
attribute_type: attributeType || null
};
// console.log('fileInfo', fileInfo)
+30 -1
View File
@@ -32,6 +32,7 @@ import {
type UserInfo
} from "~/api/user/user-management";
import { API_BASE_URL } from '~/config/api-config';
import { CONTRACT_TYPES, DEFAULT_CONTRACT_TYPE } from '~/constants/contractTypes';
export const meta: MetaFunction = () => {
return [
@@ -173,6 +174,7 @@ export default function CrossCheckingUpload() {
const [documentNumber] = useState<string>("");
const [remark] = useState<string>("");
const [isTestDocument] = useState<boolean>(false);
const [attributeType, setAttributeType] = useState<string>(DEFAULT_CONTRACT_TYPE);
// 文件管理状态 - 简化为单文件上传
const [uploadedFile, setUploadedFile] = useState<CrossCheckingUploadedFile | null>(null);
@@ -358,7 +360,8 @@ export default function CrossCheckingUpload() {
selectedDocType.code, // 使用文档类型code
taskInfo.type, // 使用任务类型(市局间交叉评查 或 区局间交叉评查)
frontendJWT,
principalUserIds // 负责人ID数组
principalUserIds, // 负责人ID数组
attributeType // 合同类型
);
@@ -987,6 +990,32 @@ export default function CrossCheckingUpload() {
</div>
</div>
{/* 合同类型选择器 - 仅在选择合同类型文档时显示 */}
{selectedDocTypeId === 1 && (
<div className="flex justify-center mb-6">
<div className="w-full max-w-2xl">
<div className="text-sm font-medium text-gray-700 mb-3 text-center"></div>
<div className="grid grid-cols-4 gap-2">
{CONTRACT_TYPES.map((type) => (
<button
key={type.value}
type="button"
className={`px-3 py-2 text-sm rounded-md border transition-colors ${
attributeType === type.value
? 'bg-[var(--color-primary)] text-white border-[var(--color-primary)]'
: 'bg-white text-gray-700 border-gray-300 hover:bg-gray-50'
}`}
onClick={() => setAttributeType(type.value)}
disabled={isUploading}
>
{type.label}
</button>
))}
</div>
</div>
</div>
)}
{/* 文件上传区域 - 左右布局 */}
<input type="hidden" name="selectedDocTypeId" value={selectedDocTypeId || ''} />