diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue
index 640351200c..765eed7c51 100644
--- a/frontend/src/views/chart/view/ChartEdit.vue
+++ b/frontend/src/views/chart/view/ChartEdit.vue
@@ -66,15 +66,32 @@
clearable
class="main-area-input"
/>
-
+
+
+
+
+
+
+ {{ $t('chart.ds_field_edit') }}
+
+
+ {{ $t('chart.chart_field_edit') }}
+
+
+
-
+
- {{ item.name }}
+ {{ item.name }}
+
+
+
+
+
+ {{ $t('commons.copy') }}...
+
+
@@ -132,7 +157,7 @@
v-for="item in quotaData"
v-show="chart.type && (chart.type !== 'table-info' || (chart.type === 'table-info' && item.id !=='count'))"
:key="item.id"
- class="item-quota"
+ class="item-quota father"
:title="item.name"
>
@@ -143,7 +168,15 @@
class="field-icon-value"
/>
- {{ item.name }}
+ {{ item.name }}
+
+
+
+
+
+ {{ $t('commons.copy') }}...
+
+
@@ -151,7 +184,6 @@
-
+
+
+
+
+
+
{{ $t('chart.confirm') }}
+
+
+
+
+
@@ -1031,9 +1099,14 @@ import ValueFormatterEdit from '@/views/chart/components/value-formatter/ValueFo
import ChartStyle from '@/views/chart/view/ChartStyle'
import CustomSortEdit from '@/views/chart/components/compare/CustomSortEdit'
import {delGroup} from "@/api/panel/panel";
+import ChartFieldEdit from '@/views/chart/view/ChartFieldEdit'
+import CalcChartFieldEdit from '@/views/chart/view/CalcChartFieldEdit'
+
export default {
name: 'ChartEdit',
components: {
+ CalcChartFieldEdit,
+ ChartFieldEdit,
CustomSortEdit,
ChartStyle,
ValueFormatterEdit,
@@ -1177,6 +1250,9 @@ export default {
showCustomSort: false,
customSortList: [],
customSortField: {},
+ showEditChartField: false,
+ currEditField: {},
+ editChartCalcField: false,
fieldShow: false
}
@@ -1330,21 +1406,29 @@ export default {
if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
- if (this.view.tableId === id) {
- this.dimension = response.data.dimension
- this.quota = response.data.quota
- this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
- this.quotaData = JSON.parse(JSON.stringify(this.quota))
- this.fieldFilter(this.searchField)
- if (optType === 'change') {
- this.resetChangeTable()
- this.$nextTick(() => {
- bus.$emit('reset-change-table', 'change')
- this.calcData()
- })
+ post('/chart/field/listByDQ/' + this.param.id + '/' + this.panelInfo.id, null).then(res => {
+ if (this.view.tableId === id) {
+ this.dimension = response.data.dimension.concat(res.data.dimensionList)
+ this.quota = response.data.quota.concat(res.data.quotaList)
+ this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
+ this.quotaData = JSON.parse(JSON.stringify(this.quota))
+ this.fieldFilter(this.searchField)
+ if (optType === 'change') {
+ this.resetChangeTable()
+ this.$nextTick(() => {
+ bus.$emit('reset-change-table', 'change')
+ this.calcData()
+ })
+ }
}
- }
- this.fieldShow = true
+ this.fieldShow = true
+ }).catch(err => {
+ console.log(err)
+ this.resetView()
+ this.httpRequest.status = err.response.data.success
+ this.httpRequest.msg = err.response.data.message
+ return true
+ })
}).catch(err => {
console.error(err)
@@ -1454,13 +1538,18 @@ export default {
if (!ele.chartType) {
ele.chartType = 'bar'
}
- if (!ele.summary || ele.summary === '') {
- if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) {
- ele.summary = 'count'
- } else {
- ele.summary = 'sum'
+ if (ele.chartId) {
+ ele.summary = ''
+ } else {
+ if (!ele.summary || ele.summary === '') {
+ if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) {
+ ele.summary = 'count'
+ } else {
+ ele.summary = 'sum'
+ }
}
}
+
if (!ele.sort || ele.sort === '') {
ele.sort = 'none'
}
@@ -1476,13 +1565,18 @@ export default {
if (!ele.chartType) {
ele.chartType = 'bar'
}
- if (!ele.summary || ele.summary === '') {
- if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) {
- ele.summary = 'count'
- } else {
- ele.summary = 'sum'
+ if (ele.chartId) {
+ ele.summary = ''
+ } else {
+ if (!ele.summary || ele.summary === '') {
+ if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) {
+ ele.summary = 'count'
+ } else {
+ ele.summary = 'sum'
+ }
}
}
+
if (!ele.sort || ele.sort === '') {
ele.sort = 'none'
}
@@ -2097,9 +2191,12 @@ export default {
const optType = this.view.tableId === this.changeTable.id ? 'same' : 'change'
// this.save(true, 'chart', false)
this.view.tableId = this.changeTable.id
- this.calcData(true, 'chart', false)
- this.initTableData(this.view.tableId, optType)
- this.closeChangeChart()
+ // 更换数据集后清空视图字段
+ post('/chart/field/deleteByChartId/' + this.param.id + '/' + this.panelInfo.id, null).then(response => {
+ this.calcData(true, 'chart', false)
+ this.initTableData(this.view.tableId, optType)
+ this.closeChangeChart()
+ })
},
fieldFilter(val) {
@@ -2125,6 +2222,15 @@ export default {
this.initTableField(this.table.id)
},
+ editChartField() {
+ this.showEditChartField = true
+ },
+
+ closeEditChartField() {
+ this.showEditChartField = false
+ this.initTableField(this.table.id)
+ },
+
// drag
dragCheckType(list, type) {
if (list && list.length > 0) {
@@ -2504,6 +2610,50 @@ export default {
})
this.closeCustomSort()
this.calcData(true)
+ },
+
+ fieldEdit(param) {
+ switch (param.type) {
+ case 'ds':
+ this.editField()
+ break
+ case 'chart':
+ this.editChartField()
+ break
+ default:
+ break
+ }
+ },
+ beforeFieldEdit(type) {
+ return {
+ type: type
+ }
+ },
+
+ chartFieldEdit(param) {
+ this.currEditField = JSON.parse(JSON.stringify(param.item))
+ switch (param.type) {
+ case 'copy':
+ this.currEditField.id = null
+ this.currEditField.extField = 1
+ this.showChartCalcField()
+ break
+ }
+ },
+ handleChartFieldEdit(item, type) {
+ return {
+ type: type,
+ item: item
+ }
+ },
+
+ showChartCalcField() {
+ this.editChartCalcField = true
+ },
+ closeChartCalcField() {
+ this.editChartCalcField = false
+ this.currEditField = {}
+ this.initTableField(this.table.id)
}
}
}
@@ -2583,6 +2733,7 @@ export default {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
+ position: relative;
}
.blackTheme .item-dimension {
@@ -2621,6 +2772,7 @@ export default {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
+ position: relative;
}
.blackTheme .item-quota {
@@ -2905,6 +3057,30 @@ span {
font-size: 12px;
}
+.field-name{
+ display: inline-block;
+ width: 90px;
+ word-break: break-all;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ position: absolute;
+ top: 2px;
+}
+
+.field-setting{
+ position: absolute;
+ right: 8px;
+}
+
+.father .child {
+ visibility: hidden;
+}
+
+.father:hover .child {
+ visibility: visible;
+}
+
.field-split{
height: calc(100% - 40px);
}