NEZ-2787 fix:Project 删除后,右侧 topo 未刷新

This commit is contained in:
zhangyu
2023-04-19 17:32:37 +08:00
parent be1406caf6
commit c1120da417
4 changed files with 24 additions and 5 deletions

View File

@@ -131,7 +131,7 @@ export default {
type: Boolean
}
},
inject: ['getTableData'],
inject: ['getTableData', 'delCallBack'],
methods: {
batchDelete: function () {
if (!this.single) {
@@ -215,6 +215,9 @@ export default {
return this.idStr.indexOf(item.id) !== -1
})
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
if (this.delCallBack) {
this.delCallBack(this.idStr)
}
// this.$emit('after')
} else {
this.$message.error(res.msg)

View File

@@ -51,7 +51,8 @@ export default {
},
provide () {
return {
getTableData: this.getTableData
getTableData: this.getTableData,
delCallBack: this.delCallBack
}
},
methods: {

View File

@@ -180,8 +180,11 @@ export default {
if (this.trendPromiseIndex < this.trendPromise.length) {
Promise.all(this.trendPromise[this.trendPromiseIndex]).then(response => {
response.forEach((res, index) => {
const arr = res.responseURL.split('=')
const id = arr[arr.length - 1]
const arr = res.responseURL && res.responseURL.split('=')
let id = ''
if (arr) {
id = arr[arr.length - 1]
}
const item = this.tableData.find(row => row.id == id)
if (!res.data) {
return
@@ -204,7 +207,7 @@ export default {
this.trendPromiseIndex++
this.renderTrend()
}).catch((msg) => {
console.log(msg)
// console.log(msg)
})
}
}

View File

@@ -134,6 +134,7 @@ export default {
},
methods: {
getTableData (params) {
console.log('213123123')
if (params && Object.keys(params).length > 0) {
for (const key in params) {
this.$set(this.searchLabel, key, params[key])
@@ -194,6 +195,17 @@ export default {
}
}
})
},
delCallBack (id) {
console.log(id, 'id')
if (id.indexOf(this.$store.state.currentProject.id) !== -1) {
console.log(123, id)
this.$store.commit('currentProjectChange', {
id: '',
name: '',
remark: ''
})
}
}
},
computed: {