add drill down support to reports (#183)

* add drill down support to reports

* add validations and service implementation for get report output

* add parameters for change report output

* add service implementation for report output and add change print format

* fix send parameters of report

* add support to change view report

* bugfix names of properties

* minor bugfix

* add support to list drill tables by reports

* modify styles for childs menu

* open drill report in other container

* bugfix route definition

* bugfix default report format

* bugfix to generate reports

Co-authored-by: EdwinBetanc0urt <EdwinBetanc0urt@hotmail.com>
pull/3759/head
Leonel Matos 2020-01-10 14:47:25 -04:00 committed by Yamel Senih
parent 28b93fb80b
commit da3fad95a6
15 changed files with 410 additions and 104 deletions

View File

@ -334,6 +334,7 @@ export function unlockPrivateAccessFromServer({ tableName: tableName, recordId:
export function getFavoritesFromServer(userUuid) { export function getFavoritesFromServer(userUuid) {
return Instance.call(this).requestFavorites(userUuid) return Instance.call(this).requestFavorites(userUuid)
} }
export function getPendingDocumentsFromServer(userUuid, roleUuid) { export function getPendingDocumentsFromServer(userUuid, roleUuid) {
return Instance.call(this).requestPendingDocuments(userUuid, roleUuid) return Instance.call(this).requestPendingDocuments(userUuid, roleUuid)
} }
@ -345,3 +346,35 @@ export function requestReportViews({ tableName, processUuid }) {
export function requestPrintFormats({ tableName, reportViewUuid, processUuid }) { export function requestPrintFormats({ tableName, reportViewUuid, processUuid }) {
return Instance.call(this).requestPrintFormats({ tableName: tableName, reportViewUuid: reportViewUuid, processUuid: processUuid }) return Instance.call(this).requestPrintFormats({ tableName: tableName, reportViewUuid: reportViewUuid, processUuid: processUuid })
} }
export function requestDrillTables(tableName) {
return Instance.call(this).requestDrillTables(tableName)
}
export function getReportOutput({
criteria: criteria,
printFormatUuid: printFormatUuid,
reportViewUuid: reportViewUuid,
isSummary: isSummary,
reportName: reportName,
reportType: reportType,
tableName: tableName
}) {
const criteriaForReport = getCriteria(tableName)
if (criteria && criteria.length) {
criteria.forEach(parameter => {
var isAddCodition = true
if (parameter.isRange && criteria.some(param => param.columnName === `${parameter.columnName}_To`)) {
parameter.valueTo = criteria.find(param => param.columnName === `${parameter.columnName}_To`).value
}
const convertedParameter = Instance.call(this).convertCondition(parameter)
if (parameter.isRange && !parameter.hasOwnProperty('valueTo')) {
isAddCodition = false
}
if (isAddCodition) {
criteriaForReport.addConditions(convertedParameter)
}
})
}
return Instance.call(this).getReportOutput({ criteria: criteriaForReport, printFormatUuid: printFormatUuid, reportViewUuid: reportViewUuid, isSummary: isSummary, reportName: reportName, reportType: reportType })
}

View File

@ -22,9 +22,11 @@
<template slot="title"> <template slot="title">
{{ action.name }} {{ action.name }}
</template> </template>
<el-menu-item v-for="(child, key) in action.childs" :key="key" :index="child.uuid" @click="runAction(child)"> <el-scrollbar wrap-class="scroll-child">
{{ child.name }} <el-menu-item v-for="(child, key) in action.childs" :key="key" :index="child.uuid" @click="runAction(child)">
</el-menu-item> {{ child.name }}
</el-menu-item>
</el-scrollbar>
</el-submenu> </el-submenu>
<el-menu-item v-else v-show="!action.hidden" :key="index" :index="action.name" :disabled="action.disabled" @click="runAction(action)"> <el-menu-item v-else v-show="!action.hidden" :key="index" :index="action.name" :disabled="action.disabled" @click="runAction(action)">
{{ action.name }} {{ action.name }}
@ -60,7 +62,7 @@
</el-menu-item> </el-menu-item>
</template> </template>
</el-submenu> </el-submenu>
<el-menu-item v-show="$route.name === 'Report Viewer'" index="9" @click="$router.push({ name: ROUTES.PRINT_FORMAT_SETUP_WINDOW.uuid })"> <el-menu-item v-show="$route.name === 'Report Viewer'" index="9" @click="redirect">
{{ $t('components.contextMenuPrintFormatSetup') }} {{ $t('components.contextMenuPrintFormatSetup') }}
</el-menu-item> </el-menu-item>
<el-menu-item v-if="panelType !== 'process'" index="8" @click="refreshData"> <el-menu-item v-if="panelType !== 'process'" index="8" @click="refreshData">

View File

@ -159,6 +159,9 @@ export const contextMixin = {
} }
} }
return false return false
},
metadataReport() {
return this.$store.getters.getCachedReport(this.$route.params.instanceUuid)
} }
}, },
watch: { watch: {
@ -424,6 +427,38 @@ export const contextMixin = {
} }
}) })
} }
} else if (action.type === 'updateReport') {
var updateReportParams = {
instanceUuid: action.instanceUuid,
processUuid: action.processUuid,
tableName: action.tableName,
processId: action.processId,
printFormatUuid: action.printFormatUuid,
reportViewUuid: action.reportViewUuid,
isSummary: false,
reportName: this.$store.getters.getProcessResult.name,
reportType: this.$store.getters.getReportType,
option: action.option
}
this.$store.dispatch('getReportOutputFromServer', updateReportParams)
.then(response => {
if (!response.isError) {
var link = {
href: undefined,
download: undefined
}
const blob = new Blob([response.outputStream], { type: response.mimeType })
link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = response.fileName
if (response.reportType !== 'pdf' && response.reportType !== 'html') {
link.click()
}
response.url = link.href
}
this.$store.dispatch('finishProcess', { processOutput: response, routeToDelete: this.$route })
})
} }
}, },
setShareLink() { setShareLink() {
@ -489,6 +524,15 @@ export const contextMixin = {
duration: 1500 duration: 1500
}) })
}, },
redirect() {
this.$router.push({
name: ROUTES.PRINT_FORMAT_SETUP_WINDOW.uuid,
query: {
action: this.metadataReport.output.printFormatUuid,
tabParent: ROUTES.PRINT_FORMAT_SETUP_WINDOW.tabParent
}
})
},
validatePrivateAccess(response) { validatePrivateAccess(response) {
if (response.isLocked) { if (response.isLocked) {
this.actions.find(item => item.action === 'unlockRecord').hidden = false this.actions.find(item => item.action === 'unlockRecord').hidden = false

View File

@ -146,6 +146,10 @@ export default {
max-height: 400px; max-height: 400px;
} }
.scroll-child {
max-height: 300px;
}
.el-icon-more { .el-icon-more {
transform: rotate(90deg); transform: rotate(90deg);
} }

View File

@ -161,7 +161,8 @@ export default {
unsupportedInfo: 'Please check that the view is supported in this version, or click the button below to return to the homepage.', unsupportedInfo: 'Please check that the view is supported in this version, or click the button below to return to the homepage.',
unsupportedButton: 'Back to dashboard', unsupportedButton: 'Back to dashboard',
reportView: 'Report Views', reportView: 'Report Views',
printFormat: 'Print Formats' printFormat: 'Print Formats',
drillTable: 'Drill Down'
}, },
report: { report: {
ExportXlsx: '(xlsx) Excel File Extension', ExportXlsx: '(xlsx) Excel File Extension',

View File

@ -161,7 +161,8 @@ export default {
unsupportedInfo: 'Verifique que la vista sea compatible con esta versión, o haga clic en el botón a continuación para volver a la página de inicio.', unsupportedInfo: 'Verifique que la vista sea compatible con esta versión, o haga clic en el botón a continuación para volver a la página de inicio.',
unsupportedButton: 'Volver al Panel de control', unsupportedButton: 'Volver al Panel de control',
reportView: 'Vistas de Reporte', reportView: 'Vistas de Reporte',
printFormat: 'Formatos de Impresión' printFormat: 'Formatos de Impresión',
drillTable: 'Entrar en Detalle'
}, },
report: { report: {
ExportXlsx: '(xlsx) Extencion de Archivo Excel', ExportXlsx: '(xlsx) Extencion de Archivo Excel',

View File

@ -107,7 +107,7 @@ export default {
generateTitle, // generateTitle by vue-i18n generateTitle, // generateTitle by vue-i18n
isActive(route) { isActive(route) {
if (route.name === 'Report Viewer') { if (route.name === 'Report Viewer') {
if (route.params.processId === this.$route.params.processId) { if (route.params.processId === this.$route.params.processId && route.params.tableName === this.$route.params.tableName) {
return route.params.processId === this.$route.params.processId return route.params.processId === this.$route.params.processId
} else { } else {
return route.path === this.$route.path return route.path === this.$route.path
@ -158,7 +158,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
for (const tag of tags) { for (const tag of tags) {
if (this.$route.name === 'Report Viewer') { if (this.$route.name === 'Report Viewer') {
if (this.$route.params && tag.to.params && tag.to.params.processId === this.$route.params.processId) { if (this.$route.params && tag.to.params && tag.to.params.processId === this.$route.params.processId && tag.to.params.tableName === this.$route.params.tableName) {
this.$refs.scrollPane.moveToTarget(tag) this.$refs.scrollPane.moveToTarget(tag)
} }
} }

View File

@ -39,10 +39,10 @@ const staticRoutes = [
path: '/report-viewer', path: '/report-viewer',
component: Layout, component: Layout,
hidden: true, hidden: true,
redirect: 'report-viewer/:processId/:instanceUuid/:fileName', redirect: 'report-viewer/:processId/:instanceUuid/:fileName/:tableName?',
children: [ children: [
{ {
path: ':processId/:instanceUuid/:fileName', path: ':processId/:instanceUuid/:fileName/:tableName?',
component: () => import('@/views/ADempiere/ReportViewer'), component: () => import('@/views/ADempiere/ReportViewer'),
name: 'Report Viewer', name: 'Report Viewer',
meta: { meta: {

View File

@ -6,12 +6,11 @@ import {
getDefaultValueFromServer, getDefaultValueFromServer,
convertValueFromGRPC, convertValueFromGRPC,
getContextInfoValueFromServer, getContextInfoValueFromServer,
getFavoritesFromServer,
getPrivateAccessFromServer, getPrivateAccessFromServer,
lockPrivateAccessFromServer, lockPrivateAccessFromServer,
unlockPrivateAccessFromServer, unlockPrivateAccessFromServer,
getFavoritesFromServer, getPendingDocumentsFromServer
getPendingDocumentsFromServer,
requestPrintFormats
} from '@/api/ADempiere' } from '@/api/ADempiere'
import { convertValuesMapToObject, isEmptyValue } from '@/utils/ADempiere/valueUtils' import { convertValuesMapToObject, isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification' import { showMessage } from '@/utils/ADempiere/notification'
@ -27,8 +26,7 @@ const data = {
pendingDocuments: [], pendingDocuments: [],
inGetting: [], inGetting: [],
contextInfoField: [], contextInfoField: [],
recordPrivateAccess: {}, recordPrivateAccess: {}
printFormatList: []
}, },
mutations: { mutations: {
addInGetting(state, payload) { addInGetting(state, payload) {
@ -115,9 +113,6 @@ const data = {
}, },
setPrivateAccess(state, payload) { setPrivateAccess(state, payload) {
state.recordPrivateAccess = payload state.recordPrivateAccess = payload
},
setPrintFormatList(state, payload) {
state.printFormatList.push(payload)
} }
}, },
actions: { actions: {
@ -987,29 +982,6 @@ const data = {
}) })
console.error(error) console.error(error)
}) })
},
requestPrintFormats({ commit }, parameters) {
return requestPrintFormats({
processUuid: parameters.processUuid
})
.then(response => {
const printFormatList = response.getPrintformatsList().map(printFormat => {
return {
uuid: printFormat.getUuid(),
name: printFormat.getName(),
description: printFormat.getDescription(),
isDefault: printFormat.getIsdefault()
}
})
commit('setPrintFormatList', {
containerUuid: parameters.processUuid,
printFormatList: printFormatList
})
return printFormatList
})
.catch(error => {
console.error(error)
})
} }
}, },
getters: { getters: {
@ -1153,13 +1125,6 @@ const data = {
} }
return undefined return undefined
} }
},
getPrintFormatList: (state) => (containerUuid) => {
var printFormatList = state.printFormatList.find(list => list.containerUuid === containerUuid)
if (printFormatList) {
return printFormatList.printFormatList
}
return []
} }
} }
} }

View File

@ -1227,6 +1227,7 @@ const panel = {
return { return {
columnName: parameterItem.columnName, columnName: parameterItem.columnName,
value: value, value: value,
isRange: parameterItem.isRange,
values: values values: values
} }
}) })

View File

@ -1,4 +1,4 @@
import { runProcess, requestProcessActivity, requestReportViews } from '@/api/ADempiere' import { runProcess, requestProcessActivity } from '@/api/ADempiere'
import { showNotification } from '@/utils/ADempiere/notification' import { showNotification } from '@/utils/ADempiere/notification'
import { isEmptyValue, convertMapToArrayPairs } from '@/utils/ADempiere' import { isEmptyValue, convertMapToArrayPairs } from '@/utils/ADempiere'
import language from '@/lang' import language from '@/lang'
@ -14,8 +14,7 @@ const processControl = {
process: [], // process to run finish process: [], // process to run finish
sessionProcess: [], sessionProcess: [],
notificationProcess: [], notificationProcess: [],
inRequestMetadata: [], inRequestMetadata: []
reportViewList: []
}, },
mutations: { mutations: {
// Add process in execution // Add process in execution
@ -57,7 +56,12 @@ const processControl = {
}, },
setReportValues(state, payload) { setReportValues(state, payload) {
state.reportObject = payload state.reportObject = payload
state.reportList.push(payload) if (state.reportList.some(report => report.instanceUuid === payload.instanceUuid)) {
var reportIndex = state.reportList.findIndex(report => report.instanceUuid === payload.instanceUuid)
state.reportList.splice(reportIndex, 1, payload)
} else {
state.reportList.push(payload)
}
}, },
setSessionProcess(state, payload) { setSessionProcess(state, payload) {
state.sessionProcess = payload.processList state.sessionProcess = payload.processList
@ -74,9 +78,6 @@ const processControl = {
state.sessionProcess = [] state.sessionProcess = []
state.notificationProcess = [] state.notificationProcess = []
state.inRequestMetadata = [] state.inRequestMetadata = []
},
setReportViewsList(state, payload) {
state.reportViewList.push(payload)
} }
}, },
actions: { actions: {
@ -208,7 +209,7 @@ const processControl = {
outputStream: '', outputStream: '',
reportType: '' reportType: ''
} }
if (response.getOutput()) { if (response.hasOutput()) {
const responseOutput = response.getOutput() const responseOutput = response.getOutput()
output = { output = {
uuid: responseOutput.getUuid(), uuid: responseOutput.getUuid(),
@ -218,7 +219,14 @@ const processControl = {
mimeType: responseOutput.getMimetype(), mimeType: responseOutput.getMimetype(),
output: responseOutput.getOutput(), output: responseOutput.getOutput(),
outputStream: responseOutput.getOutputstream(), outputStream: responseOutput.getOutputstream(),
reportType: responseOutput.getReporttype() 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 = [] var logList = []
@ -253,15 +261,22 @@ const processControl = {
option: 'reportView' option: 'reportView'
} }
reportViewList.childs = getters.getReportViewList(processResult.processUuid) reportViewList.childs = getters.getReportViewList(processResult.processUuid)
if (!reportViewList.childs.length) { if (reportViewList && !reportViewList.childs.length) {
dispatch('requestReportViews', { dispatch('requestReportViews', {
processUuid: processResult.processUuid processUuid: processResult.processUuid,
instanceUuid: response.getInstanceuuid(),
processId: processDefinition.id,
tableName: output.tableName,
printFormatUuid: output.printFormatUuid,
reportViewUuid: output.reportViewUuid
}) })
.then(response => { .then(response => {
reportViewList.childs = response reportViewList.childs = response
// Get contextMenu metadata and concat print report views with contextMenu actions if (reportViewList.childs.length) {
var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid) // Get contextMenu metadata and concat print report views with contextMenu actions
contextMenuMetadata.actions.push(reportViewList) var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
contextMenuMetadata.actions.push(reportViewList)
}
}) })
} }
@ -274,17 +289,54 @@ const processControl = {
option: 'printFormat' option: 'printFormat'
} }
printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid) printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid)
if (!printFormatList.childs.length) { if (printFormatList && !printFormatList.childs.length) {
dispatch('requestPrintFormats', { dispatch('requestPrintFormats', {
processUuid: processResult.processUuid processUuid: processResult.processUuid,
instanceUuid: response.getInstanceuuid(),
processId: processDefinition.id,
tableName: output.tableName,
printFormatUuid: output.printFormatUuid,
reportViewUuid: output.reportViewUuid
}) })
.then(response => { .then(response => {
printFormatList.childs = response printFormatList.childs = response
// Get contextMenu metadata and concat print Format List with contextMenu actions if (printFormatList.childs.length) {
var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid) // Get contextMenu metadata and concat print Format List with contextMenu actions
contextMenuMetadata.actions.push(printFormatList) var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
contextMenuMetadata.actions.push(printFormatList)
}
}) })
} }
// Drill Tables to context menu
var drillTablesList = {
name: language.t('views.drillTable'),
type: 'summary',
action: '',
childs: [],
option: 'drillTable'
}
if (!isEmptyValue(output.tableName)) {
drillTablesList.childs = rootGetters.getDrillTablesList(processResult.processUuid)
if (drillTablesList && isEmptyValue(drillTablesList.childs)) {
dispatch('requestDrillTables', {
processUuid: processResult.processUuid,
instanceUuid: response.getInstanceuuid(),
processId: processDefinition.id,
tableName: output.tableName,
printFormatUuid: output.printFormatUuid,
reportViewUuid: output.reportViewUuid
})
.then(response => {
drillTablesList.childs = response
if (drillTablesList.childs.length) {
// Get contextMenu metadata and concat print Format List with contextMenu actions
var contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
contextMenuMetadata.actions.push(drillTablesList)
}
})
}
}
} }
// assign new attributes // assign new attributes
Object.assign(processResult, { Object.assign(processResult, {
@ -294,7 +346,7 @@ const processControl = {
isError: response.getIserror(), isError: response.getIserror(),
isProcessing: response.getIsprocessing(), isProcessing: response.getIsprocessing(),
summary: response.getSummary(), summary: response.getSummary(),
ResultTableName: response.getResulttablename(), resultTableName: response.getResulttablename(),
lastRun: response.getLastrun(), lastRun: response.getLastrun(),
logs: logList, logs: logList,
output: output output: output
@ -463,13 +515,24 @@ const processControl = {
} }
if (parameters.processOutput.isReport && !parameters.processOutput.isError) { if (parameters.processOutput.isReport && !parameters.processOutput.isError) {
// open report viewer with report response // open report viewer with report response
if (isEmptyValue(parameters.processOutput.menuParentUuid)) {
parameters.processOutput.menuParentUuid = parameters.processOutput.processUuid
}
var tableName
if (parameters.processOutput.option && !isEmptyValue(parameters.processOutput.option)) {
if (parameters.processOutput.option === 'drillTable') {
tableName = parameters.processOutput.tableName
}
}
router.push({ router.push({
name: 'Report Viewer', name: 'Report Viewer',
params: { params: {
processId: parameters.processOutput.processId, processId: parameters.processOutput.processId,
instanceUuid: parameters.processOutput.instanceUuid, instanceUuid: parameters.processOutput.instanceUuid,
fileName: parameters.processOutput.output.fileName, fileName: isEmptyValue(parameters.processOutput.output.fileName) ? parameters.processOutput.fileName : parameters.processOutput.output.fileName,
menuParentUuid: parameters.processOutput.menuParentUuid menuParentUuid: parameters.processOutput.menuParentUuid,
tableName: tableName
} }
}) })
} }
@ -485,27 +548,6 @@ const processControl = {
}, },
clearProcessControl({ commit }) { clearProcessControl({ commit }) {
commit('clearProcessControl') commit('clearProcessControl')
},
requestReportViews({ commit }, parameters) {
return requestReportViews({ processUuid: parameters.processUuid })
.then(response => {
const reportViewList = response.getReportviewsList().map(reportView => {
return {
uuid: reportView.getUuid(),
name: reportView.getName(),
tableName: reportView.getTablename(),
description: reportView.getDescription()
}
})
commit('setReportViewsList', {
containerUuid: parameters.processUuid,
viewList: reportViewList
})
return reportViewList
})
.catch(error => {
console.error(error)
})
} }
}, },
getters: { getters: {
@ -550,13 +592,6 @@ const processControl = {
return state.reportList.find( return state.reportList.find(
item => item.instanceUuid === instanceUuid item => item.instanceUuid === instanceUuid
) )
},
getReportViewList: (state) => (containerUuid) => {
var reportViewList = state.reportViewList.find(list => list.containerUuid === containerUuid)
if (reportViewList) {
return reportViewList.viewList
}
return []
} }
} }
} }

