Merge pull request #1940 from dataease/pr@dev@refactor_chart_edit

refactor: 视图编辑块优化
This commit is contained in:
Junjun 2022-03-21 10:49:29 +08:00 committed by GitHub
commit 6475c388ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 11 deletions

View File

@ -62,7 +62,12 @@ export default {
methods: {
// xaxisextStack
initFieldList() {
const xAxis = JSON.parse(this.chart.xaxis)
let xAxis = null
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
xAxis = JSON.parse(JSON.stringify(this.chart.xaxis))
} else {
xAxis = JSON.parse(this.chart.xaxis)
}
const t1 = xAxis.filter(ele => { return ele.deType === 1 })
this.fieldList = t1
//

View File

@ -13,7 +13,7 @@
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
<span v-if="false && item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />

View File

@ -13,7 +13,7 @@
</span>
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="item.deType === 1" class="summary-span">
<span v-if="false && item.deType === 1" class="summary-span">
{{ $t('chart.' + item.dateStyle) }}
</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />

View File

@ -17,7 +17,7 @@
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
{{ $t('chart.' + item.summary) }}<span v-if="false && item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
@ -176,12 +176,17 @@ export default {
}
},
isEnableCompare() {
const xAxis = JSON.parse(this.chart.xaxis)
let xAxis = null
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
xAxis = JSON.parse(JSON.stringify(this.chart.xaxis))
} else {
xAxis = JSON.parse(this.chart.xaxis)
}
const t1 = xAxis.filter(ele => {
return ele.deType === 1
})
// /
if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') {
if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'label' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') {
this.disableEditCompare = false
} else {
this.disableEditCompare = true

View File

@ -17,7 +17,7 @@
<span class="item-span-style" :title="item.name">{{ item.name }}</span>
<field-error-tips v-if="tagType === 'danger'" />
<span v-if="chart.type !== 'table-info' && item.summary" class="summary-span">
{{ $t('chart.' + item.summary) }}<span v-if="item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
{{ $t('chart.' + item.summary) }}<span v-if="false && item.compareCalc && item.compareCalc.type && item.compareCalc.type !== '' && item.compareCalc.type !== 'none'">-{{ $t('chart.' + item.compareCalc.type) }}</span>
</span>
<i class="el-icon-arrow-down el-icon--right" style="position: absolute;top: 6px;right: 10px;" />
</el-tag>
@ -173,12 +173,17 @@ export default {
}
},
isEnableCompare() {
const xAxis = JSON.parse(this.chart.xaxis)
let xAxis = null
if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') {
xAxis = JSON.parse(JSON.stringify(this.chart.xaxis))
} else {
xAxis = JSON.parse(this.chart.xaxis)
}
const t1 = xAxis.filter(ele => {
return ele.deType === 1
})
// /
if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') {
if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'label' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') {
this.disableEditCompare = false
} else {
this.disableEditCompare = true

View File

@ -89,7 +89,7 @@ export default {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.xaxisExt) {
let arr = null
if (Object.prototype.toString.call(chart.xaxisExt) === '[object Object]') {
if (Object.prototype.toString.call(chart.xaxisExt) === '[object Array]') {
arr = JSON.parse(JSON.stringify(chart.xaxisExt))
} else {
arr = JSON.parse(chart.xaxisExt)
@ -102,7 +102,7 @@ export default {
const chart = JSON.parse(JSON.stringify(this.chart))
if (chart.xaxis) {
let arr = null
if (Object.prototype.toString.call(chart.xaxis) === '[object Object]') {
if (Object.prototype.toString.call(chart.xaxis) === '[object Array]') {
arr = JSON.parse(JSON.stringify(chart.xaxis))
} else {
arr = JSON.parse(chart.xaxis)

View File

@ -1635,6 +1635,7 @@ export default {
ele.filter = []
}
})
this.chart = JSON.parse(JSON.stringify(view))
this.view = JSON.parse(JSON.stringify(view))
// stringify json param
view.xaxis = JSON.stringify(view.xaxis)