From ca6a18359c179cfde018e6871e10d381d37a0224 Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Fri, 29 May 2026 17:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archivesDetail/uploadFile/index.vue | 15 ++++- src/views/components/category/PreviewForm.vue | 66 +++++++++++++++++-- src/views/preview/index.vue | 4 +- 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/src/views/components/archivesDetail/uploadFile/index.vue b/src/views/components/archivesDetail/uploadFile/index.vue index f08b250..2eaee85 100644 --- a/src/views/components/archivesDetail/uploadFile/index.vue +++ b/src/views/components/archivesDetail/uploadFile/index.vue @@ -125,6 +125,7 @@ import { archivesUpload } from '@/utils/upload' import { downloadFile, getCurrentTime } from '@/utils/index' import { mapGetters } from 'vuex' import { FetchIsAuthByLookType } from '@/api/archivesManage/library' +import { getToken } from '@/utils/auth' // import Sortable from 'sortablejs' export default { name: 'UploadFile', @@ -346,11 +347,19 @@ export default { }, // 下载附件 downloadFile(row) { - const url = this.baseApi + '/downloadFile' + row.file_path - fetch(url).then(res => res.blob()).then(blob => { + const url = this.baseApi + '/api/minioUpload/getFile?filePath=' + row.file_path + '&bucketType=2' + const fetchOptions = { + method: 'GET', + headers: { + 'Authorization': getToken() + } + } + fetch(url, fetchOptions).then(res => res.blob()).then(blob => { downloadFile(blob, row.file_name.split('.')[0], row.file_type) + this.downloading = false }).catch(() => { - this.$message.error('下载文件失败!') + this.$message({ message: '下载文件失败', type: 'error', offset: 8 }) + this.downloading = false }) }, // 选择删除 diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index ed446eb..76fd4f6 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -76,6 +76,7 @@ > + @@ -863,10 +864,10 @@ export default { this.itemNoAutoGenerated = true console.log('件号自动赋值完成:', this.addOrUpdateForm.item_no) - // 检查件号是否是档号的组成项,如果是则重新生成档号(只在首次生成时执行) - const isItemNoInAutoMatic = this.autoMatic.some(item => item.fieldName === 'item_no') - if (isItemNoInAutoMatic && !this.itemNoAutoGenerated) { - // 如果件号是档号组成项,重新生成档号(只在首次时执行,避免循环调用) + // 检查件号是否是档号的组成项,如果是则重新生成档号 + const isItemNoInAutoMatic = this.autoMatic && this.autoMatic.some(item => item.fieldName === 'item_no') + if (isItemNoInAutoMatic) { + // 如果件号是档号组成项,重新生成档号 await this.handleAuto() } } @@ -875,6 +876,63 @@ export default { console.error('查询最大件号失败:', error) } }, + // 点击刷新图标获取最大件号 + async handleRefreshItemNo() { + try { + // 1. 检查是否已有档号 + if (this.addOrUpdateForm.archive_no) { + await this.fetchAndSetMaxItemNo(this.addOrUpdateForm.archive_no) + return + } + console.log('this.autoMatic', this.autoMatic) + // 2. 检查 autoMatic 是否已初始化,如果未初始化则先获取 + if (!this.autoMatic || !this.autoMatic.length) { + // 获取当前分类ID + let categoryId = null + if (this.isDesFormType !== 'mergeFile' && this.isDesFormType !== 'arcives' && this.isDesFormType !== 'manageArcives') { + categoryId = this.selectedCategory?.pid || this.selectedCategory?.id + } else { + categoryId = this.selectedCategory?.id + } + + if (!categoryId) { + this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) + return + } + + // 调用 FetchNoFormatField 获取档号格式配置 + await this.FetchNoFormatField(categoryId) + + // 再次检查是否获取到配置 + if (!this.autoMatic || !this.autoMatic.length) { + this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) + return + } + } + + // 3. 检查组成项是否有值 + const hasComponentValue = this.autoMatic.some(val => { + if (val.fieldName === 'item_no') return false + return this.addOrUpdateForm[val.fieldName] + }) + + if (hasComponentValue) { + // 组成项有值,先生成档号 + const archivesNo = await this.handleAuto() + if (archivesNo) { + await this.fetchAndSetMaxItemNo(archivesNo) + } else { + this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) + } + } else { + // 没有组成项的值 + this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) + } + } catch (error) { + console.error('刷新最大件号失败:', error) + this.$message({ message: '刷新最大件号失败', type: 'error', offset: 8 }) + } + }, // 2. 抽离档号验证逻辑,确保异步验证稳定 updateArchiveNoValidator(item) { const validateArchiveNo = async(value) => { diff --git a/src/views/preview/index.vue b/src/views/preview/index.vue index 73e46bd..71e9f91 100644 --- a/src/views/preview/index.vue +++ b/src/views/preview/index.vue @@ -42,8 +42,8 @@