fix : 修复分摊明细/汇总导出

This commit is contained in:
2024-06-20 03:24:58 +08:00
parent 994e474532
commit 255dbe67e0
4 changed files with 174 additions and 145 deletions

View File

@@ -17,6 +17,7 @@
</div>
<!-- 列显示配置 -->
<div v-if="isSettingCol" style="float: right">
<el-button v-if="tableConfig.export && tableConfig.export.open" @click="exportTable" color="#DED0B2" style="margin-bottom: 10px">导出</el-button>
<el-tooltip effect="dark" content="列配置" placement="bottom">
<el-button ref="buttonRef" link>
<el-icon size="18">
@@ -101,6 +102,7 @@
<script setup>
import {ElNotification} from 'element-plus';
import {requestList} from '../../api/common';
import {exportExcel} from "@/utils/export-excel";
const props = defineProps({
//表格配置
@@ -129,6 +131,20 @@ const tableInstance = ref()
const buttonRef = ref()
const popoverRef = ref()
const exportTable = () => {
const $e = tableInstance.value.$el
let $table = $e.querySelector('.el-table__fixed')
if (!$table) {
$table = $e
}
let fileName = ""
if (props.tableConfig.export && props.tableConfig.export) {
fileName = props.tableConfig.export.fileName
}
exportExcel($table, localData.list[0], fileName)
}
const localData = reactive({
list: [], // 表格数据
query: {
@@ -204,12 +220,12 @@ const getList = async () => {
try {
const {code, data, msg} = await requestList(api, queryParmas)
if (code === 1000) {
if(data.rows){
if (data.rows) {
localData.list = data.rows
}else {
} else {
localData.list = data
}
if(data.total){
if (data.total) {
localData.total = data.total
emits('getTotal', localData.total)
}