refactor: 代码合并

main
wu.jian2 1 year ago
parent e76c8ed1c1
commit a80545f7b2

@ -4,6 +4,9 @@ import com.gccloud.dataroom.core.module.chart.bean.Chart;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author hongyang
@ -14,77 +17,7 @@ import lombok.Data;
public class ScreenBorderChart extends Chart {
@ApiModelProperty(notes = "个性化配置")
private Customize customize = new Customize();
@Data
public static class Customize {
@ApiModelProperty(notes = "边框主颜色")
private String borderMainColor;
@ApiModelProperty(notes = "边框次颜色")
private String borderSecondaryColor;
@ApiModelProperty(notes = "背景颜色")
private String backgroundColor;
@ApiModelProperty(notes = "边框颜色")
private String borderColor;
@ApiModelProperty(notes = "边框宽度")
private Integer borderWidth;
@ApiModelProperty(notes = "是否翻转")
private Boolean reverse;
@ApiModelProperty(notes = "单次动画时长")
private Integer dur;
@ApiModelProperty(notes = "颜色类型")
private String colorType;
@ApiModelProperty(notes = "渐变色0值")
private String gradientColor0;
@ApiModelProperty(notes = "渐变色1值")
private String gradientColor1;
@ApiModelProperty(notes = "渐变色色值改变方向")
private String gradientDirection;
@ApiModelProperty(notes = "透明度")
private Float opacity;
@ApiModelProperty(notes = "字体大小")
private Integer fontSize;
@ApiModelProperty(notes = "字体颜色")
private String fontColor;
@ApiModelProperty(notes = "字体粗细")
private Integer fontWeight;
@ApiModelProperty(notes = "中心文本")
private String text;
@ApiModelProperty(notes = "长度")
private Integer height;
@ApiModelProperty(notes = "宽度")
private Integer width;
@ApiModelProperty(notes = "左上圆角")
private Integer radiusLeftTop;
@ApiModelProperty(notes = "右上圆角")
private Integer radiusRightTop;
@ApiModelProperty(notes = "左下圆角")
private Integer radiusLeftBottom;
@ApiModelProperty(notes = "右下圆角")
private Integer radiusRightBottom;
private Map<String, Object> customize = new HashMap<>();
}
}

