Merge pull request #11235 from dataease/pr@dev-v2@refactor_pivot_tree_export

refactor(图表): 透视表树形模式暂不支持带格式导出
This commit is contained in:
wisonic-s 2024-07-29 18:26:03 +08:00 committed by GitHub
commit eca2816181
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 4 deletions

View File

@ -117,9 +117,13 @@
<el-dropdown-item @click="exportAsExcel">Excel</el-dropdown-item>
<el-dropdown-item
v-if="element.innerType === 'table-pivot'"
:disabled="!enableFormattedExport"
@click="exportAsFormattedExcel"
>Excel(带格式)</el-dropdown-item
>
<span :title="enableFormattedExport ? '' : '树形模式暂不支持导出'"
>Excel(带格式)</span
>
</el-dropdown-item>
<el-dropdown-item @click="exportAsImage">图片</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -147,9 +151,11 @@
<el-dropdown-item @click="exportAsExcel">Excel</el-dropdown-item>
<el-dropdown-item
v-if="element.innerType === 'table-pivot'"
:disabled="!enableFormattedExport"
@click="exportAsFormattedExcel"
>Excel(带格式)</el-dropdown-item
>
<span :title="enableFormattedExport ? '' : '树形模式暂不支持导出'">Excel(带格式)</span>
</el-dropdown-item>
<el-dropdown-item @click="exportAsImage">图片</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -386,6 +392,12 @@ const exportAsFormattedExcel = () => {
const chart = dvMainStore.getViewDetails(element.value.id)
exportPivotExcel(s2Instance, chart)
}
const enableFormattedExport = computed(() => {
const chart = dvMainStore.getViewDetails(element.value.id) as ChartObj
const mode = chart?.customAttr?.basicStyle?.tableLayoutMode
return mode === 'grid'
})
const exportAsExcel = () => {
const viewDataInfo = dvMainStore.getViewDataDetails(element.value.id)
const chartExtRequest = dvMainStore.getLastViewRequestInfo(element.value.id)

View File

@ -52,9 +52,10 @@
icon="Download"
size="middle"
:loading="exportLoading"
:disabled="!enableFormattedExport"
@click="exportAsFormattedExcel"
>
导出Excel(带格式)
<span :title="enableFormattedExport ? '' : '树形模式暂不支持导出'">导出Excel(带格式)</span>
</el-button>
<el-divider class="close-divider" direction="vertical" v-if="authShow" />
</div>
@ -298,7 +299,11 @@ const exportAsFormattedExcel = () => {
const chart = dvMainStore.getViewDetails(viewInfo.value.id)
exportPivotExcel(s2Instance, chart)
}
const enableFormattedExport = computed(() => {
const chart = dvMainStore.getViewDetails(viewInfo.value.id) as ChartObj
const mode = chart?.customAttr?.basicStyle?.tableLayoutMode
return mode === 'grid'
})
const exportData = () => {
useEmitt().emitter.emit('data-export-center', { activeName: 'IN_PROGRESS' })
}