人员审查兼容修改

ln_ry20250512
dshclm 4 days ago
parent 99f5a6a122
commit 1d00dfc711

@ -399,12 +399,12 @@
rejectReason: '',
},
computed: {
previewUrl() {
previewUrl: function() {
return this.selectedFile ? window.URL.createObjectURL(this.selectedFile) : '';
}
},
methods: {
downloadFile(file) {
downloadFile: function(file) {
// 直接通过接口下载
axios.get(ctx + 'system/file/download',{
params: { fileId: file.id },
@ -413,22 +413,22 @@
'Content-Type': 'application/json',
}
})
.then(response => {
let url = window.URL.createObjectURL(new Blob([response.data]));
let link = document.createElement('a');
.then(function(response) {
var url = window.URL.createObjectURL(new Blob([response.data]));
var link = document.createElement('a');
link.href = url;
link.setAttribute('download', file.fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
.catch(error => {
.catch(function(error) {
console.error('下载错误:', error);
alert('下载文件时出错');
});
},
// 新增通过申请方法
approveApplication() {
approveApplication: function() {
if (this.uploadedFiles.length === 0) {
alert('请上传所需材料');
return;
@ -437,17 +437,17 @@
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).then(function() {
$.operate.saveTab(`${this.prefix}/submitAudit`,{applyId:this.formData.applyId});
}).catch(() => {
}.bind(this)).catch(function() {
this.$message({
type: 'info',
message: '已取消'
});
});
}.bind(this));
},
// 新增显示退回对话框方法
showRejectDialog() {
showRejectDialog: function() {
if (this.uploadedFiles.length === 0) {
alert('请上传所需材料');
return;
@ -457,7 +457,7 @@
this.rejectReason = '';
},
// 新增退回申请方法
rejectApplication() {
rejectApplication: function() {
if (!this.rejectReason.trim()) {
alert('请输入退回原因');
return;
@ -469,7 +469,7 @@
});
},
// 获取已上传文件
getUploadedFiles() {
getUploadedFiles: function() {
if (!this.formData.applyId) return;
axios.get(ctx + 'system/file/getFileInfo', {
params: {
@ -477,9 +477,9 @@
fileCode:'bm_user_audit_001',
}
})
.then(response => {
.then(function(response) {
if (response.data.code === web_status.SUCCESS) {
this.uploadedFiles = response.data.data.map((file)=>{
this.uploadedFiles = response.data.data.map(function(file) {
return {
id: file.fileId,
fileName: file.fileName,
@ -488,32 +488,32 @@
fileUrl: file.filePath,
uploadTime: file.createTime
}
})
});
}
})
.catch(error => {
}.bind(this))
.catch(function(error) {
console.error('获取文件列表错误:', error);
alert('获取已上传文件时出错');
});
},
// 新增图片预览相关方法
isImageFile(fileName) {
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','pdf'];
const extension = fileName.split('.').pop().toLowerCase();
isImageFile: function(fileName) {
var imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','pdf'];
var extension = fileName.split('.').pop().toLowerCase();
return imageExtensions.includes(extension);
},
getFileIcon(fileName) {
const extension = fileName.split('.').pop().toLowerCase();
getFileIcon: function(fileName) {
var extension = fileName.split('.').pop().toLowerCase();
if (extension === 'pdf') return 'fa-solid fa-file-pdf text-red-500';
if (['doc', 'docx'].includes(extension)) return 'fa-solid fa-file-word text-blue-500';
if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(extension)) return 'fa-solid fa-file-image text-green-500';
return 'fa-solid fa-file text-gray-500';
},
previewFile(file) {
let extension = file.fileName.split('.').pop().toLowerCase();
previewFile: function(file) {
var extension = file.fileName.split('.').pop().toLowerCase();
if (extension === 'pdf') {
// 使用preventDefault阻止默认行为避免影响当前页面状态
let event = window.event;
var event = window.event;
if (event) {
event.preventDefault();
}
@ -523,11 +523,11 @@
this.previewingFile = file;
this.previewModalVisible = true;
},
closePreviewModal() {
closePreviewModal: function() {
this.previewModalVisible = false;
this.previewingFile = {};
},
getPreviewUrl(file) {
getPreviewUrl: function(file) {
// 如果是图片直接返回URL
if (this.isImageFile(file.fileName)) {
return ctx + 'system/file/download?fileId=' + file.id;
@ -535,18 +535,18 @@
return '';
}
},
mounted() {
mounted: function() {
// 从后端获取转义后的 JSON 字符串
if ([[${applyInfoList}]]){
this.formData = {...[[${applyInfoList}]]}
// 获取图片并转换为 Blob
if (this.formData.photoUrl) {
fetch(this.formData.photoUrl)
.then(response => response.blob())
.then(blob => {
.then(function(response) { return response.blob(); })
.then(function(blob) {
this.selectedFile = blob;
})
.catch(error => console.error('处理图片时出错:', error));
}.bind(this))
.catch(function(error) { console.error('处理图片时出错:', error); });
}
}

Loading…
Cancel
Save