forked from github/dataease
refactor(图表): 明细导出样式等优化
This commit is contained in:
parent
cd53482acd
commit
ad02177bd6
@ -572,7 +572,7 @@ public class ChartDataManage {
|
|||||||
data = resultCustomSort(xAxis, data);
|
data = resultCustomSort(xAxis, data);
|
||||||
}
|
}
|
||||||
// 如果是表格导出查询 则在此处直接就可以返回
|
// 如果是表格导出查询 则在此处直接就可以返回
|
||||||
if (chartExtRequest.getExcelExportFlag()) {
|
if (view.getIsExcelExport()) {
|
||||||
Map<String, Object> sourceInfo = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
|
Map<String, Object> sourceInfo = ChartDataBuild.transTableNormal(xAxis, yAxis, view, data, extStack, desensitizationList);
|
||||||
sourceInfo.put("sourceData", data);
|
sourceInfo.put("sourceData", data);
|
||||||
view.setData(sourceInfo);
|
view.setData(sourceInfo);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
link
|
link
|
||||||
icon="Download"
|
icon="Download"
|
||||||
size="middle"
|
size="middle"
|
||||||
|
:loading="exportLoading"
|
||||||
@click="downloadViewDetails"
|
@click="downloadViewDetails"
|
||||||
>
|
>
|
||||||
导出Excel
|
导出Excel
|
||||||
@ -71,6 +72,7 @@ const { t } = useI18n()
|
|||||||
const optType = ref(null)
|
const optType = ref(null)
|
||||||
const chartComponentDetails = ref(null)
|
const chartComponentDetails = ref(null)
|
||||||
const { dvInfo } = storeToRefs(dvMainStore)
|
const { dvInfo } = storeToRefs(dvMainStore)
|
||||||
|
const exportLoading = ref(false)
|
||||||
const DETAIL_TABLE_ATTR: DeepPartial<ChartObj> = {
|
const DETAIL_TABLE_ATTR: DeepPartial<ChartObj> = {
|
||||||
render: 'antv',
|
render: 'antv',
|
||||||
type: 'table-info',
|
type: 'table-info',
|
||||||
@ -119,7 +121,10 @@ const downloadViewDetails = () => {
|
|||||||
const viewDataInfo = dvMainStore.getViewDataDetails(viewInfo.value.id)
|
const viewDataInfo = dvMainStore.getViewDataDetails(viewInfo.value.id)
|
||||||
const chartExtRequest = dvMainStore.getLastViewRequestInfo(viewInfo.value.id)
|
const chartExtRequest = dvMainStore.getLastViewRequestInfo(viewInfo.value.id)
|
||||||
const chart = { ...viewInfo.value, chartExtRequest, data: viewDataInfo }
|
const chart = { ...viewInfo.value, chartExtRequest, data: viewDataInfo }
|
||||||
exportExcelDownload(chart)
|
exportLoading.value = true
|
||||||
|
exportExcelDownload(chart, () => {
|
||||||
|
exportLoading.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const htmlToImage = () => {
|
const htmlToImage = () => {
|
||||||
|
@ -419,7 +419,7 @@ export const getGeoJsonFile = async (areaId: string): Promise<FeatureCollection>
|
|||||||
return toRaw(geoJson)
|
return toRaw(geoJson)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const exportExcelDownload = chart => {
|
export const exportExcelDownload = (chart, callBack?) => {
|
||||||
const fields = JSON.parse(JSON.stringify(chart.data.fields))
|
const fields = JSON.parse(JSON.stringify(chart.data.fields))
|
||||||
const tableRow = JSON.parse(JSON.stringify(chart.data.tableRow))
|
const tableRow = JSON.parse(JSON.stringify(chart.data.tableRow))
|
||||||
const excelHeader = fields.map(item => item.chartShowName ?? item.name)
|
const excelHeader = fields.map(item => item.chartShowName ?? item.name)
|
||||||
@ -471,9 +471,11 @@ export const exportExcelDownload = chart => {
|
|||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
document.body.removeChild(link)
|
document.body.removeChild(link)
|
||||||
|
callBack('success')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.error('Excel download error')
|
console.error('Excel download error')
|
||||||
|
callBack('error')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user