parent
3af4d67678
commit
45b53ab6ea
|
@ -271,7 +271,7 @@ import MainPanel from '@/components/ADempiere/Panel'
|
|||
import { sortFields } from '@/utils/ADempiere'
|
||||
import { FIELD_READ_ONLY_FORM } from '@/components/ADempiere/Field/references'
|
||||
import { fieldIsDisplayed } from '@/utils/ADempiere'
|
||||
import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil'
|
||||
import { supportedTypes, exportFileFromJson, exportFileZip } from '@/utils/ADempiere/exportUtil'
|
||||
import evaluator from '@/utils/ADempiere/evaluator'
|
||||
|
||||
export default {
|
||||
|
@ -670,6 +670,18 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
exporZipRecordTable() {
|
||||
const Header = this.getterFieldListHeader
|
||||
const filterVal = this.getterFieldListValue
|
||||
const list = this.getDataSelection
|
||||
const data = this.formatJson(filterVal, list)
|
||||
const filename = 'prueba'
|
||||
exportFileZip(
|
||||
Header,
|
||||
data,
|
||||
filename
|
||||
)
|
||||
},
|
||||
exporRecordTable(key) {
|
||||
const Header = this.getterFieldListHeader
|
||||
const filterVal = this.getterFieldListValue
|
||||
|
|
|
@ -28,6 +28,11 @@
|
|||
>
|
||||
{{ process.name }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
@click="exporZipRecordTable"
|
||||
>
|
||||
{{ $t('table.dataTable.exportZip') }}
|
||||
</el-menu-item>
|
||||
<el-submenu
|
||||
:disabled="Boolean(getDataSelection.length < 1)"
|
||||
index="xlsx"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil'
|
||||
import { supportedTypes, exportFileFromJson, exportFileZip } from '@/utils/ADempiere/exportUtil'
|
||||
import { showNotification } from '@/utils/ADempiere/notification'
|
||||
|
||||
export const menuTableMixin = {
|
||||
|
@ -299,6 +299,24 @@ export const menuTableMixin = {
|
|||
exportType: key
|
||||
})
|
||||
},
|
||||
exporZipRecordTable() {
|
||||
const Header = this.getterFieldListHeader
|
||||
const filterVal = this.getterFieldListValue
|
||||
var list
|
||||
if (!this.isOption) {
|
||||
list = this.getDataSelection
|
||||
} else {
|
||||
list = this.gettersRecordContextMenu
|
||||
}
|
||||
|
||||
const data = this.formatJson(filterVal, list)
|
||||
exportFileZip({
|
||||
header: Header,
|
||||
data,
|
||||
filename: '',
|
||||
exportType: 'zip'
|
||||
})
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => v[j]))
|
||||
}
|
||||
|
|
|
@ -193,6 +193,7 @@ export default {
|
|||
selected: 'Selected',
|
||||
deleteSelection: 'Delete Selected Records',
|
||||
advancedQuery: 'Advanced Query',
|
||||
exportZip: 'Export Zip',
|
||||
showOnlyMandatoryColumns: 'Show Only Mandatory Columns',
|
||||
showAllAvailableColumns: 'Show All Available Columns',
|
||||
exportRecordTable: 'Export Selected Records',
|
||||
|
|
|
@ -193,6 +193,7 @@ export default {
|
|||
selected: 'Seleccionados',
|
||||
deleteSelection: 'Eliminar Registros Seleccionados',
|
||||
advancedQuery: 'Consulta Avanzada',
|
||||
exportZip: 'Exportar Zip',
|
||||
showOnlyMandatoryColumns: 'Mostrar Solo Columnas Obligatorias',
|
||||
showAllAvailableColumns: 'Mostrar Todas Columnas Disponibles',
|
||||
exportRecordTable: 'Exportar Registros Seleccionados',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { export_json_to_excel } from '@/vendor/Export2Excel'
|
||||
import { export_txt_to_zip } from '@/vendor/Export2Zip'
|
||||
import language from '@/lang'
|
||||
|
||||
export const supportedTypes = {
|
||||
|
@ -29,3 +30,23 @@ export function exportFileFromJson({
|
|||
bookType: exportType
|
||||
})
|
||||
}
|
||||
|
||||
export function exportFileZip({
|
||||
header,
|
||||
data,
|
||||
title
|
||||
}) {
|
||||
var Json = data.map(dataJson => {
|
||||
Object.keys(dataJson).forEach(key => {
|
||||
if (typeof dataJson[key] === 'boolean') {
|
||||
dataJson[key] = dataJson[key] ? language.t('components.switchActiveText') : language.t('components.switchInactiveText')
|
||||
}
|
||||
})
|
||||
return dataJson
|
||||
})
|
||||
export_txt_to_zip(
|
||||
header,
|
||||
Json,
|
||||
title
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue