refactor(仪表板、数据大屏): 富文本数据集清理优化,过滤组件禁用未选数据集的组件等优化 #11324

This commit is contained in:
wangjiahao 2024-08-08 14:07:47 +08:00
parent ed099ce5c5
commit 8de15b1f35
4 changed files with 44 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package io.dataease.chart.manage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.dataease.extensions.datasource.dto.DatasetTableFieldDTO;
@ -71,7 +72,13 @@ public class ChartViewManege {
if (ObjectUtils.isEmpty(coreChartView)) {
coreChartViewMapper.insert(record);
} else {
coreChartViewMapper.updateById(record);
UpdateWrapper<CoreChartView> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", record.getId());
//富文本允许设置空的tableId 这里额外更新一下
if(record.getTableId() == null){
updateWrapper.set("table_id", null);
}
coreChartViewMapper.update(record,updateWrapper);
}
return chartViewDTO;
}

View File

@ -392,6 +392,19 @@ const calcData = (view: Chart, callback) => {
})
callback?.()
})
} else if (!view.tableId) {
state.data = []
state.viewDataInfo = {}
state.totalItems = 0
const curViewInfo = canvasViewInfo.value[element.value.id]
curViewInfo['curFields'] = []
dvMainStore.setViewDataDetails(element.value.id, state.data)
initReady.value = true
initCurFields(curViewInfo)
callback?.()
nextTick(() => {
initReady.value = true
})
} else {
nextTick(() => {
initReady.value = true
@ -472,7 +485,7 @@ const renderChart = viewInfo => {
}
const conditionAdaptor = (chart: Chart) => {
if (!chart) {
if (!chart || !chart.senior) {
return
}
const { threshold } = parseJson(chart.senior)

View File

@ -214,6 +214,7 @@ const handleClear = e => {
e.preventDefault()
e.stopPropagation()
dsClick({ leaf: true, id: null } as Tree)
useEmitt().emitter.emit('clear-remove', ['xAxis', 'yAxis', 'drillFields'])
}
const handleFocus = () => {

View File

@ -145,10 +145,23 @@ const { view } = toRefs(props)
let cacheId = ''
const clearRemove = items => {
if (items) {
items.forEach(item => removeItems(item))
}
}
onBeforeMount(() => {
cacheId = route.query.id as unknown as string
})
onMounted(() => {
useEmitt({
name: 'clear-remove',
callback: clearRemove
})
})
const appStore = useAppStoreWithOut()
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
const itemFormRules = reactive<FormRules>({
@ -1474,7 +1487,14 @@ const calcEle = () => {
const setCacheId = () => {
nextTick(() => {
if (!cacheId || !!view.value.tableId || templateStatusShow.value) return
// 使cacheId
if (
!cacheId ||
!!view.value.tableId ||
templateStatusShow.value ||
view.value.type === 'rich-text'
)
return
view.value.tableId = cacheId as unknown as number
})
}