fix: Export record in table, and mobile support to Smart Browser. (#325)
* fix: Export record in table, and mobile support to Smart Browser. * Change comparison disabled export record action. * Closed fotmat exports list in export record action menu.pull/3759/head
							parent
							
								
									ac4b0df91c
								
							
						
					
					
						commit
						252cc43679
					
				|  | @ -1,6 +1,7 @@ | ||||||
| <template> | <template> | ||||||
|   <div class="container-submenu container-context-menu"> |   <div class="container-submenu container-context-menu"> | ||||||
|     <el-menu |     <el-menu | ||||||
|  |       ref="contextMenu" | ||||||
|       v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }" |       v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }" | ||||||
|       :default-active="activeMenu" |       :default-active="activeMenu" | ||||||
|       :router="false" |       :router="false" | ||||||
|  | @ -8,120 +9,104 @@ | ||||||
|       mode="horizontal" |       mode="horizontal" | ||||||
|       menu-trigger="hover" |       menu-trigger="hover" | ||||||
|       unique-opened |       unique-opened | ||||||
|       @select="typeFormat" |  | ||||||
|       @shortkey.native="actionContextMenu" |       @shortkey.native="actionContextMenu" | ||||||
|     > |     > | ||||||
|       <template> |       <el-submenu v-if="!isEmptyValue(relationsList)" class="el-menu-item" index="1"> | ||||||
|         <el-submenu v-if="!isEmptyValue(relationsList)" class="el-menu-item" index="1"> |         <template slot="title"> | ||||||
|           <template slot="title"> |  | ||||||
|             {{ $t('components.contextMenuRelations') }} |  | ||||||
|           </template> |  | ||||||
|           <el-scrollbar wrap-class="scroll"> |  | ||||||
|             <item v-for="(relation, index) in relationsList" :key="index" :item="relation" /> |  | ||||||
|           </el-scrollbar> |  | ||||||
|         </el-submenu> |  | ||||||
|         <el-menu-item v-else disabled index="1"> |  | ||||||
|           {{ $t('components.contextMenuRelations') }} |           {{ $t('components.contextMenuRelations') }} | ||||||
|         </el-menu-item> |         </template> | ||||||
|         <el-submenu v-if="actions !== undefined && actions.length" class="el-menu-item" index="2" @click.native="runAction(actions[0])"> |         <el-scrollbar wrap-class="scroll"> | ||||||
|           <template slot="title"> |           <item v-for="(relation, index) in relationsList" :key="index" :item="relation" /> | ||||||
|             {{ $t('components.contextMenuActions') }} |         </el-scrollbar> | ||||||
|           </template> |       </el-submenu> | ||||||
|           <template v-for="(action, index) in actions"> |       <el-menu-item v-else disabled index="relations"> | ||||||
|             <el-submenu v-if="action.childs" :key="index" :index="action.name" :disabled="action.disabled"> |         {{ $t('components.contextMenuRelations') }} | ||||||
|               <template slot="title"> |       </el-menu-item> | ||||||
|                 {{ action.name }} | 
 | ||||||
