From 4beece5a6ebb876d21591416d1d25399b570afd2 Mon Sep 17 00:00:00 2001 From: wang-liang0615 <53748875+wang-liang0615@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:18:00 +0800 Subject: [PATCH] fix:open triggerForm from attributeCard (#322) --- .../modules/cmdb/views/ci_types/attributeCard.vue | 6 +++++- .../modules/cmdb/views/ci_types/attributesTable.vue | 2 ++ cmdb-ui/src/modules/cmdb/views/ci_types/index.vue | 12 ++++++++++++ .../modules/cmdb/views/ci_types/triggerTable.vue | 13 ------------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/attributeCard.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/attributeCard.vue index fb2a9b9..6c9bd78 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/attributeCard.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/attributeCard.vue @@ -104,6 +104,10 @@ export default { type: Boolean, default: false, }, + attributes: { + type: Array, + default: () => [] + } }, data() { const propertyList = [ @@ -160,7 +164,7 @@ export default { }) }, openTrigger() { - this.$refs.triggerForm.open(this.property) + this.$refs.triggerForm.open(this.property, this.attributes) }, handleCalcComputed() { const that = this diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue index 42da472..aca98d2 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/attributesTable.vue @@ -98,6 +98,7 @@ :property="item" @ok="handleOk" :CITypeId="CITypeId" + :attributes="attributes" /> @@ -137,6 +138,7 @@ :property="item" @ok="handleOk" :CITypeId="CITypeId" + :attributes="attributes" /> diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/index.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/index.vue index 2d4722d..18b7cd1 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/index.vue @@ -293,6 +293,7 @@ import SplitPane from '@/components/SplitPane' import CMDBGrant from '../../components/cmdbGrant' import { ops_move_icon as OpsMoveIcon } from '@/core/icons' import AttributeStore from './attributeStore.vue' +import { getAllDepAndEmployee } from '@/api/company' export default { name: 'CITypes', @@ -342,6 +343,8 @@ export default { orderSelectionOptions: [], default_order_asc: '1', + + allTreeDepAndEmp: [], } }, computed: { @@ -405,9 +408,13 @@ export default { resource_type: () => { return this.resource_type }, + provide_allTreeDepAndEmp: () => { + return this.allTreeDepAndEmp + }, } }, mounted() { + this.getAllDepAndEmployee() const _currentId = localStorage.getItem('ops_cityps_currentId') if (_currentId) { this.currentId = _currentId @@ -419,6 +426,11 @@ export default { this.getAttributes() }, methods: { + getAllDepAndEmployee() { + getAllDepAndEmployee({ block: 0 }).then((res) => { + this.allTreeDepAndEmp = res + }) + }, async loadCITypes(isResetCurrentId = false) { const groups = await getCITypeGroupsConfig({ need_other: true }) let alreadyReset = false diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/triggerTable.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/triggerTable.vue index c67ed1c..8d0f6fc 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/triggerTable.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/triggerTable.vue @@ -71,7 +71,6 @@ import _ from 'lodash' import { getTriggerList, deleteTrigger, updateTrigger } from '../../api/CIType' import { getCITypeAttributesById } from '../../api/CITypeAttr' import TriggerForm from './triggerForm.vue' -import { getAllDepAndEmployee } from '@/api/company' export default { name: 'TriggerTable', @@ -86,7 +85,6 @@ export default { return { tableData: [], attrList: [], - allTreeDepAndEmp: [], } }, computed: { @@ -97,20 +95,9 @@ export default { provide() { return { refresh: this.getTableData, - provide_allTreeDepAndEmp: () => { - return this.allTreeDepAndEmp - }, } }, - mounted() { - this.getAllDepAndEmployee() - }, methods: { - getAllDepAndEmployee() { - getAllDepAndEmployee({ block: 0 }).then((res) => { - this.allTreeDepAndEmp = res - }) - }, async getTableData() { const [triggerList, attrList] = await Promise.all([ getTriggerList(this.CITypeId),