forked from github/dataease
Merge pull request #10550 from dataease/pr@dev-v2@refactor_xpack
refactor: 优化仪表板大屏定时报告预览预览
This commit is contained in:
commit
b0a9388b3e
@ -39,7 +39,6 @@ import io.dataease.visualization.dao.auto.mapper.DataVisualizationInfoMapper;
|
||||
import io.dataease.visualization.dao.auto.mapper.VisualizationWatermarkMapper;
|
||||
import io.dataease.visualization.dao.ext.mapper.ExtDataVisualizationMapper;
|
||||
import io.dataease.visualization.manage.CoreVisualizationManage;
|
||||
import io.dataease.xpack.base.report.dao.auto.mapper.VisualizationReportFilterMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -92,9 +91,6 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
@Resource
|
||||
private VisualizationWatermarkMapper watermarkMapper;
|
||||
|
||||
@Resource
|
||||
private VisualizationReportFilterMapper reportFilterMapper;
|
||||
|
||||
@Override
|
||||
public DataVisualizationVO findCopyResource(Long dvId, String busiFlag) {
|
||||
DataVisualizationVO result = findById(new DataVisualizationBaseRequest(dvId, busiFlag));
|
||||
|
@ -23,7 +23,7 @@ export const findCopyResource = async (dvId, busiFlag): Promise<IResponse> => {
|
||||
export const findById = async (
|
||||
dvId,
|
||||
busiFlag,
|
||||
attachInfo = { source: 'main' }
|
||||
attachInfo = { source: 'main', taskId: null }
|
||||
): Promise<IResponse> => {
|
||||
let busiFlagResult = busiFlag
|
||||
if (!busiFlagResult) {
|
||||
|
@ -25,6 +25,7 @@ import { viewFieldTimeTrans } from '@/utils/viewUtils'
|
||||
export const dvMainStore = defineStore('dataVisualization', {
|
||||
state: () => {
|
||||
return {
|
||||
canvasAttachInfo: {}, // 仪表板附加信息
|
||||
fullscreenFlag: false, // 全屏启用标识
|
||||
staticResourcePath: '/static-resource/',
|
||||
canvasCollapse: {
|
||||
@ -178,6 +179,9 @@ export const dvMainStore = defineStore('dataVisualization', {
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setCanvasAttachInfo(value) {
|
||||
this.canvasAttachInfo = value
|
||||
},
|
||||
setEmbeddedCallBack(value) {
|
||||
this.embeddedCallBack = value
|
||||
},
|
||||
|
@ -93,7 +93,11 @@ export function initCanvasDataPrepare(dvId, busiFlag, callBack) {
|
||||
const copyFlag = busiFlag != null && busiFlag.includes('-copy')
|
||||
const busiFlagCustom = copyFlag ? busiFlag.split('-')[0] : busiFlag
|
||||
const method = copyFlag ? findCopyResource : findById
|
||||
method(dvId, busiFlagCustom).then(res => {
|
||||
let attachInfo = { source: 'main' }
|
||||
if (dvMainStore.canvasAttachInfo && !!dvMainStore.canvasAttachInfo.taskId) {
|
||||
attachInfo = { source: 'report', taskId: dvMainStore.canvasAttachInfo.taskId }
|
||||
}
|
||||
method(dvId, busiFlagCustom, attachInfo).then(res => {
|
||||
const canvasInfo = res.data
|
||||
const watermarkInfo = {
|
||||
...canvasInfo.watermarkInfo,
|
||||
@ -122,9 +126,21 @@ export function initCanvasDataPrepare(dvId, busiFlag, callBack) {
|
||||
//历史字段适配
|
||||
canvasStyleResult.component['seniorStyleSetting'] =
|
||||
canvasStyleResult.component['seniorStyleSetting'] || deepCopy(SENIOR_STYLE_SETTING_LIGHT)
|
||||
|
||||
const reportFilterInfo = canvasInfo.reportFilterInfo
|
||||
canvasDataResult.forEach(componentItem => {
|
||||
componentItem['canvasActive'] = false
|
||||
// 定时报告过滤组件适配 如果当前是定时报告默认切有设置对应的过滤组件默认值,则替换过滤组件
|
||||
if (
|
||||
componentItem.component === 'VQuery' &&
|
||||
attachInfo.source === 'report' &&
|
||||
!!reportFilterInfo
|
||||
) {
|
||||
componentItem.propValue.forEach((filterItem, index) => {
|
||||
if (reportFilterInfo[filterItem.id]) {
|
||||
componentItem.propValue[index] = JSON.parse(reportFilterInfo[filterItem.id].filterInfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (componentItem.component === 'Group') {
|
||||
componentItem.expand = componentItem.expand || false
|
||||
}
|
||||
|
@ -122,6 +122,9 @@ onMounted(async () => {
|
||||
await new Promise(r => (p = r))
|
||||
const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId
|
||||
const { dvType, callBackFlag, taskId } = router.currentRoute.value.query
|
||||
if (!!taskId) {
|
||||
dvMainStore.setCanvasAttachInfo({ taskId: taskId })
|
||||
}
|
||||
if (dvId) {
|
||||
loadCanvasDataAsync(dvId, dvType)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user