fix(cmdb-ui):model relation table (#343)

This commit is contained in:
wang-liang0615 2023-12-27 13:24:01 +08:00 committed by GitHub
parent 5883c1616e
commit 341f5dba53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 10 deletions

View File

@ -13,12 +13,7 @@
> >
<vxe-column field="created_at" title="创建时间" sortable width="159px"></vxe-column> <vxe-column field="created_at" title="创建时间" sortable width="159px"></vxe-column>
<vxe-column field="parent.alias" title="源模型"></vxe-column> <vxe-column field="parent.alias" title="源模型"></vxe-column>
<vxe-column <vxe-column field="relation_type_id" title="关系" :filters="[{ data: '' }]" :filter-multiple="false">
field="relation_type_id"
title="关系"
:filters="[{ data: '' }]"
:filter-multiple="false"
>
<template #default="{ row }"> <template #default="{ row }">
<a-tag color="cyan"> <a-tag color="cyan">
{{ row.relation_type.name }} {{ row.relation_type.name }}
@ -63,9 +58,8 @@ export default {
components: { components: {
CMDBGrant, CMDBGrant,
}, },
async created() { created() {
await this.getRelationTypes() this.refresh()
await this.getMainData()
}, },
computed: { computed: {
windowHeight() { windowHeight() {
@ -73,6 +67,10 @@ export default {
}, },
}, },
methods: { methods: {
async refresh() {
await this.getRelationTypes()
await this.getMainData()
},
async getMainData() { async getMainData() {
const res = await getCITypeRelations() const res = await getCITypeRelations()
res.forEach((item) => { res.forEach((item) => {
@ -106,7 +104,7 @@ export default {
deleteRelation(row) { deleteRelation(row) {
deleteRelation(row.parent_id, row.child_id).then((res) => { deleteRelation(row.parent_id, row.child_id).then((res) => {
this.$message.success(`删除成功`) this.$message.success(`删除成功`)
this.getRelationTypes() this.refresh()
}) })
}, },
}, },