[update] 标准点击编号或名称跳转详情和删除详情的评价等功能
This commit is contained in:
@@ -6,22 +6,6 @@
|
||||
<div class="detail-page-part" v-for="(part, index) in partList" :key="part + index">
|
||||
<div class="detail-page-part-title">
|
||||
<span>{{ part }}</span>
|
||||
<div class="detail-page-part-title-operate-box" v-if="index === 0">
|
||||
<!-- 更新记录-->
|
||||
<a-button type="link" @click="handleOpenUpdateRecord" v-has="btnPermission.updateRecord">
|
||||
<i class="iconfont icon-root-list" />
|
||||
{{ $t('standardRegulationLibrary.updateRecord') }}
|
||||
</a-button>
|
||||
<!-- 提交问题-->
|
||||
<a-button type="link" @click="submitQuestion" v-has="btnPermission.submitQuestion">
|
||||
<a-icon type="database" />
|
||||
{{ $t('standardRegulationLibrary.submitQuestion') }}
|
||||
</a-button>
|
||||
<!-- 分享-->
|
||||
<a-button type="link" @click="handleShare" v-has="btnPermission.share">
|
||||
<i class="iconfont icon-share-internal" />{{ $t('share') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-page-part-form" v-if="part !== '过程稿件' && part !== 'Process Manuscript'">
|
||||
<div class="detail-page-part-form-item" v-for="formItem in form[part]" :key="formItem.id">
|
||||
@@ -122,12 +106,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 更新记录-->
|
||||
<update-record-modal ref="uploadRecordModal" />
|
||||
<!-- 提交问题-->
|
||||
<submit-question-modal ref="submitQuestionModal" />
|
||||
<!-- 分享选人-->
|
||||
<user-select-modal ref="userSelectModal" type="checkbox" @change="continueShare" />
|
||||
<!-- 标准分解单-->
|
||||
<standard-resolution-sheet-modal ref="standardResolutionSheetModal" />
|
||||
<!-- 查看全部弹框 -->
|
||||
@@ -140,31 +118,22 @@ import '@assets/less/common.less'
|
||||
import { FieldType, StandardSource } from '../../../enums/commonEnums'
|
||||
import {
|
||||
getDomesticStandardFormModal,
|
||||
shareDomesticStandard,
|
||||
getDomesticStandardDetail,
|
||||
getOverseasStandardForm,
|
||||
getOverseasStandardDocumentInfo,
|
||||
shareOverseasStandard
|
||||
getOverseasStandardDocumentInfo
|
||||
} from '../../../api/standardRegulationLibraryApi'
|
||||
import UpdateRecordModal from './modules/UpdateRecordModal.vue'
|
||||
import SubmitQuestionModal from './modules/SubmitQuestionModal.vue'
|
||||
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
|
||||
import StandardResolutionSheetModal from './modules/StandardResolutionSheetModal.vue'
|
||||
import { getFileInfo } from '../../../api/api.js'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '../../../store/mutation-types.js'
|
||||
import { downloadFile, getFileAccessHttpUrl } from '../../../api/manage.js'
|
||||
import { previewPdf } from '../../../utils/previewPdf.js'
|
||||
import { Base64 } from 'js-base64'
|
||||
import { kkFilePreview } from '../../../utils/kkFilePreview'
|
||||
import { previewFileCurrentWindowByFileId, queryStandardInfoByStandardNumber } from '../../../utils/util'
|
||||
import { queryStandardInfoByStandardNumber } from '../../../utils/util'
|
||||
import TextContentModal from '../../enterpriseStandardLibrary/standard/detail/module/TextContentModal'
|
||||
|
||||
// 国内标准权限
|
||||
const DomesticStandardPermission = {
|
||||
updateRecord: 'domesticStandard:updateRecord', // 更新记录
|
||||
submitQuestion: 'domesticStandard:submitQuestion', // 提交问题
|
||||
share: 'domesticStandard:share', // 分享
|
||||
standardResolutionSheet: 'domesticStandard:standardResolutionSheet', // 标准分解单
|
||||
download: 'domesticStandard:download', // 下载
|
||||
unwatermarkedDownload: 'domesticStandard:unwatermarkedDownload' // 无水印下载
|
||||
@@ -172,9 +141,6 @@ const DomesticStandardPermission = {
|
||||
|
||||
// 海外标准权限
|
||||
const OverseasStandardPermission = {
|
||||
updateRecord: 'overseasStandard:updateRecord', // 更新记录
|
||||
submitQuestion: 'overseasStandard:submitQuestion', // 提交问题
|
||||
share: 'overseasStandard:share', // 分享
|
||||
standardResolutionSheet: 'overseasStandard:standardResolutionSheet', // 标准分解单
|
||||
download: 'overseasStandard:download', // 下载
|
||||
unwatermarkedDownload: 'overseasStandard:unwatermarkedDownload' // 无水印下载
|
||||
@@ -183,15 +149,13 @@ const OverseasStandardPermission = {
|
||||
// 国内标准接口
|
||||
const DomesticApi = {
|
||||
getFormFunc: getDomesticStandardFormModal, // 获取字段
|
||||
getDetailData: getDomesticStandardDetail, // 获取详情数据
|
||||
share: shareDomesticStandard // 分享
|
||||
getDetailData: getDomesticStandardDetail // 获取详情数据
|
||||
}
|
||||
|
||||
// 海外标准接口
|
||||
const OverseasApi = {
|
||||
getFormFunc: getOverseasStandardForm, // 获取字段
|
||||
getDetailData: getOverseasStandardDocumentInfo, // 获取详情数据
|
||||
share: shareOverseasStandard // 分享
|
||||
getDetailData: getOverseasStandardDocumentInfo // 获取详情数据
|
||||
}
|
||||
|
||||
// 支持预览的文件后缀
|
||||
@@ -201,7 +165,7 @@ const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
|
||||
|
||||
export default {
|
||||
name: 'StandardDetailPage',
|
||||
components: { UpdateRecordModal, SubmitQuestionModal, UserSelectModal, StandardResolutionSheetModal, TextContentModal },
|
||||
components: { StandardResolutionSheetModal, TextContentModal },
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -273,16 +237,6 @@ export default {
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
// 如果是要直接看文件
|
||||
// if (this.$route.query.viewFile) {
|
||||
// // TODO 这里需要调一个接口,通过标准id按规则获取文件
|
||||
// const fileId = '1734843741558288385'
|
||||
// previewFileCurrentWindowByFileId(fileId).then(() => {
|
||||
// }).catch((message) => {
|
||||
// this.$message.warning(message)
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
await this.initForm()
|
||||
this.initDetailData()
|
||||
},
|
||||
@@ -351,45 +305,6 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 更新记录
|
||||
*/
|
||||
handleOpenUpdateRecord () {
|
||||
this.$refs.uploadRecordModal.open(this.detailData.standard_number)
|
||||
},
|
||||
/**
|
||||
* 提交问题
|
||||
*/
|
||||
submitQuestion () {
|
||||
this.$refs.submitQuestionModal.open(this.detailData.standard_number, this.type)
|
||||
},
|
||||
/**
|
||||
* 分享
|
||||
*/
|
||||
handleShare () {
|
||||
this.$refs.userSelectModal.open()
|
||||
},
|
||||
/**
|
||||
* 选择分享的人之后继续分享
|
||||
* @param ids
|
||||
*/
|
||||
continueShare (ids) {
|
||||
const params = {
|
||||
standardId: this.$route.query.id, // 要分享的标准的id
|
||||
standardNumber: this.detailData.standard_number, // 分享的标准编号
|
||||
recipientId: ids // 分享给的用户的id
|
||||
}
|
||||
this.loading = true
|
||||
this.operateApiFunc.share(params).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 查看标准分解单
|
||||
*/
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="$t('standardRegulationLibrary.submitQuestion')"
|
||||
:maskClosable="false"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirm-loading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel">
|
||||
|
||||
<a-form :form="form">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<!-- 标题-->
|
||||
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('title')"
|
||||
:maxLength="50"
|
||||
v-decorator="['title', validatorRules.title]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<!-- 项目-->
|
||||
<a-form-item :label="$t('project')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-select :placeholder="$t('pleaseSelect') + $t('project')"
|
||||
v-decorator="['project', validatorRules.project]"
|
||||
show-search
|
||||
:filter-option="filterOption">
|
||||
<a-select-option v-for="item in projectSelectOptions" :key="item.id" :title="item.projectName">{{ item.projectName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<!-- 标准编号-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.standardDetail.standardNumber')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('standardRegulationLibrary.standardDetail.standardNumber')"
|
||||
:maxLength="50"
|
||||
disabled
|
||||
v-decorator="['standardNumber', validatorRules.standardNumber]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<!-- 提问时间-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.standardDetail.problemOccurrenceTime')" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-date-picker :placeholder="$t('pleaseSelect') + $t('standardRegulationLibrary.standardDetail.problemOccurrenceTime')"
|
||||
:getCalendarContainer="(trigger) => trigger.parentNode"
|
||||
v-decorator="['quizTime', validatorRules.quizTime]"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
showTime
|
||||
style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<!-- 问题描述-->
|
||||
<a-form-item :label="$t('standardRegulationLibrary.standardDetail.problemDescription')"
|
||||
:labelCol="longLabelCol"
|
||||
:wrapperCol="longWrapperCol">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('standardRegulationLibrary.standardDetail.problemDescription')"
|
||||
type="textarea"
|
||||
:maxLength="500"
|
||||
v-decorator="['problemDescription', validatorRules.problemDescription]" />
|
||||
<j-upload v-decorator="['file', validatorRules.file]" return-id multiple />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { submitDomesticQuestion, submitOverseasQuestion } from '../../../../api/standardRegulationLibraryApi.js'
|
||||
import { getCarTypeProjectList } from '../../../../api/projectLibraryApi.js'
|
||||
import { StandardSource } from '../../../../enums/commonEnums.js'
|
||||
import moment from 'moment'
|
||||
|
||||
export default {
|
||||
name: 'SubmitQuestionModal',
|
||||
data () {
|
||||
return {
|
||||
width: 800,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
modal: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 8 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
longLabelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 4 }
|
||||
},
|
||||
longWrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 }
|
||||
},
|
||||
validatorRules: {
|
||||
// 标题
|
||||
title: {
|
||||
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('title') }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
// 项目
|
||||
project: {
|
||||
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('project') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 标准编号
|
||||
standardNumber: {
|
||||
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardRegulationLibrary.standardDetail.standardNumber') }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
// 问题发生时间
|
||||
quizTime: {
|
||||
rules: [{ required: false, message: this.$t('pleaseSelect') + this.$t('standardRegulationLibrary.standardDetail.problemOccurrenceTime') }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
// 问题描述
|
||||
problemDescription: {
|
||||
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardRegulationLibrary.standardDetail.problemDescription') }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
// 附件
|
||||
file: {},
|
||||
type: null
|
||||
},
|
||||
projectSelectOptions: [] // 项目下拉数据
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open (standardNumber, type) {
|
||||
this.visible = true
|
||||
this.initProjectOptions()
|
||||
this.type = type
|
||||
const param = {}
|
||||
param.standardNumber = standardNumber
|
||||
param.quizTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(param)
|
||||
})
|
||||
},
|
||||
// 获取项目下拉框数据
|
||||
initProjectOptions () {
|
||||
getCarTypeProjectList({ column: 'createTime', order: 'desc' }).then(res => {
|
||||
if (res.success) {
|
||||
this.projectSelectOptions = res.result
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOk () {
|
||||
if (this.confirmLoading) return
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let submitFunc
|
||||
switch (this.type) {
|
||||
case StandardSource.DOMESTIC.value:
|
||||
submitFunc = submitDomesticQuestion
|
||||
break
|
||||
case StandardSource.OVERSEAS.value:
|
||||
submitFunc = submitOverseasQuestion
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
this.confirmLoading = true
|
||||
const param = Object.assign({}, values)
|
||||
submitFunc(param).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.close()
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
},
|
||||
filterOption (input, option) {
|
||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
@@ -1,76 +0,0 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="$t('standardRegulationLibrary.updateRecord')"
|
||||
:maskClosable="false"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirm-loading="confirmLoading"
|
||||
switchFullscreen
|
||||
@cancel="handleCancel">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<template v-if="recordList && recordList.length > 0">
|
||||
<div class="record-item" v-for="record in recordList" :key="record.id">
|
||||
{{ record.content }}
|
||||
</div>
|
||||
</template>
|
||||
<a-empty v-else/>
|
||||
</a-spin>
|
||||
|
||||
<template v-slot:footer>
|
||||
<a-button @click="handleCancel">{{ $t('close') }}</a-button>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDomesticStandardUpdateRecord } from '../../../../api/standardRegulationLibraryApi.js'
|
||||
|
||||
export default {
|
||||
name: 'UpdateRecordModal',
|
||||
data () {
|
||||
return {
|
||||
width: 800,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
recordList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open (standardNumber) {
|
||||
this.visible = true
|
||||
this.initRecord(standardNumber)
|
||||
},
|
||||
initRecord (standardNumber) {
|
||||
this.confirmLoading = true
|
||||
getDomesticStandardUpdateRecord({ standardNumber }).then(res => {
|
||||
if (res.success) {
|
||||
this.recordList = res.result || []
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.record-item {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid #E5E6EB;
|
||||
}
|
||||
|
||||
.record-item:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.record-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
</style>
|
||||
@@ -139,7 +139,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="filePreview(record)">{{
|
||||
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
|
||||
text
|
||||
}}
|
||||
</div>
|
||||
@@ -151,7 +151,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="filePreview(record)">{{
|
||||
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
|
||||
text
|
||||
}}
|
||||
</div>
|
||||
@@ -235,7 +235,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import '@assets/less/common.less'
|
||||
import { ConfigurableTableMixin } from '@/mixins/ConfigurableTableMixin'
|
||||
import Search from '../../../components/customField/Search.vue'
|
||||
@@ -244,8 +243,6 @@ import DomesticStandardModal from './modules/DomesticStandardModal.vue'
|
||||
import {
|
||||
configDomesticStandard,
|
||||
deleteDomesticSystemTree,
|
||||
getDomesticStandardDetail,
|
||||
getDomesticStandardFormModal,
|
||||
getDomesticStandardSearchForm,
|
||||
getDomesticStandardTableHeader,
|
||||
getDomesticStandardTree,
|
||||
@@ -263,10 +260,6 @@ import {
|
||||
import DomesticSystemTreeModal from './modules/DomesticSystemTreeModal.vue'
|
||||
import SelectionDomesticStandardDrawer from './modules/SelectionDomesticStandardDrawer.vue'
|
||||
import { postDownFile } from '@api/manage'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { previewPdf } from '@/utils/previewPdf'
|
||||
import { kkFilePreview } from '@/utils/kkFilePreview'
|
||||
import { getFileInfo } from '@api/api'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
@@ -293,12 +286,6 @@ export default {
|
||||
clickEvent: 'handleCollection',
|
||||
has: 'domesticStandard:collection'
|
||||
},
|
||||
// 查看
|
||||
{
|
||||
text: this.$t('viewDetail'),
|
||||
clickEvent: 'toDetailPage',
|
||||
has: 'domesticStandard:view'
|
||||
},
|
||||
// 编辑
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
@@ -571,109 +558,6 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 按顺序打开最新的pdf或word
|
||||
*/
|
||||
async filePreview (record) {
|
||||
console.log('filePreview', record)
|
||||
// 获取并处理过程稿件数据
|
||||
let res = await getDomesticStandardFormModal({ 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 getDomesticStandardDetail({ 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).toLowerCase()
|
||||
if (suffix === 'pdf') {
|
||||
pdfFileList.push({ id, name, suffix })
|
||||
}
|
||||
if (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]
|
||||
},
|
||||
/**
|
||||
* 重置查询
|
||||
*/
|
||||
|
||||
@@ -140,7 +140,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="filePreview(record)">{{
|
||||
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
|
||||
text
|
||||
}}
|
||||
</div>
|
||||
@@ -152,7 +152,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="filePreview(record)">{{
|
||||
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{
|
||||
text
|
||||
}}
|
||||
</div>
|
||||
@@ -248,9 +248,7 @@ import {
|
||||
cancelCollectionOverseasStandard,
|
||||
deleteOverseasStandardSystem,
|
||||
configOverseasStandard,
|
||||
removeOverseasStandard,
|
||||
getOverseasStandardForm,
|
||||
getOverseasStandardDocumentInfo
|
||||
removeOverseasStandard
|
||||
} from '../../../api/standardRegulationLibraryApi'
|
||||
import {
|
||||
OperationType,
|
||||
@@ -264,11 +262,6 @@ 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',
|
||||
@@ -294,12 +287,6 @@ export default {
|
||||
clickEvent: 'handleCollection',
|
||||
has: 'overseasStandard:collection'
|
||||
},
|
||||
// 查看
|
||||
{
|
||||
text: this.$t('viewDetail'),
|
||||
clickEvent: 'toDetailPage',
|
||||
has: 'overseasStandard:view'
|
||||
},
|
||||
// 编辑
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
@@ -572,109 +559,6 @@ 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).toLowerCase()
|
||||
if (suffix === 'pdf') {
|
||||
pdfFileList.push({ id, name, suffix })
|
||||
}
|
||||
if (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]
|
||||
},
|
||||
/**
|
||||
* 重置查询
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user