parent
f5e0988181
commit
b9e1abe2d6
@ -0,0 +1,19 @@ |
|||||||
|
package com.jianshui.web.utils; |
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author kk |
||||||
|
* @date 2023年12月23日 23:01 |
||||||
|
*/ |
||||||
|
public class Test { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
String encodedText = "$01MDM3MDAyMzAwMjExPC8+MTkxMjY4MDc8Lz4yMC4wPC8+MjAyMzEyPC8+aHR0cHM6Ly9kbGouNTFmYXBpYW8uY24vZGxqL3Y3L2Y2YzEyZDQyODMzZGQyYjZmMjhlZDk1NDExMjQxZjk4NDA3MmFkPC8+NzYyM2Y3NjA4MDA5NDExNWEzZWNkM2JjODk0ZTM4OTg8Lz4wMTwvPkFEMTU="; |
||||||
|
|
||||||
|
// 使用Hutool进行Base64解码,并指定字符集为UTF-8
|
||||||
|
String decodedText = Base64.decodeStr(encodedText, "UTF-8"); |
||||||
|
|
||||||
|
System.out.println(decodedText); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
import request from '@/utils/request' |
||||||
|
|
||||||
|
// 查询导入设置列表
|
||||||
|
export function getFilePreview(data) { |
||||||
|
return request({ |
||||||
|
url: '/invoice/filePreview', |
||||||
|
method: 'post', |
||||||
|
data: data |
||||||
|
}) |
||||||
|
} |
@ -1 +1,81 @@ |
|||||||
数电 |
<template> |
||||||
|
<div class="invoice-preview"> |
||||||
|
|
||||||
|
<!-- 使用Flex布局来居中显示 --> |
||||||
|
<div class="center-container"> |
||||||
|
<!-- 下载PDF按钮 --> |
||||||
|
<div style="float:left;"> |
||||||
|
<el-button type="primary" @click="downloadPDF" class="download-button">下载PDF</el-button> |
||||||
|
<el-button type="primary" @click="downloadPDF" class="download-button">下载OFD</el-button> |
||||||
|
<el-button type="primary" @click="downloadPDF" class="download-button">下载XML</el-button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<img :src="invoiceImageUrl" alt="发票图片损坏" class="invoice-image"> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import {getFilePreview} from "@/api/sdInvoicefile/sdinvoicefile"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 替换为你的发票图片base64 |
||||||
|
invoiceImageUrl: '' |
||||||
|
}; |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
const id = this.$route.params.id; |
||||||
|
console.log('id:', id); |
||||||
|
this.filePreview(id); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
filePreview(id){ |
||||||
|
this.loading = true; |
||||||
|
getFilePreview(id).then(response => { |
||||||
|
console.info("aa="+response); |
||||||
|
this.invoiceImageUrl = response; |
||||||
|
// this.$forceUpdate(); |
||||||
|
|
||||||
|
}); |
||||||
|
}, |
||||||
|
// 下载PDF按钮点击事件 |
||||||
|
downloadPDF() { |
||||||
|
// 在这里执行下载PDF的逻辑 |
||||||
|
// 可以使用第三方库或服务进行PDF生成,然后提供下载链接 |
||||||
|
// 例如:window.open('your_pdf_download_link.pdf', '_blank'); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
.invoice-preview { |
||||||
|
width: 100%; |
||||||
|
height: 100vh; /* 设置容器的高度为整个视口高度 */ |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
justify-content: center; |
||||||
|
align-items: center; |
||||||
|
} |
||||||
|
|
||||||
|
.center-container { |
||||||
|
display: flex; |
||||||
|
flex-direction: column; /* 将子元素垂直排列 */ |
||||||
|
justify-content: center; |
||||||
|
align-items: center; |
||||||
|
height: 80vh; /* 或者根据需要设置一个固定高度 */ |
||||||
|
flex: 1; /* 占据剩余的垂直空间 */ |
||||||
|
} |
||||||
|
|
||||||
|
.invoice-image { |
||||||
|
max-width: 90%; |
||||||
|
max-height: 90%; |
||||||
|
} |
||||||
|
|
||||||
|
.download-button { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
</style> |
||||||
|
Loading…
Reference in new issue