fix: 修复远程应用发布机跳转到详情报错

This commit is contained in:
“huailei000”
2023-04-11 16:23:14 +08:00
parent 3694a27752
commit 87196e0cd1
2 changed files with 10 additions and 10 deletions

View File

@@ -141,9 +141,9 @@ export default {
} else if (fieldMeta.type === 'labeled_choice') {
value = value?.['label']
} else if (fieldMeta.type === 'related_field' || fieldMeta.type === 'nested object') {
value = value['name']
value = value?.['name']
} else if (fieldMeta.type === 'm2m_related_field') {
value = value.map(item => item['name']).join(', ')
value = value?.map(item => item['name']).join(', ')
} else if (fieldMeta.type === 'boolean') {
value = value ? this.$t('common.Yes') : this.$t('common.No')
}

View File

@@ -2,8 +2,8 @@
<el-row :gutter="20">
<el-col :md="14" :sm="24">
<AutoDetailCard v-bind="detailBasicConfig" />
<AutoDetailCard v-if="detailSpecInfoConfig.show" v-bind="detailSpecInfoConfig" />
<AutoDetailCard v-if="detailInfoConfig.show" v-bind="detailInfoConfig" />
<AutoDetailCard v-bind="detailSpecInfoConfig" />
<AutoDetailCard v-bind="detailInfoConfig" />
</el-col>
<el-col :md="10" :sm="24">
<QuickActions type="primary" :actions="quickActions" />
@@ -116,18 +116,18 @@ export default {
]
},
detailSpecInfoConfig: {
show: Object.keys(this.object['spec_info']).length > 0,
title: this.$t('common.SpecificInfo'),
url: `/api/v1/assets/assets/${this.object.id}/spec-info/`,
object: this.object.spec_info,
url: `/api/v1/assets/assets/${this.object.id}/`,
object: this.object,
nested: 'spec_info',
showUndefine: false,
excludes: ['spec_info.script']
},
detailInfoConfig: {
show: this.object.category.value === 'host' && Object.keys(this.object['info']).length > 0,
url: `/api/v1/assets/hosts/${this.object.id}/info/`,
url: `/api/v1/assets/hosts/${this.object.id}/`,
title: this.$t('assets.HardwareInfo'),
object: this.object.info,
object: this.object,
nested: 'info',
showUndefine: false
}
}