View File

@ -0,0 +1,216 @@
import { requestReportViews, requestPrintFormats, requestDrillTables, getReportOutput } from '@/api/ADempiere'
import { isEmptyValue } from '@/utils/ADempiere'
const contextMenu = {
state: {
reportFormatsList: [],
reportViewsList: [],
drillTablesList: [],
reportOutput: {}
},
mutations: {
setReportFormatsList(state, payload) {
state.reportFormatsList.push(payload)
},
setReportViewsList(state, payload) {
state.reportViewsList.push(payload)
},
setDrillTablesList(state, payload) {
state.drillTablesList.push(payload)
},
setNewReportOutput(state, payload) {
state.reportOutput = payload
}
},
actions: {
requestPrintFormats({ commit }, parameters) {
return requestPrintFormats({ processUuid: parameters.processUuid })
.then(response => {
const printFormatList = response.getPrintformatsList().map(printFormat => {
return {
printFormatUuid: printFormat.getUuid(),
name: printFormat.getName(),
description: printFormat.getDescription(),
isDefault: printFormat.getIsdefault(),
tableName: printFormat.getTablename(),
reportViewUuid: printFormat.getReportviewuuid(),
type: 'updateReport',
option: 'printFormat',
instanceUuid: parameters.instanceUuid,
processUuid: parameters.processUuid,
processId: parameters.processId
}
})
commit('setReportFormatsList', {
containerUuid: parameters.processUuid,
printFormatList: printFormatList
})
return printFormatList
})
.catch(error => {
console.error(error)
})
},
requestReportViews({ commit }, parameters) {
return requestReportViews({ processUuid: parameters.processUuid })
.then(response => {
const reportViewList = response.getReportviewsList().map(reportView => {
return {
reportViewUuid: reportView.getUuid(),
name: reportView.getName(),
tableName: reportView.getTablename(),
description: reportView.getDescription(),
type: 'updateReport',
option: 'reportView',
instanceUuid: parameters.instanceUuid,
printFormatUuid: parameters.printFormatUuid,
processUuid: parameters.processUuid,
processId: parameters.processId
}
})
commit('setReportViewsList', {
containerUuid: parameters.processUuid,
viewList: reportViewList
})
return reportViewList
})
.catch(error => {
console.error(error)
})
},
requestDrillTables({ commit }, parameters) {
return requestDrillTables(parameters.tableName)
.then(response => {
const drillTablesList = response.getDrilltablesList().map(drillTable => {
return {
name: drillTable.getPrintname(),
tableName: drillTable.getTablename(),
type: 'updateReport',
option: 'drillTable',
instanceUuid: parameters.instanceUuid,
printFormatUuid: parameters.printFormatUuid,
reportViewUuid: parameters.reportViewUuid,
processUuid: parameters.processUuid,
processId: parameters.processId
}
})
commit('setDrillTablesList', {
containerUuid: parameters.processUuid,
drillTablesList: drillTablesList
})
return drillTablesList
})
.catch(error => {
console.error(error)
})
},
getReportOutputFromServer({ commit, getters, rootGetters }, parameters) {
if (isEmptyValue(parameters.printFormatUuid)) {
parameters.printFormatUuid = getters.getDefaultPrintFormat(parameters.processUuid).printFormatUuid
}
const {
tableName,
printFormatUuid,
reportViewUuid,
isSummary,
reportName,
reportType,
processUuid,
processId,
instanceUuid,
option
} = parameters
const processParameters = rootGetters.getParametersToServer({ containerUuid: processUuid })
return getReportOutput({
criteria: processParameters,
printFormatUuid: printFormatUuid,
reportViewUuid: reportViewUuid,
isSummary: isSummary,
reportName: reportName,
reportType: reportType,
tableName: tableName
})
.then(response => {
const reportOutput = {
uuid: response.getUuid(),
processName: response.getName(),
description: response.getDescription(),
fileName: response.getFilename(),
output: response.getOutput(),
mimeType: response.getMimetype(),
dataCols: response.getDatacols(),
dataRows: response.getDatarows(),
headerName: response.getHeadername(),
footerName: response.getFootername(),
printFormatUuid: response.getPrintformatuuid(),
reportViewUuid: response.getReportviewuuid(),
tableName: response.getTablename(),
outputStream: response.getOutputstream(),
reportType: response.getReporttype(),
processId: processId,
processUuid: processUuid,
isError: false,
instanceUuid: instanceUuid,
isReport: true,
option: option
}
commit('setNewReportOutput', reportOutput)
return reportOutput
})
.catch(error => {
const reportOutput = {
uuid: '',
processName: '',
description: '',
fileName: '',
output: '',
mimeType: '',
dataCols: null,
dataRows: null,
headerName: '',
footerName: '',
printFormatUuid: '',
reportViewUuid: '',
tableName: '',
outputStream: [],
reportType: '',
processId: null,
processUuid: '',
isError: true,
instanceUuid: '',
isReport: true,
option: ''
}
console.error(error)
return reportOutput
})
}
},
getters: {
getPrintFormatList: (state) => (containerUuid) => {
var printFormatList = state.reportFormatsList.find(list => list.containerUuid === containerUuid)
if (printFormatList) {
return printFormatList.printFormatList
}
return []
},
getDefaultPrintFormat: (state, getters) => (containerUuid) => {
return getters.getPrintFormatList(containerUuid).find(printFormat => printFormat.isDefault)
},
getReportViewList: (state) => (containerUuid) => {
var reportViewList = state.reportViewsList.find(list => list.containerUuid === containerUuid)
if (reportViewList) {
return reportViewList.viewList
}
return []
},
getDrillTablesList: (state) => (containerUuid) => {
var drillTablesList = state.drillTablesList.find(list => list.containerUuid === containerUuid)
if (drillTablesList) {
return drillTablesList.viewList
}
return []
}
}
}
export default contextMenu

