Merge pull request #10072 from dataease/pr@dev@feat_drill_field_rename

feat(视图): 下钻字段支持设置显示名称 #9226
This commit is contained in:
wisonic-s 2024-06-04 14:16:32 +08:00 committed by GitHub
commit a7a8a5fb6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -146,7 +146,13 @@
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item
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"
:command="beforeClickItem('remove')"
@ -161,7 +167,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'
@ -234,6 +240,9 @@ export default {
return
}
switch (param.type) {
case 'rename':
this.showRename()
break
case 'remove':
this.removeItem()
break
@ -246,6 +255,15 @@ export default {
type: type
}
},
showRename() {
this.item.index = this.index
this.item.renameType = 'drill'
if (this.specialType) {
this.item.renameType = this.specialType
}
this.item.dsFieldName = getOriginFieldName(this.dimensionData, this.quotaData, this.item)
this.$emit('onNameEdit', this.item)
},
removeItem() {
this.item.index = this.index
this.$emit('onDimensionItemRemove', this.item)

View File

@ -1186,6 +1186,7 @@
:chart="chart"
@onDimensionItemChange="drillItemChange"
@onDimensionItemRemove="drillItemRemove"
@onNameEdit="showRename"
@onCustomSort="item => onCustomSort(item, 'drillFields')"
/>
</transition-group>
@ -3202,6 +3203,8 @@ export default {
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
} else if (this.itemForm.renameType === 'drill') {
this.view.drillFields[this.itemForm.index].name = this.itemForm.name
}
this.calcData(true)
this.closeRename()