* fix:add package

* fix:notice_info为null的情况

* fix:2 bugs
This commit is contained in:
wang-liang0615 2023-09-28 09:45:11 +08:00 committed by GitHub
parent d42513c4a4
commit 89a2985ee4
2 changed files with 1709 additions and 1696 deletions

View File

@ -276,7 +276,7 @@ export default {
} else if (_findADT.agent_id) { } else if (_findADT.agent_id) {
this.agent_type = 'agent_id' this.agent_type = 'agent_id'
} else { } else {
this.agent_type = 'agent_id' this.agent_type = this.agentTypeRadioList[0].value
} }
if (_findADT.interval || (!_findADT.interval && !_findADT.cron)) { if (_findADT.interval || (!_findADT.interval && !_findADT.cron)) {
this.interval = 'interval' this.interval = 'interval'
@ -348,9 +348,17 @@ export default {
} }
if (this.agent_type === 'agent_id' || this.agent_type === 'all') { if (this.agent_type === 'agent_id' || this.agent_type === 'all') {
params.query_expr = '' params.query_expr = ''
if (this.agent_type === 'agent_id' && !params.agent_id) {
this.$message.error('请填写指定节点!')
return
}
} }
if (this.agent_type === 'query_expr' || this.agent_type === 'all') { if (this.agent_type === 'query_expr' || this.agent_type === 'all') {
params.agent_id = '' params.agent_id = ''
if (this.agent_type === 'query_expr' && !params.query_expr) {
this.$message.error('请从cmdb中选择')
return
}
} }
putCITypeDiscovery(currentAdt.id, params).then((res) => { putCITypeDiscovery(currentAdt.id, params).then((res) => {

View File

@ -560,20 +560,22 @@ export default {
} else { } else {
q = `q=_type:${this.currentTypeId[0]},` + q q = `q=_type:${this.currentTypeId[0]},` + q
} }
const res = await searchCI2(q) if (this.currentTypeId[0]) {
this.pageNo = res.page const res = await searchCI2(q)
this.numfound = res.numfound this.pageNo = res.page
res.result.forEach((item, index) => (item.key = item._id)) this.numfound = res.numfound
const jsonAttrList = this.preferenceAttrList.filter((attr) => attr.value_type === '6') res.result.forEach((item, index) => (item.key = item._id))
console.log(jsonAttrList) const jsonAttrList = this.preferenceAttrList.filter((attr) => attr.value_type === '6')
this.instanceList = res['result'].map((item) => { console.log(jsonAttrList)
jsonAttrList.forEach( this.instanceList = res['result'].map((item) => {
(jsonAttr) => (item[jsonAttr.name] = item[jsonAttr.name] ? JSON.stringify(item[jsonAttr.name]) : '') jsonAttrList.forEach(
) (jsonAttr) => (item[jsonAttr.name] = item[jsonAttr.name] ? JSON.stringify(item[jsonAttr.name]) : '')
return { ..._.cloneDeep(item) } )
}) return { ..._.cloneDeep(item) }
this.initialInstanceList = _.cloneDeep(this.instanceList) })
this.calcColumns() this.initialInstanceList = _.cloneDeep(this.instanceList)
this.calcColumns()
}
} else { } else {
q += `&root_id=${this.treeKeys[this.treeKeys.length - 1].split('%')[0]}` q += `&root_id=${this.treeKeys[this.treeKeys.length - 1].split('%')[0]}`
const typeId = parseInt(this.treeKeys[this.treeKeys.length - 1].split('%')[1]) const typeId = parseInt(this.treeKeys[this.treeKeys.length - 1].split('%')[1])
@ -608,25 +610,28 @@ export default {
} else { } else {
q = `q=_type:${this.currentTypeId[0]},` + q q = `q=_type:${this.currentTypeId[0]},` + q
} }
const res = await searchCIRelation(q) if (this.currentTypeId[0]) {
const res = await searchCIRelation(q)
const _data = Object.assign([], res.result) const _data = Object.assign([], res.result)
_data.forEach((item, index) => (item.key = item._id)) _data.forEach((item, index) => (item.key = item._id))
this.numfound = res.numfound this.numfound = res.numfound
this.pageNo = res.page this.pageNo = res.page
const jsonAttrList = this.preferenceAttrList.filter((attr) => attr.value_type === '6') const jsonAttrList = this.preferenceAttrList.filter((attr) => attr.value_type === '6')
this.instanceList = _data.map((item) => { this.instanceList = _data.map((item) => {
jsonAttrList.forEach( jsonAttrList.forEach(
(jsonAttr) => (item[jsonAttr.name] = item[jsonAttr.name] ? JSON.stringify(item[jsonAttr.name]) : '') (jsonAttr) => (item[jsonAttr.name] = item[jsonAttr.name] ? JSON.stringify(item[jsonAttr.name]) : '')
) )
return { ..._.cloneDeep(item) } return { ..._.cloneDeep(item) }
}) })
this.initialInstanceList = _.cloneDeep(this.instanceList) this.initialInstanceList = _.cloneDeep(this.instanceList)
this.calcColumns()
}
this.calcColumns()
if (refreshType === 'refreshNumber') { if (refreshType === 'refreshNumber') {
this.treeKeys.map((key, index) => { const promises = this.treeKeys.map((key, index) => {
statisticsCIRelation({ statisticsCIRelation({
root_ids: key.split('%')[0], root_ids: key.split('%')[0],
level: this.treeKeys.length - index, level: this.treeKeys.length - index,