perf: Optimize the display of labels in strategy actions

This commit is contained in:
jiangweidong 2025-02-17 15:48:25 +08:00 committed by Bryan
parent 910bef6695
commit eddff3d75b

View File

@ -39,8 +39,7 @@ export default {
submitBtnSize: 'mini', submitBtnSize: 'mini',
submitBtnText: this.$t('Add'), submitBtnText: this.$t('Add'),
hasReset: false, hasReset: false,
onSubmit: () => { onSubmit: () => {},
},
submitMethod: () => 'post', submitMethod: () => 'post',
getUrl: () => '', getUrl: () => '',
cleanFormValue(data) { cleanFormValue(data) {
@ -110,26 +109,30 @@ export default {
url: '', url: '',
clearable: false, clearable: false,
transformOption: (item) => { transformOption: (item) => {
let label let display
switch (this.resourceType) { switch (this.resourceType) {
case 'platform': case 'platform':
label = item?.name display = item?.name
this.globalProtocols[item.id] = item.protocols this.globalProtocols[item.id] = item.protocols
this.globalResource[item.id] = label this.globalResource[item.id] = display
break break
case 'account_template': case 'account_template':
label = `${item.name}(${item.username})` display = `${item.name}(${item.username})`
this.globalResource[item.id] = label this.globalResource[item.id] = display
break break
case 'node': case 'node':
label = item?.full_value display = item?.full_value
this.globalResource[item.id] = label this.globalResource[item.id] = display
break
case 'label':
display = `${item.name}:${item.value}`
this.globalResource[item.id] = display
break break
default: default:
label = item?.name display = item?.name
this.globalResource[item.id] = label this.globalResource[item.id] = display
} }
return { label: label, value: item.id } return { label: display, value: item.id }
} }
}, },
multiple: false multiple: false