add feature print format selection in report viewer (#162)
* add feature print format selection in report viewer * add service implementation * add print format list to context menu actionspull/3759/head
parent
974c6a5139
commit
2564ce307f
|
@ -318,3 +318,7 @@ export function getDefaultValueFromServer(query) {
|
||||||
export function getContextInfoValueFromServer({ uuid, query }) {
|
export function getContextInfoValueFromServer({ uuid, query }) {
|
||||||
return Instance.call(this).getContextInfoValue({ uuid: uuid, query: query })
|
return Instance.call(this).getContextInfoValue({ uuid: uuid, query: query })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function requestPrintFormats({ tableName, reportViewUuid, processUuid }) {
|
||||||
|
return Instance.call(this).requestPrintFormats({ tableName: tableName, reportViewUuid: reportViewUuid, processUuid: processUuid })
|
||||||
|
}
|
||||||
|
|
|
@ -154,7 +154,9 @@ export default {
|
||||||
unsupportedSorry: 'Sorry',
|
unsupportedSorry: 'Sorry',
|
||||||
unsupportedHeadline: 'This view is currently unavailable',
|
unsupportedHeadline: 'This view is currently unavailable',
|
||||||
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',
|
||||||
|
printFormat: 'Print Format',
|
||||||
|
changePrintFormat: 'Change Print Format'
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
ProcessActivity: {
|
ProcessActivity: {
|
||||||
|
|
|
@ -154,7 +154,9 @@ export default {
|
||||||
unsupportedSorry: 'Lo sentimos',
|
unsupportedSorry: 'Lo sentimos',
|
||||||
unsupportedHeadline: 'Esta vista no está disponible actualmente',
|
unsupportedHeadline: 'Esta vista no está disponible actualmente',
|
||||||
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',
|
||||||
|
printFormat: 'Formato de Impresión',
|
||||||
|
changePrintFormat: 'Cambiar Formato de Impresión'
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
ProcessActivity: {
|
ProcessActivity: {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import {
|
||||||
getRecentItems,
|
getRecentItems,
|
||||||
getDefaultValueFromServer,
|
getDefaultValueFromServer,
|
||||||
convertValueFromGRPC,
|
convertValueFromGRPC,
|
||||||
getContextInfoValueFromServer
|
getContextInfoValueFromServer,
|
||||||
|
requestPrintFormats
|
||||||
} from '@/api/ADempiere'
|
} from '@/api/ADempiere'
|
||||||
import { convertValuesMapToObject, isEmptyValue, showMessage, convertAction } from '@/utils/ADempiere'
|
import { convertValuesMapToObject, isEmptyValue, showMessage, convertAction } from '@/utils/ADempiere'
|
||||||
import language from '@/lang'
|
import language from '@/lang'
|
||||||
|
@ -16,7 +17,8 @@ const data = {
|
||||||
recordDetail: [],
|
recordDetail: [],
|
||||||
recentItems: [],
|
recentItems: [],
|
||||||
inGetting: [],
|
inGetting: [],
|
||||||
contextInfoField: []
|
contextInfoField: [],
|
||||||
|
printFormatList: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addInGetting(state, payload) {
|
addInGetting(state, payload) {
|
||||||
|
@ -89,6 +91,9 @@ const data = {
|
||||||
},
|
},
|
||||||
setContextInfoField(state, payload) {
|
setContextInfoField(state, payload) {
|
||||||
state.contextInfoField.push(payload)
|
state.contextInfoField.push(payload)
|
||||||
|
},
|
||||||
|
setPrintFormatList(state, payload) {
|
||||||
|
state.printFormatList.push(payload)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -762,6 +767,27 @@ const data = {
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error ${error.code} getting context info value for field ${error.message}`)
|
console.warn(`Error ${error.code} getting context info value for field ${error.message}`)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
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: {
|
||||||
|
@ -887,6 +913,13 @@ const data = {
|
||||||
info.contextInfoUuid === contextInfoUuid &&
|
info.contextInfoUuid === contextInfoUuid &&
|
||||||
info.sqlStatement === sqlStatement
|
info.sqlStatement === sqlStatement
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
getPrintFormatList: (state) => (containerUuid) => {
|
||||||
|
var printFormatList = state.printFormatList.find(list => list.containerUuid === containerUuid)
|
||||||
|
if (printFormatList) {
|
||||||
|
return printFormatList.printFormatList
|
||||||
|
}
|
||||||
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,26 @@ const processControl = {
|
||||||
if (reportType !== 'pdf' && reportType !== 'html') {
|
if (reportType !== 'pdf' && reportType !== 'html') {
|
||||||
link.click()
|
link.click()
|
||||||
}
|
}
|
||||||
|
// 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
|
// assign new attributes
|
||||||
Object.assign(processResult, {
|
Object.assign(processResult, {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<el-row type="flex" style="min-height: inherit;">
|
<el-row type="flex" style="min-height: inherit;">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3 class="text-center">
|
<h3 class="text-center" style="margin: 0 !important;">
|
||||||
<el-popover
|
<el-popover
|
||||||
v-if="!isEmptyValue(processMetadata.help)"
|
v-if="!isEmptyValue(processMetadata.help)"
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
|
@ -86,7 +86,9 @@ export default {
|
||||||
reportContent: '',
|
reportContent: '',
|
||||||
reportHeader: '',
|
reportHeader: '',
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
reportResult: {}
|
reportResult: {},
|
||||||
|
printFormatList: [],
|
||||||
|
printFormat: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -156,7 +158,6 @@ export default {
|
||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 20px 0px;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0%;
|
top: 0%;
|
||||||
}
|
}
|
||||||
|
@ -175,13 +176,10 @@ export default {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
padding-top: 0px;
|
|
||||||
padding-bottom: 20px;
|
|
||||||
|
|
||||||
.sub-content-html {
|
.sub-content-html {
|
||||||
min-height: inherit;
|
min-height: inherit;
|
||||||
height: inherit;
|
height: inherit;
|
||||||
height: -webkit-fill-available;
|
|
||||||
max-height: -webkit-max-content;
|
max-height: -webkit-max-content;
|
||||||
max-height: -moz-max-content;
|
max-height: -moz-max-content;
|
||||||
max-height: max-content;
|
max-height: max-content;
|
||||||
|
@ -200,7 +198,4 @@ export default {
|
||||||
.container-report {
|
.container-report {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.scroll {
|
|
||||||
max-height: -webkit-fill-available;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue