From 1e3b39bf110ccb1819299e4d669358b4f0a23626 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Wed, 1 Apr 2026 17:02:03 +0800 Subject: [PATCH] =?UTF-8?q?2026-04-01=20=E7=89=A9=E6=96=99=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E7=AE=A1=E7=90=86-=E3=80=8BSOP=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/qc/sopFileManagementUpload.vue | 11 +++++-- src/views/modules/qc/sopFileUpload.vue | 30 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/views/modules/qc/sopFileManagementUpload.vue b/src/views/modules/qc/sopFileManagementUpload.vue index 56f1556..fd08949 100644 --- a/src/views/modules/qc/sopFileManagementUpload.vue +++ b/src/views/modules/qc/sopFileManagementUpload.vue @@ -158,15 +158,20 @@ export default { const nameWithoutSuffix = lastDotIndex > -1 ? fileName.substring(0, lastDotIndex) : fileName const suffix = lastDotIndex > -1 ? fileName.substring(lastDotIndex + 1) : '' + const currentDate = new Date() + const formatDate = currentDate.getFullYear() + '-' + + String(currentDate.getMonth() + 1).padStart(2, '0') + '-' + + String(currentDate.getDate()).padStart(2, '0') + this.fileList.push({ raw: file.raw, fileNo: nameWithoutSuffix, fileName: fileName, sopType: '', fileSuffix: suffix, - version: 'A0', + version: '', itemNo: '', - phaseInDate: '', + phaseInDate: formatDate, phaseOutDate: '' }) } @@ -235,7 +240,7 @@ export default { fileName: file.fileName || '', sopType: file.sopType || '', fileSuffix: file.fileSuffix || '', - version: file.version || 'A0', + version: file.version || '', itemNo: file.itemNo || '', phaseInDate: file.phaseInDate || formatDate, phaseOutDate: file.phaseOutDate || '' diff --git a/src/views/modules/qc/sopFileUpload.vue b/src/views/modules/qc/sopFileUpload.vue index f75bb01..5c0e8dc 100644 --- a/src/views/modules/qc/sopFileUpload.vue +++ b/src/views/modules/qc/sopFileUpload.vue @@ -308,7 +308,7 @@ export default { this.originalFileList = data.page.list || [] // 保存原始数据 // 过滤掉已添加的文件 this.fileList = this.originalFileList.filter(file => - !this.uploadedFileList.some(uploaded => uploaded.fileNo === file.fileNo) + !this.uploadedFileList.some(uploaded => uploaded.fileNo === file.fileNo && uploaded.sopRevNo === file.sopRevNo) ) this.fileTotalPage = data.page.totalCount || 0 } else { @@ -346,7 +346,7 @@ export default { // 确保选中的文件包含完整数据 this.selectedFiles = val.map(selectedFile => { // 从原始文件列表中找到完整的文件信息 - const completeFile = this.fileList.find(file => file.fileNo === selectedFile.fileNo) + const completeFile = this.fileList.find(file => file.fileNo === selectedFile.fileNo && file.sopRevNo === selectedFile.sopRevNo) return completeFile || selectedFile }) }, @@ -357,10 +357,15 @@ export default { return } + let duplicateCount = 0 + let addedCount = 0 + // 添加到已上传列表 this.selectedFiles.forEach(file => { - const exists = this.uploadedFileList.some(uploaded => uploaded.fileNo === file.fileNo) - if (!exists) { + const exists = this.uploadedFileList.some(uploaded => uploaded.fileNo === file.fileNo && uploaded.sopRevNo === file.sopRevNo) + if (exists) { + duplicateCount++ + } else { this.uploadedFileList.push({ site: file.site, buNo: file.buNo, @@ -376,15 +381,22 @@ export default { phaseInDate: file.phaseInDate || '', phaseOutDate: file.phaseOutDate || '' }) + addedCount++ } }) + if (duplicateCount > 0) { + this.$message.warning(`存在 ${duplicateCount} 个文件编码和版本号重复的文件,不能重复添加`) + } + // 从上方列表中移除已添加的文件 this.fileList = this.fileList.filter(file => - !this.selectedFiles.some(selected => selected.fileNo === file.fileNo) + !this.uploadedFileList.some(uploaded => uploaded.fileNo === file.fileNo && uploaded.sopRevNo === file.sopRevNo) ) - this.$message.success(`已添加${this.selectedFiles.length}个文件`) + if (addedCount > 0) { + this.$message.success(`已添加 ${addedCount} 个文件`) + } // 清空选择 this.$refs.fileTable && this.$refs.fileTable.clearSelection() @@ -400,10 +412,10 @@ export default { // 将删除的文件重新添加到上方列表 this.selectedUploadedFiles.forEach(file => { // 检查原始列表中是否存在该文件 - const originalFile = this.originalFileList.find(original => original.fileNo === file.fileNo) + const originalFile = this.originalFileList.find(original => original.fileNo === file.fileNo && original.sopRevNo === file.sopRevNo) if (originalFile) { // 检查上方列表中是否已存在 - const exists = this.fileList.some(existing => existing.fileNo === file.fileNo) + const exists = this.fileList.some(existing => existing.fileNo === file.fileNo && existing.sopRevNo === file.sopRevNo) if (!exists) { this.fileList.push(originalFile) } @@ -412,7 +424,7 @@ export default { // 从已上传列表中移除 this.uploadedFileList = this.uploadedFileList.filter(file => - !this.selectedUploadedFiles.some(selected => selected.fileNo === file.fileNo) + !this.selectedUploadedFiles.some(selected => selected.fileNo === file.fileNo && selected.sopRevNo === file.sopRevNo) ) this.$message.success(`已删除${this.selectedUploadedFiles.length}个文件`)