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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -104,6 +104,7 @@ import { fromRoute } from '@/components/common/js/constants'
import bottomBox from '@/components/common/bottomBox/bottomBox' import bottomBox from '@/components/common/bottomBox/bottomBox'
import { bottomBoxWindow } from '@/components/common/js/tools' import { bottomBoxWindow } from '@/components/common/js/tools'
import panelChart from '@/components/chart/panelChart' import panelChart from '@/components/chart/panelChart'
import bus from '@/libs/bus'
export default { export default {
name: 'nzDataList', name: 'nzDataList',
components: { components: {
@@ -154,7 +155,7 @@ export default {
}, },
data () { data () {
return { return {
sign:'', sign: '',
fromRoute: fromRoute, fromRoute: fromRoute,
/* 二级页面相关 */ /* 二级页面相关 */
bottomBox: { bottomBox: {
@@ -175,7 +176,23 @@ export default {
timeRange: [new Date(), new Date()] timeRange: [new Date(), new Date()]
} }
}, },
mounted () {
bus.$on('delTableRow', this.delTableRow)
},
methods: { 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) { updateCustomTableTitle (custom) {
this.$emit('update:customTableTitle', custom) this.$emit('update:customTableTitle', custom)
}, },
@@ -225,6 +242,9 @@ export default {
this.showLayout = [...n] this.showLayout = [...n]
} }
} }
},
beforeDestroy () {
bus.$off('delTableRow', this.delTableRow)
} }
} }
</script> </script>