Merge remote-tracking branch 'origin/thirdStage' into fourthStage

This commit is contained in:
fengchenchen
2024-01-29 10:16:23 +08:00
5 changed files with 304 additions and 9 deletions
@@ -35,7 +35,8 @@ module.exports = {
cancelAuthor: '解除授权',
authorizationDate: '授权日期',
authorizationStandard: '授权企标',
confirmCancelAuthor: '确认解除授权?'
confirmCancelAuthor: '确认解除授权?',
viewAll: '查看全部'
},
// 评审会记录
reviewMeeting: {
@@ -115,6 +115,8 @@
<template v-if="record.del_flag">
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
<a @click="operationClick(operation,record)">
<!-- 查看图标-->
<i class="iconfont icon-link operate-btn-icon" v-if="operation.text === $t('view')" />
<!-- 编辑图标 -->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标 -->
@@ -129,6 +131,8 @@
<template v-else>
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum).filter(item => item.text !== $t('delete'))" :key="index">
<a @click="operationClick(operation,record)">
<!-- 查看图标-->
<i class="iconfont icon-link operate-btn-icon" v-if="operation.text === $t('view')" />
<!-- 编辑图标 -->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标 -->
@@ -166,7 +170,7 @@
<template v-slot:standard_number="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="link-a" @click="detailClick(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
<a class="link-a" @click="filePreview(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
<div class="table-text" v-else-if="(text || text === 0) && !record.detailFlag">{{ text }}</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
@@ -176,7 +180,7 @@
<template v-slot:standard_name="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="link-a" @click="detailClick(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
<a class="link-a" @click="filePreview(record)" v-if="(text || text === 0) && record.detailFlag">{{ text }}</a>
<div class="table-text" v-else-if="(text || text === 0) && !record.detailFlag">{{ text }}</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</a-tooltip>
@@ -215,7 +219,9 @@ import {
collectStandard,
cancelCollectStandard,
shareStandard,
deleteTreeNode
deleteTreeNode,
getEnterpriseStandardInfoById,
getEnterpriseStandardAddForm
} from '@api/enterpriseStandardLibraryApi'
// 添加、编辑弹框
import EnterpriseStandardModal from './modules/EnterpriseStandardModal'
@@ -227,6 +233,11 @@ import UserSelectModal from '../../../components/selection/UserSelectModal'
import AllocationStandardDrawer from './modules/AllocationStandardDrawer'
import { postDownFile, downloadFile, postAction } from '@/api/manage'
import TemporaryPermissionRecord from './modules/TemporaryPermissionRecord'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
import { kkFilePreview } from '@/utils/kkFilePreview'
import { getFileInfo } from '@api/api'
export default {
name: 'EnterpriseStandardList',
@@ -250,6 +261,12 @@ export default {
clickEvent: 'handleCollection',
has: 'enterpriseStandard:collection'
},
// 查看
{
text: this.$t('view'),
clickEvent: 'detailClick',
has: 'enterpriseStandard:view'
},
{ // 编辑
text: this.$t('edit'),
clickEvent: 'handleEdit',
@@ -670,6 +687,108 @@ export default {
}
})
},
/**
* 按顺序打开最新的pdf或word
*/
async filePreview (record) {
console.log('filePreview', record)
// 获取并处理过程稿件数据
let res = await getEnterpriseStandardAddForm({ type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getDomesticStandardFormModal error:', res)
return
}
console.log('res.result', res.result)
const data = res.result || {}
const form = data
const partList = Object.keys(data)
let part
const partZh = '过程稿件'
const partEn = 'Process Manuscript'
if (partList.includes(partEn))part = partEn
if (partList.includes(partZh))part = partZh
console.log('part', part)
const processManuscript = form[part]
console.log('过程稿件', processManuscript)
// 获取并处理详情数据
res = await getEnterpriseStandardInfoById({ id: record.id, type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getDomesticStandardDetail error:', res)
return
}
const detailData = Object.assign({}, res.result || {})
console.log('detailData', detailData)
// 选择合适的文件
let file = null
const pdfFileList = []
const docFileList = []
let newestFileList = []
// 按照过程稿件顺序寻找文件
for (const formItem of processManuscript) {
const keyId = formItem.dbFieldName
const keyName = formItem.dbFieldName + '_dictText'
if (!detailData[keyId]) continue
const idArray = detailData[keyId].split(',')
const nameArray = detailData[keyName].split(',')
// 每个过程中可能有多个文件
for (let i = 0; i < idArray.length; i++) {
const id = idArray[i]
const name = nameArray[i]
var suffix = name.substring(name.lastIndexOf('.') + 1)
if (suffix === 'pdf') {
pdfFileList.push({ id, name, suffix })
}
if (suffix === 'doc' || suffix === 'docx') {
docFileList.push({ id, name, suffix })
}
}
// 一旦一个过程中找到pdf或者doc,就可以退出
if (pdfFileList.length > 0 || docFileList.length > 0) {
break
}
}
newestFileList = pdfFileList // 默认从pdf里选最新的文件
if (pdfFileList.length === 0)newestFileList = docFileList // 如果没有pdf文件,就从doc文件里选
file = await this.selectNewestFile(newestFileList)
if (file === null) { // 没有找到文件就退出
console.log('没有找到符合要求的文件!')
this.$message.error('没有找到符合要求的文件!')
return
}
console.log('seletedFile', file)
// 预览选择的文件
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
console.log(fileFullUrl)
if (file.suffix === 'pdf') { // pdf预览
const url = previewPdf(file.id)
window.open(url)
return
}
kkFilePreview(fileFullUrl)// 其余可预览文件仍使用KKFile进行预览
},
/**
* 从文件列表里选择最新文件
* @param fileList
*/
async selectNewestFile (fileList) {
if (!fileList || fileList.length === 0) return null
if (fileList.length === 1) return fileList[0]
const newFileList = []
// 获取时间信息
for (const file of fileList) {
const res = await getFileInfo(file)
newFileList.push({ ...file, ...res.result })
}
// 排序取出最新
newFileList.sort((a, b) => b.id - a.id) // 日期只精确到天,用id更能区分
console.log('newFileList', newFileList)
return newFileList[0]
},
// 操作完需要刷树的回调
modalFormOk () {
this.selectedTreeKeys = []
@@ -47,6 +47,12 @@
<span></span>
</template>
</div>
<!-- 需要显示查看全部按钮 -->
<a-button v-else-if="showViewAllField.includes(formItem.dbFieldName) &&
(detailData[formItem.dbFieldName + '_dictText'] || detailData[formItem.dbFieldName])"
type="primary" ghost @click="viewAll('auth_dept')">
{{ $t('enterpriseStandardLibrary.standard.viewAll')}}
</a-button>
<span v-else-if="detailData[formItem.dbFieldName + '_dictText']">{{ detailData[formItem.dbFieldName + '_dictText'] }}</span>
<!-- 标准适用范围,有标签需要编译 -->
<span v-else-if="detailData[formItem.dbFieldName] && formItem.dbFieldName === 'standard_scope'" v-html="detailData[formItem.dbFieldName]"></span>
@@ -128,6 +134,7 @@
<img v-show="image" :src="imageUrl">
</div>
</div>
<text-content-modal ref="textContentModal"></text-content-modal>
</div>
</template>
@@ -146,6 +153,7 @@ import { getFileInfo } from '../../../../api/api'
import UserSelectModal from '@comp/selection/UserSelectModal'
import StandardResolutionSheetModal from '@views/standardRegulationLibrary/commonPage/modules/StandardResolutionSheetModal'
import { kkFilePreview } from '@/utils/kkFilePreview'
import TextContentModal from './module/TextContentModal'
// 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
@@ -154,7 +162,7 @@ const FILE_TYPE_PDF = 'pdf'
export default {
name: 'EnterpriseStandardDetail',
components: { StandardResolutionSheetModal, UserSelectModal, EnterpriseStandardEvaluateModal, SubmitQuestionModal, UpdateRecordModal },
components: { TextContentModal, StandardResolutionSheetModal, UserSelectModal, EnterpriseStandardEvaluateModal, SubmitQuestionModal, UpdateRecordModal },
data () {
return {
FieldType,
@@ -199,7 +207,8 @@ export default {
], // 稽查内容表格列参数
dataSource: [], // 稽查内容数据
image: false,
imageUrl: ''
imageUrl: '',
showViewAllField: ['auth_dept'] // 需要显示展示查看全部按钮的字段
}
},
created () {
@@ -323,6 +332,11 @@ export default {
previewStandardResolutionSheet (id) {
this.$refs.standardResolutionSheetModal.open(id)
},
// 查看全部
viewAll (fieldName) {
const data = this.detailData[fieldName + '_dictText'] || this.detailData[fieldName]
this.$refs.textContentModal.open(data)
}
}
}
</script>
@@ -0,0 +1,42 @@
<template>
<j-modal
:title="$t('view')"
:visible="visible"
:width="1000"
:footer="false"
switchFullscreen
@cancel="handleCancel">
<div class="text-content">{{ content }}</div>
</j-modal>
</template>
<script>
export default {
name: 'TextContentModal',
data () {
return {
visible: false,
content: null
}
},
methods: {
open (text) {
this.content = text
this.visible = true
},
handleCancel () {
this.visible = false
this.content = null
}
}
}
</script>
<style scoped lang="less">
.text-content {
max-height: calc(100vh - 200px - 55px);
overflow: auto;
margin: 0 -24px;
padding: 0 24px;
}
</style>
@@ -138,7 +138,7 @@
<template v-slot:standard_number="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="filePreview(record)">{{
text
}}
</div>
@@ -150,7 +150,7 @@
<template v-slot:standard_name="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="filePreview(record)">{{
text
}}
</div>
@@ -168,6 +168,8 @@
</a>
<a v-else @click="operationClick(operationList[0],record)">
<div class="operate-btn">
<!-- 查看图标-->
<i class="iconfont icon-link operate-btn-icon" v-if="operationList[0].text === $t('view')" />
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operationList[0].text === $t('edit')" />
<!-- 分享图标-->
@@ -184,6 +186,8 @@
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
<a @click="operationClick(operation,record)">
<div class="operate-btn">
<!-- 查看图标-->
<i class="iconfont icon-link operate-btn-icon" v-if="operation.text === $t('view')" />
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标-->
@@ -251,7 +255,9 @@ import {
shareOverseasStandard,
deleteOverseasStandardSystem,
configOverseasStandard,
removeOverseasStandard
removeOverseasStandard,
getOverseasStandardForm,
getOverseasStandardDocumentInfo
} from '../../../api/standardRegulationLibraryApi'
import { OperationType, StandardSource, StandardSystemTreeNodeType, YesOrNoEnum } from '../../../enums/commonEnums'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
@@ -260,6 +266,11 @@ import OverseasSystemTreeModal from './modules/OverseasSystemTreeModal.vue'
import SelectionOverseasStandardDrawer from './modules/SelectionOverseasStandardDrawer.vue'
import { postDownFile } from '../../../api/manage.js'
import { mapGetters } from 'vuex'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
import { kkFilePreview } from '@/utils/kkFilePreview'
import { getFileInfo } from '@api/api'
export default {
name: 'OverseasStandardList',
@@ -286,6 +297,12 @@ export default {
clickEvent: 'handleCollection',
has: 'overseasStandard:collection'
},
// 查看
{
text: this.$t('view'),
clickEvent: 'toDetailPage',
has: 'overseasStandard:view'
},
// 编辑
{
text: this.$t('edit'),
@@ -591,6 +608,108 @@ export default {
}
})
},
/**
* 按顺序打开最新的pdf或word
*/
async filePreview (record) {
console.log('filePreview', record)
// 获取并处理过程稿件数据
let res = await getOverseasStandardForm({ type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getDomesticStandardFormModal error:', res)
return
}
console.log('res.result', res.result)
const data = res.result || {}
const form = data
const partList = Object.keys(data)
let part
const partZh = '过程稿件'
const partEn = 'Process Manuscript'
if (partList.includes(partEn))part = partEn
if (partList.includes(partZh))part = partZh
console.log('part', part)
const processManuscript = form[part]
console.log('过程稿件', processManuscript)
// 获取并处理详情数据
res = await getOverseasStandardDocumentInfo({ id: record.id, type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getDomesticStandardDetail error:', res)
return
}
const detailData = Object.assign({}, res.result || {})
console.log('detailData', detailData)
// 选择合适的文件
let file = null
const pdfFileList = []
const docFileList = []
let newestFileList = []
// 按照过程稿件顺序寻找文件
for (const formItem of processManuscript) {
const keyId = formItem.dbFieldName
const keyName = formItem.dbFieldName + '_dictText'
if (!detailData[keyId]) continue
const idArray = detailData[keyId].split(',')
const nameArray = detailData[keyName].split(',')
// 每个过程中可能有多个文件
for (let i = 0; i < idArray.length; i++) {
const id = idArray[i]
const name = nameArray[i]
var suffix = name.substring(name.lastIndexOf('.') + 1)
if (suffix === 'pdf') {
pdfFileList.push({ id, name, suffix })
}
if (suffix === 'doc' || suffix === 'docx') {
docFileList.push({ id, name, suffix })
}
}
// 一旦一个过程中找到pdf或者doc,就可以退出
if (pdfFileList.length > 0 || docFileList.length > 0) {
break
}
}
newestFileList = pdfFileList // 默认从pdf里选最新的文件
if (pdfFileList.length === 0)newestFileList = docFileList // 如果没有pdf文件,就从doc文件里选
file = await this.selectNewestFile(newestFileList)
if (file === null) { // 没有找到文件就退出
console.log('没有找到符合要求的文件!')
this.$message.error('没有找到符合要求的文件!')
return
}
console.log('seletedFile', file)
// 预览选择的文件
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
console.log(fileFullUrl)
if (file.suffix === 'pdf') { // pdf预览
const url = previewPdf(file.id)
window.open(url)
return
}
kkFilePreview(fileFullUrl)// 其余可预览文件仍使用KKFile进行预览
},
/**
* 从文件列表里选择最新文件
* @param fileList
*/
async selectNewestFile (fileList) {
if (!fileList || fileList.length === 0) return null
if (fileList.length === 1) return fileList[0]
const newFileList = []
// 获取时间信息
for (const file of fileList) {
const res = await getFileInfo(file)
newFileList.push({ ...file, ...res.result })
}
// 排序取出最新
newFileList.sort((a, b) => b.id - a.id) // 日期只精确到天,用id更能区分
console.log('newFileList', newFileList)
return newFileList[0]
},
/**
* 重置查询
*/