File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1616from apps .data_training .models .data_training_model import DataTrainingInfo
1717from common .core .config import settings
1818from common .core .deps import SessionDep , CurrentUser , Trans
19+ from common .core .file import FileRequest
1920from common .utils .data_format import DataFormat
2021
2122router = APIRouter (tags = ["DataTraining" ], prefix = "/system/data-training" )
@@ -214,11 +215,12 @@ def inner():
214215 return await asyncio .to_thread (inner )
215216
216217
217- @router .get ("/download-fail-info/{filename} " )
218- async def download_excel (filename : str , trans : Trans ):
218+ @router .post ("/download-fail-info" )
219+ async def download_excel (req : FileRequest ):
219220 """
220221 根据文件路径下载 Excel 文件
221222 """
223+ filename = req .file
222224 file_path = os .path .join (path , filename )
223225
224226 # 检查文件是否存在
Original file line number Diff line number Diff line change 1+ from pydantic import BaseModel
2+
3+ class FileRequest (BaseModel ):
4+ file : str
Original file line number Diff line number Diff line change @@ -16,8 +16,12 @@ export const trainingApi = {
1616 requestOptions : { customError : true } ,
1717 } ) ,
1818 downloadError : ( path : any ) =>
19- request . get ( `/system/data-training/download-fail-info/${ path } ` , {
20- responseType : 'blob' ,
21- requestOptions : { customError : true } ,
22- } ) ,
19+ request . post (
20+ `/system/data-training/download-fail-info` ,
21+ { file : path } ,
22+ {
23+ responseType : 'blob' ,
24+ requestOptions : { customError : true } ,
25+ }
26+ ) ,
2327}
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ const onSuccess = (response: any) => {
134134 })
135135 const link = document .createElement (' a' )
136136 link .href = URL .createObjectURL (blob )
137- link .download = ` ${ t ( ' training.data_training ' )}_error.xlsx `
137+ link .download = response . data . error_excel_filename
138138 document .body .appendChild (link )
139139 link .click ()
140140 document .body .removeChild (link )
You can’t perform that action at this time.
0 commit comments