-
-
-
-
-
-
- {{ $t('table.dataTable.deleteSelection') }}
-
-
- {{ $t('table.dataTable.exportRecordTable') }}
-
-
- {{ format }}
-
-
-
-
- {{ $t('components.filterableItems') }}
-
-
- {{ $t('components.fixedleItems') }}
-
-
- {{ $t('table.dataTable.showOnlyMandatoryColumns') }}
-
-
- {{ $t('table.dataTable.showAllAvailableColumns') }}
-
-
- {{ $t('window.newRecord') }}
-
-
-
+
{
+ if (menu.type === 'process') {
+ return menu
+ }
+ })
+ }
+ return false
+ },
getShowContextMenuTable() {
return this.$store.getters.getShowContextMenuTable
},
+ getShowContextMenuTabChildren() {
+ return this.$store.getters.getShowContextMenuTabChildren
+ },
getterFieldList() {
return this.$store.getters.getFieldsListFromPanel(this.containerUuid)
},
@@ -641,6 +573,9 @@ export default {
this.$store.dispatch('showMenuTable', {
isShowedTable: false
})
+ this.$store.dispatch('showMenuTabChildren', {
+ isShowedTabChildren: false
+ })
},
block() {
return false
@@ -657,13 +592,27 @@ export default {
} else {
this.left = left
}
-
- this.top = event.clientY - 100
- this.isOption = row
- this.visible = true
- this.$store.dispatch('showMenuTable', {
- isShowedTable: true
- })
+ if (this.isParent) {
+ this.top = event.clientY - 100
+ this.isOption = row
+ this.visible = true
+ this.$store.dispatch('showMenuTable', {
+ isShowedTable: true
+ })
+ this.$store.dispatch('showMenuTabChildren', {
+ isShowedTabChildren: false
+ })
+ } else {
+ this.top = event.clientY - event.screenY
+ this.isOption = row
+ this.visible = true
+ this.$store.dispatch('showMenuTabChildren', {
+ isShowedTabChildren: true
+ })
+ this.$store.dispatch('showMenuTable', {
+ isShowedTable: false
+ })
+ }
},
typeFormat(key, keyPath) {
Object.keys(supportedTypes).forEach(type => {
diff --git a/src/components/ADempiere/DataTable/menu/contextMenu.vue b/src/components/ADempiere/DataTable/menu/contextMenu.vue
new file mode 100644
index 00000000..2bb90865
--- /dev/null
+++ b/src/components/ADempiere/DataTable/menu/contextMenu.vue
@@ -0,0 +1,42 @@
+
+
+
+
diff --git a/src/components/ADempiere/DataTable/menu/index.vue b/src/components/ADempiere/DataTable/menu/index.vue
new file mode 100644
index 00000000..af3a4bf5
--- /dev/null
+++ b/src/components/ADempiere/DataTable/menu/index.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+ {{ $t('window.newRecord') }}
+
+
+ {{ $t('table.dataTable.deleteSelection') }}
+
+
+ {{ process.name }}
+
+
+ {{ $t('table.dataTable.exportRecordTable') }}
+
+
+ {{ format }}
+
+
+
+
+ {{ $t('components.filterableItems') }}
+
+
+ {{ $t('table.dataTable.showOnlyMandatoryColumns') }}
+
+
+ {{ $t('table.dataTable.showAllAvailableColumns') }}
+
+
+ {{ isPanel.isShowedTotals ? $t('table.dataTable.hiddenTotal') : $t('table.dataTable.showTotal') }}
+
+
+
+
+
+
diff --git a/src/components/ADempiere/DataTable/menu/mixinMenu.js b/src/components/ADempiere/DataTable/menu/mixinMenu.js
new file mode 100644
index 00000000..535f09a3
--- /dev/null
+++ b/src/components/ADempiere/DataTable/menu/mixinMenu.js
@@ -0,0 +1,306 @@
+import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil'
+import { showNotification } from '@/utils/ADempiere/notification'
+
+export const menuTableMixin = {
+ props: {
+ parentUuid: {
+ type: String,
+ default: undefined
+ },
+ containerUuid: {
+ type: String,
+ required: true
+ },
+ panelType: {
+ type: String,
+ default: 'window'
+ },
+ isOption: {
+ type: Object,
+ default: () => {}
+ },
+ isParent: {
+ type: Boolean,
+ default: false
+ },
+ isProcessMenu: {
+ type: Array,
+ default: function() {
+ return []
+ }
+ },
+ isPanelWindow: {
+ type: Boolean,
+ default: false
+ },
+ isMobile: {
+ type: Boolean,
+ default: false
+ },
+ isPanel: {
+ type: Object,
+ default: () => {}
+ },
+ isDataRecord: {
+ type: Object,
+ default: () => {}
+ }
+ },
+ data() {
+ return {
+ option: supportedTypes,
+ typoFormatExport: [],
+ menuTable: '1',
+ isCollapse: true,
+ visible: false
+ }
+ },
+ computed: {
+ isProcessTable() {
+ if (this.isProcessMenu) {
+ return true
+ }
+ return false
+ },
+ classTableMenu() {
+ if (this.isMobile) {
+ return 'menu-table-mobile'
+ } else if (this.$store.state.app.sidebar.opened) {
+ return 'menu-table'
+ }
+ return 'menu-table'
+ },
+ getterDataRecordsAndSelection() {
+ return this.$store.getters.getDataRecordAndSelection(this.containerUuid)
+ },
+ getterNewRecords() {
+ if (this.isPanelWindow && !this.isParent) {
+ var newRecordTable = this.getterDataRecordsAndSelection.record.filter(recordItem => {
+ return recordItem.isNew
+ })
+ return newRecordTable.length
+ }
+ return 0
+ },
+ getDataSelection() {
+ return this.getterDataRecordsAndSelection.selection
+ },
+ fieldList() {
+ if (this.isPanel && this.isPanel.fieldList) {
+ return this.sortFields(
+ this.isPanel.fieldList,
+ this.panelType !== 'browser' ? 'seqNoGrid' : 'sequence'
+ )
+ }
+ return []
+ },
+ isReadOnlyParent() {
+ if (this.isPanelWindow) {
+ if (this.$store.getters.getContextIsActive(this.parentUuid) === false) {
+ return true
+ }
+ if (this.$store.getters.getContextProcessing(this.parentUuid) === true ||
+ this.$store.getters.getContextProcessing(this.parentUuid) === 'Y') {
+ return true
+ }
+ if (this.$store.getters.getContextProcessed(this.parentUuid)) {
+ return true
+ }
+ }
+ return false
+ },
+ isDisabledAddNew() {
+ if (this.isParent) {
+ return true
+ }
+ if (this.$route.query.action === 'create-new') {
+ return true
+ }
+ if (!this.isPanel.isInsertRecord) {
+ return true
+ }
+ if (this.isReadOnlyParent) {
+ return true
+ }
+ if (this.getterNewRecords) {
+ return true
+ }
+ return false
+ },
+ getterFieldList() {
+ return this.$store.getters.getFieldsListFromPanel(this.containerUuid)
+ },
+ getterFieldListHeader() {
+ var header = this.getterFieldList.filter(fieldItem => {
+ const isDisplayed = fieldItem.isDisplayed || fieldItem.isDisplayedFromLogic
+ if (fieldItem.isActive && isDisplayed && !fieldItem.isKey) {
+ return fieldItem.name
+ }
+ })
+ return header.map(fieldItem => {
+ return fieldItem.name
+ })
+ },
+ getterFieldListValue() {
+ var value = this.getterFieldList.filter(fieldItem => {
+ const isDisplayed = fieldItem.isDisplayed || fieldItem.isDisplayedFromLogic
+ if (fieldItem.isActive && isDisplayed && !fieldItem.isKey) {
+ return fieldItem
+ }
+ })
+ return value.map(fieldItem => {
+ if (fieldItem.componentPath === 'FieldSelect') {
+ return 'DisplayColumn_' + fieldItem.columnName
+ } else {
+ return fieldItem.columnName
+ }
+ })
+ },
+ gettersRecordContextMenu() {
+ var record = []
+ var recordTable = this.isOption
+ record.push(recordTable)
+ return record
+ }
+ },
+ methods: {
+ showNotification,
+ closeMenu() {
+ this.$store.dispatch('showMenuTable', {
+ isShowedTable: false
+ })
+ this.$store.dispatch('showMenuTabChildren', {
+ isShowedTabChildren: false
+ })
+ },
+ showModal(process) {
+ var processData
+ processData = this.$store.getters.getProcess(process.uuid)
+ if (!this.isOption) {
+ this.$store.dispatch('setProcessSelect', {
+ selection: this.getDataSelection,
+ processTablaSelection: true,
+ tableName: this.isPanel.keyColumn
+ })
+ } else {
+ var selection = this.isOption
+ for (const element in selection) {
+ if (element === this.isPanel.keyColumn) {
+ valueProcess = selection[element]
+ }
+ }
+ this.$store.dispatch('setProcessTable', {
+ valueRecord: valueProcess,
+ tableName: this.isPanel.keyColumn,
+ processTable: true
+ })
+ }
+ var valueProcess
+ if (processData === undefined) {
+ this.$store.dispatch('getProcessFromServer', {
+ containerUuid: process.uuid,
+ routeToDelete: this.$route
+ })
+ .then(response => {
+ this.$store.dispatch('setShowDialog', {
+ type: process.type,
+ action: response,
+ record: this.getDataSelection
+ })
+ }).catch(error => {
+ console.warn('ContextMenu: Dictionary Process (State) - Error ' + error.code + ': ' + error.message)
+ })
+ } else {
+ this.$store.dispatch('setShowDialog', { type: process.type, action: processData })
+ }
+ },
+ tableProcess(process) {
+ // if (!this.isOption) {
+ // if (this.getDataSelection.length <= 1) {
+ // this.showModal(process)
+ // }
+ // } else {
+ // this.showModal(process)
+ // }
+ this.showModal(process)
+ },
+ showTotals() {
+ this.$store.dispatch('showedTotals', this.containerUuid)
+ },
+ showOnlyMandatoryColumns() {
+ this.$store.dispatch('showOnlyMandatoryColumns', {
+ containerUuid: this.containerUuid
+ })
+ },
+ showAllAvailableColumns() {
+ this.$store.dispatch('showAllAvailableColumns', {
+ containerUuid: this.containerUuid
+ })
+ },
+ deleteSelection() {
+ this.$store.dispatch('deleteSelectionDataList', {
+ parentUuid: this.parentUuid,
+ containerUuid: this.containerUuid
+ })
+ this.$store.dispatch('setRecordSelection', {
+ parentUuid: this.parentUuid,
+ containerUuid: this.containerUuid,
+ panelType: this.panelType
+ })
+ },
+ addNewRow() {
+ if (this.getterNewRecords <= 0) {
+ this.$store.dispatch('addNewRow', {
+ parentUuid: this.parentUuid,
+ containerUuid: this.containerUuid,
+ fieldList: this.fieldList,
+ isEdit: true,
+ isSendServer: false
+ })
+ } else {
+ const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({ containerUuid: this.containerUuid })
+ this.$message({
+ message: this.$t('notifications.mandatoryFieldMissing') + fieldsEmpty,
+ type: 'info'
+ })
+ }
+ },
+ optionalPanel() {
+ this.showTableSearch = false
+ this.isOptional = !this.isOptional
+ },
+ fixedPanel() {
+ this.showTableSearch = false
+ this.isFixed = !this.isFixed
+ },
+ typeFormat(key, keyPath) {
+ Object.keys(supportedTypes).forEach(type => {
+ if (type === key) {
+ this.exporRecordTable(key)
+ }
+ })
+ this.closeMenu()
+ },
+ exporRecordTable(key) {
+ 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)
+ exportFileFromJson({
+ header: Header,
+ data,
+ filename: '',
+ exportType: key
+ })
+ },
+ formatJson(filterVal, jsonData) {
+ return jsonData.map(v => filterVal.map(j => v[j]))
+ }
+ }
+}
diff --git a/src/components/ADempiere/Dialog/index.vue b/src/components/ADempiere/Dialog/index.vue
index 342c2562..08771c4a 100644
--- a/src/components/ADempiere/Dialog/index.vue
+++ b/src/components/ADempiere/Dialog/index.vue
@@ -93,6 +93,12 @@ export default {
},
windowRecordSelected() {
return this.$store.state.window.recordSelected
+ },
+ getterDataRecordsAndSelection() {
+ return this.$store.getters.getDataRecordAndSelection(this.containerUuid)
+ },
+ getDataSelection() {
+ return this.getterDataRecordsAndSelection.selection
}
},
watch: {
@@ -140,17 +146,35 @@ export default {
const fieldNotReady = this.$store.getters.isNotReadyForSubmit(action.uuid)
if (!fieldNotReady) {
this.closeDialog()
- this.$store.dispatch('startProcess', {
- action: action, // process metadata
- parentUuid: this.parentUuid,
- containerUuid: this.containerUuid,
- panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
- reportFormat: this.reportExportType,
- routeToDelete: this.$route
- })
- .catch(error => {
- console.warn(error)
+ const porcesTabla = this.$store.getters.getProcessSelect.processTablaSelection
+ const selection = this.$store.getters.getProcessSelect
+ if (porcesTabla) {
+ // selection.forEach(element => {
+ this.$store.dispatch('SelectionProcess', {
+ action: action, // process metadata
+ parentUuid: this.parentUuid,
+ containerUuid: this.containerUuid,
+ panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
+ reportFormat: this.reportExportType,
+ recordUuidSelection: selection,
+ isProcessTableSelection: true,
+ routeToDelete: this.$route
})
+ // })
+ } else {
+ this.$store.dispatch('startProcess', {
+ action: action, // process metadata
+ parentUuid: this.parentUuid,
+ isProcessTableSelection: false,
+ containerUuid: this.containerUuid,
+ panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
+ reportFormat: this.reportExportType,
+ routeToDelete: this.$route
+ })
+ .catch(error => {
+ console.warn(error)
+ })
+ }
} else {
this.showNotification({
type: 'warning',
diff --git a/src/components/ADempiere/Field/FieldDate.vue b/src/components/ADempiere/Field/FieldDate.vue
index 4810d5de..c8ec5331 100644
--- a/src/components/ADempiere/Field/FieldDate.vue
+++ b/src/components/ADempiere/Field/FieldDate.vue
@@ -25,7 +25,13 @@ export default {
name: 'FieldDate',
mixins: [fieldMixin],
data() {
+ // value render
+ let value = this.metadata.value
+ if (this.metadata.inTable) {
+ value = this.valueModel
+ }
return {
+ value: value,
pickerOptionsDate: {
shortcuts: [{
text: this.$t('components.date.Today'),
diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js
index 8f87f7dd..a2961871 100644
--- a/src/lang/ADempiere/en.js
+++ b/src/lang/ADempiere/en.js
@@ -16,9 +16,10 @@ export default {
// simplex
completed: 'Completed',
loading: 'Loading',
- succesful: 'Successful',
- error: 'Error',
+ succesful: ' Successful ',
+ error: ' Error ',
opened: 'Opened',
+ totalProcess: 'Total Processor Records ',
// search
searching: 'Searching records on the server',
succcessSearch: 'The search has been made',
diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js
index 920efacb..39df6cdd 100644
--- a/src/lang/ADempiere/es.js
+++ b/src/lang/ADempiere/es.js
@@ -16,9 +16,10 @@ export default {
// simplex
completed: 'Completado',
loading: 'Cargando',
- succesful: 'Exitoso',
- error: 'Error',
+ succesful: ' Exitoso ',
+ error: ' Error ',
opened: 'Abierto',
+ totalProcess: 'Total de Registros Procesador ',
// search
searching: 'Buscando registros en el servidor',
succcessSearch: 'La búsqueda se ha realizado',
diff --git a/src/store/modules/ADempiere/processControl.js b/src/store/modules/ADempiere/processControl.js
index 24c9619c..40376652 100644
--- a/src/store/modules/ADempiere/processControl.js
+++ b/src/store/modules/ADempiere/processControl.js
@@ -14,7 +14,13 @@ const processControl = {
process: [], // process to run finish
sessionProcess: [],
notificationProcess: [],
- inRequestMetadata: []
+ inRequestMetadata: [],
+ reportViewList: [],
+ totalResponse: 0,
+ totalRequest: 0,
+ totalSelection: 0,
+ errorSelection: 0,
+ successSelection: 0
},
mutations: {
// Add process in execution
@@ -78,23 +84,39 @@ const processControl = {
state.sessionProcess = []
state.notificationProcess = []
state.inRequestMetadata = []
+ },
+ setReportViewsList(state, payload) {
+ state.reportViewList.push(payload)
+ },
+ setTotalResponse(state, payload) {
+ state.totalResponse = payload
+ },
+ setTotalSelection(state, payload) {
+ state.totalSelection = payload
+ },
+ setSuccessSelection(state, payload) {
+ state.successSelection = payload
+ },
+ setErrorSelection(state, payload) {
+ state.errorSelection = payload
+ },
+ setTotalRequest(state, payload) {
+ state.totalRequest = payload
}
},
actions: {
// Supported Actions for it
- startProcess({ commit, dispatch, getters, rootGetters }, params) {
+ startProcess({ commit, state, dispatch, getters, rootGetters }, params) {
return new Promise((resolve, reject) => {
// TODO: Add support to evaluate params to send
const samePocessInExecution = getters.getInExecution(params.containerUuid)
// exists some call to executed process with container uuid
- if (samePocessInExecution) {
+ if (samePocessInExecution && !params.isProcessTableSelection) {
return reject({
error: 0,
message: `In this process (${samePocessInExecution.name}) there is already an execution in progress.`
})
}
-
- // additional attributes to send server, selection to browser, or table name and record id to window
var selection = []
var allData = {}
var tab, tableName, recordId
@@ -117,13 +139,25 @@ const processControl = {
}
}
if (params.panelType === 'window') {
- tab = rootGetters.getTab(params.parentUuid, params.containerUuid)
- tableName = tab.tableName
- const field = rootGetters.getFieldFromColumnName(params.containerUuid, tableName + '_ID')
- recordId = field.value
+ const contextMenu = getters.getRecordUuidMenu
+ if (params.isProcessTableSelection) {
+ tab = rootGetters.getTab(params.parentUuid, params.containerUuid)
+ tableName = params.tableNameUuidSelection
+ recordId = params.recordUuidSelection
+ } else {
+ if (contextMenu.processTable) {
+ tab = rootGetters.getTab(params.parentUuid, params.containerUuid)
+ tableName = contextMenu.tableName
+ recordId = contextMenu.valueRecord
+ } else {
+ tab = rootGetters.getTab(params.parentUuid, params.containerUuid)
+ tableName = tab.tableName
+ const field = rootGetters.getFieldFromColumnName(params.containerUuid, tableName + '_ID')
+ recordId = field.value
+ }
+ }
}
}
-
// get info metadata process
const processDefinition = rootGetters.getProcess(params.action.uuid)
var reportType = params.reportFormat
@@ -188,78 +222,223 @@ const processControl = {
router.push({ path: '/dashboard' })
dispatch('tagsView/delView', params.routeToDelete)
}
+ if (params.isProcessTableSelection) {
+ var windowSelectionProcess = getters.getProcessSelect
+ windowSelectionProcess.selection.forEach(selection => {
+ Object.assign(processResult, {
+ selection: selection.UUID,
+ record: selection[windowSelectionProcess.tableName]
+ })
+ const countRequest = state.totalRequest + 1
+ commit('setTotalRequest', countRequest)
+ if (!windowSelectionProcess.finish) {
+ runProcess({
+ uuid: processDefinition.uuid,
+ id: processDefinition.id,
+ reportType: reportType,
+ parameters: finalParameters,
+ selection: selection,
+ tableName: windowSelectionProcess.tableName,
+ recordId: selection[windowSelectionProcess.tableName]
- runProcess({
- uuid: processDefinition.uuid,
- id: processDefinition.id,
- reportType: reportType,
- parameters: finalParameters,
- selection: selection,
- tableName: tableName,
- recordId: recordId
- })
- .then(response => {
- var output = {
- uuid: '',
- name: '',
- description: '',
- fileName: '',
- mimeType: '',
- output: '',
- outputStream: '',
- reportType: ''
- }
- if (response.hasOutput()) {
- const responseOutput = response.getOutput()
- output = {
- uuid: responseOutput.getUuid(),
- name: responseOutput.getName(),
- description: responseOutput.getDescription(),
- fileName: responseOutput.getFilename(),
- mimeType: responseOutput.getMimetype(),
- output: responseOutput.getOutput(),
- outputStream: responseOutput.getOutputstream(),
- reportType: responseOutput.getReporttype(),
- dataCols: responseOutput.getDatacols(),
- dataRows: responseOutput.getDatarows(),
- footerName: responseOutput.getFootername(),
- headerName: responseOutput.getHeadername(),
- printFormatUuid: responseOutput.getPrintformatuuid(),
- reportViewUuid: responseOutput.getReportviewuuid(),
- tableName: responseOutput.getTablename()
- }
- }
- var logList = []
- if (response.getLogsList()) {
- logList = response.getLogsList().map(itemLog => {
- return {
- log: itemLog.getLog(),
- recordId: itemLog.getRecordid()
- }
})
- }
+ .then(response => {
+ var output = {
+ uuid: '',
+ name: '',
+ description: '',
+ fileName: '',
+ mimeType: '',
+ output: '',
+ outputStream: '',
+ reportType: ''
+ }
+ if (response.getOutput()) {
+ const responseOutput = response.getOutput()
+ output = {
+ uuid: responseOutput.getUuid(),
+ name: responseOutput.getName(),
+ description: responseOutput.getDescription(),
+ fileName: responseOutput.getFilename(),
+ mimeType: responseOutput.getMimetype(),
+ output: responseOutput.getOutput(),
+ outputStream: responseOutput.getOutputstream(),
+ reportType: responseOutput.getReporttype()
+ }
+ }
+ var logList = []
+ if (response.getLogsList()) {
+ logList = response.getLogsList().map(itemLog => {
+ return {
+ log: itemLog.getLog(),
+ recordId: itemLog.getRecordid()
+ }
+ })
+ }
- var link = {
- href: undefined,
- download: undefined
- }
- if (processDefinition.isReport) {
- const blob = new Blob([output.outputStream], { type: output.mimeType })
- link = document.createElement('a')
- link.href = window.URL.createObjectURL(blob)
- link.download = output.fileName
- if (reportType !== 'pdf' && reportType !== 'html') {
- link.click()
- }
+ var link = {
+ href: undefined,
+ download: undefined
+ }
+ if (processDefinition.isReport) {
+ const blob = new Blob([output.outputStream], { type: output.mimeType })
+ link = document.createElement('a')
+ link.href = window.URL.createObjectURL(blob)
+ link.download = output.fileName
+ if (reportType !== 'pdf' && reportType !== 'html') {
+ link.click()
+ }
- // Report views List to context menu
- var reportViewList = {
- name: language.t('views.reportView'),
- type: 'summary',
- action: '',
- childs: [],
- option: 'reportView'
+ // Report views List to context menu
+ var reportViewList = {
+ name: language.t('views.reportView'),
+ type: 'summary',
+ action: '',
+ childs: [],
+ option: 'reportView'
+ }
+ reportViewList.childs = getters.getReportViewList(processResult.processUuid)
+ if (!reportViewList.childs.length) {
+ dispatch('requestReportViews', {
+ processUuid: processResult.processUuid
+ })
+ .then(response => {
+ reportViewList.childs = response
+ // Get contextMenu metadata and concat print report views with contextMenu actions
+ var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
+ contextMenuMetadata.actions.push(reportViewList)
+ })
+ }
+
+ // Print formats to context menu
+ var printFormatList = {
+ name: language.t('views.printFormat'),
+ type: 'summary',
+ action: '',
+ childs: [],
+ option: 'printFormat'
+ }
+ printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid)
+ if (!printFormatList.childs.length) {
+ dispatch('requestPrintFormats', {
+ processUuid: processResult.processUuid
+ })
+ .then(response => {
+ printFormatList.childs = response
+ // Get contextMenu metadata and concat print Format List with contextMenu actions
+ var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
+ contextMenuMetadata.actions.push(printFormatList)
+ })
+ }
+ }
+ // assign new attributes
+ Object.assign(processResult, {
+ instanceUuid: response.getInstanceuuid(),
+ url: link.href,
+ download: link.download,
+ isError: response.getIserror(),
+ isProcessing: response.getIsprocessing(),
+ summary: response.getSummary(),
+ ResultTableName: response.getResulttablename(),
+ lastRun: response.getLastrun(),
+ logs: logList,
+ output: output
+ })
+ dispatch('setReportTypeToShareLink', processResult.output.reportType)
+ commit('addNotificationProcess', processResult)
+ resolve(processResult)
+ })
+ .catch(error => {
+ Object.assign(processResult, {
+ isError: true,
+ message: error.message,
+ isProcessing: false
+ })
+ console.log('Error running the process', error)
+ reject(error)
+ })
+ .finally(() => {
+ if (processResult.isError) {
+ const countError = state.errorSelection + 1
+ commit('setErrorSelection', countError)
+ } else {
+ const countSuccess = state.successSelection + 1
+ commit('setSuccessSelection', countSuccess)
+ }
+ const countResponse = state.totalResponse + 1
+ commit('setTotalResponse', countResponse)
+ if (state.totalResponse === state.totalRequest) {
+ // showNotification({
+ // title: language.t('notifications.succesful'),
+ // message: language.t('notifications.totalProcess') + countResponse + language.t('notifications.error') + state.errorSelection + language.t('notifications.succesful') + state.successSelection + language.t('notifications.processExecuted'),
+ // type: 'success'
+ // })
+ var processMessage = {
+ title: language.t('notifications.succesful'),
+ message: language.t('notifications.totalProcess') + countResponse + language.t('notifications.error') + state.errorSelection + language.t('notifications.succesful') + state.successSelection + language.t('notifications.processExecuted'),
+ type: 'success'
+ }
+ showNotification(processMessage)
+ commit('setTotalRequest', 0)
+ commit('setTotalResponse', 0)
+ commit('setSuccessSelection', 0)
+ commit('setErrorSelection', 0)
+ }
+ dispatch('setProcessSelect', {
+ selection: 0,
+ finish: true,
+ tableName: ''
+ })
+ commit('addNotificationProcess', processResult)
+ commit('addStartedProcess', processResult)
+ commit('deleteInExecution', {
+ containerUuid: params.containerUuid
+ })
+ })
+ }
+ })
+ } else {
+ runProcess({
+ uuid: processDefinition.uuid,
+ id: processDefinition.id,
+ reportType: reportType,
+ parameters: finalParameters,
+ selection: selection,
+ tableName: tableName,
+ recordId: recordId
+ })
+ .then(response => {
+ var output = {
+ uuid: '',
+ name: '',
+ description: '',
+ fileName: '',
+ mimeType: '',
+ output: '',
+ outputStream: '',
+ reportType: ''
}
+ if (response.getOutput()) {
+ const responseOutput = response.getOutput()
+ output = {
+ uuid: responseOutput.getUuid(),
+ name: responseOutput.getName(),
+ description: responseOutput.getDescription(),
+ fileName: responseOutput.getFilename(),
+ mimeType: responseOutput.getMimetype(),
+ output: responseOutput.getOutput(),
+ outputStream: responseOutput.getOutputstream(),
+ reportType: responseOutput.getReporttype()
+ }
+ }
+ var logList = []
+ if (response.getLogsList()) {
+ logList = response.getLogsList().map(itemLog => {
+ return {
+ log: itemLog.getLog(),
+ recordId: itemLog.getRecordid()
+ }
+ })
reportViewList.childs = getters.getReportViewList(processResult.processUuid)
if (reportViewList && !reportViewList.childs.length) {
dispatch('requestReportViews', {
@@ -280,13 +459,9 @@ const processControl = {
})
}
- // Print formats to context menu
- var printFormatList = {
- name: language.t('views.printFormat'),
- type: 'summary',
- action: '',
- childs: [],
- option: 'printFormat'
+ var link = {
+ href: undefined,
+ download: undefined
}
printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid)
if (printFormatList && !printFormatList.childs.length) {
@@ -306,6 +481,34 @@ const processControl = {
contextMenuMetadata.actions.push(printFormatList)
}
})
+ .then(response => {
+ reportViewList.childs = response
+ // Get contextMenu metadata and concat print report views with contextMenu actions
+ var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
+ contextMenuMetadata.actions.push(reportViewList)
+ })
+ }
+
+ // Print formats to context menu
+ var printFormatList = {
+ name: language.t('views.printFormat'),
+ type: 'summary',
+ action: '',
+ childs: [],
+ option: 'printFormat'
+ }
+ printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid)
+ if (!printFormatList.childs.length) {
+ dispatch('requestPrintFormats', {
+ processUuid: processResult.processUuid
+ })
+ .then(response => {
+ printFormatList.childs = response
+ // Get contextMenu metadata and concat print Format List with contextMenu actions
+ var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
+ contextMenuMetadata.actions.push(printFormatList)
+ })
+ }
}
// Drill Tables to context menu
@@ -337,7 +540,7 @@ const processControl = {
})
}
}
- }
+ }),
// assign new attributes
Object.assign(processResult, {
instanceUuid: response.getInstanceuuid(),
@@ -351,45 +554,245 @@ const processControl = {
logs: logList,
output: output
})
- dispatch('setReportTypeToShareLink', processResult.output.reportType)
- resolve(processResult)
- })
- .catch(error => {
- Object.assign(processResult, {
- isError: true,
- message: error.message,
- isProcessing: false
+ .catch(error => {
+ Object.assign(processResult, {
+ isError: true,
+ message: error.message,
+ isProcessing: false
+ })
+ console.log('Error running the process', error)
+ reject(error)
})
- console.log('Error running the process', error)
- reject(error)
- })
- .finally(() => {
- if (!processResult.isError) {
- if (params.panelType === 'window') {
- // TODO: Add conditional to indicate when update record
- dispatch('updateRecordAfterRunProcess', {
- parentUuid: params.parentUuid,
- containerUuid: params.containerUuid,
- tab: tab
- })
- } else if (params.panelType === 'browser') {
- if (allData.record.length >= 100) {
- dispatch('getBrowserSearch', {
- containerUuid: params.containerUuid
+ .finally(() => {
+ if (!processResult.isError) {
+ if (params.panelType === 'window') {
+ // TODO: Add conditional to indicate when update record
+ dispatch('updateRecordAfterRunProcess', {
+ parentUuid: params.parentUuid,
+ containerUuid: params.containerUuid,
+ tab: tab
})
+ } else if (params.panelType === 'browser') {
+ if (allData.record.length >= 100) {
+ dispatch('getBrowserSearch', {
+ containerUuid: params.containerUuid
+ })
+ }
}
}
- }
- commit('addNotificationProcess', processResult)
- dispatch('finishProcess', { processOutput: processResult, routeToDelete: params.routeToDelete })
-
- commit('deleteInExecution', {
- containerUuid: params.containerUuid
+ commit('addNotificationProcess', processResult)
+ dispatch('finishProcess', {
+ processOutput: processResult,
+ routeToDelete: params.routeToDelete
+ })
+ dispatch('setProcessTable', {
+ valueRecord: 0,
+ tableName: '',
+ processTable: false
+ })
+ dispatch('setProcessSelect', {
+ finish: true
+ })
+ commit('deleteInExecution', {
+ containerUuid: params.containerUuid
+ })
})
- })
+ }
})
},
+ // Supported to process selection
+ SelectionProcess({ commit, state, dispatch, getters, rootGetters }, params) {
+ // get info metadata process
+ const processDefinition = rootGetters.getProcess(params.action.uuid)
+ var reportType = 'pdf'
+ const finalParameters = rootGetters.getParametersToServer({ containerUuid: processDefinition.uuid })
+
+ showNotification({
+ title: language.t('notifications.processing'),
+ message: processDefinition.name,
+ summary: processDefinition.description,
+ type: 'info'
+ })
+ const timeInitialized = (new Date()).getTime()
+ // Run process on server and wait for it for notify
+ if (params.isProcessTableSelection) {
+ var windowSelectionProcess = getters.getProcessSelect
+ windowSelectionProcess.selection.forEach(selection => {
+ var processResult = {
+ // panel attributes from where it was executed
+ parentUuid: params.parentUuid,
+ containerUuid: params.containerUuid,
+ panelType: params.panelType,
+ menuParentUuid: params.menuParentUuid,
+ processIdPath: params.routeToDelete.path,
+ // process attributes
+ lastRun: timeInitialized,
+ action: processDefinition.name,
+ name: processDefinition.name,
+ description: processDefinition.description,
+ instanceUuid: '',
+ processUuid: processDefinition.uuid,
+ processId: processDefinition.id,
+ processName: processDefinition.processName,
+ parameters: finalParameters,
+ isError: false,
+ isProcessing: true,
+ isReport: processDefinition.isReport,
+ summary: '',
+ resultTableName: '',
+ logs: [],
+ selection: selection.UUID,
+ record: selection[windowSelectionProcess.tableName],
+ output: {
+ uuid: '',
+ name: '',
+ description: '',
+ fileName: '',
+ output: '',
+ outputStream: '',
+ reportType: ''
+ }
+ }
+ const countRequest = state.totalRequest + 1
+ commit('addInExecution', processResult)
+ commit('setTotalRequest', countRequest)
+ if (!windowSelectionProcess.finish) {
+ return runProcess({
+ uuid: processDefinition.uuid,
+ id: processDefinition.id,
+ reportType: reportType,
+ parameters: finalParameters,
+ selection: selection,
+ tableName: windowSelectionProcess.tableName,
+ recordId: selection[windowSelectionProcess.tableName]
+ })
+ .then(response => {
+ var output = {
+ uuid: '',
+ name: '',
+ description: '',
+ fileName: '',
+ mimeType: '',
+ output: '',
+ outputStream: '',
+ reportType: ''
+ }
+ if (response.getOutput()) {
+ const responseOutput = response.getOutput()
+ output = {
+ uuid: responseOutput.getUuid(),
+ name: responseOutput.getName(),
+ description: responseOutput.getDescription(),
+ fileName: responseOutput.getFilename(),
+ mimeType: responseOutput.getMimetype(),
+ output: responseOutput.getOutput(),
+ outputStream: responseOutput.getOutputstream(),
+ reportType: responseOutput.getReporttype()
+ }
+ }
+ var logList = []
+ if (response.getLogsList()) {
+ logList = response.getLogsList().map(itemLog => {
+ return {
+ log: itemLog.getLog(),
+ recordId: itemLog.getRecordid()
+ }
+ })
+ }
+
+ var link = {
+ href: undefined,
+ download: undefined
+ }
+ if (processDefinition.isReport) {
+ const blob = new Blob([output.outputStream], { type: output.mimeType })
+ link = document.createElement('a')
+ link.href = window.URL.createObjectURL(blob)
+ link.download = output.fileName
+ if (reportType !== 'pdf' && reportType !== 'html') {
+ link.click()
+ }
+
+ // Report views List to context menu
+ var reportViewList = {
+ name: language.t('views.reportView'),
+ type: 'summary',
+ action: '',
+ childs: [],
+ option: 'reportView'
+ }
+ reportViewList.childs = getters.getReportViewList(processResult.processUuid)
+ if (!reportViewList.childs.length) {
+ dispatch('requestReportViews', {
+ processUuid: processResult.processUuid
+ })
+ .then(response => {
+ reportViewList.childs = response
+ // Get contextMenu metadata and concat print report views with contextMenu actions
+ var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
+ contextMenuMetadata.actions.push(reportViewList)
+ })
+ }
+ }
+ // assign new attributes
+ Object.assign(processResult, {
+ instanceUuid: response.getInstanceuuid(),
+ url: link.href,
+ download: link.download,
+ isError: response.getIserror(),
+ isProcessing: response.getIsprocessing(),
+ summary: response.getSummary(),
+ ResultTableName: response.getResulttablename(),
+ lastRun: response.getLastrun(),
+ logs: logList,
+ output: output
+ })
+ dispatch('setReportTypeToShareLink', processResult.output.reportType)
+ if (processResult.isError) {
+ const countError = state.errorSelection + 1
+ commit('setErrorSelection', countError)
+ } else {
+ const countSuccess = state.successSelection + 1
+ commit('setSuccessSelection', countSuccess)
+ }
+ const countResponse = state.totalResponse + 1
+ commit('setTotalResponse', countResponse)
+ if (state.totalResponse === state.totalRequest) {
+ var processMessage = {
+ title: language.t('notifications.succesful'),
+ message: language.t('notifications.totalProcess') + countResponse + language.t('notifications.error') + state.errorSelection + language.t('notifications.succesful') + state.successSelection + language.t('notifications.processExecuted'),
+ type: 'success'
+ }
+ showNotification(processMessage)
+ commit('setTotalRequest', 0)
+ commit('setTotalResponse', 0)
+ commit('setSuccessSelection', 0)
+ commit('setErrorSelection', 0)
+ }
+ dispatch('setProcessSelect', {
+ selection: 0,
+ finish: true,
+ tableName: ''
+ })
+ commit('addNotificationProcess', processResult)
+ commit('addStartedProcess', processResult)
+ commit('deleteInExecution', {
+ containerUuid: params.containerUuid
+ })
+ })
+ .catch(error => {
+ Object.assign(processResult, {
+ isError: true,
+ message: error.message,
+ isProcessing: false
+ })
+ console.log('Error running the process', error)
+ })
+ }
+ })
+ }
+ },
/**
* TODO: Add date time in which the process/report was executed
*/
@@ -505,7 +908,7 @@ const processControl = {
logs: parameters.processOutput.logs,
summary: parameters.processOutput.summary
}
- var errorMessage = !isEmptyValue(parameters.processOutput.message) ? parameters.processOutput.message : language.t('login.unexpectedError')
+ var errorMessage = !isEmptyValue(parameters.processOutput.message) ? parameters.processOutput.message : language.t('login.error')
// TODO: Add isReport to type always 'success'
if (parameters.processOutput.isError || isEmptyValue(parameters.processOutput.processId) || isEmptyValue(parameters.processOutput.instanceUuid)) {
processMessage.title = language.t('notifications.error')
diff --git a/src/store/modules/ADempiere/utils.js b/src/store/modules/ADempiere/utils.js
index 65994e74..5e470d31 100644
--- a/src/store/modules/ADempiere/utils.js
+++ b/src/store/modules/ADempiere/utils.js
@@ -10,7 +10,9 @@ const utils = {
oldAction: undefined,
reportType: '',
isShowedTable: false,
- recordUuidTable: 0
+ isShowedTabChildren: false,
+ recordTable: 0,
+ selectionProcess: []
},
mutations: {
setWidth(state, width) {
@@ -28,11 +30,17 @@ const utils = {
showMenuTable(state, isShowedTable) {
state.isShowedTable = isShowedTable
},
+ showMenuTabChildren(state, isShowedTabChildren) {
+ state.isShowedTabChildren = isShowedTabChildren
+ },
setSplitHeightTop(state, splitHeightTop) {
state.splitHeightTop = splitHeightTop
},
- setRecordUuidMenu(state, recordUuidTable) {
- state.recordUuidTable = recordUuidTable
+ setProcessTable(state, recordTable) {
+ state.recordTable = recordTable
+ },
+ setProcessSelecetion(state, selectionProcess) {
+ state.selectionProcess = selectionProcess
},
setTempShareLink(state, payload) {
state.tempShareLink = payload
@@ -57,14 +65,20 @@ const utils = {
showMenuTable({ commit }, isShowedTable) {
commit('showMenuTable', isShowedTable)
},
+ showMenuTabChildren({ commit }, isShowedTabChildren) {
+ commit('showMenuTabChildren', isShowedTabChildren)
+ },
setSplitHeight({ commit }, splitHeight) {
commit('setSplitHeight', splitHeight)
},
setSplitHeightTop({ commit }, splitHeightTop) {
commit('setSplitHeightTop', splitHeightTop)
},
- setRecordUuidMenu({ commit }, recordUuidTable) {
- commit('setRecordUuidMenu', recordUuidTable)
+ setProcessTable({ commit }, recordTable) {
+ commit('setProcessTable', recordTable)
+ },
+ setProcessSelect({ commit }, params) {
+ commit('setProcessSelecetion', params)
},
changeShowedDetail({ dispatch }, params) {
if (params.panelType === 'window') {
@@ -89,6 +103,9 @@ const utils = {
getWidth: (state) => {
return state.width
},
+ getProcessSelect: (state) => {
+ return state.selectionProcess
+ },
getWidthLayout: (state, rootGetters) => {
if (rootGetters.toggleSideBar) {
return state.width - 250
@@ -102,12 +119,16 @@ const utils = {
return state.getSplitHeightTop
},
getRecordUuidMenu: (state) => {
- return state.recordUuidTable
+ return state.recordTable
},
getShowContextMenuTable: (state) => {
const menu = state.isShowedTable.isShowedTable
return menu
},
+ getShowContextMenuTabChildren: (state) => {
+ const menu = state.isShowedTabChildren.isShowedTabChildren
+ return menu
+ },
getSplitHeight: (state) => {
const split = state.splitHeight
var panelHeight = 0
diff --git a/src/views/ADempiere/ProcessActivity/index.vue b/src/views/ADempiere/ProcessActivity/index.vue
index 05f9c64c..8ea355af 100644
--- a/src/views/ADempiere/ProcessActivity/index.vue
+++ b/src/views/ADempiere/ProcessActivity/index.vue
@@ -52,7 +52,7 @@
-
- {{ checkStatus(activity.isError, activity.isProcessing, activity.isReport).text }}
-
+
+
+ {{ checkStatus(activity.isError, activity.isProcessing, activity.isReport).text }}
+
+