[update] 外来标准过程稿件出其他外,非废止状态只能看最新文件,废止状态都不能查看

This commit is contained in:
lideqin
2024-07-12 15:42:07 +08:00
parent 57e116b556
commit 0e5d9a3910
3 changed files with 38 additions and 9 deletions
@@ -79,17 +79,20 @@
<div class="detail-page-process-manuscript-file"
v-for="file in detailData[formItem.dbFieldName + 'List']"
:key="file.id">
<div class="detail-page-process-manuscript-file-info">
<div class="detail-page-process-manuscript-file-info"
:class="newestManuScriptField.includes(formItem.dbFieldName) && file.id !== manuScriptNewestFileId ? 'disabled-file-info' : ''">
<a-icon type="link" />
<div class="detail-page-process-manuscript-file-name" @click="handlePreview(file)">{{ file.fileName }}</div>
<div class="detail-page-process-manuscript-file-name" @click="handlePreview(file, formItem)">{{ file.fileName }}</div>
</div>
<div class="detail-page-process-manuscript-file-operate">
<!-- 下载-->
<a-button type="link" icon="download" v-has="btnPermission.download" @click="handleWatermarkedDownload(file)">
<a-button type="link" icon="download" v-has="btnPermission.download" @click="handleWatermarkedDownload(file)"
:disabled="newestManuScriptField.includes(formItem.dbFieldName) && file.id !== manuScriptNewestFileId">
{{ $t('download') }}
</a-button>
<!-- 无水印下载-->
<a-button type="link" v-has="btnPermission.unwatermarkedDownload" @click="handleDownload(file)">
<a-button type="link" v-has="btnPermission.unwatermarkedDownload" @click="handleDownload(file)"
:disabled="newestManuScriptField.includes(formItem.dbFieldName) && file.id !== manuScriptNewestFileId">
<i class="iconfont icon-water-drop-slash"></i>
{{ $t('unwatermarkedDownload') }}
</a-button>
@@ -117,7 +120,7 @@
import { getForeignStandardDetail, getForeignStandardFormModal } from '@/api/standardRegulationLibraryApi'
import StandardResolutionSheetModal from './modules/StandardResolutionSheetModal'
import TextContentModal from '../../../enterpriseStandardLibrary/standard/detail/module/TextContentModal'
import { FieldType, StandardSource } from '../../../../enums/commonEnums'
import { FieldType, StandardSource, StandardStatus } from '../../../../enums/commonEnums'
import { getFileInfo } from '../../../../api/api'
import Vue from 'vue'
import { ACCESS_TOKEN } from '../../../../store/mutation-types'
@@ -156,13 +159,18 @@ export default {
detailData: {},
// 文件的字段
fileField: [],
// 参与只允许查看
// 需要数据字段翻译的属性类型
needDictFieldList: [FieldType.USER_SINGLE.value, FieldType.ORGAN_SINGLE.value, FieldType.ORGAN_MORE.value, FieldType.OPTION_SINGLE.value, FieldType.OPTION_MORE.value, FieldType.TREE.value, FieldType.TREE_SINGLE.value],
image: false,
imageUrl: null,
// 标准字段,需要跳转标准详情
standardFields: ['substitute_standard_number', 'replaced_by_standard_number', 'reference_standard', 'referenced_standard', 'adopt_the_international_standard_number', 'associated_foreign_standards'],
showViewAllField: ['auth_dept'] // 需要显示展示查看全部按钮的字段
showViewAllField: [], // 需要显示展示查看全部按钮的字段
// 参与只允许查看最新稿件排序的字段顺序(发布稿>TBT通报文件>报批稿>送审稿>征求意见稿>草案)
newestManuScriptField: ['publish_of_original', 'tbt_file', 'draft_for_review', 'draft_for_approval', 'draft_for_comment', 'draft'],
// 过程稿件中可以查看的最新文件id
manuScriptNewestFileId: ''
}
},
computed: {
@@ -229,6 +237,17 @@ export default {
this.$set(this.detailData, item + 'List', fileInfoList)
}
})
// 不是废止状态的话,获取过程稿件中可以查看的最新文件id
if (this.detailData.standard_state !== StandardStatus.ABOLISH.value) {
for (const item of this.newestManuScriptField) {
if (this.detailData[item]) {
// 从文件列表里面获取
const sortFileIdArr = this.detailData[item].split(',').sort((a, b) => b - a) // 日期只精确到天,用id更能区分
this.manuScriptNewestFileId = sortFileIdArr[0]
break
}
}
}
console.log(this.detailData)
} else {
this.$message.warn(res.message)
@@ -260,10 +279,14 @@ export default {
const data = this.detailData[fieldName + '_dictText'] || this.detailData[fieldName]
this.$refs.textContentModal.open(data)
},
handlePreview (file) {
handlePreview (file, formItem) {
if (!file || !file.url) {
return
}
if (this.newestManuScriptField.includes(formItem.dbFieldName) && file.id !== manuScriptNewestFileId) {
// 参与最新稿件不预览的不是最新的稿件不能预览
return
}
// 截取文件后缀名
const fileSuffix = file.fileName ? file.fileName.split('.')[file.fileName.split('.').length - 1] : ''
const canPreview = CAN_PREVIEW_FILE_SUFFIX.some(tt => fileSuffix.toLowerCase() === tt)
@@ -138,6 +138,8 @@ export default {
}
</script>
<style scoped>
<style scoped lang="less">
/deep/ .ant-drawer-content-wrapper {
min-width: 800px;
}
</style>