mirror of https://github.com/veops/cmdb.git
feat:ci detail share (#403)
This commit is contained in:
parent
ef1d0c34cf
commit
f010b9625e
|
@ -145,7 +145,7 @@ export default {
|
||||||
selectedRowKeys: {
|
selectedRowKeys: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -179,7 +179,12 @@ export default {
|
||||||
this.fuzzySearch = ''
|
this.fuzzySearch = ''
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inject: ['setPreferenceSearchCurrent'],
|
inject: {
|
||||||
|
setPreferenceSearchCurrent: {
|
||||||
|
from: 'setPreferenceSearchCurrent',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.type === 'resourceSearch') {
|
if (this.type === 'resourceSearch') {
|
||||||
this.getCITypeGroups()
|
this.getCITypeGroups()
|
||||||
|
@ -234,7 +239,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emitRefresh() {
|
emitRefresh() {
|
||||||
|
if (this.setPreferenceSearchCurrent) {
|
||||||
this.setPreferenceSearchCurrent(null)
|
this.setPreferenceSearchCurrent(null)
|
||||||
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$emit('refresh', true)
|
this.$emit('refresh', true)
|
||||||
})
|
})
|
||||||
|
|
|
@ -19,6 +19,7 @@ const cmdb_en = {
|
||||||
operationHistory: 'Operation Audit',
|
operationHistory: 'Operation Audit',
|
||||||
relationType: 'Relation Type',
|
relationType: 'Relation Type',
|
||||||
ad: 'AutoDiscovery',
|
ad: 'AutoDiscovery',
|
||||||
|
cidetail: 'CI Detail'
|
||||||
},
|
},
|
||||||
ciType: {
|
ciType: {
|
||||||
ciType: 'CIType',
|
ciType: 'CIType',
|
||||||
|
@ -467,6 +468,8 @@ const cmdb_en = {
|
||||||
tips10: 'Other attributes of the CIType are computed using expressions\n\nA code snippet computes the returned value.',
|
tips10: 'Other attributes of the CIType are computed using expressions\n\nA code snippet computes the returned value.',
|
||||||
newUpdateField: 'Add a Attribute',
|
newUpdateField: 'Add a Attribute',
|
||||||
attributeSettings: 'Attribute Settings',
|
attributeSettings: 'Attribute Settings',
|
||||||
|
share: 'Share',
|
||||||
|
noPermission: 'No Permission'
|
||||||
},
|
},
|
||||||
serviceTree: {
|
serviceTree: {
|
||||||
deleteNode: 'Delete Node',
|
deleteNode: 'Delete Node',
|
||||||
|
|
|
@ -19,6 +19,7 @@ const cmdb_zh = {
|
||||||
operationHistory: '操作审计',
|
operationHistory: '操作审计',
|
||||||
relationType: '关系类型',
|
relationType: '关系类型',
|
||||||
ad: '自动发现',
|
ad: '自动发现',
|
||||||
|
cidetail: 'CI 详情'
|
||||||
},
|
},
|
||||||
ciType: {
|
ciType: {
|
||||||
ciType: '模型',
|
ciType: '模型',
|
||||||
|
@ -466,6 +467,8 @@ const cmdb_zh = {
|
||||||
tips10: '模型的其他属性通过表达式的方式计算出来\n\n一个代码片段计算返回的值',
|
tips10: '模型的其他属性通过表达式的方式计算出来\n\n一个代码片段计算返回的值',
|
||||||
newUpdateField: '新增修改字段',
|
newUpdateField: '新增修改字段',
|
||||||
attributeSettings: '字段设置',
|
attributeSettings: '字段设置',
|
||||||
|
share: '分享',
|
||||||
|
noPermission: '暂无权限'
|
||||||
},
|
},
|
||||||
serviceTree: {
|
serviceTree: {
|
||||||
deleteNode: '删除节点',
|
deleteNode: '删除节点',
|
||||||
|
|
|
@ -56,6 +56,13 @@ const genCmdbRoutes = async () => {
|
||||||
meta: { title: 'cmdb.menu.adCIs', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc-selected', keepAlive: false },
|
meta: { title: 'cmdb.menu.adCIs', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc-selected', keepAlive: false },
|
||||||
component: () => import('../views/discoveryCI/index.vue')
|
component: () => import('../views/discoveryCI/index.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: `/cmdb/cidetail/:typeId/:ciId`,
|
||||||
|
name: 'cmdb_ci_detail',
|
||||||
|
hidden: true,
|
||||||
|
meta: { title: 'cmdb.menu.cidetail', keepAlive: false },
|
||||||
|
component: () => import('../views/ci/ciDetailPage.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/cmdb/disabled2',
|
path: '/cmdb/disabled2',
|
||||||
name: 'cmdb_disabled2',
|
name: 'cmdb_disabled2',
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="ci-detail-header">{{ this.type.name }}</div>
|
||||||
|
<div class="ci-detail-page">
|
||||||
|
<CiDetailTab ref="ciDetailTab" :typeId="typeId" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CiDetailTab from './modules/ciDetailTab.vue'
|
||||||
|
import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr'
|
||||||
|
import { getCIType } from '@/modules/cmdb/api/CIType'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CiDetailPage',
|
||||||
|
components: { CiDetailTab },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
typeId: Number(this.$route.params.typeId),
|
||||||
|
type: {},
|
||||||
|
attrList: [],
|
||||||
|
attributes: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
attrList: () => {
|
||||||
|
return this.attrList
|
||||||
|
},
|
||||||
|
attributes: () => {
|
||||||
|
return this.attributes
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const { ciId = undefined } = this.$route.params
|
||||||
|
if (ciId) {
|
||||||
|
this.$refs.ciDetailTab.create(Number(ciId))
|
||||||
|
}
|
||||||
|
getCIType(this.typeId).then((res) => {
|
||||||
|
this.type = res.ci_types[0]
|
||||||
|
})
|
||||||
|
this.getAttributeList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getAttributeList() {
|
||||||
|
await getCITypeAttributesById(this.typeId).then((res) => {
|
||||||
|
this.attrList = res.attributes
|
||||||
|
this.attributes = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
@import '~@/style/static.less';
|
||||||
|
|
||||||
|
.ci-detail-header {
|
||||||
|
border-left: 3px solid @primary-color;
|
||||||
|
padding-left: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.ci-detail-page {
|
||||||
|
background-color: #fff;
|
||||||
|
height: calc(100vh - 122px);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -57,7 +57,7 @@
|
||||||
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</SearchForm>
|
</SearchForm>
|
||||||
<CiDetail ref="detail" :typeId="typeId" />
|
<CiDetailDrawer ref="detail" :typeId="typeId" />
|
||||||
<ops-table
|
<ops-table
|
||||||
:id="`cmdb-ci-${typeId}`"
|
:id="`cmdb-ci-${typeId}`"
|
||||||
border
|
border
|
||||||
|
@ -297,7 +297,7 @@ import router, { resetRouter } from '@/router'
|
||||||
|
|
||||||
import SearchForm from '../../components/searchForm/SearchForm.vue'
|
import SearchForm from '../../components/searchForm/SearchForm.vue'
|
||||||
import CreateInstanceForm from './modules/CreateInstanceForm'
|
import CreateInstanceForm from './modules/CreateInstanceForm'
|
||||||
import CiDetail from './modules/CiDetail'
|
import CiDetailDrawer from './modules/ciDetailDrawer.vue'
|
||||||
import EditAttrsPopover from './modules/editAttrsPopover'
|
import EditAttrsPopover from './modules/editAttrsPopover'
|
||||||
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
||||||
import { searchCI, updateCI, deleteCI } from '@/modules/cmdb/api/ci'
|
import { searchCI, updateCI, deleteCI } from '@/modules/cmdb/api/ci'
|
||||||
|
@ -320,7 +320,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
SearchForm,
|
SearchForm,
|
||||||
CreateInstanceForm,
|
CreateInstanceForm,
|
||||||
CiDetail,
|
CiDetailDrawer,
|
||||||
JsonEditor,
|
JsonEditor,
|
||||||
PasswordField,
|
PasswordField,
|
||||||
EditAttrsPopover,
|
EditAttrsPopover,
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<template>
|
||||||
|
<CustomDrawer
|
||||||
|
width="80%"
|
||||||
|
placement="left"
|
||||||
|
@close="
|
||||||
|
() => {
|
||||||
|
visible = false
|
||||||
|
}
|
||||||
|
"
|
||||||
|
:visible="visible"
|
||||||
|
:hasTitle="false"
|
||||||
|
:hasFooter="false"
|
||||||
|
:bodyStyle="{ padding: 0, height: '100vh' }"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<CiDetailTab ref="ciDetailTab" :typeId="typeId" :treeViewsLevels="treeViewsLevels" />
|
||||||
|
</CustomDrawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CiDetailTab from './ciDetailTab.vue'
|
||||||
|
export default {
|
||||||
|
name: 'CiDetailDrawer',
|
||||||
|
components: { CiDetailTab },
|
||||||
|
props: {
|
||||||
|
typeId: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
treeViewsLevels: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
create(ciId, activeTabKey = 'tab_1', ciDetailRelationKey = '1') {
|
||||||
|
this.visible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.ciDetailTab.create(ciId, activeTabKey, ciDetailRelationKey)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -39,7 +39,11 @@
|
||||||
class="ops-stripe-table"
|
class="ops-stripe-table"
|
||||||
>
|
>
|
||||||
<template #operation_default="{ row }">
|
<template #operation_default="{ row }">
|
||||||
<a-popconfirm arrowPointAtCenter :title="$t('cmdb.ci.confirmDeleteRelation')" @confirm="deleteRelation(row._id, ciId)">
|
<a-popconfirm
|
||||||
|
arrowPointAtCenter
|
||||||
|
:title="$t('cmdb.ci.confirmDeleteRelation')"
|
||||||
|
@confirm="deleteRelation(row._id, ciId)"
|
||||||
|
>
|
||||||
<a
|
<a
|
||||||
:disabled="!canEdit[parent.id]"
|
:disabled="!canEdit[parent.id]"
|
||||||
:style="{
|
:style="{
|
||||||
|
@ -82,7 +86,11 @@
|
||||||
class="ops-stripe-table"
|
class="ops-stripe-table"
|
||||||
>
|
>
|
||||||
<template #operation_default="{ row }">
|
<template #operation_default="{ row }">
|
||||||
<a-popconfirm arrowPointAtCenter :title="$t('cmdb.ci.confirmDeleteRelation')" @confirm="deleteRelation(ciId, row._id)">
|
<a-popconfirm
|
||||||
|
arrowPointAtCenter
|
||||||
|
:title="$t('cmdb.ci.confirmDeleteRelation')"
|
||||||
|
@confirm="deleteRelation(ciId, row._id)"
|
||||||
|
>
|
||||||
<a
|
<a
|
||||||
:disabled="!canEdit[child.id]"
|
:disabled="!canEdit[child.id]"
|
||||||
:style="{
|
:style="{
|
||||||
|
@ -416,6 +424,7 @@ export default {
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.ci-detail-relation {
|
.ci-detail-relation {
|
||||||
|
height: 100%;
|
||||||
.ci-detail-relation-table-title {
|
.ci-detail-relation-table-title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div
|
<div
|
||||||
id="ci-detail-relation-topo"
|
id="ci-detail-relation-topo"
|
||||||
class="ci-detail-relation-topo"
|
class="ci-detail-relation-topo"
|
||||||
:style="{ width: '100%', marginTop: '20px', height: 'calc(100vh - 136px)' }"
|
:style="{ width: '100%', marginTop: '20px', height: 'calc(100% - 44px)' }"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<CustomDrawer
|
<div :style="{ height: '100%' }">
|
||||||
width="80%"
|
<a-tabs v-if="hasPermission" class="ci-detail-tab" v-model="activeTabKey" @change="changeTab">
|
||||||
placement="left"
|
<a @click="shareCi" slot="tabBarExtraContent" :style="{ marginRight: '24px' }">
|
||||||
@close="
|
<a-icon type="share-alt" />
|
||||||
() => {
|
{{ $t('cmdb.ci.share') }}
|
||||||
visible = false
|
</a>
|
||||||
}
|
|
||||||
"
|
|
||||||
:visible="visible"
|
|
||||||
:hasTitle="false"
|
|
||||||
:hasFooter="false"
|
|
||||||
:bodyStyle="{ padding: 0, height: '100vh' }"
|
|
||||||
wrapClassName="ci-detail"
|
|
||||||
destroyOnClose
|
|
||||||
>
|
|
||||||
<a-tabs v-model="activeTabKey" @change="changeTab">
|
|
||||||
<a-tab-pane key="tab_1">
|
<a-tab-pane key="tab_1">
|
||||||
<span slot="tab"><a-icon type="book" />{{ $t('cmdb.attribute') }}</span>
|
<span slot="tab"><a-icon type="book" />{{ $t('cmdb.attribute') }}</span>
|
||||||
<div :style="{ maxHeight: `${windowHeight - 44}px`, overflow: 'auto', padding: '24px' }" class="ci-detail-attr">
|
<div class="ci-detail-attr">
|
||||||
<el-descriptions
|
<el-descriptions
|
||||||
:title="group.name || $t('other')"
|
:title="group.name || $t('other')"
|
||||||
:key="group.name"
|
:key="group.name"
|
||||||
|
@ -37,18 +27,18 @@
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="tab_2">
|
<a-tab-pane key="tab_2">
|
||||||
<span slot="tab"><a-icon type="branches" />{{ $t('cmdb.relation') }}</span>
|
<span slot="tab"><a-icon type="branches" />{{ $t('cmdb.relation') }}</span>
|
||||||
<div :style="{ padding: '24px' }">
|
<div :style="{ height: '100%', padding: '24px' }">
|
||||||
<CiDetailRelation ref="ciDetailRelation" :ciId="ciId" :typeId="typeId" :ci="ci" />
|
<CiDetailRelation ref="ciDetailRelation" :ciId="ciId" :typeId="typeId" :ci="ci" />
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="tab_3">
|
<a-tab-pane key="tab_3">
|
||||||
<span slot="tab"><a-icon type="clock-circle" />{{ $t('cmdb.ci.history') }}</span>
|
<span slot="tab"><a-icon type="clock-circle" />{{ $t('cmdb.ci.history') }}</span>
|
||||||
<div :style="{ padding: '24px', height: 'calc(100vh - 44px)' }">
|
<div :style="{ padding: '24px', height: '100%' }">
|
||||||
<vxe-table
|
<vxe-table
|
||||||
ref="xTable"
|
ref="xTable"
|
||||||
:data="ciHistory"
|
:data="ciHistory"
|
||||||
size="small"
|
size="small"
|
||||||
:max-height="`${windowHeight - 94}px`"
|
height="auto"
|
||||||
:span-method="mergeRowMethod"
|
:span-method="mergeRowMethod"
|
||||||
border
|
border
|
||||||
:scroll-y="{ enabled: false }"
|
:scroll-y="{ enabled: false }"
|
||||||
|
@ -88,12 +78,22 @@
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="tab_4">
|
<a-tab-pane key="tab_4">
|
||||||
<span slot="tab"><ops-icon type="itsm_auto_trigger" />{{ $t('cmdb.history.triggerHistory') }}</span>
|
<span slot="tab"><ops-icon type="itsm_auto_trigger" />{{ $t('cmdb.history.triggerHistory') }}</span>
|
||||||
<div :style="{ padding: '24px', height: 'calc(100vh - 44px)' }">
|
<div :style="{ padding: '24px', height: '100%' }">
|
||||||
<TriggerTable :ci_id="ci._id" />
|
<TriggerTable :ci_id="ci._id" />
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</CustomDrawer>
|
<a-empty
|
||||||
|
v-else
|
||||||
|
:image-style="{
|
||||||
|
height: '100px',
|
||||||
|
}"
|
||||||
|
:style="{ paddingTop: '20%' }"
|
||||||
|
>
|
||||||
|
<img slot="image" :src="require('@/assets/data_empty.png')" />
|
||||||
|
<span slot="description"> {{ $t('cmdb.ci.noPermission') }} </span>
|
||||||
|
</a-empty>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -105,8 +105,8 @@ import { getCIById } from '@/modules/cmdb/api/ci'
|
||||||
import CiDetailAttrContent from './ciDetailAttrContent.vue'
|
import CiDetailAttrContent from './ciDetailAttrContent.vue'
|
||||||
import CiDetailRelation from './ciDetailRelation.vue'
|
import CiDetailRelation from './ciDetailRelation.vue'
|
||||||
import TriggerTable from '../../operation_history/modules/triggerTable.vue'
|
import TriggerTable from '../../operation_history/modules/triggerTable.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: 'CiDetailTab',
|
||||||
components: {
|
components: {
|
||||||
ElDescriptions: Descriptions,
|
ElDescriptions: Descriptions,
|
||||||
ElDescriptionsItem: DescriptionsItem,
|
ElDescriptionsItem: DescriptionsItem,
|
||||||
|
@ -126,7 +126,6 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
|
||||||
ci: {},
|
ci: {},
|
||||||
attributeGroups: [],
|
attributeGroups: [],
|
||||||
activeTabKey: 'tab_1',
|
activeTabKey: 'tab_1',
|
||||||
|
@ -134,13 +133,13 @@ export default {
|
||||||
ciHistory: [],
|
ciHistory: [],
|
||||||
ciId: null,
|
ciId: null,
|
||||||
ci_types: [],
|
ci_types: [],
|
||||||
|
hasPermission: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
windowHeight() {
|
windowHeight() {
|
||||||
return this.$store.state.windowHeight
|
return this.$store.state.windowHeight
|
||||||
},
|
},
|
||||||
|
|
||||||
operateTypeMap() {
|
operateTypeMap() {
|
||||||
return {
|
return {
|
||||||
0: this.$t('new'),
|
0: this.$t('new'),
|
||||||
|
@ -156,10 +155,22 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['reload', 'handleSearch', 'attrList'],
|
inject: {
|
||||||
|
reload: {
|
||||||
|
from: 'reload',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
handleSearch: {
|
||||||
|
from: 'handleSearch',
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
attrList: {
|
||||||
|
from: 'attrList',
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
create(ciId, activeTabKey = 'tab_1', ciDetailRelationKey = '1') {
|
async create(ciId, activeTabKey = 'tab_1', ciDetailRelationKey = '1') {
|
||||||
this.visible = true
|
|
||||||
this.activeTabKey = activeTabKey
|
this.activeTabKey = activeTabKey
|
||||||
if (activeTabKey === 'tab_2') {
|
if (activeTabKey === 'tab_2') {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -167,12 +178,14 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.ciId = ciId
|
this.ciId = ciId
|
||||||
|
await this.getCI()
|
||||||
|
if (this.hasPermission) {
|
||||||
this.getAttributes()
|
this.getAttributes()
|
||||||
this.getCI()
|
|
||||||
this.getCIHistory()
|
this.getCIHistory()
|
||||||
getCITypes().then((res) => {
|
getCITypes().then((res) => {
|
||||||
this.ci_types = res.ci_types
|
this.ci_types = res.ci_types
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getAttributes() {
|
getAttributes() {
|
||||||
getCITypeGroupById(this.typeId, { need_other: 1 })
|
getCITypeGroupById(this.typeId, { need_other: 1 })
|
||||||
|
@ -181,11 +194,14 @@ export default {
|
||||||
})
|
})
|
||||||
.catch((e) => {})
|
.catch((e) => {})
|
||||||
},
|
},
|
||||||
getCI() {
|
async getCI() {
|
||||||
getCIById(this.ciId)
|
await getCIById(this.ciId)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// this.ci = res.ci
|
if (res.result.length) {
|
||||||
this.ci = res.result[0]
|
this.ci = res.result[0]
|
||||||
|
} else {
|
||||||
|
this.hasPermission = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {})
|
.catch((e) => {})
|
||||||
},
|
},
|
||||||
|
@ -270,10 +286,14 @@ export default {
|
||||||
// 修改的字段为树形视图订阅的字段 则全部reload
|
// 修改的字段为树形视图订阅的字段 则全部reload
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (_find) {
|
if (_find) {
|
||||||
|
if (this.reload) {
|
||||||
this.reload()
|
this.reload()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (this.handleSearch) {
|
||||||
this.handleSearch()
|
this.handleSearch()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
|
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
|
||||||
|
@ -303,23 +323,49 @@ export default {
|
||||||
// 修改的字段为树形视图订阅的字段 则全部reload
|
// 修改的字段为树形视图订阅的字段 则全部reload
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (_find) {
|
if (_find) {
|
||||||
|
if (this.reload) {
|
||||||
this.reload()
|
this.reload()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (this.handleSearch) {
|
||||||
this.handleSearch()
|
this.handleSearch()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
|
shareCi() {
|
||||||
|
const text = `${document.location.host}/cmdb/cidetail/${this.typeId}/${this.ciId}`
|
||||||
|
this.$copyText(text)
|
||||||
|
.then(() => {
|
||||||
|
this.$message.success(this.$t('copySuccess'))
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$message.error(this.$t('cmdb.ci.copyFailed'))
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.ci-detail {
|
.ci-detail-tab {
|
||||||
|
height: 100%;
|
||||||
|
.ant-tabs-content {
|
||||||
|
height: calc(100% - 45px);
|
||||||
|
.ant-tabs-tabpane {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.ant-tabs-bar {
|
.ant-tabs-bar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
.ant-tabs-extra-content {
|
||||||
|
line-height: 44px;
|
||||||
|
}
|
||||||
.ci-detail-attr {
|
.ci-detail-attr {
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 24px;
|
||||||
.el-descriptions-item__content {
|
.el-descriptions-item__content {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
&:hover a {
|
&:hover a {
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div :style="{ height: '100%' }">
|
||||||
<vxe-table
|
<vxe-table
|
||||||
show-overflow
|
show-overflow
|
||||||
show-header-overflow
|
show-header-overflow
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
class="ops-stripe-table"
|
class="ops-stripe-table"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
v-bind="ci_id ? { maxHeight: `${windowHeight - 94}px` } : { height: `${windowHeight - 225}px` }"
|
v-bind="ci_id ? { height: 'auto' } : { height: `${windowHeight - 225}px` }"
|
||||||
>
|
>
|
||||||
<vxe-column field="trigger_name" :title="$t('cmdb.history.triggerName')"> </vxe-column>
|
<vxe-column field="trigger_name" :title="$t('cmdb.history.triggerName')"> </vxe-column>
|
||||||
<vxe-column field="type" :title="$t('type')">
|
<vxe-column field="type" :title="$t('type')">
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
<!-- <GrantDrawer ref="grantDrawer" resourceTypeName="RelationView" app_id="cmdb" /> -->
|
<!-- <GrantDrawer ref="grantDrawer" resourceTypeName="RelationView" app_id="cmdb" /> -->
|
||||||
<CMDBGrant ref="cmdbGrant" resourceType="RelationView" app_id="cmdb" />
|
<CMDBGrant ref="cmdbGrant" resourceType="RelationView" app_id="cmdb" />
|
||||||
|
|
||||||
<ci-detail ref="detail" :typeId="Number(currentTypeId[0])" />
|
<CiDetailDrawer ref="detail" :typeId="Number(currentTypeId[0])" />
|
||||||
<create-instance-form
|
<create-instance-form
|
||||||
ref="create"
|
ref="create"
|
||||||
:typeIdFromRelation="Number(currentTypeId[0])"
|
:typeIdFromRelation="Number(currentTypeId[0])"
|
||||||
|
@ -354,7 +354,7 @@ import { roleHasPermissionToGrant } from '@/modules/acl/api/permission'
|
||||||
import { searchResourceType } from '@/modules/acl/api/resource'
|
import { searchResourceType } from '@/modules/acl/api/resource'
|
||||||
import SplitPane from '@/components/SplitPane'
|
import SplitPane from '@/components/SplitPane'
|
||||||
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
||||||
import CiDetail from '../ci/modules/CiDetail'
|
import CiDetailDrawer from '../ci/modules/ciDetailDrawer.vue'
|
||||||
import CreateInstanceForm from '../ci/modules/CreateInstanceForm'
|
import CreateInstanceForm from '../ci/modules/CreateInstanceForm'
|
||||||
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
||||||
import BatchDownload from '../../components/batchDownload/batchDownload.vue'
|
import BatchDownload from '../../components/batchDownload/batchDownload.vue'
|
||||||
|
@ -375,7 +375,7 @@ export default {
|
||||||
SplitPane,
|
SplitPane,
|
||||||
ElTree: Tree,
|
ElTree: Tree,
|
||||||
EditAttrsPopover,
|
EditAttrsPopover,
|
||||||
CiDetail,
|
CiDetailDrawer,
|
||||||
CreateInstanceForm,
|
CreateInstanceForm,
|
||||||
JsonEditor,
|
JsonEditor,
|
||||||
BatchDownload,
|
BatchDownload,
|
||||||
|
|
|
@ -371,7 +371,7 @@
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<ci-detail ref="detail" :typeId="Number(typeId)" :treeViewsLevels="treeViewsLevels" />
|
<CiDetailDrawer ref="detail" :typeId="Number(typeId)" :treeViewsLevels="treeViewsLevels" />
|
||||||
<create-instance-form
|
<create-instance-form
|
||||||
ref="create"
|
ref="create"
|
||||||
:typeIdFromRelation="Number(typeId)"
|
:typeIdFromRelation="Number(typeId)"
|
||||||
|
@ -404,7 +404,7 @@ import PasswordField from '../../components/passwordField/index.vue'
|
||||||
import SplitPane from '@/components/SplitPane'
|
import SplitPane from '@/components/SplitPane'
|
||||||
import TreeViewsNode from './modules/treeViewsNode.vue'
|
import TreeViewsNode from './modules/treeViewsNode.vue'
|
||||||
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
||||||
import CiDetail from '../ci/modules/CiDetail'
|
import CiDetailDrawer from '../ci/modules/ciDetailDrawer.vue'
|
||||||
import CreateInstanceForm from '../ci/modules/CreateInstanceForm'
|
import CreateInstanceForm from '../ci/modules/CreateInstanceForm'
|
||||||
import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr'
|
import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr'
|
||||||
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
import JsonEditor from '../../components/JsonEditor/jsonEditor.vue'
|
||||||
|
@ -424,7 +424,7 @@ export default {
|
||||||
SplitPane,
|
SplitPane,
|
||||||
TreeViewsNode,
|
TreeViewsNode,
|
||||||
EditAttrsPopover,
|
EditAttrsPopover,
|
||||||
CiDetail,
|
CiDetailDrawer,
|
||||||
CreateInstanceForm,
|
CreateInstanceForm,
|
||||||
JsonEditor,
|
JsonEditor,
|
||||||
BatchDownload,
|
BatchDownload,
|
||||||
|
|
Loading…
Reference in New Issue