NEZ-1088 fix:Project页面点击Alert字段不能跳转到Alert message页面

This commit is contained in:
zhangyu
2021-10-27 10:49:53 +08:00
parent 4a4106d9ec
commit ffb6cb23ea
4 changed files with 61 additions and 12 deletions

View File

@@ -1,3 +1,5 @@
import project from "@/components/page/monitor/project/project";
export default {
props: {},
data () {
@@ -42,12 +44,29 @@ export default {
this.detailViewLoading = false
this.$refs.clickSearch && this.$refs.clickSearch.needMore()
this.$refs[dataList].$refs.searchInput.sreach_num = 0
this.$refs[dataList].$refs.searchInput.select_list = []
console.log(this.searchMsg.searchLabelList)
this.searchMsg.searchLabelList.forEach(searchLabel => {
if (this.searchLabel[searchLabel.label]) {
let val = this.searchLabel[searchLabel.label]
console.log(val)
if (searchLabel.label === 'projectIds') {
const project = this.$refs.dataList.$refs.searchInput.projectSelect.find(project => val == project.id || val == project.name)
console.log(project)
val = project.name
const valnum = project.id
this.$refs[dataList].$refs.searchInput.select_list.push({
...searchLabel,
val: this.searchLabel[searchLabel.label]
val: val,
valnum: valnum
})
} else {
this.$refs[dataList].$refs.searchInput.select_list.push({
...searchLabel,
val: val
})
}
this.$refs[dataList].$refs.searchInput.sreach_num++
this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs.dataList.$refs.searchInput.searchLabelList.filter(item => searchLabel.label !== item.label)
}

View File

@@ -53,7 +53,7 @@
</span>
</template>
<template v-else-if="item.prop === 'alertNum'">
<span class="alert-num">
<span class="alert-num" @click="jumpAlertMessage(scope.row)">
<i class="nz-icon nz-icon-overview-alert" :class="scope.row[item.prop]>0?'colorEF7458':'color23BF9A'"/>
{{scope.row[item.prop]}}
</span>
@@ -142,9 +142,13 @@ export default {
this.$store.commit('currentProjectChange', project)
},
jumpModule (row) {
localStorage.setItem('moduleProjectId', row.id)
localStorage.setItem('moduleProjectId', JSON.stringify([row.id, row.name]))
this.$router.push({ path: '/monitor/module' })
},
jumpAlertMessage (row) {
localStorage.setItem('alertMessageProjectId', row.id)
this.$router.push({ path: '/alertMessage' })
},
jumpEndpoint (row) {
localStorage.setItem('endpointProjectId', row.id)
this.$router.push({ path: '/monitor/endpoint' })

View File

@@ -352,6 +352,19 @@ export default {
}
}
},
created () {
if (localStorage.getItem('alertMessageProjectId')) {
this.selectValue.projectIds = [Number(localStorage.getItem('alertMessageProjectId'))]
this.searchCheckBox.projectIds = this.selectValue.projectIds.join(',')
}
},
mounted () {
if (localStorage.getItem('alertMessageProjectId')) {
this.selectValue.projectIds = [Number(localStorage.getItem('alertMessageProjectId'))]
// this.$refs.clickSearch.selectValueOut.projectIds = [localStorage.getItem('endpointProjectId')]
}
// this.getTitleSearch()
},
methods: {
labelsSort (obj) {
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'project', 'datacenter', 'parent_asset', 'user']
@@ -990,6 +1003,9 @@ export default {
}
},
deleteMessage () {}
},
destroyed () {
localStorage.removeItem('endpointProjectId')
}
}
</script>

View File

@@ -275,6 +275,7 @@ export default {
name: this.$t('overall.projectName'),
type: 'project',
label: 'projectIds',
id: 11,
readonly: true,
disabled: false
}
@@ -425,19 +426,28 @@ export default {
},
created () {
if (localStorage.getItem('moduleProjectId')) {
this.searchLabel.projectIds = localStorage.getItem('moduleProjectId')
this.searchLabel.projectIds = JSON.parse(localStorage.getItem('moduleProjectId'))[0]
}
if (localStorage.getItem('moduleProjectId')) {
const project = JSON.parse(localStorage.getItem('moduleProjectId'))
let dataList = ''
if (this.detailType !== 'view') {
dataList = 'dataList'
} else {
dataList = 'detailList'
}
setTimeout(() => {
this.$refs.dataList.$refs.searchInput.select_list.push({
this.$refs[dataList].$refs.searchInput.select_list.push({
id: 11,
name: 'project id',
type: 'input',
name: this.$t('overall.projectName'),
type: 'project',
label: 'projectIds',
disabled: false,
val: localStorage.getItem('moduleProjectId')
val: project[1],
valnum: project[0]
})
this.$refs.dataList.$refs.searchInput.sreach_num = 1
this.$refs[dataList].$refs.searchInput.sreach_num = 1
this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs[dataList].$refs.searchInput.searchLabelList.filter(item => item.label !== 'projectIds')
})
}
},