diff --git a/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue b/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue index dbed7bbc..5d18d202 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue +++ b/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue @@ -1,6 +1,7 @@
diff --git a/src/components/ADempiere/ContextMenu/contextMenuMixin.js b/src/components/ADempiere/ContextMenu/contextMenuMixin.js index 447c5691..71b07dd3 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMixin.js +++ b/src/components/ADempiere/ContextMenu/contextMenuMixin.js @@ -48,7 +48,7 @@ export const contextMixin = { data() { return { actions: [], - option: supportedTypes, + supportedTypes: supportedTypes, references: [], file: this.$store.getters.getProcessResult.download, downloads: this.$store.getters.getProcessResult.url, @@ -68,9 +68,6 @@ export const contextMixin = { } return path }, - getDataSelection() { - return this.$store.getters.getDataRecordSelection(this.containerUuid) - }, getterContextMenu() { return this.$store.getters.getContextMenu(this.containerUuid) }, @@ -133,11 +130,20 @@ export const contextMixin = { } }) }, + isDisabledExportRecord() { + if (this.panelType === 'browser') { + return this.getDataSelection.length < 1 + } + return false + }, getterDataRecordsAll() { - return this.$store.getters.getDataRecordAndSelection(this.containerUuid).record + return this.$store.getters.getDataRecordAndSelection(this.containerUuid) + }, + getDataSelection() { + return this.getterDataRecordsAll.selection }, getDataRecord() { - return this.getterDataRecordsAll.filter(fieldItem => { + return this.getterDataRecordsAll.record.filter(fieldItem => { if (this.recordUuid === fieldItem.UUID) { return fieldItem } @@ -186,6 +192,14 @@ export const contextMixin = { if (this.panelType === 'window' && newValue !== oldValue) { this.generateContextMenu() } + }, + isDisabledExportRecord(isDisabled) { + if (isDisabled) { + this.$nextTick(() => { + // close childs items in exportRecord menu + this.$refs.contextMenu.close('exportRecord') + }) + } } }, created() { @@ -276,37 +290,22 @@ export const contextMixin = { this.isLoadedReferences = false } }, - typeFormat(key) { - Object.keys(supportedTypes).forEach(type => { - if (type === key && (this.panelType === 'window')) { - this.exporWindow(key) - } else if (type === key && (this.panelType === 'browser')) { - this.exporBrowser(key) - } - }) - }, - exporBrowser(key) { + exportRecord(fotmatToExport) { const tHeader = this.getterFieldListHeader const filterVal = this.getterFieldListValue - const list = this.getDataSelection + let list = [] + if (this.panelType === 'window') { + list = this.getDataRecord + } else if (this.panelType === 'browser') { + // TODO: Check usage as the selection is exported with the table menu + list = this.getDataSelection + } const data = this.formatJson(filterVal, list) exportFileFromJson({ header: tHeader, data, filename: '', - exportType: key - }) - }, - exporWindow(key) { - const tHeader = this.getterFieldListHeader - const filterVal = this.getterFieldListValue - const list = this.getDataRecord - const data = this.formatJson(filterVal, list) - exportFileFromJson({ - header: tHeader, - data, - filename: '', - exportType: key + exportType: fotmatToExport }) }, formatJson(filterVal, jsonData) { diff --git a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue index 13e442ee..ff82a20f 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue +++ b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue @@ -2,6 +2,7 @@