feat : 台账导出

This commit is contained in:
clay
2024-06-23 18:55:42 +08:00
parent 5edf97338e
commit f66a570f00
2 changed files with 139 additions and 106 deletions

View File

@@ -2,6 +2,7 @@
<baseTitle title="基础信息"></baseTitle>
<fvForm :schema="schema" @getInstance="(e)=>baseForm = e"></fvForm>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<el-button @click="exportExcelHandler">导出</el-button>
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick">
<template #empty>
<el-empty description="暂无数据"/>
@@ -13,8 +14,7 @@
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {toThousands} from '@/utils/changePrice.js'
import {getBaseInfoApi} from "@/components/steps/api";
import {searchUpdateLedgerData} from "@/api/project-manage";
import {ElNotification} from "element-plus";
import {searchUpdateLedgerData,exportExcel} from "@/api/project-manage";
const router = useRouter()
const route = useRoute()
@@ -270,6 +270,25 @@ const handleUploadFee = () => {
})
}
const exportExcelHandler = () => {
let data = {
projectId: 113
}
exportExcel(data).then(res => {
console.log(res)
let reg = /filename=([^&]+)/;
let contentDisposition = decodeURI(res.headers['content-disposition'])
let result = reg.exec(contentDisposition)
let fileName = result[1]
fileName = fileName.replace(/\"/g, '')
const blob = new Blob([res.data])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = fileName
a.click()
})
}
const search = (val) => {
tableConfig.params = {...val, projectId: route.query.id}
tableIns.value.refresh()