冀北数据总览添加导出功能
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
></DatePicker>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-slot:operation></template>
|
||||
<template v-slot:operation>
|
||||
<el-button type="primary" icon="el-icon-Download" @click="exportTemplate">导出</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
|
||||
<GridLayout
|
||||
@@ -68,9 +70,12 @@ import { useRouter, useRoute } from 'vue-router'
|
||||
import { View } from '@element-plus/icons-vue'
|
||||
import { useTimeCacheStore } from '@/stores/timeCache'
|
||||
import { adminBaseRoutePath } from '@/router/static'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { dataVerifyExcel } from '@/api/device-boot/line'
|
||||
const { push } = useRouter()
|
||||
const datePickerRef = ref()
|
||||
const router = useRouter()
|
||||
const adminInfo = useAdminInfo()
|
||||
const route = useRoute()
|
||||
const timeCacheStore = useTimeCacheStore()
|
||||
|
||||
@@ -288,7 +293,29 @@ const fetchLayoutData = async () => {
|
||||
// 可以添加错误提示逻辑
|
||||
}
|
||||
}
|
||||
// 导出
|
||||
const exportTemplate = () => {
|
||||
console.log(123)
|
||||
|
||||
dataVerifyExcel({
|
||||
deptId: adminInfo.$state.deptId,
|
||||
searchBeginTime: datePickerRef.value?.timeValue[0],
|
||||
searchEndTime: datePickerRef.value?.timeValue[1]
|
||||
}).then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
})
|
||||
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
// link.download = "电压暂降事件分析报告"; // 设置下载的文件名
|
||||
link.download = '数据总览' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
document.body.removeChild(link)
|
||||
})
|
||||
}
|
||||
// 窗口大小变化处理 - 使用防抖
|
||||
const handleResize = useDebounceFn(() => {
|
||||
initRowHeight()
|
||||
|
||||
Reference in New Issue
Block a user