|
@@ -345,6 +345,10 @@
|
|
|
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
+ <el-image-viewer
|
|
|
+ v-if="showViewer"
|
|
|
+ :on-close="closeViewer"
|
|
|
+ :url-list="[url]" />
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<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>
|
|
@@ -414,7 +418,9 @@
|
|
|
},
|
|
|
filesArra2: [],
|
|
|
fileList: [],
|
|
|
- isFlag: true
|
|
|
+ isFlag: true,
|
|
|
+ showViewer: false, // 显示查看器
|
|
|
+ url: ''
|
|
|
}
|
|
|
},
|
|
|
projectService: null,
|
|
@@ -424,6 +430,15 @@
|
|
|
this.projectService = new ProjectService()
|
|
|
},
|
|
|
methods: {
|
|
|
+ onPreview (url) {
|
|
|
+ this.url = url
|
|
|
+ this.showViewer = true
|
|
|
+ },
|
|
|
+ // 关闭查看器
|
|
|
+ closeViewer () {
|
|
|
+ this.url = ''
|
|
|
+ this.showViewer = false
|
|
|
+ },
|
|
|
init (method, id) {
|
|
|
this.ossService.findFileList(id).then(({data}) => {
|
|
|
data.forEach((item) => {
|
|
@@ -560,6 +575,17 @@
|
|
|
},
|
|
|
showFile (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 !== '') {
|
|
|
+ this.onPreview(row.url)
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.ossService.getTemporaryUrl(row.raw.url).then((data) => {
|
|
|
+ this.onPreview(data)
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
if (row.url !== null && row.url !== undefined && row.url !== '') {
|
|
|
if (suffix === 'pdf') {
|
|
|
window.open('https://view.xdocin.com/xdoc?xdoc=' + row.url, '_blank')
|