-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef1d0c3
commit f010b96
Showing
13 changed files
with
257 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailDrawer.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.