人员审查兼容修改

ln_ry20250512
dshclm 4 days ago
parent 99f5a6a122
commit 1d00dfc711

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

Loading…
Cancel
Save