fix:open triggerForm from attributeCard (#322)

This commit is contained in:
wang-liang0615 2023-12-21 14:18:00 +08:00 committed by GitHub
parent 920295d955
commit 4beece5a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 14 deletions

View File

@ -104,6 +104,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
attributes: {
type: Array,
default: () => []
}
}, },
data() { data() {
const propertyList = [ const propertyList = [
@ -160,7 +164,7 @@ export default {
}) })
}, },
openTrigger() { openTrigger() {
this.$refs.triggerForm.open(this.property) this.$refs.triggerForm.open(this.property, this.attributes)
}, },
handleCalcComputed() { handleCalcComputed() {
const that = this const that = this

View File

@ -98,6 +98,7 @@
:property="item" :property="item"
@ok="handleOk" @ok="handleOk"
:CITypeId="CITypeId" :CITypeId="CITypeId"
:attributes="attributes"
/> />
<i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i>
</draggable> </draggable>
@ -137,6 +138,7 @@
:property="item" :property="item"
@ok="handleOk" @ok="handleOk"
:CITypeId="CITypeId" :CITypeId="CITypeId"
:attributes="attributes"
/> />
<i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i>
</draggable> </draggable>

View File

@ -293,6 +293,7 @@ import SplitPane from '@/components/SplitPane'
import CMDBGrant from '../../components/cmdbGrant' import CMDBGrant from '../../components/cmdbGrant'
import { ops_move_icon as OpsMoveIcon } from '@/core/icons' import { ops_move_icon as OpsMoveIcon } from '@/core/icons'
import AttributeStore from './attributeStore.vue' import AttributeStore from './attributeStore.vue'
import { getAllDepAndEmployee } from '@/api/company'
export default { export default {
name: 'CITypes', name: 'CITypes',
@ -342,6 +343,8 @@ export default {
orderSelectionOptions: [], orderSelectionOptions: [],
default_order_asc: '1', default_order_asc: '1',
allTreeDepAndEmp: [],
} }
}, },
computed: { computed: {
@ -405,9 +408,13 @@ export default {
resource_type: () => { resource_type: () => {
return this.resource_type return this.resource_type
}, },
provide_allTreeDepAndEmp: () => {
return this.allTreeDepAndEmp
},
} }
}, },
mounted() { mounted() {
this.getAllDepAndEmployee()
const _currentId = localStorage.getItem('ops_cityps_currentId') const _currentId = localStorage.getItem('ops_cityps_currentId')
if (_currentId) { if (_currentId) {
this.currentId = _currentId this.currentId = _currentId
@ -419,6 +426,11 @@ export default {
this.getAttributes() this.getAttributes()
}, },
methods: { methods: {
getAllDepAndEmployee() {
getAllDepAndEmployee({ block: 0 }).then((res) => {
this.allTreeDepAndEmp = res
})
},
async loadCITypes(isResetCurrentId = false) { async loadCITypes(isResetCurrentId = false) {
const groups = await getCITypeGroupsConfig({ need_other: true }) const groups = await getCITypeGroupsConfig({ need_other: true })
let alreadyReset = false let alreadyReset = false

View File

@ -71,7 +71,6 @@ import _ from 'lodash'
import { getTriggerList, deleteTrigger, updateTrigger } from '../../api/CIType' import { getTriggerList, deleteTrigger, updateTrigger } from '../../api/CIType'
import { getCITypeAttributesById } from '../../api/CITypeAttr' import { getCITypeAttributesById } from '../../api/CITypeAttr'
import TriggerForm from './triggerForm.vue' import TriggerForm from './triggerForm.vue'
import { getAllDepAndEmployee } from '@/api/company'
export default { export default {
name: 'TriggerTable', name: 'TriggerTable',
@ -86,7 +85,6 @@ export default {
return { return {
tableData: [], tableData: [],
attrList: [], attrList: [],
allTreeDepAndEmp: [],
} }
}, },
computed: { computed: {
@ -97,20 +95,9 @@ export default {
provide() { provide() {
return { return {
refresh: this.getTableData, refresh: this.getTableData,
provide_allTreeDepAndEmp: () => {
return this.allTreeDepAndEmp
},
} }
}, },
mounted() {
this.getAllDepAndEmployee()
},
methods: { methods: {
getAllDepAndEmployee() {
getAllDepAndEmployee({ block: 0 }).then((res) => {
this.allTreeDepAndEmp = res
})
},
async getTableData() { async getTableData() {
const [triggerList, attrList] = await Promise.all([ const [triggerList, attrList] = await Promise.all([
getTriggerList(this.CITypeId), getTriggerList(this.CITypeId),