fix: 修复复用明细表翻页模式切换失败问题

This commit is contained in:
wangjiahao 2023-10-25 13:18:43 +08:00
parent cb539ac59f
commit 8483fd828f
2 changed files with 12 additions and 5 deletions

View File

@ -577,7 +577,11 @@ export const dvMainStore = defineStore('dataVisualization', {
} else {
viewInfo[propertyInfo.custom][propertyInfo.property] = propertyInfo.value
}
useEmitt().emitter.emit('renderChart-' + viewId, viewInfo)
if (['tablePageMode', 'tablePageSize'].includes(propertyInfo.subProp)) {
useEmitt().emitter.emit('calcData-' + viewId, viewInfo)
} else {
useEmitt().emitter.emit('renderChart-' + viewId, viewInfo)
}
})
} else {
this.componentData.forEach(component => {

View File

@ -108,18 +108,21 @@ const renderChartFromDialog = (viewInfo: Chart, chartDataInfo) => {
chartData.value = chartDataInfo
renderChart(viewInfo, false)
}
const renderChart = (view: Chart, resetPageInfo: boolean) => {
if (!view) {
const renderChart = (viewInfo: Chart, resetPageInfo: boolean) => {
if (!viewInfo) {
return
}
// view view.data
const chart = {
...defaultsDeep(view, cloneDeep(BASE_VIEW_CONFIG)),
...defaultsDeep(viewInfo, cloneDeep(BASE_VIEW_CONFIG)),
data: chartData.value
} as ChartObj
setupPage(chart, resetPageInfo)
myChart?.destroy()
const chartView = chartViewManager.getChartView(view.render, view.type) as S2ChartView<any>
const chartView = chartViewManager.getChartView(
viewInfo.render,
viewInfo.type
) as S2ChartView<any>
myChart = chartView.drawChart({
container: containerId,
chart: toRaw(chart),