fix: Show/hidden optional columns in table. (#256)

pull/3759/head
EdwinBetanc0urt 2020-01-22 17:39:30 -04:00 committed by Yamel Senih
parent f1dc173558
commit b854a8c68a
4 changed files with 27 additions and 18 deletions

View File

@ -49,7 +49,7 @@
/> />
</icon-element> </icon-element>
<filter-columns <filter-columns
v-if="isOptional" v-if="isShowOptionalColumns"
:container-uuid="containerUuid" :container-uuid="containerUuid"
:panel-type="panelType" :panel-type="panelType"
class="field-optional" class="field-optional"
@ -73,7 +73,7 @@
class="header-search-input" class="header-search-input"
/> />
<filter-columns <filter-columns
v-if="isOptional" v-if="isShowOptionalColumns"
:container-uuid="containerUuid" :container-uuid="containerUuid"
:panel-type="panelType" :panel-type="panelType"
class="field-optional" class="field-optional"
@ -334,7 +334,6 @@ export default {
option: supportedTypes, option: supportedTypes,
menuTable: '1', menuTable: '1',
activeName: this.$route.query.action === 'advancedQuery' ? '1' : '', activeName: this.$route.query.action === 'advancedQuery' ? '1' : '',
isOptional: false,
isFixed: false, isFixed: false,
isLoadPanelFromServer: false, isLoadPanelFromServer: false,
rowStyle: { height: '52px' }, rowStyle: { height: '52px' },
@ -406,6 +405,9 @@ export default {
getterPanel() { getterPanel() {
return this.$store.getters.getPanel(this.containerUuid) return this.$store.getters.getPanel(this.containerUuid)
}, },
isShowOptionalColumns() {
return this.getterPanel.isShowedTableOptionalColumns
},
getterDataRecordsAndSelection() { getterDataRecordsAndSelection() {
return this.$store.getters.getDataRecordAndSelection(this.containerUuid) return this.$store.getters.getDataRecordAndSelection(this.containerUuid)
}, },
@ -701,9 +703,6 @@ export default {
handleChange(val) { handleChange(val) {
val = !val val = !val
}, },
showTotals() {
this.$store.dispatch('showedTotals', this.containerUuid)
},
showOnlyMandatoryColumns() { showOnlyMandatoryColumns() {
this.$store.dispatch('showOnlyMandatoryColumns', { this.$store.dispatch('showOnlyMandatoryColumns', {
containerUuid: this.containerUuid containerUuid: this.containerUuid
@ -890,10 +889,6 @@ export default {
}) })
} }
}, },
optionalPanel() {
this.showTableSearch = false
this.isOptional = !this.isOptional
},
fixedPanel() { fixedPanel() {
this.showTableSearch = false this.showTableSearch = false
this.isFixed = !this.isFixed this.isFixed = !this.isFixed
@ -1144,7 +1139,6 @@ export default {
}) })
}, },
click() { click() {
this.isOptional = false
this.showTableSearch = !this.showTableSearch this.showTableSearch = !this.showTableSearch
if (this.showTableSearch) { if (this.showTableSearch) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus() this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()

View File

@ -44,7 +44,7 @@
</el-menu-item> </el-menu-item>
</template> </template>
</el-submenu> </el-submenu>
<el-menu-item index="optional" @click="optionalPanel()"> <el-menu-item index="optional" @click="showOptionalColums()">
{{ $t('components.filterableItems') }} {{ $t('components.filterableItems') }}
</el-menu-item> </el-menu-item>
<el-menu-item index="mandatory" @click="showOnlyMandatoryColumns()"> <el-menu-item index="mandatory" @click="showOnlyMandatoryColumns()">

View File

@ -221,7 +221,10 @@ export const menuTableMixin = {
this.showModal(process) this.showModal(process)
}, },
showTotals() { showTotals() {
this.$store.dispatch('showedTotals', this.containerUuid) this.$store.dispatch('changePanelAttributesBoolean', {
containerUuid: this.containerUuid,
attributeName: 'isShowedTotals'
})
}, },
showOnlyMandatoryColumns() { showOnlyMandatoryColumns() {
this.$store.dispatch('showOnlyMandatoryColumns', { this.$store.dispatch('showOnlyMandatoryColumns', {
@ -261,9 +264,11 @@ export const menuTableMixin = {
}) })
} }
}, },
optionalPanel() { showOptionalColums() {
this.showTableSearch = false this.$store.dispatch('changePanelAttributesBoolean', {
this.isOptional = !this.isOptional containerUuid: this.containerUuid,
attributeName: 'isShowedTableOptionalColumns'
})
}, },
fixedPanel() { fixedPanel() {
this.showTableSearch = false this.showTableSearch = false

View File

@ -115,6 +115,8 @@ const panel = {
}) })
params.recordUuid = null params.recordUuid = null
// show/hidden optionals columns to table
params.isShowedTableOptionalColumns = false
commit('addPanel', params) commit('addPanel', params)
}, },
@ -772,10 +774,18 @@ const panel = {
} }
}) })
}, },
showedTotals({ commit, getters }, containerUuid) { changePanelAttributesBoolean({ commit, getters }, {
containerUuid,
attributeName,
attributeValue
}) {
const panel = getters.getPanel(containerUuid) const panel = getters.getPanel(containerUuid)
const newPanel = panel const newPanel = panel
newPanel.isShowedTotals = !panel.isShowedTotals if (isEmptyValue(attributeValue)) {
newPanel[attributeName] = !panel[attributeName]
} else {
newPanel[attributeName] = attributeValue
}
commit('changePanel', { commit('changePanel', {
panel: panel, panel: panel,
newPanel: newPanel newPanel: newPanel