|
@@ -305,7 +305,7 @@
|
|
|
:show-file-list="false"
|
|
|
:on-change="changes"
|
|
|
:file-list="filesArra2">
|
|
|
- <el-button type="info" size="mini">点击上传</el-button>
|
|
|
+ <el-button type="info" size="mini" v-if="inputForm.permissionFlag">点击上传</el-button>
|
|
|
</el-upload>
|
|
|
<div style="height: calc(100% - 80px);margin-top: 30px">
|
|
|
<vxe-table
|
|
@@ -347,8 +347,8 @@
|
|
|
<!-- <vxe-column title="文件描述" field="description"></vxe-column>-->
|
|
|
<vxe-column title="操作" width="200px" fixed="right" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
+ <el-button type="text" icon="el-icon-delete" size="small" v-if="inputForm.permissionFlag" @click="deleteMsgById(scope.row, scope.$rowIndex)">删除</el-button>
|
|
|
<el-button type="text" icon="el-icon-edit" size="small" @click="toHref(scope.row)">下载</el-button>
|
|
|
- <el-button type="text" icon="el-icon-delete" size="small" @click="deleteMsgById(scope.row, scope.$rowIndex)">删除</el-button>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
@@ -388,6 +388,7 @@
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
inputForm: {
|
|
|
+ permissionFlag: '', // 判断是否为当前登录人参数
|
|
|
customerName: '',
|
|
|
projectName: '',
|
|
|
evaluationObjective: '',
|
|
@@ -465,31 +466,37 @@
|
|
|
// }
|
|
|
// },
|
|
|
async toHref (row) {
|
|
|
- let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
|
|
|
- if (suffix === 'pdf' || suffix === 'txt') {
|
|
|
- if (row.id === null || row.id === undefined || row.id === '') {
|
|
|
- this.ossService.downLoadAttach(row.raw.url).then((res) => {
|
|
|
- this.$utils.download(res.data, '项目导入模板')
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.ossService.downLoadAttach(row.url).then((res) => {
|
|
|
- this.$utils.download(res.data, '项目导入模板')
|
|
|
- })
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
- console.log('rr', row)
|
|
|
const link = document.createElement('a')
|
|
|
- link.setAttribute('download', row.name)
|
|
|
- link.setAttribute('target', '_blank')
|
|
|
if (row.id === null || row.id === undefined || row.id === '') {
|
|
|
await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
- link.setAttribute('href', data.data)
|
|
|
- link.click()
|
|
|
+ const url = data.data // 完整的url则直接使用
|
|
|
+ // 这里是将url转成blob地址,
|
|
|
+ fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
|
|
|
+ link.href = URL.createObjectURL(blob)
|
|
|
+ console.log(link.href)
|
|
|
+ link.download = row.name || '' // 下载文件的名字
|
|
|
+ // a.download = url.split('/')[url.split('/').length -1] // // 下载文件的名字
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ // 在资源下载完成后 清除 占用的缓存资源
|
|
|
+ window.URL.revokeObjectURL(link.href)
|
|
|
+ document.body.removeChild(link)
|
|
|
+ })
|
|
|
})
|
|
|
} else {
|
|
|
- link.setAttribute('href', row.temporaryUrl)
|
|
|
- link.click()
|
|
|
+ const url = row.temporaryUrl // 完整的url则直接使用
|
|
|
+ // 这里是将url转成blob地址,
|
|
|
+ fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
|
|
|
+ link.href = URL.createObjectURL(blob)
|
|
|
+ console.log(link.href)
|
|
|
+ link.download = row.name || '' // 下载文件的名字
|
|
|
+ // a.download = url.split('/')[url.split('/').length -1] // // 下载文件的名字
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ // 在资源下载完成后 清除 占用的缓存资源
|
|
|
+ window.URL.revokeObjectURL(link.href)
|
|
|
+ document.body.removeChild(link)
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
onPreview (url) {
|
|
@@ -579,6 +586,7 @@
|
|
|
this.inputForm.evaluationReportDateUi = data.evaluationReportDate
|
|
|
this.inputForm.invoiceDateUi = data.invoiceDate
|
|
|
this.inputForm.reimbursementDateUi = data.reimbursementDate
|
|
|
+ this.inputForm.permissionFlag = data.permissionFlag
|
|
|
this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
|
|
|
this.loading = false
|
|
|
})
|