|
@@ -69,9 +69,6 @@ const downloadName = computed(() => {
|
|
|
const isShowTooltips = computed(() => {
|
|
const isShowTooltips = computed(() => {
|
|
|
return bar_data.value?.isShowTooltips
|
|
return bar_data.value?.isShowTooltips
|
|
|
})
|
|
})
|
|
|
-let header: any = []
|
|
|
|
|
-let data: any = []
|
|
|
|
|
-let sheetname: any = []
|
|
|
|
|
const exportData = ({ filename }: any) => {
|
|
const exportData = ({ filename }: any) => {
|
|
|
$api
|
|
$api
|
|
|
.RevenueDownload({
|
|
.RevenueDownload({
|
|
@@ -80,6 +77,9 @@ const exportData = ({ filename }: any) => {
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
|
|
+ let header: any = []
|
|
|
|
|
+ let data: any = []
|
|
|
|
|
+ let sheetname: any = []
|
|
|
let filterA = res.data.r2_cloumn.map((el: any) => {
|
|
let filterA = res.data.r2_cloumn.map((el: any) => {
|
|
|
return el.dataIndex
|
|
return el.dataIndex
|
|
|
})
|
|
})
|
|
@@ -114,35 +114,34 @@ const exportData = ({ filename }: any) => {
|
|
|
sheetname.push(result[i].sheetName)
|
|
sheetname.push(result[i].sheetName)
|
|
|
data.push(formatJson(result[i].filterVal, result[i].tableDatas))
|
|
data.push(formatJson(result[i].filterVal, result[i].tableDatas))
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .finally(() => {
|
|
|
|
|
- // 将表头插入数据数组中
|
|
|
|
|
- for (let i = 0; i < header.length; i++) {
|
|
|
|
|
- data[i].unshift(header[i])
|
|
|
|
|
- }
|
|
|
|
|
- let ws_name = sheetname
|
|
|
|
|
- // 创建工作簿对象
|
|
|
|
|
- let wb = XLSX.utils.book_new()
|
|
|
|
|
- let ws: any = []
|
|
|
|
|
- // 创建每个工作表并设置列宽
|
|
|
|
|
- for (let j = 0; j < header.length; j++) {
|
|
|
|
|
- ws.push(XLSX.utils.aoa_to_sheet(data[j]))
|
|
|
|
|
- let arr: any = []
|
|
|
|
|
- header[j].forEach((val: any) => {
|
|
|
|
|
- arr.push({
|
|
|
|
|
- wpx: 120
|
|
|
|
|
|
|
+ // 将表头插入数据数组中
|
|
|
|
|
+ for (let i = 0; i < header.length; i++) {
|
|
|
|
|
+ data[i].unshift(header[i])
|
|
|
|
|
+ }
|
|
|
|
|
+ let ws_name = sheetname
|
|
|
|
|
+ // 创建工作簿对象
|
|
|
|
|
+ let wb = XLSX.utils.book_new()
|
|
|
|
|
+ let ws: any = []
|
|
|
|
|
+ // 创建每个工作表并设置列宽
|
|
|
|
|
+ for (let j = 0; j < header.length; j++) {
|
|
|
|
|
+ ws.push(XLSX.utils.aoa_to_sheet(data[j]))
|
|
|
|
|
+ let arr: any = []
|
|
|
|
|
+ header[j].forEach((val: any) => {
|
|
|
|
|
+ arr.push({
|
|
|
|
|
+ wpx: 120
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
- ws[j]['!cols'] = arr
|
|
|
|
|
- }
|
|
|
|
|
- // 将工作表对象添加到工作簿中
|
|
|
|
|
- for (let k = 0; k < header.length; k++) {
|
|
|
|
|
- wb.SheetNames.push(ws_name[k])
|
|
|
|
|
- wb.Sheets[ws_name[k]] = ws[k]
|
|
|
|
|
|
|
+ ws[j]['!cols'] = arr
|
|
|
|
|
+ }
|
|
|
|
|
+ // 将工作表对象添加到工作簿中
|
|
|
|
|
+ for (let k = 0; k < header.length; k++) {
|
|
|
|
|
+ wb.SheetNames.push(ws_name[k])
|
|
|
|
|
+ wb.Sheets[ws_name[k]] = ws[k]
|
|
|
|
|
+ }
|
|
|
|
|
+ XLSX.writeFile(wb, filename + '.xlsx') // 导出文件
|
|
|
}
|
|
}
|
|
|
- XLSX.writeFile(wb, filename + '.xlsx') // 导出文件
|
|
|
|
|
})
|
|
})
|
|
|
|
|
+ .finally(() => {})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 数额
|
|
// 数额
|