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 { export default {
props: {}, props: {},
data () { data () {
@@ -42,12 +44,29 @@ export default {
this.detailViewLoading = false this.detailViewLoading = false
this.$refs.clickSearch && this.$refs.clickSearch.needMore() this.$refs.clickSearch && this.$refs.clickSearch.needMore()
this.$refs[dataList].$refs.searchInput.sreach_num = 0 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 => { this.searchMsg.searchLabelList.forEach(searchLabel => {
if (this.searchLabel[searchLabel.label]) { 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({ this.$refs[dataList].$refs.searchInput.select_list.push({
...searchLabel, ...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.sreach_num++
this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs.dataList.$refs.searchInput.searchLabelList.filter(item => searchLabel.label !== item.label) 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> </span>
</template> </template>
<template v-else-if="item.prop === 'alertNum'"> <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'"/> <i class="nz-icon nz-icon-overview-alert" :class="scope.row[item.prop]>0?'colorEF7458':'color23BF9A'"/>
{{scope.row[item.prop]}} {{scope.row[item.prop]}}
</span> </span>
@@ -142,9 +142,13 @@ export default {
this.$store.commit('currentProjectChange', project) this.$store.commit('currentProjectChange', project)
}, },
jumpModule (row) { jumpModule (row) {
localStorage.setItem('moduleProjectId', row.id) localStorage.setItem('moduleProjectId', JSON.stringify([row.id, row.name]))
this.$router.push({ path: '/monitor/module' }) this.$router.push({ path: '/monitor/module' })
}, },
jumpAlertMessage (row) {
localStorage.setItem('alertMessageProjectId', row.id)
this.$router.push({ path: '/alertMessage' })
},
jumpEndpoint (row) { jumpEndpoint (row) {
localStorage.setItem('endpointProjectId', row.id) localStorage.setItem('endpointProjectId', row.id)
this.$router.push({ path: '/monitor/endpoint' }) 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: { methods: {
labelsSort (obj) { labelsSort (obj) {
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'project', 'datacenter', 'parent_asset', 'user'] const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'project', 'datacenter', 'parent_asset', 'user']
@@ -990,6 +1003,9 @@ export default {
} }
}, },
deleteMessage () {} deleteMessage () {}
},
destroyed () {
localStorage.removeItem('endpointProjectId')
} }
} }
</script> </script>

View File

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