Merge branch 'master' of github.com:veops/cmdb

This commit is contained in:
pycook 2023-08-25 11:01:24 +08:00
commit cd70b16eb3
2 changed files with 11 additions and 10 deletions

View File

@ -453,10 +453,12 @@ class AutoDiscoveryCICRUD(DBMixin):
relation_adts = AutoDiscoveryCIType.get_by(type_id=adt.type_id, adr_id=None, to_dict=False) relation_adts = AutoDiscoveryCIType.get_by(type_id=adt.type_id, adr_id=None, to_dict=False)
for r_adt in relation_adts: for r_adt in relation_adts:
if r_adt.relation and ci_id is not None: if not r_adt.relation or ci_id is None:
ad_key, cmdb_key = None, {} continue
for ad_key in r_adt.relation: for ad_key in r_adt.relation:
cmdb_key = r_adt.relation[ad_key] if not adc.instance.get(ad_key):
continue
cmdb_key = r_adt.relation[ad_key]
query = "_type:{},{}:{}".format(cmdb_key.get('type_name'), cmdb_key.get('attr_name'), query = "_type:{},{}:{}".format(cmdb_key.get('type_name'), cmdb_key.get('attr_name'),
adc.instance.get(ad_key)) adc.instance.get(ad_key))
s = search(query) s = search(query)

View File

@ -1,7 +1,7 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<div class="action-btn"> <div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-bottom: 15px">新增关系类型</a-button> <a-button @click="handleCreate" type="primary" style="margin-bottom: 15px;">新增关系类型</a-button>
</div> </div>
<vxe-table <vxe-table
ref="relationTypeTable" ref="relationTypeTable"
@ -20,17 +20,17 @@
:edit-render="{ name: 'input', attrs: { type: 'text' }, events: { keyup: customCloseEdit } }" :edit-render="{ name: 'input', attrs: { type: 'text' }, events: { keyup: customCloseEdit } }"
></vxe-table-column> ></vxe-table-column>
<vxe-table-column field="updateTime" title="更新时间"> <vxe-table-column field="updateTime" title="更新时间">
<template #default="{ row }"> <template #default="{row}">
{{ row.updated_at || row.created_at }} {{ row.updated_at || row.created_at }}
</template> </template>
</vxe-table-column> </vxe-table-column>
<vxe-table-column field="operation" title="操作" align="center"> <vxe-table-column field="operation" title="操作" align="center">
<template #default="{ row }"> <template #default="{row}">
<template> <template>
<a><a-icon type="edit" @click="handleEdit(row)" /></a> <a><a-icon type="edit" @click="handleEdit(row)"/></a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm title="确认删除吗?" @confirm="handleDelete(row)" okText="" cancelText=""> <a-popconfirm title="确认删除吗?" @confirm="handleDelete(row)" okText="" cancelText="">
<a :style="{ color: 'red' }"><a-icon type="delete" /></a> <a :style="{ color: 'red' }"><a-icon type="delete"/></a>
</a-popconfirm> </a-popconfirm>
</template> </template>
</template> </template>
@ -122,7 +122,6 @@ export default {
if ($event.keyCode === 13) { if ($event.keyCode === 13) {
const $table = this.$refs.relationTypeTable const $table = this.$refs.relationTypeTable
$table.clearActived() $table.clearActived()
this.handleEditClose({ row: value.row })
} }
}, },
}, },