mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
fix: 修复未发布的仪表板跳转内部仪表板未参与联动问题
This commit is contained in:
@@ -10,6 +10,9 @@ public class DataVisualizationConstants {
|
||||
|
||||
// 主工程
|
||||
public static final String MAIN = "main";
|
||||
|
||||
// 主工程编辑区
|
||||
public static final String MAIN_EDIT = "main-edit";
|
||||
}
|
||||
|
||||
//新建仪表板来源
|
||||
|
||||
@@ -38,6 +38,8 @@ public interface ExtVisualizationLinkJumpMapper {
|
||||
|
||||
List<VisualizationLinkJumpDTO> getTargetVisualizationJumpInfo(@Param("request") VisualizationLinkJumpBaseRequest request);
|
||||
|
||||
List<VisualizationLinkJumpDTO> getTargetVisualizationJumpInfoSnapshot(@Param("request") VisualizationLinkJumpBaseRequest request);
|
||||
|
||||
void copyLinkJump(@Param("copyId")Long copyId);
|
||||
|
||||
void copyLinkJumpInfo(@Param("copyId")Long copyId);
|
||||
|
||||
@@ -170,7 +170,7 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
String busiFlag = request.getBusiFlag();
|
||||
String resourceTable = request.getResourceTable();
|
||||
// 如果是编辑查询 则进行镜像检查
|
||||
if (CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(resourceTable)) {
|
||||
if (DataVisualizationConstants.QUERY_SOURCE.MAIN_EDIT.equals(request.getSource())) {
|
||||
QueryWrapper<SnapshotDataVisualizationInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", dvId);
|
||||
queryWrapper.in("status", Arrays.asList(CommonConstants.DV_STATUS.UNPUBLISHED, CommonConstants.DV_STATUS.SAVED_UNPUBLISHED)); // 状态为0 未发布 和 2 已保存未发布的 不需要重置镜像
|
||||
|
||||
@@ -81,12 +81,12 @@ public class VisualizationLinkJumpService implements VisualizationLinkJumpApi {
|
||||
@DeLinkPermit
|
||||
//获取仪表板的跳转信息
|
||||
@Override
|
||||
public VisualizationLinkJumpBaseResponse queryVisualizationJumpInfo(Long dvId,String resourceTable) {
|
||||
public VisualizationLinkJumpBaseResponse queryVisualizationJumpInfo(Long dvId, String resourceTable) {
|
||||
Map<String, VisualizationLinkJumpInfoDTO> resultBase = new HashMap<>();
|
||||
List<VisualizationLinkJumpDTO> resultLinkJumpList = null;
|
||||
if(CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(resourceTable)){
|
||||
if (CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(resourceTable)) {
|
||||
resultLinkJumpList = extVisualizationLinkJumpMapper.queryWithDvIdSnapshot(dvId, AuthUtils.getUser().getUserId(), ModelUtils.isDesktop());
|
||||
}else{
|
||||
} else {
|
||||
resultLinkJumpList = extVisualizationLinkJumpMapper.queryWithDvId(dvId, AuthUtils.getUser().getUserId(), ModelUtils.isDesktop());
|
||||
}
|
||||
Optional.ofNullable(resultLinkJumpList).orElse(new ArrayList<>()).forEach(resultLinkJump -> {
|
||||
@@ -155,7 +155,12 @@ public class VisualizationLinkJumpService implements VisualizationLinkJumpApi {
|
||||
@DeLinkPermit("#p0.targetDvId")
|
||||
@Override
|
||||
public VisualizationLinkJumpBaseResponse queryTargetVisualizationJumpInfo(VisualizationLinkJumpBaseRequest request) {
|
||||
List<VisualizationLinkJumpDTO> result = extVisualizationLinkJumpMapper.getTargetVisualizationJumpInfo(request);
|
||||
List<VisualizationLinkJumpDTO> result = null;
|
||||
if (CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(request.getResourceTable())) {
|
||||
result = extVisualizationLinkJumpMapper.getTargetVisualizationJumpInfoSnapshot(request);
|
||||
} else {
|
||||
result = extVisualizationLinkJumpMapper.getTargetVisualizationJumpInfo(request);
|
||||
}
|
||||
return new VisualizationLinkJumpBaseResponse(null, Optional.ofNullable(result).orElse(new ArrayList<>()).stream().filter(item -> StringUtils.isNotEmpty(item.getSourceInfo())).collect(Collectors.toMap(VisualizationLinkJumpDTO::getSourceInfo, VisualizationLinkJumpDTO::getTargetInfoList)));
|
||||
}
|
||||
|
||||
@@ -174,7 +179,7 @@ public class VisualizationLinkJumpService implements VisualizationLinkJumpApi {
|
||||
outParamsJumpInfo = new ArrayList<>();
|
||||
componentData = "[]";
|
||||
}
|
||||
return new VisualizationComponentDTO(componentData,result,outParamsJumpInfo);
|
||||
return new VisualizationComponentDTO(componentData, result, outParamsJumpInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -357,6 +357,24 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTargetVisualizationJumpInfoSnapshot" resultMap="AllJumpMap">
|
||||
SELECT DISTINCT
|
||||
concat( lj.source_view_id, '#', jtvi.source_field_active_id ) AS sourceInfo,
|
||||
concat( jtvi.target_view_id, '#', jtvi.target_field_id ) AS targetInfo
|
||||
FROM
|
||||
snapshot_visualization_link_jump_target_view_info jtvi
|
||||
LEFT JOIN snapshot_visualization_link_jump_info lji ON jtvi.link_jump_info_id = lji.id
|
||||
LEFT JOIN snapshot_visualization_link_jump lj ON lji.link_jump_id = lj.id
|
||||
WHERE
|
||||
lji.checked = 1
|
||||
and lj.source_dv_id = #{request.sourceDvId}
|
||||
AND lj.source_view_id = #{request.sourceViewId}
|
||||
AND lji.target_dv_id = #{request.targetDvId}
|
||||
<if test="request.sourceFieldId != null">
|
||||
AND lji.source_field_id = #{request.sourceFieldId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="copyLinkJump">
|
||||
insert into visualization_link_jump (id, source_dv_id, source_view_id, link_jump_info, `checked`, copy_from,
|
||||
copy_id)
|
||||
|
||||
@@ -339,7 +339,7 @@ export function initCanvasDataPrepare(dvId, params, callBack) {
|
||||
const copyFlag = busiFlag != null && busiFlag.includes('-copy')
|
||||
const busiFlagCustom = copyFlag ? busiFlag.split('-')[0] : busiFlag
|
||||
const method = copyFlag ? findCopyResource : findById
|
||||
let attachInfo = { source: 'main' }
|
||||
let attachInfo = { source: params.source ? params.source : 'main' }
|
||||
if (dvMainStore.canvasAttachInfo && !!dvMainStore.canvasAttachInfo.taskId) {
|
||||
attachInfo = { source: 'report', taskId: dvMainStore.canvasAttachInfo.taskId }
|
||||
const showWatermarkExist =
|
||||
|
||||
@@ -470,9 +470,11 @@ const jumpClick = param => {
|
||||
const jumpInfoParam = `&jumpInfoParam=${encodeURIComponent(
|
||||
Base64.encode(JSON.stringify(param))
|
||||
)}`
|
||||
|
||||
// 内部仪表板跳转
|
||||
if (jumpInfo.linkType === 'inner') {
|
||||
if (jumpInfo.targetDvId) {
|
||||
const editPreviewParams = showPosition.value === 'canvas' ? '&editPreview=true' : ''
|
||||
const filterOuterParams = {}
|
||||
const curFilter = dvMainStore.getLastViewRequestInfo(param.viewId)
|
||||
const targetViewInfoList = jumpInfo.targetViewInfoList
|
||||
@@ -507,9 +509,9 @@ const jumpClick = param => {
|
||||
if (jumpInfo.publicJumpId) {
|
||||
let url = `${embeddedBaseUrl}#/de-link/${jumpInfo.publicJumpId}?fromLink=true&dvType=${jumpInfo.targetDvType}`
|
||||
if (attachParamsInfo) {
|
||||
url = url + attachParamsInfo + jumpInfoParam
|
||||
url = url + attachParamsInfo + jumpInfoParam + editPreviewParams
|
||||
} else {
|
||||
url = url + '&ignoreParams=true' + jumpInfoParam
|
||||
url = url + '&ignoreParams=true' + jumpInfoParam + editPreviewParams
|
||||
}
|
||||
const currentUrl = window.location.href
|
||||
localStorage.setItem('beforeJumpUrl', currentUrl)
|
||||
@@ -520,9 +522,9 @@ const jumpClick = param => {
|
||||
} else {
|
||||
let url = `${embeddedBaseUrl}#/preview?dvId=${jumpInfo.targetDvId}&fromLink=true&dvType=${jumpInfo.targetDvType}`
|
||||
if (attachParamsInfo) {
|
||||
url = url + attachParamsInfo + jumpInfoParam
|
||||
url = url + attachParamsInfo + jumpInfoParam + editPreviewParams
|
||||
} else {
|
||||
url = url + '&ignoreParams=true' + jumpInfoParam
|
||||
url = url + '&ignoreParams=true' + jumpInfoParam + editPreviewParams
|
||||
}
|
||||
const currentUrl = window.location.href
|
||||
localStorage.setItem('beforeJumpUrl', currentUrl)
|
||||
|
||||
@@ -162,19 +162,23 @@ const doUseCache = flag => {
|
||||
const initLocalCanvasData = callBack => {
|
||||
const { resourceId, opt, sourcePid } = state
|
||||
const busiFlag = opt === 'copy' ? 'dashboard-copy' : 'dashboard'
|
||||
initCanvasData(resourceId, { busiFlag, resourceTable: 'snapshot' }, function () {
|
||||
dataInitState.value = true
|
||||
if (dvInfo.value && opt === 'copy') {
|
||||
dvInfo.value.dataState = 'prepare'
|
||||
dvInfo.value.optType = 'copy'
|
||||
dvInfo.value.pid = sourcePid
|
||||
setTimeout(() => {
|
||||
snapshotStore.recordSnapshotCache('initLocalCanvasData')
|
||||
}, 1500)
|
||||
initCanvasData(
|
||||
resourceId,
|
||||
{ busiFlag, resourceTable: 'snapshot', source: 'main-edit' },
|
||||
function () {
|
||||
dataInitState.value = true
|
||||
if (dvInfo.value && opt === 'copy') {
|
||||
dvInfo.value.dataState = 'prepare'
|
||||
dvInfo.value.optType = 'copy'
|
||||
dvInfo.value.pid = sourcePid
|
||||
setTimeout(() => {
|
||||
snapshotStore.recordSnapshotCache('initLocalCanvasData')
|
||||
}, 1500)
|
||||
}
|
||||
onInitReady({ resourceId: resourceId })
|
||||
callBack && callBack()
|
||||
}
|
||||
onInitReady({ resourceId: resourceId })
|
||||
callBack && callBack()
|
||||
})
|
||||
)
|
||||
}
|
||||
onMounted(async () => {
|
||||
dvMainStore.setCurComponent({ component: null, index: null })
|
||||
|
||||
@@ -64,7 +64,8 @@ const loadCanvasDataAsync = async (dvId, dvType, ignoreParams = false) => {
|
||||
sourceDvId: jumpParam.sourceDvId,
|
||||
sourceViewId: jumpParam.sourceViewId,
|
||||
sourceFieldId: null,
|
||||
targetDvId: dvId
|
||||
targetDvId: dvId,
|
||||
resourceTable: state.editPreview ? 'snapshot' : 'core'
|
||||
}
|
||||
try {
|
||||
// 刷新跳转目标仪表板联动信息
|
||||
|
||||
@@ -303,24 +303,28 @@ const doUseCache = flag => {
|
||||
const initLocalCanvasData = async callback => {
|
||||
const { opt, sourcePid, resourceId } = state
|
||||
const busiFlag = opt === 'copy' ? 'dataV-copy' : 'dataV'
|
||||
await initCanvasData(resourceId, { busiFlag, resourceTable: 'snapshot' }, function () {
|
||||
state.canvasInitStatus = true
|
||||
// afterInit
|
||||
nextTick(() => {
|
||||
dvMainStore.setDataPrepareState(true)
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
if (dvInfo.value && opt === 'copy') {
|
||||
dvInfo.value.dataState = 'prepare'
|
||||
dvInfo.value.optType = 'copy'
|
||||
dvInfo.value.pid = sourcePid
|
||||
setTimeout(() => {
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
}, 1500)
|
||||
}
|
||||
onInitReady({ resourceId: resourceId })
|
||||
callback && callback()
|
||||
})
|
||||
})
|
||||
await initCanvasData(
|
||||
resourceId,
|
||||
{ busiFlag, resourceTable: 'snapshot', source: 'main-edit' },
|
||||
function () {
|
||||
state.canvasInitStatus = true
|
||||
// afterInit
|
||||
nextTick(() => {
|
||||
dvMainStore.setDataPrepareState(true)
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
if (dvInfo.value && opt === 'copy') {
|
||||
dvInfo.value.dataState = 'prepare'
|
||||
dvInfo.value.optType = 'copy'
|
||||
dvInfo.value.pid = sourcePid
|
||||
setTimeout(() => {
|
||||
snapshotStore.recordSnapshotCache('renderChart')
|
||||
}, 1500)
|
||||
}
|
||||
onInitReady({ resourceId: resourceId })
|
||||
callback && callback()
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const previewScaleChange = () => {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DataVisualizationBaseRequest extends DataVisualizationVO {
|
||||
|
||||
private List<Long> activeViewIds;
|
||||
|
||||
// 查询来源 main=主工程 report=定时报告
|
||||
// 查询来源 main-edit= 主工程编辑区 main=主工程 report=定时报告
|
||||
private String source;
|
||||
|
||||
// 定时报告id
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.dataease.api.visualization.request;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.dataease.constant.CommonConstants;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,8 @@ public class VisualizationLinkJumpBaseRequest {
|
||||
|
||||
private Boolean activeStatus;
|
||||
|
||||
private String resourceTable = CommonConstants.RESOURCE_TABLE.CORE;
|
||||
|
||||
public VisualizationLinkJumpBaseRequest() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user