feat: AntV散点图类别支持重命名

This commit is contained in:
ulleo 2023-11-28 14:34:23 +08:00
parent cf9849ffdc
commit 67805111cb
2 changed files with 23 additions and 1 deletions

View File

@ -201,6 +201,16 @@
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item
v-if="chart.type ==='scatter' && chart.render === 'antv'"
icon="el-icon-edit-outline"
divided
:command="beforeClickItem('rename')"
>
<span>{{ $t('chart.show_name_set') }}</span>
</el-dropdown-item>
<el-dropdown-item
icon="el-icon-delete"
divided
@ -215,7 +225,7 @@
</template>
<script>
import { getItemType } from '@/views/chart/components/dragItem/utils'
import { getItemType, getOriginFieldName } from '@/views/chart/components/dragItem/utils'
import FieldErrorTips from '@/views/chart/components/dragItem/components/FieldErrorTips'
import bus from '@/utils/bus'
@ -288,6 +298,9 @@ export default {
return
}
switch (param.type) {
case 'rename':
this.showRename()
break
case 'remove':
this.removeItem()
break
@ -353,6 +366,12 @@ export default {
},
getItemTagType() {
this.tagType = getItemType(this.dimensionData, this.quotaData, this.item)
},
showRename() {
this.item.index = this.index
this.item.renameType = 'extStack'
this.item.dsFieldName = getOriginFieldName(this.dimensionData, this.quotaData, this.item)
this.$emit('onNameEdit', this.item)
}
}
}

View File

@ -912,6 +912,7 @@
@onItemChange="stackItemChange"
@onItemRemove="stackItemRemove"
@onItemCustomSort="stackItemCustomSort"
@onNameEdit="showRename"
/>
</transition-group>
</draggable>
@ -3046,6 +3047,8 @@ export default {
this.view.yaxisExt[this.itemForm.index].name = this.itemForm.name
} else if (this.itemForm.renameType === 'dimensionExt') {
this.view.xaxisExt[this.itemForm.index].name = this.itemForm.name
} else if (this.itemForm.renameType === 'extStack') {
this.view.extStack[this.itemForm.index].name = this.itemForm.name
}
this.calcData(true)
this.closeRename()