feat(review-meeting): 上传前生成标准资料文件名
parent
2c70c062a2
commit
f5789503eb
|
|
@ -130,6 +130,12 @@ export interface ReviewMeetingMaterialUploadReqVO {
|
||||||
fileType?: string
|
fileType?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ReviewMeetingMaterialUploadFileNameReqVO {
|
||||||
|
reviewMeetingProjectId: number
|
||||||
|
materialCode: string
|
||||||
|
originalFileName: string
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// API 调用
|
// API 调用
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -208,6 +214,13 @@ export const getProjectMaterialHistory = (reviewMeetingProjectId: number, materi
|
||||||
params: { reviewMeetingProjectId, materialCode }
|
params: { reviewMeetingProjectId, materialCode }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 获取结构化材料上传文件名 */
|
||||||
|
export const getProjectMaterialUploadFileName = (params: ReviewMeetingMaterialUploadFileNameReqVO) =>
|
||||||
|
request.get<string>({
|
||||||
|
url: '/project/review-project/material-upload-file-name',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
|
||||||
/** 下载当前议程分类模板包 */
|
/** 下载当前议程分类模板包 */
|
||||||
export const downloadProjectTemplateBundle = (agendaType: string) =>
|
export const downloadProjectTemplateBundle = (agendaType: string) =>
|
||||||
request.download({
|
request.download({
|
||||||
|
|
@ -222,7 +235,12 @@ export const uploadProjectMaterial = async (
|
||||||
materialCode: string,
|
materialCode: string,
|
||||||
file: File
|
file: File
|
||||||
) => {
|
) => {
|
||||||
const presignedInfo = await FileApi.getFilePresignedUrl(file.name, 'review-meeting')
|
const targetFileName = await getProjectMaterialUploadFileName({
|
||||||
|
reviewMeetingProjectId,
|
||||||
|
materialCode,
|
||||||
|
originalFileName: file.name
|
||||||
|
})
|
||||||
|
const presignedInfo = await FileApi.getFilePresignedUrl(targetFileName, 'review-meeting')
|
||||||
await axios.put(presignedInfo.uploadUrl, file, {
|
await axios.put(presignedInfo.uploadUrl, file, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': file.type || 'application/octet-stream'
|
'Content-Type': file.type || 'application/octet-stream'
|
||||||
|
|
@ -233,7 +251,7 @@ export const uploadProjectMaterial = async (
|
||||||
configId: presignedInfo.configId,
|
configId: presignedInfo.configId,
|
||||||
url: presignedInfo.url,
|
url: presignedInfo.url,
|
||||||
path: presignedInfo.path,
|
path: presignedInfo.path,
|
||||||
name: file.name,
|
name: targetFileName,
|
||||||
type: file.type || 'application/octet-stream',
|
type: file.type || 'application/octet-stream',
|
||||||
size: file.size
|
size: file.size
|
||||||
})
|
})
|
||||||
|
|
@ -244,10 +262,10 @@ export const uploadProjectMaterial = async (
|
||||||
reviewMeetingId,
|
reviewMeetingId,
|
||||||
reviewMeetingProjectId,
|
reviewMeetingProjectId,
|
||||||
materialCode,
|
materialCode,
|
||||||
fileName: file.name,
|
fileName: targetFileName,
|
||||||
fileUrl: presignedInfo.url,
|
fileUrl: presignedInfo.url,
|
||||||
fileSize: file.size,
|
fileSize: file.size,
|
||||||
fileType: file.name.includes('.') ? file.name.split('.').pop()?.toLowerCase() : ''
|
fileType: targetFileName.includes('.') ? targetFileName.split('.').pop()?.toLowerCase() : ''
|
||||||
} satisfies ReviewMeetingMaterialUploadReqVO
|
} satisfies ReviewMeetingMaterialUploadReqVO
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue