diff --git a/nezha-fronted/src/components/common/deleteButton.vue b/nezha-fronted/src/components/common/deleteButton.vue index 3959f2c7d..49527c3e3 100644 --- a/nezha-fronted/src/components/common/deleteButton.vue +++ b/nezha-fronted/src/components/common/deleteButton.vue @@ -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) diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index f8b3419d1..5ea3af2d8 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -51,7 +51,8 @@ export default { }, provide () { return { - getTableData: this.getTableData + getTableData: this.getTableData, + delCallBack: this.delCallBack } }, methods: { diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index 3a97797a6..bb16ee14f 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -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) }) } } diff --git a/nezha-fronted/src/components/page/monitor/project/projectList.vue b/nezha-fronted/src/components/page/monitor/project/projectList.vue index 1922ef5a5..7517fc6c8 100644 --- a/nezha-fronted/src/components/page/monitor/project/projectList.vue +++ b/nezha-fronted/src/components/page/monitor/project/projectList.vue @@ -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: {