|
@@ -329,7 +329,16 @@
|
|
<vxe-column type="seq" width="40"></vxe-column>
|
|
<vxe-column type="seq" width="40"></vxe-column>
|
|
<vxe-column title="文件名称" field="name">
|
|
<vxe-column title="文件名称" field="name">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-link type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.name}}</el-link>
|
|
|
|
|
|
+ <div v-if="ifName(scope.row) === true">
|
|
|
|
+ <el-image
|
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
|
+ :src="getsrc(scope.row)"
|
|
|
|
+ :preview-src-list="srcList">
|
|
|
|
+ </el-image>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ <el-link type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.name}}</el-link>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</vxe-column>
|
|
</vxe-column>
|
|
<vxe-column title="创建人" field="createBy"></vxe-column>
|
|
<vxe-column title="创建人" field="createBy"></vxe-column>
|
|
@@ -337,7 +346,7 @@
|
|
<!-- <vxe-column title="文件描述" field="description"></vxe-column>-->
|
|
<!-- <vxe-column title="文件描述" field="description"></vxe-column>-->
|
|
<vxe-column title="操作" width="200px" fixed="right" align="center">
|
|
<vxe-column title="操作" width="200px" fixed="right" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button type="text" icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</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-edit" size="small" @click="toHref(scope.row)">下载</el-button>
|
|
<el-button type="text" icon="el-icon-edit" size="small" @click="toHref(scope.row)">下载</el-button>
|
|
</template>
|
|
</template>
|
|
</vxe-column>
|
|
</vxe-column>
|
|
@@ -349,7 +358,8 @@
|
|
<el-image-viewer
|
|
<el-image-viewer
|
|
v-if="showViewer"
|
|
v-if="showViewer"
|
|
:on-close="closeViewer"
|
|
:on-close="closeViewer"
|
|
- :url-list="[url]" />
|
|
|
|
|
|
+ :url-list="[url]"
|
|
|
|
+ zIndex="9999"/>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
<el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
<el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
<el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
@@ -366,6 +376,7 @@
|
|
fileName
|
|
fileName
|
|
} from '@/api/sys/OSSService'
|
|
} from '@/api/sys/OSSService'
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
|
|
+ import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -426,6 +437,7 @@
|
|
rowurl: ''
|
|
rowurl: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ components: { ElImageViewer },
|
|
projectService: null,
|
|
projectService: null,
|
|
ossService: null,
|
|
ossService: null,
|
|
created () {
|
|
created () {
|
|
@@ -433,7 +445,34 @@
|
|
this.projectService = new ProjectService()
|
|
this.projectService = new ProjectService()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ async getsrc (row) {
|
|
|
|
+ console.log('rrrr', row)
|
|
|
|
+ if (row.id === null || row.id === undefined || row.id === '') {
|
|
|
|
+ await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
|
+ return data.data
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ return row.url
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ ifName (row) {
|
|
|
|
+ let suffix = row.name.substring(row.name.lastIndexOf('.') + 1)
|
|
|
|
+ if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async toHref (row) {
|
|
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)
|
|
|
|
+ } else {
|
|
|
|
+ this.ossService.downLoadAttach(row.url)
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
console.log('rr', row)
|
|
console.log('rr', row)
|
|
const link = document.createElement('a')
|
|
const link = document.createElement('a')
|
|
link.setAttribute('download', row.name)
|
|
link.setAttribute('download', row.name)
|
|
@@ -444,7 +483,7 @@
|
|
link.click()
|
|
link.click()
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- link.setAttribute('href', row.url)
|
|
|
|
|
|
+ link.setAttribute('href', row.temporaryUrl)
|
|
link.click()
|
|
link.click()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -613,7 +652,7 @@
|
|
return
|
|
return
|
|
} else {
|
|
} else {
|
|
await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
await this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
- this.onPreview(data)
|
|
|
|
|
|
+ this.onPreview(data.data)
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -647,7 +686,12 @@
|
|
}
|
|
}
|
|
this.refreshList()
|
|
this.refreshList()
|
|
},
|
|
},
|
|
- deleteMsgById (row) {
|
|
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|