NEZ-1946 fix: 打开底部弹窗 删除对应元素 底部弹窗不关闭的问题

This commit is contained in:
zhangyu
2022-06-20 16:31:52 +08:00
parent dcf070fb7e
commit 34ddcc0b82
7 changed files with 29 additions and 6 deletions

View File

@@ -10,6 +10,7 @@
</template>
<script>
import bus from '@/libs/bus'
export default {
name: 'deleteButton',
props: {
@@ -44,6 +45,7 @@ export default {
if (response.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
this.$emit('after')
bus.$emit('delTableRow', this.deleteObjs.map(item => item.id))
} else {
this.$message.error(response.msg)
}

View File

@@ -161,6 +161,7 @@ export default {
self.delFlag = true
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
self.getTableData()
bus.$emit('delTableRow', [row.id])
} else {
this.$message.error(response.msg)
}

View File

@@ -244,7 +244,7 @@ export default {
tempEndpoint: {},
tempEndpoint2: {},
assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false },
rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
optionType: 'batch',
blankEndpoint: {
id: '',

View File

@@ -268,7 +268,7 @@ export default {
tempEndpoint: {},
tempEndpoint2: {},
assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false },
rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
optionType: 'batchAdd',
endpointTableTitle: [ // 原始table列
{

View File

@@ -157,7 +157,7 @@ export default {
tempEndpoint: {},
tempEndpoint2: {},
assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false },
rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
blankEndpoint: {
id: '',
projectId: '',

View File

@@ -10,10 +10,10 @@
{{ $t("project.module.batchEndpoint")}}
</span>
<span v-if="optionType === 'add'">
{{ $t("overall.createEndpoin")}}
{{ $t("overall.createEndpoint")}}
</span>
<span v-if="optionType === 'batchAdd'">
{{ $t("overall.createEndpoin")}}
{{ $t("overall.createEndpoint")}}
</span>
</div>
<!-- end--标题-->

View File

@@ -104,6 +104,7 @@ import { fromRoute } from '@/components/common/js/constants'
import bottomBox from '@/components/common/bottomBox/bottomBox'
import { bottomBoxWindow } from '@/components/common/js/tools'
import panelChart from '@/components/chart/panelChart'
import bus from '@/libs/bus'
export default {
name: 'nzDataList',
components: {
@@ -175,7 +176,23 @@ export default {
timeRange: [new Date(), new Date()]
}
},
mounted () {
bus.$on('delTableRow', this.delTableRow)
},
methods: {
delTableRow (ids) { // 接收一个 删除的id数组 判断当前底部弹窗id 是否包含 包含则关闭当前弹窗
if (ids.indexOf(this.bottomBox.object.id) !== -1) {
this.bottomBox = {
object: {},
mainResizeShow: true, // dom高度改变时是否展示|隐藏
subResizeShow: true,
isFullScreen: false, // 全屏状态
showSubList: false, // 是否显示二级列表
targetTab: '', // 显示二级列表中的哪个页签
inTransform: false // 搜索框相关搜索条件下拉框是否在transform里
}
}
},
updateCustomTableTitle (custom) {
this.$emit('update:customTableTitle', custom)
},
@@ -225,6 +242,9 @@ export default {
this.showLayout = [...n]
}
}
},
beforeDestroy () {
bus.$off('delTableRow', this.delTableRow)
}
}
</script>