View File

@ -6,7 +6,11 @@ const state = {
const mutations = { const mutations = {
ADD_VISITED_VIEW: (state, view) => { ADD_VISITED_VIEW: (state, view) => {
if (view.name === 'Report Viewer') { if (view.name === 'Report Viewer') {
if (state.visitedViews.some(v => v.params && v.params.processId === view.params.processId)) return if (state.visitedViews.some(v =>
v.params &&
v.params.processId === view.params.processId &&
v.params.tableName === view.params.tableName
)) return
state.visitedViews.push( state.visitedViews.push(
Object.assign({}, view, { Object.assign({}, view, {
title: view.meta.title || 'no-name' title: view.meta.title || 'no-name'

View File

@ -204,7 +204,7 @@ export function generateProcess({ processToGenerate, containerUuidAssociated = u
description: processToGenerate.description, description: processToGenerate.description,
isReport: processToGenerate.isReport, isReport: processToGenerate.isReport,
isDirectPrint: processToGenerate.isDirectPrint, isDirectPrint: processToGenerate.isDirectPrint,
reportExportType: undefined reportExportType: 'html'
}, { }, {
name: language.t('components.ChangeParameters'), name: language.t('components.ChangeParameters'),
processName: processToGenerate.name, processName: processToGenerate.name,

View File

@ -105,10 +105,10 @@ export default {
showNotification, showNotification,
displayReport(reportResult) { displayReport(reportResult) {
if (!reportResult.isError) { if (!reportResult.isError) {
this.reportFormat = reportResult.output.reportType this.reportFormat = this.isEmptyValue(reportResult.output.reportType) ? reportResult.reportType : reportResult.output.reportType
this.reportContent = reportResult.output.output this.reportContent = this.isEmptyValue(reportResult.output.output) ? reportResult.output : reportResult.output.output
this.reportHeader = reportResult.output.name this.reportHeader = this.isEmptyValue(reportResult.output.name) ? reportResult.processName : reportResult.output.name
this.name = reportResult.output.fileName this.name = this.isEmptyValue(reportResult.output.fileName) ? reportResult.fileName : reportResult.output.fileName
this.isLoading = true this.isLoading = true
} }
}, },