提交 76162f14 authored 作者: wangjiahao's avatar wangjiahao

fix: 仪表盘样式设置 回显不准确问题

上级 85a7b1fd
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<div v-loading="requestStatus==='waiting'" class="rect-shape"> <div v-loading="requestStatus==='waiting'" class="rect-shape">
<div v-if="requestStatus==='error'" class="chart-error-class"> <div v-if="requestStatus==='error'" class="chart-error-class">
<div style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;"> <div style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;">
<span v-if="message.response.data.message">{{ message.response.data.message }}<span>,{{ $t('chart.chart_show_error') }} {{ message }},{{ $t('chart.chart_show_error') }}
<br> <br>
{{ $t('chart.chart_error_tips') }} {{ $t('chart.chart_error_tips') }}
</span></span></div> </div>
</div> </div>
<chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table') && !chart.type.includes('text')" :ref="element.propValue.id" class="chart-class" :chart="chart" /> <chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table') && !chart.type.includes('text')" :ref="element.propValue.id" class="chart-class" :chart="chart" />
<table-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('table')" :ref="element.propValue.id" :chart="chart" class="table-class" /> <table-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('table')" :ref="element.propValue.id" :chart="chart" class="table-class" />
...@@ -180,7 +180,11 @@ export default { ...@@ -180,7 +180,11 @@ export default {
return true return true
}).catch(err => { }).catch(err => {
this.requestStatus = 'error' this.requestStatus = 'error'
if (err && err.response && err.response.data) {
this.message = err.response.data.message
} else {
this.message = err this.message = err
}
return true return true
}) })
} }
......
...@@ -42,6 +42,18 @@ export default { ...@@ -42,6 +42,18 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
this.init()
}
}
},
mounted() {
this.init()
},
methods: {
changeBackgroundStyle() {
this.$emit('onChangeBackgroundForm', this.colorForm)
},
init() {
const chart = JSON.parse(JSON.stringify(this.chart)) const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.customStyle) { if (chart.customStyle) {
let customStyle = null let customStyle = null
...@@ -56,14 +68,6 @@ export default { ...@@ -56,14 +68,6 @@ export default {
} }
} }
} }
},
mounted() {
},
methods: {
changeBackgroundStyle() {
this.$emit('onChangeBackgroundForm', this.colorForm)
}
}
} }
</script> </script>
......
...@@ -126,22 +126,12 @@ export default { ...@@ -126,22 +126,12 @@ export default {
watch: { watch: {
'chart': { 'chart': {
handler: function() { handler: function() {
const chart = JSON.parse(JSON.stringify(this.chart)) this.init()
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.color) {
this.colorForm = customAttr.color
}
}
} }
} }
}, },
mounted() { mounted() {
this.init()
}, },
methods: { methods: {
changeColorCase() { changeColorCase() {
...@@ -153,6 +143,20 @@ export default { ...@@ -153,6 +143,20 @@ export default {
val.value = items[0].value val.value = items[0].value
val.colors = items[0].colors val.colors = items[0].colors
this.$emit('onColorChange', val) this.$emit('onColorChange', val)
},
init() {
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.color) {
this.colorForm = customAttr.color
}
}
} }
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<el-collapse-item :title="$t('chart.module_style')" name="component"> <el-collapse-item :title="$t('chart.module_style')" name="component">
<el-row style="background-color: #f7f8fa; margin: 5px"> <el-row style="background-color: #f7f8fa; margin: 5px">
<!-- <title-selector class="attr-selector" :chart="chart" @onTextChange="onTextChange" />--> <!-- <title-selector class="attr-selector" :chart="chart" @onTextChange="onTextChange" />-->
<background-color-selector class="attr-selector" :chart="chart" @onChangeBackgroundForm="onChangeBackgroundForm" /> <background-color-selector v-if="chart" class="attr-selector" :chart="chart" @onChangeBackgroundForm="onChangeBackgroundForm" />
</el-row> </el-row>
</el-collapse-item> </el-collapse-item>
<el-collapse-item :title="$t('chart.shape_attr')" name="graphical"> <el-collapse-item :title="$t('chart.shape_attr')" name="graphical">
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</el-collapse-item> </el-collapse-item>
<el-collapse-item :title="$t('panel.table')" name="table"> <el-collapse-item :title="$t('panel.table')" name="table">
<el-row style="background-color: #f7f8fa; margin: 5px"> <el-row style="background-color: #f7f8fa; margin: 5px">
<color-selector v-if="tableChartShow" index="10002" :source-type="'panelTable'" class="attr-selector" :chart="tableChart" @onColorChange="onTableColorChange" /> <color-selector index="10002" :source-type="'panelTable'" class="attr-selector" :chart="tableChart" @onColorChange="onTableColorChange" />
</el-row> </el-row>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
return { return {
panelInfo: this.$store.state.panel.panelInfo, panelInfo: this.$store.state.panel.panelInfo,
activeNames: ['panel'], activeNames: ['panel'],
chart: {}, chart: null,
tableChart: null, tableChart: null,
collapseShow: true, collapseShow: true,
tableChartShow: true tableChartShow: true
...@@ -76,9 +76,9 @@ export default { ...@@ -76,9 +76,9 @@ export default {
this.collapseShow = false this.collapseShow = false
this.$nextTick(() => (this.collapseShow = true)) this.$nextTick(() => (this.collapseShow = true))
}) })
this.init()
}, },
created() { created() {
this.init()
}, },
methods: { methods: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论