提交 aa38a4be authored 作者: wangjiahao's avatar wangjiahao

feat: 合并重复样式数据

上级 d9d1b3a2
...@@ -23,17 +23,7 @@ import { uuid } from 'vue-uuid' ...@@ -23,17 +23,7 @@ import { uuid } from 'vue-uuid'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { isChange } from '@/utils/conditionUtil' import { isChange } from '@/utils/conditionUtil'
import { import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
DEFAULT_COLOR_CASE,
DEFAULT_SIZE,
DEFAULT_TITLE_STYLE,
DEFAULT_LEGEND_STYLE,
DEFAULT_LABEL,
DEFAULT_TOOLTIP,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_STYLE,
DEFAULT_BACKGROUND_COLOR
} from '@/views/chart/chart/chart'
export default { export default {
name: 'UserView', name: 'UserView',
...@@ -64,29 +54,7 @@ export default { ...@@ -64,29 +54,7 @@ export default {
data() { data() {
return { return {
refId: null, refId: null,
chart: { chart: BASE_CHART_STRING,
stylePriority: 'panel',
xaxis: '[]',
yaxis: '[]',
show: true,
type: 'panel',
title: '',
customAttr: JSON.stringify({
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
}),
customStyle: JSON.stringify({
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
}),
customFilter: '[]'
},
requestStatus: 'waiting', requestStatus: 'waiting',
message: null message: null
} }
......
...@@ -367,3 +367,50 @@ export const BASE_GAUGE = { ...@@ -367,3 +367,50 @@ export const BASE_GAUGE = {
} }
] ]
} }
export const BASE_CHART_STRING = {
stylePriority: 'panel',
xaxis: '[]',
yaxis: '[]',
show: true,
type: 'panel',
title: '',
customAttr: JSON.stringify({
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
}),
customStyle: JSON.stringify({
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
}),
customFilter: '[]'
}
export const BASE_CHART = {
xaxis: [],
yaxis: [],
show: true,
type: 'panel',
title: '',
customAttr: {
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
},
customStyle: {
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
},
customFilter: []
}
...@@ -48,9 +48,6 @@ ...@@ -48,9 +48,6 @@
<span class="header-title"> <span class="header-title">
{{ $t('panel.panel_list') }} {{ $t('panel.panel_list') }}
<el-button style="float: right;padding-right: 7px;margin-top: -8px" icon="el-icon-plus" type="text" @click="showEditPanel(newFolder)" /> <el-button style="float: right;padding-right: 7px;margin-top: -8px" icon="el-icon-plus" type="text" @click="showEditPanel(newFolder)" />
<!-- <el-button style="float: right;" type="primary" size="mini" @click="showEditPanel(newFolder)">-->
<!-- {{ $t('panel.groupAdd') }}-->
<!-- </el-button>-->
</span> </span>
</el-row> </el-row>
<el-col class="custom-tree-container"> <el-col class="custom-tree-container">
...@@ -181,22 +178,9 @@ import bus from '@/utils/bus' ...@@ -181,22 +178,9 @@ import bus from '@/utils/bus'
import EditPanel from './EditPanel' import EditPanel from './EditPanel'
import { addGroup, delGroup, groupTree, defaultTree, findOne } from '@/api/panel/panel' import { addGroup, delGroup, groupTree, defaultTree, findOne } from '@/api/panel/panel'
import { import {
DEFAULT_COLOR_CASE, DEFAULT_COMMON_CANVAS_STYLE, DEFAULT_COMMON_CANVAS_STYLE_STRING
DEFAULT_SIZE,
DEFAULT_TITLE_STYLE,
DEFAULT_LEGEND_STYLE,
DEFAULT_LABEL,
DEFAULT_TOOLTIP,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_STYLE,
DEFAULT_BACKGROUND_COLOR
} from '@/views/chart/chart/chart'
import {
DEFAULT_COMMON_CANVAS_STYLE
} from '@/views/panel/panel' } from '@/views/panel/panel'
import { DEFAULT_PANEL_STYLE } from '@/views/panel/panel'
export default { export default {
name: 'PanelList', name: 'PanelList',
components: { GrantAuth, LinkGenerate, EditPanel }, components: { GrantAuth, LinkGenerate, EditPanel },
...@@ -216,38 +200,7 @@ export default { ...@@ -216,38 +200,7 @@ export default {
level: null, level: null,
nodeType: null, nodeType: null,
panelType: null, panelType: null,
panelStyle: JSON.stringify({ panelStyle: JSON.stringify(DEFAULT_COMMON_CANVAS_STYLE_STRING),
width: 1600,
height: 900,
scale: 100,
scaleWidth: 100,
scaleHeight: 100,
selfAdaption: true,
auxiliaryMatrix: true,
openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE,
chart: {
xaxis: '[]',
yaxis: '[]',
show: true,
type: 'panel',
title: '',
customAttr: JSON.stringify({
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
}),
customStyle: JSON.stringify({
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
}),
customFilter: '[]'
}}),
panelData: '[]' panelData: '[]'
} }
}, },
...@@ -262,38 +215,7 @@ export default { ...@@ -262,38 +215,7 @@ export default {
level: null, level: null,
nodeType: null, nodeType: null,
panelType: null, panelType: null,
panelStyle: JSON.stringify({ panelStyle: JSON.stringify(DEFAULT_COMMON_CANVAS_STYLE_STRING),
width: 1600,
height: 900,
scale: 100,
scaleWidth: 100,
scaleHeight: 100,
selfAdaption: true,
auxiliaryMatrix: true,
openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE,
chart: {
xaxis: '[]',
yaxis: '[]',
show: true,
type: 'panel',
title: '',
customAttr: JSON.stringify({
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
}),
customStyle: JSON.stringify({
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
}),
customFilter: '[]'
}}),
panelData: '[]' panelData: '[]'
} }
}, },
......
import { import { BASE_CHART, BASE_CHART_STRING } from '@/views/chart/chart/chart'
DEFAULT_COLOR_CASE,
DEFAULT_SIZE,
DEFAULT_TITLE_STYLE,
DEFAULT_LEGEND_STYLE,
DEFAULT_LABEL,
DEFAULT_TOOLTIP,
DEFAULT_XAXIS_STYLE,
DEFAULT_YAXIS_STYLE,
DEFAULT_BACKGROUND_COLOR
} from '@/views/chart/chart/chart'
import { deepCopy } from '@/components/canvas/utils/utils' import { deepCopy } from '@/components/canvas/utils/utils'
export const DEFAULT_PANEL_STYLE = { export const DEFAULT_PANEL_STYLE = {
...@@ -18,7 +8,7 @@ export const DEFAULT_PANEL_STYLE = { ...@@ -18,7 +8,7 @@ export const DEFAULT_PANEL_STYLE = {
gap: 'no' gap: 'no'
} }
export const DEFAULT_COMMON_CANVAS_STYLE = { export const CANVAS_STYLE = {
width: 1600, width: 1600,
height: 900, height: 900,
scale: 100, scale: 100,
...@@ -27,29 +17,17 @@ export const DEFAULT_COMMON_CANVAS_STYLE = { ...@@ -27,29 +17,17 @@ export const DEFAULT_COMMON_CANVAS_STYLE = {
selfAdaption: true, selfAdaption: true,
auxiliaryMatrix: true, auxiliaryMatrix: true,
openCommonStyle: true, openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE, panel: DEFAULT_PANEL_STYLE
chart: { }
xaxis: [],
yaxis: [], export const DEFAULT_COMMON_CANVAS_STYLE = {
show: true, ...CANVAS_STYLE,
type: 'panel', chart: BASE_CHART
title: '', }
customAttr: {
color: DEFAULT_COLOR_CASE, export const DEFAULT_COMMON_CANVAS_STYLE_STRING = {
tableColor: DEFAULT_COLOR_CASE, ...CANVAS_STYLE,
size: DEFAULT_SIZE, chart: BASE_CHART_STRING
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
},
customStyle: {
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
background: DEFAULT_BACKGROUND_COLOR
},
customFilter: []
}
} }
export function chartTransStr2Object(targetIn, copy) { export function chartTransStr2Object(targetIn, copy) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论