fix : 分摊汇总表格及小计导出
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<el-button color="#DED0B2" style="float: right;margin: 0 10px 10px 0" @click="exportTable">导出</el-button>
|
||||
<el-table ref="reportTable" :data="tableData" style="width: 100%;height: 479px" :span-method="objectSpanMethod" v-loading="loading">
|
||||
<el-table ref="reportTable" :data="tableData" style="width: 100%;height: 479px"
|
||||
:span-method="objectSpanMethod" v-loading="loading">
|
||||
<!-- <el-table-column label="四川省国有资产经营投资管理有限责任公司-->
|
||||
<!-- 科技创新项目人工成本分摊明细表" align="center">-->
|
||||
<el-table-column v-for="column in columnInfo" :prop="column.prop" :label="column.label" align="center"
|
||||
@@ -37,6 +38,8 @@ import {getResearchUser, getAllocationDetailList, getAllocationDetails} from "@/
|
||||
import {ElNotification} from "element-plus";
|
||||
import {exportExcel} from "@/utils/export-excel";
|
||||
|
||||
import {toThousands} from '@/utils/changePrice.js'
|
||||
|
||||
const route = useRoute()
|
||||
const tableIns = ref()
|
||||
const reportTable = ref({});
|
||||
@@ -45,6 +48,94 @@ const monthConcat = new Map()
|
||||
const tableData = ref([])
|
||||
const loading = ref(false)
|
||||
const researchOptions = ref([])
|
||||
|
||||
// const getSummaries = (param) => {
|
||||
// const {columns, data} = param
|
||||
// const sums = []
|
||||
// columns.forEach((column, index) => {
|
||||
// if (index === 1) {
|
||||
// sums[index] = '合计'
|
||||
// }
|
||||
// // else if (index == (columns.length - 1)) {//分摊金额总计
|
||||
// // const values = data.map((item) => {
|
||||
// // // Number()
|
||||
// // console.log('column.property',column.property)
|
||||
// // console.log('item]',item)
|
||||
// // })
|
||||
// // if (!values.every((value) => Number.isNaN(value))) {
|
||||
// // sums[index] = `${values.reduce((prev, curr) => {
|
||||
// // const value = Number(curr)
|
||||
// // if (!Number.isNaN(value)) {
|
||||
// // return prev + curr
|
||||
// // } else {
|
||||
// // return prev
|
||||
// // }
|
||||
// // }, 0)}`
|
||||
// // sums[index] = toThousands(sums[index])
|
||||
// // } else {
|
||||
// // sums[index] = '-'
|
||||
// // }
|
||||
// // }
|
||||
// // else if (index == (columns.length - 2)) {//分摊金额合计
|
||||
// // const values = data.map((item) => Number(item[column.property]))
|
||||
// // console.log('values',values)
|
||||
// // if (!values.every((value) => Number.isNaN(value))) {
|
||||
// // sums[index] = `${values.reduce((prev, curr) => {
|
||||
// // const value = Number(curr)
|
||||
// // if (!Number.isNaN(value)) {
|
||||
// // return prev + curr
|
||||
// // } else {
|
||||
// // return prev
|
||||
// // }
|
||||
// // }, 0)}`
|
||||
// // sums[index] = toThousands(sums[index])
|
||||
// // } else {
|
||||
// // sums[index] = '-'
|
||||
// // }
|
||||
// // }
|
||||
// const parts = column.property.split('.');
|
||||
// if (column.property.startsWith('personInfo') && parts[1] === 'separationAmount') {
|
||||
// console.log('column',column,index)
|
||||
// const values = data.map((item) => {
|
||||
// // console.log('parts[0]',parts)
|
||||
// // console.log(item[parts[0]])
|
||||
// })
|
||||
// // console.log('values',values)
|
||||
// if (!values.every((value) => Number.isNaN(value))) {
|
||||
// sums[index] = `${values.reduce((prev, curr) => {
|
||||
// const value = Number(curr)
|
||||
// if (!Number.isNaN(value)) {
|
||||
// return prev + curr
|
||||
// } else {
|
||||
// return prev
|
||||
// }
|
||||
// }, 0)}`
|
||||
// sums[index] = toThousands(sums[index])
|
||||
// } else {
|
||||
// sums[index] = '-'
|
||||
// }
|
||||
// } else {
|
||||
// if (column.property.startsWith('personInfo') && parts[1] === 'subtotal') {
|
||||
// const values = data.map((item) => Number(item[parts[0]].subtotal))
|
||||
// if (!values.every((value) => Number.isNaN(value))) {
|
||||
// sums[index] = `${values.reduce((prev, curr) => {
|
||||
// const value = Number(curr)
|
||||
// if (!Number.isNaN(value)) {
|
||||
// return prev + curr
|
||||
// } else {
|
||||
// return prev
|
||||
// }
|
||||
// }, 0)}`
|
||||
// sums[index] = toThousands(sums[index])
|
||||
// } else {
|
||||
// sums[index] = '-'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return sums
|
||||
// }
|
||||
|
||||
const objectSpanMethod = ({row, column, rowIndex, columnIndex}) => {
|
||||
if (columnIndex === 0) {
|
||||
if (monthConcat.has(rowIndex)) {
|
||||
|
||||
Reference in New Issue
Block a user