|               </template> |       <el-submenu v-if="actions !== undefined && actions.length" class="el-menu-item" index="actions" @click.native="runAction(actions[0])"> | ||||||
|               <el-scrollbar wrap-class="scroll-child"> |         <template slot="title"> | ||||||
|                 <el-menu-item |  | ||||||
|                   v-for="(child, key) in action.childs" |  | ||||||
|                   :key="key" |  | ||||||
|                   :index="child.uuid" |  | ||||||
|                   @click="runAction(child)" |  | ||||||
|                 > |  | ||||||
|                   {{ child.name }} |  | ||||||
|                 </el-menu-item> |  | ||||||
|               </el-scrollbar> |  | ||||||
|             </el-submenu> |  | ||||||
|             <el-menu-item |  | ||||||
|               v-else |  | ||||||
|               v-show="!action.hidden" |  | ||||||
|               :key="index" |  | ||||||
|               :index="action.name" |  | ||||||
|               :disabled="action.disabled" |  | ||||||
|               @click="runAction(action)" |  | ||||||
|             > |  | ||||||
|               {{ action.name }} |  | ||||||
|             </el-menu-item> |  | ||||||
|           </template> |  | ||||||
|           <el-menu-item v-show="isReport" index="4"> |  | ||||||
|             <a :href="downloads" :download="file"> |  | ||||||
|               {{ $t('components.contextMenuDownload') }} |  | ||||||
|             </a> |  | ||||||
|           </el-menu-item> |  | ||||||
|           <el-submenu |  | ||||||
|             v-if="getDataSelection.length > 0 && panelType === 'browser'" |  | ||||||
|             :disabled="Boolean(getDataSelection.length < 1)" |  | ||||||
|             index="xlsx" |  | ||||||
|             @click.native="exporBrowser('xlsx')" |  | ||||||
|           > |  | ||||||
|             <template slot="title"> |  | ||||||
|               {{ $t('components.contextMennuWindowReport') }} |  | ||||||
|             </template> |  | ||||||
|             <template v-for="(format, index) in option"> |  | ||||||
|               <el-menu-item :key="index" :index="index"> |  | ||||||
|                 {{ format }} |  | ||||||
|               </el-menu-item> |  | ||||||
|             </template> |  | ||||||
|           </el-submenu> |  | ||||||
|           <el-submenu |  | ||||||
|             v-if="panelType === 'window'" |  | ||||||
|             index="xlsx" |  | ||||||
|             @click.native="exporWindow('xlsx')" |  | ||||||
|           > |  | ||||||
|             <template slot="title"> |  | ||||||
|               {{ $t('components.contextMennuWindowReport') }} |  | ||||||
|             </template> |  | ||||||
|             <template v-for="(format, index) in option"> |  | ||||||
|               <el-menu-item :key="index" :index="index"> |  | ||||||
|                 {{ format }} |  | ||||||
|               </el-menu-item> |  | ||||||
|             </template> |  | ||||||
|           </el-submenu> |  | ||||||
|           <el-menu-item v-show="$route.name === 'Report Viewer'" index="9" @click="redirect"> |  | ||||||
|             {{ $t('components.contextMenuPrintFormatSetup') }} |  | ||||||
|           </el-menu-item> |  | ||||||
|           <el-menu-item v-if="panelType !== 'process'" index="8" @click="refreshData"> |  | ||||||
|             {{ $t('components.contextMenuRefresh') }} |  | ||||||
|           </el-menu-item> |  | ||||||
|           <el-menu-item index="5" @click="setShareLink"> |  | ||||||
|             {{ $t('components.contextMenuShareLink') }} |  | ||||||
|           </el-menu-item> |  | ||||||
|         </el-submenu> |  | ||||||
|         <el-menu-item v-else disabled index="2"> |  | ||||||
|           {{ $t('components.contextMenuActions') }} |           {{ $t('components.contextMenuActions') }} | ||||||
|         </el-menu-item> |         </template> | ||||||
|         <el-submenu :disabled="!(isReferecesContent && isLoadedReferences)" class="el-menu-item" index="3"> |         <template v-for="(action, index) in actions"> | ||||||
|           <template slot="title"> |           <el-submenu v-if="action.childs" :key="index" :index="action.name" :disabled="action.disabled"> | ||||||
|             {{ $t('components.contextMenuReferences') }} |             <template slot="title"> | ||||||
|           </template> |               {{ action.name }} | ||||||
|           <template v-if="references && !isEmptyValue(references.referencesList)"> |             </template> | ||||||
|             <el-scrollbar wrap-class="scroll-child"> |             <el-scrollbar wrap-class="scroll-child"> | ||||||
|               <el-menu-item |               <el-menu-item | ||||||
|                 v-for="(reference, index) in references.referencesList" |                 v-for="(child, key) in action.childs" | ||||||
|                 :key="index" |                 :key="key" | ||||||
|                 :index="reference.displayName" |                 :index="child.uuid" | ||||||
|                 @click="runAction(reference)" |                 @click="runAction(child)" | ||||||
|               > |               > | ||||||
|                 {{ reference.displayName }} |                 {{ child.name }} | ||||||
|               </el-menu-item> |               </el-menu-item> | ||||||
|             </el-scrollbar> |             </el-scrollbar> | ||||||
|  |           </el-submenu> | ||||||
|  |           <el-menu-item | ||||||
|  |             v-else | ||||||
|  |             v-show="!action.hidden" | ||||||
|  |             :key="index" | ||||||
|  |             :index="action.name" | ||||||
|  |             :disabled="action.disabled" | ||||||
|  |             @click="runAction(action)" | ||||||
|  |           > | ||||||
|  |             {{ action.name }} | ||||||
|  |           </el-menu-item> | ||||||
|  |         </template> | ||||||
|  |         <!-- other actions --> | ||||||
|  |         <el-menu-item v-show="isReport" index="downloadReport"> | ||||||
|  |           <a :href="downloads" :download="file"> | ||||||
|  |             {{ $t('components.contextMenuDownload') }} | ||||||
|  |           </a> | ||||||
|  |         </el-menu-item> | ||||||
|  |         <el-submenu | ||||||
|  |           v-if="['browser', 'window'].includes(panelType)" | ||||||
|  |           :disabled="isDisabledExportRecord" | ||||||
|  |           index="exportRecord" | ||||||
|  |           @click.native="exportRecord('xlsx')" | ||||||
|  |         > | ||||||
|  |           <template slot="title"> | ||||||
|  |             {{ $t('data.exportRecord') }} | ||||||
|           </template> |           </template> | ||||||
|           <el-menu-item v-else index="not-references" disabled> |           <el-menu-item v-for="(format, keyFormat) in supportedTypes" :key="keyFormat" :index="keyFormat" @click.native="exportRecord(keyFormat)"> | ||||||
|             {{ $t('components.withOutReferences') }} |             {{ format }} | ||||||
|           </el-menu-item> |           </el-menu-item> | ||||||
|         </el-submenu> |         </el-submenu> | ||||||
|       </template> |         <el-menu-item v-show="$route.name === 'Report Viewer'" index="printFormat" @click="redirect"> | ||||||
|  |           {{ $t('components.contextMenuPrintFormatSetup') }} | ||||||
|  |         </el-menu-item> | ||||||
|  |         <el-menu-item v-if="panelType !== 'process'" index="refreshData" @click="refreshData"> | ||||||
|  |           {{ $t('components.contextMenuRefresh') }} | ||||||
|  |         </el-menu-item> | ||||||
|  |         <el-menu-item index="shareLink" @click="setShareLink"> | ||||||
|  |           {{ $t('components.contextMenuShareLink') }} | ||||||
|  |         </el-menu-item> | ||||||
|  |       </el-submenu> | ||||||
|  |       <el-menu-item v-else disabled index="actionsDisabled"> | ||||||
|  |         {{ $t('components.contextMenuActions') }} | ||||||
|  |       </el-menu-item> | ||||||
|  | 
 | ||||||
