[update] 增加问答库模块,修改自测bug

This commit is contained in:
lideqin
2023-09-20 18:08:00 +08:00
parent 2fb7e230d6
commit 5abf9338bd
16 changed files with 1059 additions and 4 deletions
@@ -25,7 +25,36 @@
<div class="detail-page-part-form" v-if="index !== 3">
<div class="detail-page-part-form-item" v-for="formItem in form[part]" :key="formItem.id">
<label>{{ formItem.dbFieldTxt }}</label>
<span v-if="detailData[formItem.dbFieldName + '_dictText']">{{ detailData[formItem.dbFieldName + '_dictText'] }}</span>
<div v-if="formItem.fieldShowType === FieldType.FILE_UP.value" class="file-box">
<template v-if="detailData[formItem.dbFieldName]">
<div class="detail-page-process-manuscript-file" v-for="(fileId, index) in detailData[formItem.dbFieldName].split(',')" :key="fileId">
<div class="detail-page-process-manuscript-file-info">
<a-icon type="link" />
<div class="detail-page-process-manuscript-file-name"
@click="handlePreview(fileId, detailData[formItem.dbFieldName + '_dictText'].split(',')[index])">
{{ detailData[formItem.dbFieldName + '_dictText'].split(',')[index] }}
</div>
</div>
<!-- 下载 -->
<a-button
type="link"
icon="download"
class="file-btn"
@click="handleDownload(fileId, detailData[formItem.dbFieldName + '_dictText'].split(',')[index])">
{{ $t('download') }}
</a-button>
<!-- 无水印下载-->
<!--<a-button type="link" v-has="btnPermission.unwatermarkedDownload" class="file-btn">-->
<!-- <i class="iconfont icon-water-drop-slash"></i>-->
<!-- {{ $t('unwatermarkedDownload') }}-->
<!--</a-button>-->
</div>
</template>
<template v-else>
<span></span>
</template>
</div>
<span v-else-if="detailData[formItem.dbFieldName + '_dictText']">{{ detailData[formItem.dbFieldName + '_dictText'] }}</span>
<span v-else-if="detailData[formItem.dbFieldName]">{{ detailData[formItem.dbFieldName] }}</span>
<span v-else></span>
</div>
@@ -93,17 +122,26 @@
<script>
import '@assets/less/common.less'
import { downloadFile } from '@/api/manage'
import { FieldType } from '@/enums/commonEnums'
import { downloadFile, getFileAccessHttpUrl } from '@/api/manage'
import { getEnterpriseStandardInfoById, getEnterpriseStandardAddForm } from '@/api/enterpriseStandardLibraryApi'
import UpdateRecordModal from '../../../standardRegulationLibrary/commonPage/modules/UpdateRecordModal'
import SubmitQuestionModal from '../../../standardRegulationLibrary/commonPage/modules/SubmitQuestionModal'
import EnterpriseStandardEvaluateModal from './module/EnterpriseStandardEvaluateModal'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default {
name: 'EnterpriseStandardDetail',
components: { EnterpriseStandardEvaluateModal, SubmitQuestionModal, UpdateRecordModal },
data () {
return {
FieldType,
partList: [], // 页面模块列表
form: {}, // 页面字段
detailData: {}, // 页面数据
@@ -165,6 +203,34 @@ export default {
}
})
},
handlePreview (fileId, fileName) {
// 截取文件后缀名
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${fileId}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${fileName}`
// 图片预览,使用自己添加的组件
if (FILE_TYPE_IMGS.includes(fileSuffix)) {
this.imageUrl = getFileAccessHttpUrl(fileId)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
// this.$refs.imagePreviewModal.open(file)
return
}
// pdf预览
if (FILE_TYPE_PDF.includes(fileSuffix)) {
const url = previewPdf(fileId)
window.open(url)
return
}
// 其余可预览文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
},
handleDownload (fileId, fileName) {
// 下载文件
downloadFile(`/sys/common/download/${fileId}`, fileName)
},
// 过程稿件里的下载
downloadDraft (fileId, fileName) {
downloadFile(`/sys/common/download/${fileId}`, fileName)
@@ -193,4 +259,14 @@ export default {
.detail-page-part-table {
margin: 20px;
}
.file-box {
flex: 1;
width: 0;
}
.file-btn > ::v-deep span {
display: inline;
color: @primary-color;
font-size: 14px;
}
</style>