Unverified 提交 187d9c2a authored 作者: XiaJunjie2020's avatar XiaJunjie2020 提交者: GitHub

Merge pull request #431 from dataease/pr@v1.1@fix_仪表板编辑视图样式回显问题

fix: 仪表板编辑视图样式回显问题
...@@ -101,25 +101,29 @@ export default { ...@@ -101,25 +101,29 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.legend) {
this.legendForm = customStyle.legend
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.legend) {
this.legendForm = customStyle.legend
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 10; i <= 60; i = i + 2) { for (let i = 10; i <= 60; i = i + 2) {
......
...@@ -81,27 +81,31 @@ export default { ...@@ -81,27 +81,31 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.split) {
this.splitForm = customStyle.split
} else {
this.splitForm = JSON.parse(JSON.stringify(DEFAULT_SPLIT))
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.split) {
this.splitForm = customStyle.split
} else {
this.splitForm = JSON.parse(JSON.stringify(DEFAULT_SPLIT))
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 6; i <= 40; i = i + 2) { for (let i = 6; i <= 40; i = i + 2) {
......
...@@ -91,26 +91,30 @@ export default { ...@@ -91,26 +91,30 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.text) {
this.titleForm = customStyle.text
}
this.titleForm.title = this.chart.title
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.text) {
this.titleForm = customStyle.text
}
this.titleForm.title = this.chart.title
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 10; i <= 60; i = i + 2) { for (let i = 10; i <= 60; i = i + 2) {
......
...@@ -112,31 +112,35 @@ export default { ...@@ -112,31 +112,35 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.xAxis) {
this.axisForm = customStyle.xAxis
if (!this.axisForm.splitLine) {
this.axisForm.splitLine = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.splitLine))
}
if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.nameTextStyle))
}
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.xAxis) {
this.axisForm = customStyle.xAxis
if (!this.axisForm.splitLine) {
this.axisForm.splitLine = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.splitLine))
}
if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE.nameTextStyle))
}
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 6; i <= 40; i = i + 2) { for (let i = 6; i <= 40; i = i + 2) {
......
...@@ -112,31 +112,35 @@ export default { ...@@ -112,31 +112,35 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.yAxis) {
this.axisForm = customStyle.yAxis
if (!this.axisForm.splitLine) {
this.axisForm.splitLine = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.splitLine))
}
if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.nameTextStyle))
}
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) {
let customStyle = null
if (Object.prototype.toString.call(chart.customStyle) === '[object Object]') {
customStyle = JSON.parse(JSON.stringify(chart.customStyle))
} else {
customStyle = JSON.parse(chart.customStyle)
}
if (customStyle.yAxis) {
this.axisForm = customStyle.yAxis
if (!this.axisForm.splitLine) {
this.axisForm.splitLine = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.splitLine))
}
if (!this.axisForm.nameTextStyle) {
this.axisForm.nameTextStyle = JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE.nameTextStyle))
}
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 6; i <= 40; i = i + 2) { for (let i = 6; i <= 40; i = i + 2) {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<!-- <el-form-item :label="$t('chart.show')" class="form-item">--> <!-- <el-form-item :label="$t('chart.show')" class="form-item">-->
<!-- <el-checkbox v-model="labelForm.show" @change="changeLabelAttr">{{ $t('chart.show') }}</el-checkbox>--> <!-- <el-checkbox v-model="labelForm.show" @change="changeLabelAttr">{{ $t('chart.show') }}</el-checkbox>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item :label="$t('chart.pie_label_line_show')" class="form-item"> <el-form-item v-show="chart.type && !chart.type.includes('pie')" :label="$t('chart.pie_label_line_show')" class="form-item">
<el-checkbox v-model="labelForm.labelLine.show" @change="changeLabelAttr">{{ $t('chart.pie_label_line_show') }}</el-checkbox> <el-checkbox v-model="labelForm.labelLine.show" @change="changeLabelAttr">{{ $t('chart.pie_label_line_show') }}</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item :label="$t('chart.text_fontsize')" class="form-item"> <el-form-item :label="$t('chart.text_fontsize')" class="form-item">
...@@ -116,28 +116,32 @@ export default { ...@@ -116,28 +116,32 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.label) {
this.labelForm = customAttr.label
if (!this.labelForm.labelLine) {
this.labelForm.labelLine = JSON.parse(JSON.stringify(DEFAULT_LABEL.labelLine))
}
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.label) {
this.labelForm = customAttr.label
if (!this.labelForm.labelLine) {
this.labelForm.labelLine = JSON.parse(JSON.stringify(DEFAULT_LABEL.labelLine))
}
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 10; i <= 20; i = i + 2) { for (let i = 10; i <= 20; i = i + 2) {
......
...@@ -183,25 +183,29 @@ export default { ...@@ -183,25 +183,29 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.size) {
this.sizeForm = customAttr.size
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.size) {
this.sizeForm = customAttr.size
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 10; i <= 60; i = i + 2) { for (let i = 10; i <= 60; i = i + 2) {
......
...@@ -95,25 +95,29 @@ export default { ...@@ -95,25 +95,29 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.initData()
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.tooltip) {
this.tooltipForm = customAttr.tooltip
}
}
} }
} }
}, },
mounted() { mounted() {
this.init() this.init()
this.initData()
}, },
methods: { methods: {
initData() {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customAttr) {
let customAttr = null
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
} else {
customAttr = JSON.parse(chart.customAttr)
}
if (customAttr.tooltip) {
this.tooltipForm = customAttr.tooltip
}
}
},
init() { init() {
const arr = [] const arr = []
for (let i = 10; i <= 20; i = i + 2) { for (let i = 10; i <= 20; i = i + 2) {
......
...@@ -1128,10 +1128,12 @@ export default { ...@@ -1128,10 +1128,12 @@ export default {
}, },
changeChart() { changeChart() {
this.view.tableId = this.changeTable.id if (this.view.tableId !== this.changeTable.id) {
this.view.xaxis = [] this.view.tableId = this.changeTable.id
this.view.yaxis = [] this.view.xaxis = []
this.view.customFilter = [] this.view.yaxis = []
this.view.customFilter = []
}
this.save(true, 'chart', false) this.save(true, 'chart', false)
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论