diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 07f0a2e694..feac4aeec0 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -589,7 +589,8 @@ export default { result_filter: '结果过滤器', x_axis: '横轴', y_axis: '纵轴', - chart: '视图' + chart: '视图', + close: '关闭' }, dataset: { datalist: '数据集', diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 8ea829d28f..d4e29f733e 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -7,12 +7,12 @@ {{ view.name }} - - {{ $t('chart.cancel') }} - - - {{ $t('chart.confirm') }} + + {{ $t('chart.close') }} + + + @@ -69,6 +69,7 @@ :placeholder="$t('chart.title')" prefix-icon="el-icon-search" clearable + @blur="save" /> @@ -109,12 +110,12 @@ @end="end2" > - + - {{ item.name }} + {{ item.name }} @@ -141,16 +142,23 @@ @end="end2" > - + - {{ item.name }} + {{ item.name }} - item3 + + + item3 + + + sub1 + + item4 @@ -224,7 +232,13 @@ export default { } }, - watch: {}, + watch: { + 'view.type': { + handler: function() { + this.save() + } + } + }, created() { // this.get(this.$store.state.chart.viewId); }, @@ -296,6 +310,9 @@ export default { this.$store.dispatch('chart/setChartSceneData', this.sceneId) }) }, + closeEdit() { + this.$emit('switchComponent', { name: '' }) + }, getData(id) { if (id) { post('/chart/view/getData/' + id, null).then(response => { @@ -333,6 +350,8 @@ export default { e.clone.className = 'item' e.item.className = 'item' this.refuseMove(e) + this.removeCheckedKey(e) + this.save() }, start2(e) { console.log(e) @@ -341,9 +360,24 @@ export default { end2(e) { console.log(e) this.removeDuplicateKey(e) + this.save() + }, + removeCheckedKey(e) { + const that = this + const xItems = this.view.xaxis.filter(function(m) { + return m.id === that.moveId + }) + const yItems = this.view.yaxis.filter(function(m) { + return m.id === that.moveId + }) + if (xItems && xItems.length > 1) { + this.view.xaxis.splice(e.newDraggableIndex, 1) + } + if (yItems && yItems.length > 1) { + this.view.yaxis.splice(e.newDraggableIndex, 1) + } }, refuseMove(e) { - // TODO 最后逻辑再思考下... const that = this const xItems = this.dimension.filter(function(m) { return m.id === that.moveId @@ -351,11 +385,11 @@ export default { const yItems = this.quota.filter(function(m) { return m.id === that.moveId }) - if (xItems && xItems.length > 0) { - this.dimension.splice(e.oldDraggableIndex, 0) + if (xItems && xItems.length > 1) { + this.dimension.splice(e.newDraggableIndex, 1) } - if (yItems && yItems.length > 0) { - this.quota.splice(e.oldDraggableIndex, 0) + if (yItems && yItems.length > 1) { + this.quota.splice(e.newDraggableIndex, 1) } }, removeDuplicateKey(e) { @@ -451,7 +485,7 @@ export default { .item-axis { padding: 1px 8px; - margin: 0 3px; + margin: 0 3px 2px 3px; border: solid 1px #eee; background-color: #f1f1f1; text-align: left;