mirror of https://github.com/veops/cmdb.git
fix(cmdb-ui):model relation table (#343)
This commit is contained in:
parent
5883c1616e
commit
341f5dba53
|
@ -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()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue