|
@@ -307,7 +307,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
|
|
@@ -350,7 +350,7 @@
|
|
|
<vxe-column title="操作" width="200px" fixed="right" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<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>
|
|
|
+ <el-button type="text" icon="el-icon-delete" size="small" v-if="inputForm.permissionFlag" @click="deleteMsgById(scope.row, scope.$rowIndex)">删除</el-button>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
@@ -390,6 +390,7 @@
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
inputForm: {
|
|
|
+ permissionFlag: '', // 判断是否为当前登录人参数
|
|
|
customerName: '',
|
|
|
projectName: '',
|
|
|
evaluationObjective: '',
|
|
@@ -449,32 +450,37 @@
|
|
|
this.projectService = new ProjectService()
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
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)
|
|
|
+ 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)
|
|
|
+ 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) {
|
|
@@ -563,6 +569,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
|
|
|
})
|
|
@@ -575,7 +582,6 @@
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
this.inputForm.itemType = '2'
|
|
|
- console.log(this.dataListNew)
|
|
|
this.inputForm.workAttachments = []
|
|
|
this.dataListNew.forEach((item) => {
|
|
|
if (item.id === null || item.id === undefined || item.id === '') {
|
|
@@ -586,7 +592,6 @@
|
|
|
item.attachmentName = item.name
|
|
|
this.inputForm.workAttachments.push(item)
|
|
|
})
|
|
|
- console.log('workAttachments', this.inputForm.workAttachments)
|
|
|
this.projectService.save(this.inputForm).then(({data}) => {
|
|
|
this.close()
|
|
|
this.$message.success(data)
|
|
@@ -609,8 +614,6 @@
|
|
|
this.fileList = handleRemove()
|
|
|
},
|
|
|
changes (file, fileList) {
|
|
|
- console.log('file', file)
|
|
|
- console.log('22', fileList)
|
|
|
this.dataListNew = []
|
|
|
this.dataList.forEach((item) => {
|
|
|
this.dataListNew.push(item)
|
|
@@ -620,8 +623,6 @@
|
|
|
item.createBy = this.$store.state.user.name
|
|
|
this.dataListNew.push(item)
|
|
|
})
|
|
|
- console.log('11', this.dataList)
|
|
|
- console.log('33', this.dataListNew)
|
|
|
const isLt2M = file.size / 1024 / 1024 < 300
|
|
|
if (isLt2M === false) {
|
|
|
this.$message.error('文件大小不能超过 ' + 300 + 'M !')
|
|
@@ -635,7 +636,6 @@
|
|
|
}
|
|
|
},
|
|
|
async showFile (row) {
|
|
|
- console.log('row', row)
|
|
|
let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
|
|
|
if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
|
|
|
if (row.url !== null && row.url !== undefined && row.url !== '') {
|
|
@@ -678,7 +678,6 @@
|
|
|
this.refreshList()
|
|
|
},
|
|
|
deleteMsgById (row, index) {
|
|
|
- console.log(index)
|
|
|
this.dataListNew.splice(index, 1)
|
|
|
if (row.id !== null && row.id !== '' && row.id !== undefined) {
|
|
|
this.ossService.deleteMsgById(row.id)
|