@ -346,6 +346,15 @@ public class DataRoomPageServiceImpl extends ServiceImpl<DataRoomPageDao, PageEn
component.setComponentKey(newCode);
}
}
// 处理定时器
DataRoomPageDTO.PageConfig pageConfig = config.getPageConfig();
List<DataRoomPageDTO.RefreshConfig> refreshConfigList = pageConfig.getRefreshConfig();
if (refreshConfigList != null) {
for (DataRoomPageDTO.RefreshConfig refreshConfig : refreshConfigList) {
String oldChartCode = refreshConfig.getCode();
refreshConfig.setCode(chartCodeMap.get(oldChartCode));
}
}
String copyUrl = this.copyCoverPicture(oldCode, screenEntity.getCode());
if (StringUtils.isBlank(copyUrl)) {
screenEntity.setCoverPicture(null);

@ -2,10 +2,15 @@ import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
const baseRoutes = [{
path: '/notPermission',
component: () => import('data-room-ui/NotPermission/index.vue')
}]
const baseRoutes = [
{
path: '/notPermission',
component: () => import('data-room-ui/NotPermission/index.vue')
}, {
path: '/test',
component: () => import('data-room-ui/BizComponent_Demo')
}
]
export const constantRoutes = []

@ -155,6 +155,7 @@ import decorationComponents from 'data-room-ui/js/config/decorationComponentsCon
import LayerList from './LayerList/index.vue'
import { mapMutations } from 'vuex'
import IconSvg from 'data-room-ui/SvgIcon'
import { customSerialize } from 'data-room-ui/js/utils/jsonSerialize.js'
export default {
name: 'PageLeftPanel',
components: {
@ -275,7 +276,7 @@ export default {
/* 设置拖拽传输数据 */
event.dataTransfer.setData(
'dragComponent',
JSON.stringify({
customSerialize({
...element,
offsetX: event.offsetX,
offsetY: event.offsetY

@ -11,7 +11,7 @@
:style="renderStyle"
>
<div
v-for="chart in chartList"
v-for="chart in initChartList"
:key="chart.code"
:style="getStyle(chart)"
>
@ -43,6 +43,7 @@ import NotPermission from 'data-room-ui/NotPermission'
import Configuration from 'data-room-ui/Render/Configuration.vue'
import DataViewDialog from 'data-room-ui/BigScreenDesign/DataViewDialog/index.vue'
import { getFileUrl } from 'data-room-ui/js/utils/file'
import cloneDeep from 'lodash/cloneDeep'
export default {
name: 'BigScreenRun',
components: {
@ -66,7 +67,8 @@ export default {
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
timer: null,
hasPermission: true
hasPermission: true,
initChartList: [],
}
},
computed: {
@ -145,6 +147,14 @@ export default {
this.startTimer()
}
}
},
chartList: {
handler (val) {
if (this.initChartList.length === 0) {
this.initChartList = cloneDeep(this.chartList)
}
},
deep: true
}
},
beforeRouteLeave (to, from, next) {

@ -75,9 +75,11 @@ export default {
const resizeObserver = new ResizeObserver(entries => {
if (this.chart) {
this.chart.resize()
let config = this.observeChart(entries)
config = this.seriesStyle(config)
config.option && this.chart.setOption(config.option)
if(this.config.name.includes('3D')){
let config = this.observeChart(entries)
config = this.seriesStyle(config)
config.option && this.chart.setOption(config.option)
}
}
})
resizeObserver.observe(dragSelect)
@ -424,6 +426,9 @@ export default {
},
// series
seriesStyle (config) {
if(!config.name.includes('3D')){
return config
}
const _config = CloneDeep(config)
const seriesCustom = _config.option.seriesCustom
const ids = Object.keys(config.option.seriesCustom)

@ -58,13 +58,18 @@ export default {
},
methods: {
changeData (config, filterList) {
//
let remote = this.$refs['remoteComponent'+config.code]
if (remote && remote.changeData){
remote.changeData(config, filterList)
}
//
this.$options.mixins[1].methods.changeData.call(this, config, filterList)
let promise = this.$options.mixins[1].methods.changeData.call(this, config, filterList)
return promise.then(res => {
config = res
//
let remote = this.$refs['remoteComponent'+config.code]
if (remote && remote.changeData){
remote.changeData(config, filterList)
}
return config
})
},
...mapMutations('bigScreen', ['changeChartConfig']),
//
@ -120,7 +125,7 @@ export default {
}
}
},
linkEvent (formData) {
linkEvent (formData) {
this.linkage(formData)
},
/**

@ -93,6 +93,7 @@ import { compile } from 'tiny-sass-compiler/dist/tiny-sass-compiler.esm-browser.
import plotList, { getCustomPlots } from '../G2Plots/plotList'
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
import { getFileUrl } from 'data-room-ui/js/utils/file'
import { customDeserialize } from 'data-room-ui/js/utils/jsonSerialize.js'
export default {
name: 'BigScreenRender',
@ -351,7 +352,7 @@ export default {
//
addChart (chart, position, isComponent) {
const { left, top } = this.$el.getBoundingClientRect()
const _chart = !chart.code ? JSON.parse(chart) : chart
const _chart = !chart.code ? customDeserialize(chart) : chart
let option = _chart.option
if (_chart.type === 'customComponent') {
option = {

@ -0,0 +1,23 @@
// 自定义序列化方法解决JSON.stringify方法忽略函数属性的问题
export function customSerialize (obj) {
// 将对象属性和函数转换为字符串形式
const serializedObj = JSON.stringify(obj, function(key, value) {
if (typeof value === 'function') {
return value.toString() // 将函数转换为字符串
}
return value // 保持其他属性不变
})
return serializedObj
}
// 自定义反序列化方法
export function customDeserialize(serializedObj){
const parsedObject = JSON.parse(serializedObj, function(key, value) {
if (typeof value === 'string' && value.indexOf('function') === 0) {
// 将字符串还原为函数
return new Function('return ' + value)()
}
return value // 保持其他属性不变
})
return parsedObject
}
Loading…
Cancel
Save