Browse Source

需求更新

master
xuhuajiao 2 weeks ago
parent
commit
ca6a18359c
  1. 15
      src/views/components/archivesDetail/uploadFile/index.vue
  2. 66
      src/views/components/category/PreviewForm.vue
  3. 4
      src/views/preview/index.vue

15
src/views/components/archivesDetail/uploadFile/index.vue

@ -125,6 +125,7 @@ import { archivesUpload } from '@/utils/upload'
import { downloadFile, getCurrentTime } from '@/utils/index' import { downloadFile, getCurrentTime } from '@/utils/index'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { FetchIsAuthByLookType } from '@/api/archivesManage/library' import { FetchIsAuthByLookType } from '@/api/archivesManage/library'
import { getToken } from '@/utils/auth'
// import Sortable from 'sortablejs' // import Sortable from 'sortablejs'
export default { export default {
name: 'UploadFile', name: 'UploadFile',
@ -346,11 +347,19 @@ export default {
}, },
// //
downloadFile(row) { 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) downloadFile(blob, row.file_name.split('.')[0], row.file_type)
this.downloading = false
}).catch(() => { }).catch(() => {
this.$message.error('下载文件失败!')
this.$message({ message: '下载文件失败', type: 'error', offset: 8 })
this.downloading = false
}) })
}, },
// //

66
src/views/components/category/PreviewForm.vue

@ -76,6 +76,7 @@
> >
<i v-if="item.isInputClass === 'popover'" slot="suffix" class="el-input__icon iconfont icon-gengduo1" @click="handleCurrentFieldName(item)" /> <i v-if="item.isInputClass === 'popover'" slot="suffix" class="el-input__icon iconfont icon-gengduo1" @click="handleCurrentFieldName(item)" />
</el-input> </el-input>
<i v-if="item.fieldName === 'item_no'" class="el-icon-refresh" style="cursor: pointer;" @click="handleRefreshItemNo" />
<!-- <div v-if="shouldShowIcon(item)" :class="loadingStatus[item.fieldName] ?'auto-box loading-style':'auto-box'" :disabled="loadingStatus[item.fieldName]"> <!-- <div v-if="shouldShowIcon(item)" :class="loadingStatus[item.fieldName] ?'auto-box loading-style':'auto-box'" :disabled="loadingStatus[item.fieldName]">
<i ref="iconRef" class="iconfont icon-zidonggengxin" @click="handleIconClick(item)" /> <i ref="iconRef" class="iconfont icon-zidonggengxin" @click="handleIconClick(item)" />
</div> --> </div> -->
@ -863,10 +864,10 @@ export default {
this.itemNoAutoGenerated = true this.itemNoAutoGenerated = true
console.log('件号自动赋值完成:', this.addOrUpdateForm.item_no) 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() await this.handleAuto()
} }
} }
@ -875,6 +876,63 @@ export default {
console.error('查询最大件号失败:', error) 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. // 2.
updateArchiveNoValidator(item) { updateArchiveNoValidator(item) {
const validateArchiveNo = async(value) => { const validateArchiveNo = async(value) => {

4
src/views/preview/index.vue

@ -42,8 +42,8 @@
<li>尺寸{{ (!(fileCurrent && fileCurrent.file_dpi) || (fileCurrent && fileCurrent.file_dpi === 'null')) ? '-' : fileCurrent.file_dpi }}</li> <li>尺寸{{ (!(fileCurrent && fileCurrent.file_dpi) || (fileCurrent && fileCurrent.file_dpi === 'null')) ? '-' : fileCurrent.file_dpi }}</li>
</ul> </ul>
<div class="preview-btn"> <div class="preview-btn">
<el-button :loading="downloading" class="iconfont icon-xiazai" @click="downloadFile(fileCurrent)">下载</el-button>
<el-button v-print="printObj" class="iconfont icon-dayin">打印</el-button>
<!-- <el-button :loading="downloading" class="iconfont icon-xiazai" @click="downloadFile(fileCurrent)">下载</el-button> -->
<!-- <el-button v-print="printObj" class="iconfont icon-dayin">打印</el-button> -->
</div> </div>
</div> </div>
<div id="printArea" ref="output" class="well-box" :style="{overflowY : !loading ? 'auto' : 'hidden'}" /> <div id="printArea" ref="output" class="well-box" :style="{overflowY : !loading ? 'auto' : 'hidden'}" />

Loading…
Cancel
Save