修改冀北问题
This commit is contained in:
@@ -41,6 +41,9 @@
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出excel</el-button>
|
||||
<el-button icon="el-icon-Download" :loading="loading" @click="exportReport" type="primary">
|
||||
下载报告
|
||||
</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div class="box">
|
||||
@@ -58,10 +61,11 @@ import TableStore from '@/utils/tableStore'
|
||||
import PointTree from '@/components/tree/pqs/pointTree.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { exportModelJB } from '@/api/harmonic-boot/harmonic'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
|
||||
import { ElMessage } from 'element-plus'
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/xieboReport'
|
||||
})
|
||||
@@ -113,12 +117,13 @@ const tableStore = new TableStore({
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
allowEdit: false, // 禁止所有编辑操作(必填)
|
||||
allowEdit: false, // 禁止所有编辑操作(必填)
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
})
|
||||
const loading = ref(false)
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
@@ -159,6 +164,50 @@ const handleNodeClick = (data: any, node: any) => {
|
||||
const exportEvent = () => {
|
||||
exportExcel(luckysheet.getAllSheets(), '统计报表下载')
|
||||
}
|
||||
const exportReport = () => {
|
||||
if (!line) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
|
||||
message: '请选择要导出的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
let form = new FormData()
|
||||
form.append('isUrl', false)
|
||||
form.append('lineIndex', dotList.value.id)
|
||||
form.append('startTime', TableHeaderRef.value.datePickerRef.timeValue[0])
|
||||
form.append('endTime', TableHeaderRef.value.datePickerRef.timeValue[1])
|
||||
form.append('type', 0)
|
||||
form.append('name', dotList.value.name)
|
||||
ElMessage({
|
||||
message: '下载报告中,请稍等.....',
|
||||
duration: 1000
|
||||
})
|
||||
exportModelJB(form)
|
||||
.then(async res => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
})
|
||||
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download =
|
||||
dotList.value.name +
|
||||
TableHeaderRef.value.datePickerRef.timeValue[0] +
|
||||
'_' +
|
||||
TableHeaderRef.value.datePickerRef.timeValue[1] // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
document.body.removeChild(link)
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
@@ -167,6 +216,5 @@ const exportEvent = () => {
|
||||
|
||||
.box {
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user