|
@@ -11,7 +11,7 @@
|
|
|
<ul >
|
|
|
<li v-for="(item,index) in attachmentData" :key="index">
|
|
|
<img :src="item.src" class="logo" v-if="item.status == '1'" style="width: 100px;"/>
|
|
|
- <a v-if="item.status == '0'" style="text-decoration:underline">
|
|
|
+ <a v-if="item.status == '0'" style="text-decoration:underline" @click="accessoryDownload(item)">
|
|
|
{{item.name}}
|
|
|
</a>
|
|
|
</li>
|
|
@@ -23,6 +23,7 @@
|
|
|
<script>
|
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
|
|
+import { downFile } from '@/api/manage'
|
|
|
export default {
|
|
|
name: 'AttachmentDisplay', // 明细 弹框
|
|
|
mixins: [JeecgListMixin],
|
|
@@ -59,7 +60,28 @@ export default {
|
|
|
return [
|
|
|
'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
|
|
|
indexOf(ext.toLowerCase()) !== -1;
|
|
|
- }
|
|
|
+ },
|
|
|
+ accessoryDownload(item){
|
|
|
+ downFile(item.src).then(data => {
|
|
|
+ if (!data) {
|
|
|
+ this.$message.warning('文件下载失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
+ window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
|
|
|
+ } else {
|
|
|
+ let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
|
|
+ let link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ link.setAttribute('download', item.name + '.xls')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link) // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|