应征入伍保留学籍申请表-附件上传

This commit is contained in:
2025-11-17 17:45:23 +08:00
parent 7292888c7f
commit dcef075410
5 changed files with 243 additions and 70 deletions

View File

@@ -132,14 +132,23 @@ export default {
console.log(res.savePath)
if(item.name == res.trueName && item.status == 1){
this.fileList[i].id = res.id
this.fileList[i].status = 2
this.fileList[i].savePath = this.baseurl + res.savePath
if(this.isImageURL(res.savePath)){
this.previewList.push( this.fileList[i].savePath)
}
this.fileList[i].id = res.id
this.fileList[i].status = 2
this.fileList[i].savePath = this.baseurl + res.savePath
if(this.isImageURL(res.savePath)){
this.previewList.push( this.fileList[i].savePath)
}
// this.fileList[i].savePaths =[this.baseurl + res.savePath];
// 上传成功后向外传递当前文件的完整信息包含后端返回的res数据
this.$emit('fileUploaded', {
fileId: res.id, // 文件ID
fileName: res.trueName, // 文件名
filePath: res.savePath, // 文件相对路径不含baseurl
fullPath: this.fileList[i].savePath, // 完整路径含baseurl
fileType: this.getFileType(res.trueName), // 文件类型
originalFile: file.file // 原始文件对象(可选)
});
}
@@ -153,6 +162,12 @@ export default {
this.uploadCnt--
})
},
// 获取文件类型的方法Affix组件中新增
getFileType(fileName) {
if (!fileName) return '';
const lastDotIndex = fileName.lastIndexOf('.');
return lastDotIndex > -1 ? fileName.substring(lastDotIndex + 1).toLowerCase() : '';
},
handleBeforeUpload(file) {
if (this.affixId == null || this.affixId === '') {