fix : 替换文件下载方式

This commit is contained in:
2024-05-18 17:32:58 +08:00
parent 0c070154e1
commit 6009885c09
6 changed files with 68 additions and 11 deletions

View File

@@ -14,6 +14,7 @@
<script setup lang="jsx">
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {shallowRef} from "vue";
import {downloadFile} from "@/api/project-demand";
const searchConfig = reactive([
{
@@ -59,7 +60,7 @@ const tableConfig = reactive({
currentRender: ({row, index}) => {
return (
<div>
<a style="cursor: pointer;font-size: 14px;color: #2a99ff;" href={row.url}>下载</a>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
<el-button type="primary" size="large" link onClick={() => beforeRemove(row)}>删除</el-button>
</div>
)
@@ -71,6 +72,15 @@ const showTable=ref(true)
const otherFileList = ref([])
const getOtherFile = () => {
}
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href=URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
</script>