refactor(仪表板): 优化移动端设计面板部分交互问题

This commit is contained in:
wangjiahao 2024-10-23 20:46:20 +08:00
parent 91b74d22cf
commit fd8559b26f
4 changed files with 28 additions and 1 deletions

View File

@ -335,7 +335,9 @@ public class ChartViewManege {
record.setExtLabel(objectMapper.writeValueAsString(dto.getExtLabel())); record.setExtLabel(objectMapper.writeValueAsString(dto.getExtLabel()));
record.setExtTooltip(objectMapper.writeValueAsString(dto.getExtTooltip())); record.setExtTooltip(objectMapper.writeValueAsString(dto.getExtTooltip()));
record.setCustomAttr(objectMapper.writeValueAsString(dto.getCustomAttr())); record.setCustomAttr(objectMapper.writeValueAsString(dto.getCustomAttr()));
record.setCustomAttrMobile(objectMapper.writeValueAsString(dto.getCustomAttrMobile()));
record.setCustomStyle(objectMapper.writeValueAsString(dto.getCustomStyle())); record.setCustomStyle(objectMapper.writeValueAsString(dto.getCustomStyle()));
record.setCustomStyleMobile(objectMapper.writeValueAsString(dto.getCustomStyleMobile()));
record.setSenior(objectMapper.writeValueAsString(dto.getSenior())); record.setSenior(objectMapper.writeValueAsString(dto.getSenior()));
record.setDrillFields(objectMapper.writeValueAsString(dto.getDrillFields())); record.setDrillFields(objectMapper.writeValueAsString(dto.getDrillFields()));
record.setCustomFilter(objectMapper.writeValueAsString(dto.getCustomFilter())); record.setCustomFilter(objectMapper.writeValueAsString(dto.getCustomFilter()));
@ -363,7 +365,9 @@ public class ChartViewManege {
dto.setExtLabel(JsonUtil.parseList(record.getExtLabel(), tokenType)); dto.setExtLabel(JsonUtil.parseList(record.getExtLabel(), tokenType));
dto.setExtTooltip(JsonUtil.parseList(record.getExtTooltip(), tokenType)); dto.setExtTooltip(JsonUtil.parseList(record.getExtTooltip(), tokenType));
dto.setCustomAttr(JsonUtil.parse(record.getCustomAttr(), Map.class)); dto.setCustomAttr(JsonUtil.parse(record.getCustomAttr(), Map.class));
dto.setCustomAttrMobile(JsonUtil.parse(record.getCustomAttrMobile(), Map.class));
dto.setCustomStyle(JsonUtil.parse(record.getCustomStyle(), Map.class)); dto.setCustomStyle(JsonUtil.parse(record.getCustomStyle(), Map.class));
dto.setCustomStyleMobile(JsonUtil.parse(record.getCustomStyleMobile(), Map.class));
dto.setSenior(JsonUtil.parse(record.getSenior(), Map.class)); dto.setSenior(JsonUtil.parse(record.getSenior(), Map.class));
dto.setDrillFields(JsonUtil.parseList(record.getDrillFields(), tokenType)); dto.setDrillFields(JsonUtil.parseList(record.getDrillFields(), tokenType));
dto.setCustomFilter(JsonUtil.parseObject(record.getCustomFilter(), FilterTreeObj.class)); dto.setCustomFilter(JsonUtil.parseObject(record.getCustomFilter(), FilterTreeObj.class));

View File

@ -19,7 +19,9 @@
`ext_label`, `ext_label`,
`ext_tooltip`, `ext_tooltip`,
`custom_attr`, `custom_attr`,
`custom_attr_mobile`,
`custom_style`, `custom_style`,
`custom_style_mobile`,
`custom_filter`, `custom_filter`,
`drill_fields`, `drill_fields`,
`senior`, `senior`,
@ -59,7 +61,9 @@
`ext_label`, `ext_label`,
`ext_tooltip`, `ext_tooltip`,
`custom_attr`, `custom_attr`,
`custom_attr_mobile`,
`custom_style`, `custom_style`,
`custom_style_mobile`,
`custom_filter`, `custom_filter`,
`drill_fields`, `drill_fields`,
`senior`, `senior`,

View File

@ -397,11 +397,13 @@ export function initCanvasDataMobile(dvId, busiFlag, callBack) {
function ({ canvasDataResult, canvasStyleResult, dvInfo, canvasViewInfoPreview }) { function ({ canvasDataResult, canvasStyleResult, dvInfo, canvasViewInfoPreview }) {
const componentData = canvasDataResult.filter(ele => !!ele.inMobile) const componentData = canvasDataResult.filter(ele => !!ele.inMobile)
canvasDataResult.forEach(ele => { canvasDataResult.forEach(ele => {
const { mx, my, mSizeX, mSizeY } = ele const { mx, my, mSizeX, mSizeY, mStyle, mCommonBackground } = ele
ele.x = mx ele.x = mx
ele.y = my ele.y = my
ele.sizeX = mSizeX ele.sizeX = mSizeX
ele.sizeY = mSizeY ele.sizeY = mSizeY
ele.mStyle = mStyle || ele.Style
ele.mCommonBackground = mCommonBackground || ele.commonBackground
if (ele.component === 'DeTabs') { if (ele.component === 'DeTabs') {
ele.propValue.forEach(tabItem => { ele.propValue.forEach(tabItem => {
tabItem.componentData.forEach(tabComponent => { tabItem.componentData.forEach(tabComponent => {
@ -413,6 +415,14 @@ export function initCanvasDataMobile(dvId, busiFlag, callBack) {
}) })
} }
}) })
if (!!canvasViewInfoPreview) {
Object.keys(canvasViewInfoPreview).forEach(key => {
const viewInfo = canvasViewInfoPreview[key]
const { customAttrMobile, customStyleMobile } = viewInfo
viewInfo['customAttr'] = customAttrMobile || viewInfo['customAttr']
viewInfo['customStyle'] = customStyleMobile || viewInfo['customStyle']
})
}
dvMainStore.setComponentData(componentData) dvMainStore.setComponentData(componentData)
dvMainStore.setCanvasStyle(canvasStyleResult) dvMainStore.setCanvasStyle(canvasStyleResult)
dvMainStore.updateCurDvInfo(dvInfo) dvMainStore.updateCurDvInfo(dvInfo)

View File

@ -114,10 +114,19 @@ public class ChartViewBaseDTO implements Serializable {
*/ */
private Map<String, Object> customAttr; private Map<String, Object> customAttr;
/**
* 移动端图形属性
*/
private Map<String, Object> customAttrMobile;
/** /**
* 组件样式 * 组件样式
*/ */
private Map<String, Object> customStyle; private Map<String, Object> customStyle;
/**
* 移动端组件样式
*/
private Map<String, Object> customStyleMobile;
/** /**
* 结果过滤 * 结果过滤