refactor: 首次添加图表的图标显示时机优化

This commit is contained in:
wangjiahao 2023-10-25 10:32:26 +08:00
parent 9c9c8110b3
commit 50b83c75f5
3 changed files with 8 additions and 2 deletions

View File

@ -211,6 +211,7 @@ for (let i = 0, len = list.length; i < len; i++) {
const item = list[i] const item = list[i]
item.style = { ...commonStyle, ...item.style } item.style = { ...commonStyle, ...item.style }
item['commonBackground'] = deepCopy(COMMON_COMPONENT_BACKGROUND_BASE) item['commonBackground'] = deepCopy(COMMON_COMPONENT_BACKGROUND_BASE)
item['state'] = 'prepare'
list[i] = { ...commonAttr, ...item } list[i] = { ...commonAttr, ...item }
} }

View File

@ -525,6 +525,11 @@ const calcData = (view, resetDrill = false, updateQuery = '') => {
} }
} }
const updateChartData = view => {
curComponent.value['state'] = 'ready'
calcData(view, true, 'updateQuery')
}
const renderChart = view => { const renderChart = view => {
useEmitt().emitter.emit('renderChart-' + view.id, view) useEmitt().emitter.emit('renderChart-' + view.id, view)
snapshotStore.recordSnapshotCache('renderChart', view.id) snapshotStore.recordSnapshotCache('renderChart', view.id)
@ -1637,7 +1642,7 @@ const onRefreshChange = val => {
<el-button <el-button
type="primary" type="primary"
class="result-style-button" class="result-style-button"
@click="calcData(view, true, 'updateQuery')" @click="updateChartData(view)"
> >
<span style="font-size: 12px"> <span style="font-size: 12px">
{{ t('chart.update_chart_data') }} {{ t('chart.update_chart_data') }}

View File

@ -490,7 +490,7 @@ const loadingFlag = computed(() => {
const chartAreaShow = computed(() => { const chartAreaShow = computed(() => {
return ( return (
view.value.tableId || (view.value.tableId && element.value['state'] === 'ready') ||
view.value.type === 'rich-text' || view.value.type === 'rich-text' ||
(view.value.type === 'map' && view.value.customAttr.map.id) (view.value.type === 'map' && view.value.customAttr.map.id)
) )