添加jwt验证,添加交叉评查首页加载对接接口,评查任务文档列表对接接口,意见列表对接接口
This commit is contained in:
@@ -133,6 +133,7 @@ export async function uploadFileToBinary(file: File): Promise<ArrayBuffer> {
|
||||
* @param isTestDocument 是否为测试文档
|
||||
* @param documentId 关联的文档ID(用于合同附件上传)
|
||||
* @param isReupload 是否为重新上传
|
||||
* @param jwtToken JWT token
|
||||
* @returns 上传结果
|
||||
*/
|
||||
export async function uploadDocumentToServer(
|
||||
@@ -145,7 +146,8 @@ export async function uploadDocumentToServer(
|
||||
remark?: string | null,
|
||||
isTestDocument: boolean = false,
|
||||
documentId?: number | null,
|
||||
isReupload: boolean = false
|
||||
isReupload: boolean = false,
|
||||
jwtToken?: string
|
||||
): Promise<{data: FileUploadResponse; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
// console.log('【调试】开始上传文档:', { fileName, fileSize: binaryData.byteLength });
|
||||
@@ -185,7 +187,8 @@ export async function uploadDocumentToServer(
|
||||
const response = await fetch(uploadUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-File-Name': encodeURIComponent(fileName)
|
||||
'X-File-Name': encodeURIComponent(fileName),
|
||||
'Authorization': `Bearer ${jwtToken || ''}`
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
@@ -242,11 +245,20 @@ export async function uploadDocumentToServer(
|
||||
|
||||
/**
|
||||
* 获取当天的文档列表
|
||||
* @param userInfo 用户信息(必需)
|
||||
* @param reviewType 审核类型(可选)
|
||||
* @returns 文档列表
|
||||
*/
|
||||
export async function getTodayDocuments(reviewType?: string): Promise<{data: Document[]; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
export async function getTodayDocuments(userInfo?: { user_id?: number; [key: string]: unknown }, reviewType?: string): Promise<{data: Document[]; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
// 检查用户信息是否存在
|
||||
if (!userInfo?.user_id) {
|
||||
return {
|
||||
error: '没有找到用户信息,请刷新重试',
|
||||
status: 401
|
||||
};
|
||||
}
|
||||
|
||||
const today = dayjs().startOf('day').format('YYYY-MM-DD');
|
||||
// console.log('查询当天文档,日期范围:', today);
|
||||
|
||||
@@ -276,10 +288,12 @@ export async function getTodayDocuments(reviewType?: string): Promise<{data: Doc
|
||||
order: 'created_at.desc',
|
||||
filter: {
|
||||
'created_at': `gte.${today}`,
|
||||
'type_id': 'eq.1'
|
||||
'type_id': 'eq.1',
|
||||
'user_id': `eq.${userInfo.user_id}`
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 查询contract_structure_comparison表中的数据
|
||||
// const comparisonParams: PostgrestParams = {
|
||||
// select: `
|
||||
@@ -391,7 +405,8 @@ export async function getTodayDocuments(reviewType?: string): Promise<{data: Doc
|
||||
`,
|
||||
order: 'created_at.desc',
|
||||
filter: {
|
||||
'created_at': `gte.${today}`
|
||||
'created_at': `gte.${today}`,
|
||||
'user_id': `eq.${userInfo.user_id}`
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user