feat(cross-checking): 交叉评查上传支持合同类型选择
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { UPLOAD_URL, API_BASE_URL } from '../../config/api-config';
|
import { UPLOAD_URL, API_BASE_URL } from '../../config/api-config';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { CONTRACT_TYPES, DEFAULT_CONTRACT_TYPE } from '~/constants/contractTypes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从不同格式的 API 响应中提取数据
|
* 从不同格式的 API 响应中提取数据
|
||||||
@@ -224,7 +225,8 @@ export async function batchUploadAndAssignCrossCheckingFiles(
|
|||||||
docType: string,
|
docType: string,
|
||||||
taskType: string = '市局间交叉评查',
|
taskType: string = '市局间交叉评查',
|
||||||
token: string | null = null,
|
token: string | null = null,
|
||||||
principalUserIds: number[] = []
|
principalUserIds: number[] = [],
|
||||||
|
attributeType?: string
|
||||||
): Promise<{
|
): Promise<{
|
||||||
successes: Array<{file: CrossCheckingUploadedFile; result: Record<string, unknown>}>;
|
successes: Array<{file: CrossCheckingUploadedFile; result: Record<string, unknown>}>;
|
||||||
failures: Array<{file: CrossCheckingUploadedFile; error: string}>;
|
failures: Array<{file: CrossCheckingUploadedFile; error: string}>;
|
||||||
@@ -249,7 +251,8 @@ export async function batchUploadAndAssignCrossCheckingFiles(
|
|||||||
is_test_document: isTestDocument,
|
is_test_document: isTestDocument,
|
||||||
task_name: taskName,
|
task_name: taskName,
|
||||||
doc_type: typeof docType === 'string' ? docType.toUpperCase() : docType,
|
doc_type: typeof docType === 'string' ? docType.toUpperCase() : docType,
|
||||||
task_type: taskType
|
task_type: taskType,
|
||||||
|
attribute_type: attributeType || null
|
||||||
};
|
};
|
||||||
// console.log('fileInfo', fileInfo)
|
// console.log('fileInfo', fileInfo)
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import {
|
|||||||
type UserInfo
|
type UserInfo
|
||||||
} from "~/api/user/user-management";
|
} from "~/api/user/user-management";
|
||||||
import { API_BASE_URL } from '~/config/api-config';
|
import { API_BASE_URL } from '~/config/api-config';
|
||||||
|
import { CONTRACT_TYPES, DEFAULT_CONTRACT_TYPE } from '~/constants/contractTypes';
|
||||||
|
|
||||||
export const meta: MetaFunction = () => {
|
export const meta: MetaFunction = () => {
|
||||||
return [
|
return [
|
||||||
@@ -173,6 +174,7 @@ export default function CrossCheckingUpload() {
|
|||||||
const [documentNumber] = useState<string>("");
|
const [documentNumber] = useState<string>("");
|
||||||
const [remark] = useState<string>("");
|
const [remark] = useState<string>("");
|
||||||
const [isTestDocument] = useState<boolean>(false);
|
const [isTestDocument] = useState<boolean>(false);
|
||||||
|
const [attributeType, setAttributeType] = useState<string>(DEFAULT_CONTRACT_TYPE);
|
||||||
|
|
||||||
// 文件管理状态 - 简化为单文件上传
|
// 文件管理状态 - 简化为单文件上传
|
||||||
const [uploadedFile, setUploadedFile] = useState<CrossCheckingUploadedFile | null>(null);
|
const [uploadedFile, setUploadedFile] = useState<CrossCheckingUploadedFile | null>(null);
|
||||||
@@ -358,7 +360,8 @@ export default function CrossCheckingUpload() {
|
|||||||
selectedDocType.code, // 使用文档类型code
|
selectedDocType.code, // 使用文档类型code
|
||||||
taskInfo.type, // 使用任务类型(市局间交叉评查 或 区局间交叉评查)
|
taskInfo.type, // 使用任务类型(市局间交叉评查 或 区局间交叉评查)
|
||||||
frontendJWT,
|
frontendJWT,
|
||||||
principalUserIds // 负责人ID数组
|
principalUserIds, // 负责人ID数组
|
||||||
|
attributeType // 合同类型
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -987,6 +990,32 @@ export default function CrossCheckingUpload() {
|
|||||||
</div>
|
</div>
|
||||||
</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 || ''} />
|
<input type="hidden" name="selectedDocTypeId" value={selectedDocTypeId || ''} />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user