|  |       <el-submenu :disabled="!(isReferecesContent && isLoadedReferences)" class="el-menu-item" index="references"> | ||||||
|  |         <template slot="title"> | ||||||
|  |           {{ $t('components.contextMenuReferences') }} | ||||||
|  |         </template> | ||||||
|  |         <template v-if="references && !isEmptyValue(references.referencesList)"> | ||||||
|  |           <el-scrollbar wrap-class="scroll-child"> | ||||||
|  |             <el-menu-item | ||||||
|  |               v-for="(reference, index) in references.referencesList" | ||||||
|  |               :key="index" | ||||||
|  |               :index="reference.displayName" | ||||||
|  |               @click="runAction(reference)" | ||||||
|  |             > | ||||||
|  |               {{ reference.displayName }} | ||||||
|  |             </el-menu-item> | ||||||
|  |           </el-scrollbar> | ||||||
|  |         </template> | ||||||
|  |         <el-menu-item v-else index="not-references" disabled> | ||||||
|  |           {{ $t('components.withOutReferences') }} | ||||||
|  |         </el-menu-item> | ||||||
|  |       </el-submenu> | ||||||
|     </el-menu> |     </el-menu> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ export const contextMixin = { | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       actions: [], |       actions: [], | ||||||
|       option: supportedTypes, |       supportedTypes: supportedTypes, | ||||||
|       references: [], |       references: [], | ||||||
|       file: this.$store.getters.getProcessResult.download, |       file: this.$store.getters.getProcessResult.download, | ||||||
|       downloads: this.$store.getters.getProcessResult.url, |       downloads: this.$store.getters.getProcessResult.url, | ||||||
|  | @ -68,9 +68,6 @@ export const contextMixin = { | ||||||
|       } |       } | ||||||
|       return path |       return path | ||||||
|     }, |     }, | ||||||
|     getDataSelection() { |  | ||||||
|       return this.$store.getters.getDataRecordSelection(this.containerUuid) |  | ||||||
|     }, |  | ||||||
|     getterContextMenu() { |     getterContextMenu() { | ||||||
|       return this.$store.getters.getContextMenu(this.containerUuid) |       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() { |     getterDataRecordsAll() { | ||||||
|       return this.$store.getters.getDataRecordAndSelection(this.containerUuid).record |       return this.$store.getters.getDataRecordAndSelection(this.containerUuid) | ||||||
|  |     }, | ||||||
|  |     getDataSelection() { | ||||||
|  |       return this.getterDataRecordsAll.selection | ||||||
|     }, |     }, | ||||||
|     getDataRecord() { |     getDataRecord() { | ||||||
|       return this.getterDataRecordsAll.filter(fieldItem => { |       return this.getterDataRecordsAll.record.filter(fieldItem => { | ||||||
|         if (this.recordUuid === fieldItem.UUID) { |         if (this.recordUuid === fieldItem.UUID) { | ||||||
|           return fieldItem |           return fieldItem | ||||||
|         } |         } | ||||||
|  | @ -186,6 +192,14 @@ export const contextMixin = { | ||||||
|       if (this.panelType === 'window' && newValue !== oldValue) { |       if (this.panelType === 'window' && newValue !== oldValue) { | ||||||
|         this.generateContextMenu() |         this.generateContextMenu() | ||||||
|       } |       } | ||||||
|  |     }, | ||||||
|  |     isDisabledExportRecord(isDisabled) { | ||||||
|  |       if (isDisabled) { | ||||||
|  |         this.$nextTick(() => { | ||||||
|  |           // close childs items in exportRecord menu
 | ||||||
|  |           this.$refs.contextMenu.close('exportRecord') | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   created() { |   created() { | ||||||
|  | @ -276,37 +290,22 @@ export const contextMixin = { | ||||||
|         this.isLoadedReferences = false |         this.isLoadedReferences = false | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     typeFormat(key) { |     exportRecord(fotmatToExport) { | ||||||
|       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) { |  | ||||||
|       const tHeader = this.getterFieldListHeader |       const tHeader = this.getterFieldListHeader | ||||||
|       const filterVal = this.getterFieldListValue |       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) |       const data = this.formatJson(filterVal, list) | ||||||
|       exportFileFromJson({ |       exportFileFromJson({ | ||||||
|         header: tHeader, |         header: tHeader, | ||||||
|         data, |         data, | ||||||
|         filename: '', |         filename: '', | ||||||
|         exportType: key |         exportType: fotmatToExport | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|     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 |  | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     formatJson(filterVal, jsonData) { |     formatJson(filterVal, jsonData) { | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
|   <div class="container-submenu-mobile container-context-menu"> |   <div class="container-submenu-mobile container-context-menu"> | ||||||
|     <right-menu> |     <right-menu> | ||||||
|       <el-menu |       <el-menu | ||||||
|  |         ref="contextMenu" | ||||||
|         v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }" |         v-shortkey="{ f2: ['f2'], f3: ['f3'], f5: ['f5'], f3:['ctrl', 'd'] }" | ||||||
|         :default-active="activeMenu" |         :default-active="activeMenu" | ||||||
|         :router="false" |         :router="false" | ||||||
|  | @ -11,7 +12,7 @@ | ||||||
|         unique-opened |         unique-opened | ||||||
|         style="width: 258px; float: right;" |         style="width: 258px; float: right;" | ||||||
|       > |       > | ||||||
|         <el-submenu index="1"> |         <el-submenu index="relations"> | ||||||
|           <template slot="title"> |           <template slot="title"> | ||||||
|             <svg-icon icon-class="tree" /> |             <svg-icon icon-class="tree" /> | ||||||
|             {{ $t('components.contextMenuRelations') }} |             {{ $t('components.contextMenuRelations') }} | ||||||
|  | @ -22,7 +23,8 @@ | ||||||
|             </el-scrollbar> |             </el-scrollbar> | ||||||
|           </el-menu-item-group> |           </el-menu-item-group> | ||||||
|         </el-submenu> |         </el-submenu> | ||||||
|         <el-submenu index="2"> | 
 | ||||||
|  |         <el-submenu index="actions"> | ||||||
|           <template slot="title"> |           <template slot="title"> | ||||||
|             <svg-icon icon-class="link" /> |             <svg-icon icon-class="link" /> | ||||||
|             {{ $t('components.contextMenuActions') }} |             {{ $t('components.contextMenuActions') }} | ||||||
|  | @ -59,21 +61,38 @@ | ||||||
|                   {{ action.name }} |                   {{ action.name }} | ||||||
|                 </el-menu-item> |                 </el-menu-item> | ||||||
|               </template> |               </template> | ||||||
|               <el-menu-item v-show="isReport" index="4"> |               <!-- other actions --> | ||||||
|  |               <el-menu-item v-show="isReport" index="downloadReport"> | ||||||
|                 <a :href="downloads" :download="file"> |                 <a :href="downloads" :download="file"> | ||||||
|                   {{ $t('components.contextMenuDownload') }} |                   {{ $t('components.contextMenuDownload') }} | ||||||
|                 </a> |                 </a> | ||||||
|               </el-menu-item> |               </el-menu-item> | ||||||
|               <el-menu-item index="5" @click="setShareLink"> |               <el-submenu | ||||||
|                 {{ $t('components.contextMenuShareLink') }} |                 v-if="['browser', 'window'].includes(panelType)" | ||||||
|  |                 :disabled="isDisabledExportRecord" | ||||||
|  |                 index="exportRecord" | ||||||
|  |               > | ||||||
|  |                 <template slot="title"> | ||||||
|  |                   {{ $t('data.exportRecord') }} | ||||||
|  |                 </template> | ||||||
|  |                 <el-menu-item v-for="(format, keyFormat) in supportedTypes" :key="keyFormat" :index="keyFormat" @click.native="exportRecord(keyFormat)"> | ||||||
|  |                   {{ format }} | ||||||
|  |                 </el-menu-item> | ||||||
|  |               </el-submenu> | ||||||
|  |               <el-menu-item v-show="$route.name === 'Report Viewer'" index="printFormat" @click="redirect"> | ||||||
|  |                 {{ $t('components.contextMenuPrintFormatSetup') }} | ||||||
|               </el-menu-item> |               </el-menu-item> | ||||||
|               <el-menu-item index="6" @click="refreshData"> |               <el-menu-item v-if="panelType !== 'process'" index="refreshData" @click="refreshData"> | ||||||
|                 {{ $t('components.contextMenuRefresh') }} |                 {{ $t('components.contextMenuRefresh') }} | ||||||
|               </el-menu-item> |               </el-menu-item> | ||||||
|  |               <el-menu-item index="shareLink" @click="setShareLink"> | ||||||
|  |                 {{ $t('components.contextMenuShareLink') }} | ||||||
|  |               </el-menu-item> | ||||||
|             </el-scrollbar> |             </el-scrollbar> | ||||||
|           </el-menu-item-group> |           </el-menu-item-group> | ||||||
|         </el-submenu> |         </el-submenu> | ||||||
|         <el-submenu :disabled="!(isReferecesContent && isLoadedReferences)" class="el-menu-item" index="3"> | 
 | ||||||
|  |         <el-submenu :disabled="!(isReferecesContent && isLoadedReferences)" class="el-menu-item" index="references"> | ||||||
|           <template slot="title"> |           <template slot="title"> | ||||||
|             {{ $t('components.contextMenuReferences') }} |             {{ $t('components.contextMenuReferences') }} | ||||||
|           </template> |           </template> | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
|           </el-collapse> |           </el-collapse> | ||||||
|           <div> |           <div> | ||||||
|             <div v-if="!isMobile"> |             <div v-if="!isMobile"> | ||||||
|               <table-menu |               <table-main-menu | ||||||
|                 :container-uuid="containerUuid" |                 :container-uuid="containerUuid" | ||||||
|                 :parent-uuid="parentUuid" |                 :parent-uuid="parentUuid" | ||||||
|                 :panel-type="panelType" |                 :panel-type="panelType" | ||||||
|  | @ -120,14 +120,14 @@ | ||||||
|           </div> |           </div> | ||||||
|         </el-header> |         </el-header> | ||||||
|         <el-main style="padding: 0px !important; overflow: hidden;"> |         <el-main style="padding: 0px !important; overflow: hidden;"> | ||||||
|           <context-menu |           <table-context-menu | ||||||
|             v-show="isParent ? getShowContextMenuTable : getShowContextMenuTabChildren" |             v-show="isParent ? getShowContextMenuTable : getShowContextMenuTabChildren" | ||||||
|             :style="{ left: left + 'px', top: top + 'px' }" |             :style="{ left: left + 'px', top: top + 'px' }" | ||||||
|             class="contextmenu" |             class="contextmenu" | ||||||
|             :container-uuid="containerUuid" |             :container-uuid="containerUuid" | ||||||
|             :parent-uuid="parentUuid" |             :parent-uuid="parentUuid" | ||||||
|             :panel-type="panelType" |             :panel-type="panelType" | ||||||
|             :is-option="isOption" |             :current-row="currentRowMenu" | ||||||
|             :is-panel-window="isPanelWindow" |             :is-panel-window="isPanelWindow" | ||||||
|             :process-menu="getterContextMenu" |             :process-menu="getterContextMenu" | ||||||
|             :is-mobile="isMobile" |             :is-mobile="isMobile" | ||||||
|  | @ -247,8 +247,8 @@ import FieldDefinition from '@/components/ADempiere/Field' | ||||||
| import Sortable from 'sortablejs' | import Sortable from 'sortablejs' | ||||||
| import FilterColumns from '@/components/ADempiere/DataTable/filterColumns' | import FilterColumns from '@/components/ADempiere/DataTable/filterColumns' | ||||||
| import FixedColumns from '@/components/ADempiere/DataTable/fixedColumns' | import FixedColumns from '@/components/ADempiere/DataTable/fixedColumns' | ||||||
| import ContextMenu from '@/components/ADempiere/DataTable/menu/contextMenu' | import TableContextMenu from '@/components/ADempiere/DataTable/menu/tableContextMenu' | ||||||
| import TableMenu from '@/components/ADempiere/DataTable/menu' | import TableMainMenu from '@/components/ADempiere/DataTable/menu' | ||||||
| import IconElement from '@/components/ADempiere/IconElement' | import IconElement from '@/components/ADempiere/IconElement' | ||||||
| import { formatDate } from '@/filters/ADempiere' | import { formatDate } from '@/filters/ADempiere' | ||||||
| import MainPanel from '@/components/ADempiere/Panel' | import MainPanel from '@/components/ADempiere/Panel' | ||||||
|  | @ -263,10 +263,10 @@ export default { | ||||||
|     FieldDefinition, |     FieldDefinition, | ||||||
|     FilterColumns, |     FilterColumns, | ||||||
|     FixedColumns, |     FixedColumns, | ||||||
|     ContextMenu, |  | ||||||
|     IconElement, |     IconElement, | ||||||
|     MainPanel, |     MainPanel, | ||||||
|     TableMenu |     TableContextMenu, | ||||||
|  |     TableMainMenu | ||||||
|   }, |   }, | ||||||
|   props: { |   props: { | ||||||
|     parentUuid: { |     parentUuid: { | ||||||
|  | @ -311,7 +311,7 @@ export default { | ||||||
|     return { |     return { | ||||||
|       top: 0, |       top: 0, | ||||||
|       left: 0, |       left: 0, | ||||||
|       isOption: {}, |       currentRowMenu: {}, | ||||||
|       currentRow: null, |       currentRow: null, | ||||||
|       currentTable: 0, |       currentTable: 0, | ||||||
|       visible: this.getShowContextMenuTable, |       visible: this.getShowContextMenuTable, | ||||||
|  | @ -585,7 +585,7 @@ export default { | ||||||
|         this.top = event.clientY - 100 |         this.top = event.clientY - 100 | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       this.isOption = row |       this.currentRowMenu = row | ||||||
|       this.visible = true |       this.visible = true | ||||||
|       this.$store.dispatch('showMenuTable', { |       this.$store.dispatch('showMenuTable', { | ||||||
|         isShowedTable: this.isParent |         isShowedTable: this.isParent | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
|     :default-active="menuTable" |     :default-active="menuTable" | ||||||
|     :class="classTableMenu + ' menu-table-container'" |     :class="classTableMenu + ' menu-table-container'" | ||||||
|     mode="horizontal" |     mode="horizontal" | ||||||
|     @select="typeFormat" |     @select="exporRecordTable" | ||||||
|   > |   > | ||||||
|     <el-submenu index="2"> |     <el-submenu index="2"> | ||||||
|       <template slot="title"> |       <template slot="title"> | ||||||
|  | @ -75,11 +75,16 @@ | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/mixinMenu' | import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/menuTableMixin' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: 'TableMenu', |   name: 'TableMainMenu', | ||||||
|   mixins: [menuTableMixin] |   mixins: [menuTableMixin], | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       menuType: 'tableMainMenu' | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ export const menuTableMixin = { | ||||||
|       type: String, |       type: String, | ||||||
|       default: 'window' |       default: 'window' | ||||||
|     }, |     }, | ||||||
|     isOption: { |     currentRow: { | ||||||
|       type: Object, |       type: Object, | ||||||
|       default: () => {} |       default: () => {} | ||||||
|     }, |     }, | ||||||
|  | @ -53,8 +53,6 @@ export const menuTableMixin = { | ||||||
|     classTableMenu() { |     classTableMenu() { | ||||||
|       if (this.isMobile) { |       if (this.isMobile) { | ||||||
|         return 'menu-table-mobile' |         return 'menu-table-mobile' | ||||||
|       } else if (this.$store.state.app.sidebar.opened) { |  | ||||||
|         return 'menu-table' |  | ||||||
|       } |       } | ||||||
|       return 'menu-table' |       return 'menu-table' | ||||||
|     }, |     }, | ||||||
|  | @ -78,9 +76,13 @@ export const menuTableMixin = { | ||||||
|     }, |     }, | ||||||
|     fieldList() { |     fieldList() { | ||||||
|       if (this.panelMetadata && this.panelMetadata.fieldList) { |       if (this.panelMetadata && this.panelMetadata.fieldList) { | ||||||
|  |         let sortAttribute = 'sequence' | ||||||
|  |         if (this.panelType === 'browser') { | ||||||
|  |           sortAttribute = 'seqNoGrid' | ||||||
|  |         } | ||||||
|         return this.sortFields( |         return this.sortFields( | ||||||
|           this.panelMetadata.fieldList, |           this.panelMetadata.fieldList, | ||||||
|           this.panelType !== 'browser' ? 'seqNoGrid' : 'sequence' |           sortAttribute | ||||||
|         ) |         ) | ||||||
|       } |       } | ||||||
|       return [] |       return [] | ||||||
|  | @ -159,6 +161,7 @@ export const menuTableMixin = { | ||||||
|   methods: { |   methods: { | ||||||
|     showNotification, |     showNotification, | ||||||
|     closeMenu() { |     closeMenu() { | ||||||
|  |       // TODO: Validate to dispatch one action
 | ||||||
|       this.$store.dispatch('showMenuTable', { |       this.$store.dispatch('showMenuTable', { | ||||||
|         isShowedTable: false |         isShowedTable: false | ||||||
|       }) |       }) | ||||||
|  | @ -168,7 +171,7 @@ export const menuTableMixin = { | ||||||
|     }, |     }, | ||||||
|     showModalTable(process) { |     showModalTable(process) { | ||||||
|       const processData = this.$store.getters.getProcess(process.uuid) |       const processData = this.$store.getters.getProcess(process.uuid) | ||||||
|       if (!this.isOption) { |       if (!this.currentRow) { | ||||||
|         this.$store.dispatch('setProcessSelect', { |         this.$store.dispatch('setProcessSelect', { | ||||||
|           selection: this.getDataSelection, |           selection: this.getDataSelection, | ||||||
|           processTablaSelection: true, |           processTablaSelection: true, | ||||||
|  | @ -176,7 +179,7 @@ export const menuTableMixin = { | ||||||
|         }) |         }) | ||||||
|       } else { |       } else { | ||||||
|         let valueProcess |         let valueProcess | ||||||
|         const selection = this.isOption |         const selection = this.currentRow | ||||||
|         for (const element in selection) { |         for (const element in selection) { | ||||||
|           if (element === this.panelMetadata.keyColumn) { |           if (element === this.panelMetadata.keyColumn) { | ||||||
|             valueProcess = selection[element] |             valueProcess = selection[element] | ||||||
|  | @ -261,20 +264,15 @@ export const menuTableMixin = { | ||||||
|         attributeName: 'isShowedTableOptionalColumns' |         attributeName: 'isShowedTableOptionalColumns' | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     typeFormat(key, keyPath) { |     /** | ||||||
|       Object.keys(supportedTypes).forEach(type => { |      * @param {string} formatToExport | ||||||
|         if (type === key) { |      */ | ||||||
|           this.exporRecordTable(key) |     exporRecordTable(formatToExport) { | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|       this.closeMenu() |  | ||||||
|     }, |  | ||||||
|     exporRecordTable(key) { |  | ||||||
|       const header = this.getterFieldListHeader |       const header = this.getterFieldListHeader | ||||||
|       const filterVal = this.getterFieldListValue |       const filterVal = this.getterFieldListValue | ||||||
|       let list = this.getDataSelection |       let list = this.getDataSelection | ||||||
|       if (this.isOption) { |       if (this.menuType === 'tableContextMenu') { | ||||||
|         list = this.gettersRecrdContextMenu |         list = [this.currentRow] | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       const data = this.formatJson(filterVal, list) |       const data = this.formatJson(filterVal, list) | ||||||
|  | @ -282,8 +280,9 @@ export const menuTableMixin = { | ||||||
|         header, |         header, | ||||||
|         data, |         data, | ||||||
|         filename: '', |         filename: '', | ||||||
|         exportType: key |         exportType: formatToExport | ||||||
|       }) |       }) | ||||||
|  |       this.closeMenu() | ||||||
|     }, |     }, | ||||||
|     exporZipRecordTable() { |     exporZipRecordTable() { | ||||||
|       const header = this.getterFieldListHeader |       const header = this.getterFieldListHeader | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
|   <el-menu |   <el-menu | ||||||
|     :collapse="isCollapse" |     :collapse="isCollapse" | ||||||
|     class="el-menu-demo" |     class="el-menu-demo" | ||||||
|     @select="typeFormat" |     @select="exporRecordTable" | ||||||
|   > |   > | ||||||
|     <el-submenu |     <el-submenu | ||||||
|       index="xlsx" |       index="xlsx" | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
|       <template |       <template | ||||||
|         slot="title" |         slot="title" | ||||||
|       > |       > | ||||||
|         {{ $t('components.contextMennuWindowReport') }} |         {{ $t('data.exportRecord') }} | ||||||
|       </template> |       </template> | ||||||
|       <template v-for="(format, index) in supportedTypes"> |       <template v-for="(format, index) in supportedTypes"> | ||||||
|         <el-menu-item |         <el-menu-item | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
|       </template> |       </template> | ||||||
|     </el-submenu> |     </el-submenu> | ||||||
|     <el-menu-item |     <el-menu-item | ||||||
|       index="eliminar" |       index="delete" | ||||||
|       @click="deleteRecord()" |       @click="deleteRecord()" | ||||||
|     > |     > | ||||||
|       {{ $t('window.deleteRecord') }} |       {{ $t('window.deleteRecord') }} | ||||||
|  | @ -39,10 +39,15 @@ | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/mixinMenu' | import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/menuTableMixin' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: 'ContextMenu', |   name: 'TableContextMenu', | ||||||
|   mixins: [menuTableMixin] |   mixins: [menuTableMixin], | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       menuType: 'tableContextMenu' | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|  | @ -131,7 +131,6 @@ export default { | ||||||
|     contextMenuShareLink: 'Share Link', |     contextMenuShareLink: 'Share Link', | ||||||
|     contextMenuRefresh: 'Refresh', |     contextMenuRefresh: 'Refresh', | ||||||
|     contextMennuExport: 'Export Smart Browser', |     contextMennuExport: 'Export Smart Browser', | ||||||
|     contextMennuWindowReport: 'Export Records', |  | ||||||
|     contextMenuPrintFormatSetup: 'Print Format Setup', |     contextMenuPrintFormatSetup: 'Print Format Setup', | ||||||
|     dateStartPlaceholder: 'Start date', |     dateStartPlaceholder: 'Start date', | ||||||
|     dateEndPlaceholder: 'End date', |     dateEndPlaceholder: 'End date', | ||||||
|  | @ -192,7 +191,6 @@ export default { | ||||||
|     }, |     }, | ||||||
|     dataTable: { |     dataTable: { | ||||||
|       search: 'Search', |       search: 'Search', | ||||||
|       records: 'Records', |  | ||||||
|       selected: 'Selected', |       selected: 'Selected', | ||||||
|       deleteSelection: 'Delete Selected Records', |       deleteSelection: 'Delete Selected Records', | ||||||
|       advancedQuery: 'Advanced Query', |       advancedQuery: 'Advanced Query', | ||||||
|  | @ -285,16 +283,15 @@ export default { | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   data: { |   data: { | ||||||
|     emtpyTableName: 'Error: Table Name is not defined', |  | ||||||
|     errorGetData: 'Error getting data records', |  | ||||||
|     createRecordSuccessful: 'New record created successfully', |     createRecordSuccessful: 'New record created successfully', | ||||||
|     createNewRecord: 'Mode New record', |     createNewRecord: 'Mode New record', | ||||||
|     createRecordError: 'Error creating new record', |     createRecordError: 'Error creating new record', | ||||||
|     deleteRecordSuccessful: 'Record deleted successfully', |     deleteRecordSuccessful: 'Record deleted successfully', | ||||||
|     deleteRecordError: 'Error deleting record', |     deleteRecordError: 'Error deleting record', | ||||||
|  |     exportRecord: 'Export Record', | ||||||
|  |     lockRecord: 'Lock Record', | ||||||
|     selectionRequired: 'You must select a record', |     selectionRequired: 'You must select a record', | ||||||
|     undo: 'Undo', |     undo: 'Undo', | ||||||
|     lockRecord: 'Lock Record', |  | ||||||
|     unlockRecord: 'Unlock Record' |     unlockRecord: 'Unlock Record' | ||||||
|   }, |   }, | ||||||
|   sequence: { |   sequence: { | ||||||
|  |  | ||||||
|  | @ -127,7 +127,6 @@ export default { | ||||||
|     contextMenuShareLink: 'Compartir Link', |     contextMenuShareLink: 'Compartir Link', | ||||||
|     contextMenuRefresh: 'Actualizar', |     contextMenuRefresh: 'Actualizar', | ||||||
|     contextMennuExport: 'Exportar Smart Browser', |     contextMennuExport: 'Exportar Smart Browser', | ||||||
|     contextMennuWindowReport: 'Exportar Registro', |  | ||||||
|     contextMenuPrintFormatSetup: 'Configurar Formato de Impresión', |     contextMenuPrintFormatSetup: 'Configurar Formato de Impresión', | ||||||
|     RunProcess: 'Ejecutar', |     RunProcess: 'Ejecutar', | ||||||
|     ChangeParameters: 'Cambiar Parametros', |     ChangeParameters: 'Cambiar Parametros', | ||||||
|  | @ -192,7 +191,6 @@ export default { | ||||||
|     }, |     }, | ||||||
|     dataTable: { |     dataTable: { | ||||||
|       search: 'Buscar', |       search: 'Buscar', | ||||||
|       records: 'Registros', |  | ||||||
|       selected: 'Seleccionados', |       selected: 'Seleccionados', | ||||||
|       deleteSelection: 'Eliminar Registros Seleccionados', |       deleteSelection: 'Eliminar Registros Seleccionados', | ||||||
|       advancedQuery: 'Consulta Avanzada', |       advancedQuery: 'Consulta Avanzada', | ||||||
|  | @ -260,16 +258,15 @@ export default { | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   data: { |   data: { | ||||||
|     emtpyTableName: 'Error: El nombre de la tabla no esta definida', |  | ||||||
|     errorGetData: 'Error obteniendo los datos de registro', |  | ||||||
|     createRecordSuccessful: 'Nuevo registro creado con exito', |     createRecordSuccessful: 'Nuevo registro creado con exito', | ||||||
|     createNewRecord: 'Modo nuevo registro', |     createNewRecord: 'Modo nuevo registro', | ||||||
|     createRecordError: 'Error al crear nuevo registro', |     createRecordError: 'Error al crear nuevo registro', | ||||||
|     deleteRecordSuccessful: 'Registro eliminado exitosamente', |     deleteRecordSuccessful: 'Registro eliminado exitosamente', | ||||||
|     deleteRecordError: 'Error al eliminar el regitro', |     deleteRecordError: 'Error al eliminar el regitro', | ||||||
|  |     exportRecord: 'Exportar Registro', | ||||||
|  |     lockRecord: 'Bloquear Registro', | ||||||
|     selectionRequired: 'Debe seleccionar un registro', |     selectionRequired: 'Debe seleccionar un registro', | ||||||
|     undo: 'Deshacer', |     undo: 'Deshacer', | ||||||
|     lockRecord: 'Bloquear Registro', |  | ||||||
|     unlockRecord: 'Desbloquear Registro' |     unlockRecord: 'Desbloquear Registro' | ||||||
|   }, |   }, | ||||||
|   sequence: { |   sequence: { | ||||||
|  |  | ||||||
|  | @ -205,7 +205,6 @@ const actions = { | ||||||
|       query: route.query, |       query: route.query, | ||||||
|       title: route.meta.title |       title: route.meta.title | ||||||
|     } |     } | ||||||
|     console.log(selectedTag) |  | ||||||
|     if (isCloseAllViews) { |     if (isCloseAllViews) { | ||||||
|       dispatch('tagsView/delAllViews', selectedTag, { root: true }) |       dispatch('tagsView/delAllViews', selectedTag, { root: true }) | ||||||
|     } else { |     } else { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Edwin Betancourt
						Edwin Betancourt