[update] 修改证书模板信息查看文件弹框
This commit is contained in:
@@ -19,18 +19,18 @@
|
||||
<template slot="footer">
|
||||
<a-button key="back" @click="handleCancel">关闭</a-button>
|
||||
</template>
|
||||
<under-study-files-modal ref="filesModal" :columns="fileColumns" :isCommittee="false"></under-study-files-modal>
|
||||
<certificate-model-info-file ref="filesModal" :columns="fileColumns" :isCommittee="false"></certificate-model-info-file>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UnderStudyFilesModal from '@views/MessagePage/modules/UnderStudyFilesModal'
|
||||
import { getFileInfo } from '@api/api'
|
||||
import { getAction } from '@/api/manage'
|
||||
import CertificateModelInfoFile from './CertificateModelInfoFile'
|
||||
import { getFilesByIds } from '@api/standardsAssociationApi'
|
||||
import { getAction } from '@/api/memberManage'
|
||||
|
||||
export default {
|
||||
name: 'CertificateModeInfoModal',
|
||||
components: {UnderStudyFilesModal},
|
||||
components: {CertificateModelInfoFile},
|
||||
data () {
|
||||
return {
|
||||
title: '查看',
|
||||
@@ -46,11 +46,11 @@ export default {
|
||||
align: 'center',
|
||||
dataIndex: 'fileName',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
}, {
|
||||
title: '上传时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
scopedSlots: { customRender: 'time' }
|
||||
// }, {
|
||||
// title: '上传时间',
|
||||
// align: 'center',
|
||||
// dataIndex: 'createTime',
|
||||
// scopedSlots: { customRender: 'time' }
|
||||
}, {
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
@@ -60,7 +60,7 @@ export default {
|
||||
}
|
||||
],
|
||||
url: {
|
||||
queryById: ''
|
||||
queryById: '/vinCertificate/vinCertificate/getCertificateTemplate'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -84,8 +84,8 @@ export default {
|
||||
* */
|
||||
getFileInfo(id) {
|
||||
return new Promise(resolve => {
|
||||
let result = {}
|
||||
getFileInfo({ id: id }).then(res => {
|
||||
let result = []
|
||||
getFilesByIds({ ids: id }).then(res => {
|
||||
if (res.success) {
|
||||
result = res.result
|
||||
}
|
||||
@@ -100,14 +100,15 @@ export default {
|
||||
async initFileList(fileIds) {
|
||||
this.fileLoading = true
|
||||
if (fileIds) {
|
||||
const fileList = []
|
||||
let arr = fileIds.split(',')
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let fileObj = {}
|
||||
fileObj = await this.getFileInfo(arr[i])
|
||||
fileList.push({ fileId: fileObj.id, fileName: fileObj.fileName, createTime: fileObj.createTime })
|
||||
}
|
||||
this.fileList = [...fileList]
|
||||
// let fileList = []
|
||||
this.fileList = await this.getFileInfo(fileIds)
|
||||
// let arr = fileIds.split(',')
|
||||
// for (let i = 0; i < arr.length; i++) {
|
||||
// let fileObj = {}
|
||||
// fileObj = await this.getFileInfo(arr[i])
|
||||
// fileList.push({ fileId: fileObj.id, fileName: fileObj.fileName, createTime: fileObj.createTime })
|
||||
// }
|
||||
// this.fileList = [...fileList]
|
||||
} else {
|
||||
this.fileList = []
|
||||
}
|
||||
@@ -123,20 +124,13 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.basic-info {
|
||||
.basic-info-item {
|
||||
display: flex;
|
||||
|
||||
.ant-col {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
|
||||
label {
|
||||
flex-shrink: 0;
|
||||
width: 10%;
|
||||
text-align: right;
|
||||
}
|
||||
label {
|
||||
flex-shrink: 0;
|
||||
width: 10%;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<!-- table表格区域-->
|
||||
<div>
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
rowKey="id"
|
||||
bordered
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="false"
|
||||
:loading="confirmLoading"
|
||||
class="j-table-force-nowrap">
|
||||
|
||||
<template slot="text" slot-scope="text">
|
||||
<j-ellipsis :value="text" :length="18"></j-ellipsis>
|
||||
</template>
|
||||
|
||||
<!-- 时间戳转时间-->
|
||||
<template slot="time" slot-scope="text">
|
||||
<j-ellipsis :value="text.toString().indexOf('-') === -1 ? processingTimestamp(text) : text" :length="20"></j-ellipsis>
|
||||
</template>
|
||||
|
||||
<!-- 操作-->
|
||||
<span slot="action" class="action-span-cell" slot-scope="text, record">
|
||||
<a @click="handleDownload(record)">下载</a>
|
||||
<a @click="handlePreview(record)">查看</a>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<template slot="footer">
|
||||
<a-button key="back" @click="handleCancel">关闭</a-button>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { downloadFile } from '@api/memberManage'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { processingTimestamp } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: 'CertificateModelInfoFile',
|
||||
props: {
|
||||
columns: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '文件',
|
||||
width: 800,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
dataSource: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
processingTimestamp,
|
||||
/**
|
||||
* 下载
|
||||
* @param record
|
||||
*/
|
||||
handleDownload(record) {
|
||||
downloadFile(`sys/common/static/${record.id}`, record.fileName)
|
||||
},
|
||||
/**
|
||||
* 预览
|
||||
* @param record
|
||||
*/
|
||||
handlePreview(record) {
|
||||
if (record && record.id) {
|
||||
const fileFullUrl = `${window._CONFIG['memberDomianWebSocketURL']}/sys/common/static/${record.id}?type=view&token=${ Vue.ls.get(ACCESS_TOKEN) }&fullfilename=${record.fileName}`
|
||||
let url = `${ window._CONFIG['onlinePreviewDomainURL'] }?url=${ encodeURIComponent(fileFullUrl) }`
|
||||
window.open(url)
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
this.dataSource = []
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
Reference in New Issue
Block a user