From a617189dc73c1fc774c4ba2de9a2ec6142a6e99c Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Sun, 5 Apr 2020 21:53:14 -0400 Subject: [PATCH] fix: Without data refreshing on different child tab than the first. (#433) --- src/components/ADempiere/Tab/index.vue | 18 ++++++++++++++++++ src/components/ADempiere/Tab/tabChildren.vue | 15 +++++++-------- src/components/ADempiere/Tab/tabMixin.js | 15 +-------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/components/ADempiere/Tab/index.vue b/src/components/ADempiere/Tab/index.vue index ff97ea7b..7f5238b3 100644 --- a/src/components/ADempiere/Tab/index.vue +++ b/src/components/ADempiere/Tab/index.vue @@ -34,6 +34,11 @@ export default { MainPanel }, mixins: [tabMixin], + data() { + return { + currentTab: this.$route.query.tabParent + } + }, computed: { tabParentStyle() { // if tabs children is showed or closed @@ -70,6 +75,19 @@ export default { }) this.$route.meta.tabUuid = this.tabUuid } + }, + tabUuid(value) { + this.setCurrentTab() + } + }, + methods: { + setCurrentTab() { + this.$store.dispatch('setCurrentTab', { + parentUuid: this.windowUuid, + containerUuid: this.tabUuid, + window: this.windowMetadata + }) + this.$route.meta.tabUuid = this.tabUuid } } } diff --git a/src/components/ADempiere/Tab/tabChildren.vue b/src/components/ADempiere/Tab/tabChildren.vue index 01fad440..6d636e25 100644 --- a/src/components/ADempiere/Tab/tabChildren.vue +++ b/src/components/ADempiere/Tab/tabChildren.vue @@ -52,14 +52,9 @@ export default { getterDataParentTab() { return this.$store.getters.getDataRecordAndSelection(this.firstTabUuid) }, - getterIsLoadRecordParent() { - return this.getterDataParentTab.isLoaded - }, - getterIsLoadContextParent() { - return this.getterDataParentTab.isLoadedContext - }, isReadyFromGetData() { - return !this.getDataSelection.isLoaded && this.getterIsLoadContextParent && this.getterIsLoadRecordParent + const { isLoaded, isLoadedContext } = this.getterDataParentTab + return !this.getDataSelection.isLoaded && isLoaded && isLoadedContext } }, watch: { @@ -91,8 +86,12 @@ export default { } } }, - mounted() { + created() { this.setCurrentTabChild() + const currentIndex = parseInt(this.currentTabChild, 10) + this.tabUuid = this.tabsList[currentIndex].uuid + }, + mounted() { if (this.isReadyFromGetData) { this.getDataTable() } diff --git a/src/components/ADempiere/Tab/tabMixin.js b/src/components/ADempiere/Tab/tabMixin.js index b1571580..7bfa34e1 100644 --- a/src/components/ADempiere/Tab/tabMixin.js +++ b/src/components/ADempiere/Tab/tabMixin.js @@ -17,10 +17,8 @@ export const tabMixin = { }, data() { return { - currentTab: this.$route.query.tabParent, tabUuid: '', - panelType: 'window', - firstTableName: this.tabsList[0].tableName + panelType: 'window' } }, computed: { @@ -32,29 +30,18 @@ export const tabMixin = { this.tabUuid = this.tabsList[0].uuid }, methods: { - parseContext, - // getDataTable() { this.$store.dispatch('getDataListTab', { parentUuid: this.windowUuid, containerUuid: this.tabUuid }) }, - setCurrentTab() { - this.$store.dispatch('setCurrentTab', { - parentUuid: this.windowUuid, - containerUuid: this.tabUuid, - window: this.windowMetadata - }) - this.$route.meta.tabUuid = this.tabUuid - }, /** * @param {object} tabHTML DOM HTML the tab clicked */ handleClick(tabHTML) { if (this.tabUuid !== tabHTML.$attrs.tabuuid) { this.tabUuid = tabHTML.$attrs.tabuuid - this.setCurrentTab() } }, handleBeforeLeave(activeName) {