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

View File

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

View File

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

View File

@@ -134,6 +134,7 @@ export default {
}, },
methods: { methods: {
getTableData (params) { getTableData (params) {
console.log('213123123')
if (params && Object.keys(params).length > 0) { if (params && Object.keys(params).length > 0) {
for (const key in params) { for (const key in params) {
this.$set(this.searchLabel, key, params[key]) 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: { computed: {