feat(api): uploadDocumentToServer 增加 attribute_type 参数
This commit is contained in:
@@ -2,6 +2,7 @@ import { postgrestGet, type PostgrestParams } from '../postgrest-client';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
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, type ContractType } from '~/constants/contractTypes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查文档名称是否重复
|
* 检查文档名称是否重复
|
||||||
@@ -371,9 +372,9 @@ export async function appendContractAttachments(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function uploadDocumentToServer(
|
export async function uploadDocumentToServer(
|
||||||
binaryData: ArrayBuffer,
|
binaryData: ArrayBuffer,
|
||||||
fileName: string,
|
fileName: string,
|
||||||
fileType: string,
|
fileType: string,
|
||||||
typeId: string | number,
|
typeId: string | number,
|
||||||
priority: string,
|
priority: string,
|
||||||
documentNumber?: string | null,
|
documentNumber?: string | null,
|
||||||
@@ -382,7 +383,8 @@ export async function uploadDocumentToServer(
|
|||||||
documentId?: number | null,
|
documentId?: number | null,
|
||||||
isReupload: boolean = false,
|
isReupload: boolean = false,
|
||||||
jwtToken?: string,
|
jwtToken?: string,
|
||||||
attachments?: File[]
|
attachments?: File[],
|
||||||
|
attributeType?: string
|
||||||
): Promise<{data: FileUploadResponse; error?: never} | {data?: never; error: string; status?: number}> {
|
): Promise<{data: FileUploadResponse; error?: never} | {data?: never; error: string; status?: number}> {
|
||||||
try {
|
try {
|
||||||
// console.log('【调试】开始上传文档:', { fileName, fileSize: binaryData.byteLength });
|
// console.log('【调试】开始上传文档:', { fileName, fileSize: binaryData.byteLength });
|
||||||
@@ -397,13 +399,14 @@ export async function uploadDocumentToServer(
|
|||||||
|
|
||||||
// 将信息添加到一个JSON对象中
|
// 将信息添加到一个JSON对象中
|
||||||
const uploadInfo = {
|
const uploadInfo = {
|
||||||
type_id: Number(typeId),
|
type_id: Number(typeId),
|
||||||
evaluation_level: priority,
|
evaluation_level: priority,
|
||||||
document_number: documentNumber || null,
|
document_number: documentNumber || null,
|
||||||
remark: remark || null,
|
remark: remark || null,
|
||||||
is_test_document: isTestDocument,
|
is_test_document: isTestDocument,
|
||||||
document_id: documentId || null,
|
document_id: documentId || null,
|
||||||
is_reupload: isReupload
|
is_reupload: isReupload,
|
||||||
|
attribute_type: attributeType || null
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加JSON字符串到FormData
|
// 添加JSON字符串到FormData
|
||||||
|
|||||||
Reference in New Issue
Block a user