mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 07:04:21 +08:00
fix: Print formats unnecessary request. (#414)
This commit is contained in:
parent
1e837db9e0
commit
8c9e2f0513
@ -130,7 +130,6 @@ export default {
|
|||||||
mixins: [contextMixin],
|
mixins: [contextMixin],
|
||||||
computed: {
|
computed: {
|
||||||
isPanelTypeMobile() {
|
isPanelTypeMobile() {
|
||||||
console.log(this.panelType, this.$route.meta.type)
|
|
||||||
if (this.$route.meta.type === 'process' || this.$route.meta.type === 'report') {
|
if (this.$route.meta.type === 'process' || this.$route.meta.type === 'report') {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ export default {
|
|||||||
},
|
},
|
||||||
report: {
|
report: {
|
||||||
ExportXlsx: '(xlsx) Extencion de Archivo Excel',
|
ExportXlsx: '(xlsx) Extencion de Archivo Excel',
|
||||||
ExportXls: '(xls) Archivo Excel ',
|
ExportXls: '(xls) Archivo Excel',
|
||||||
ExporXml: '(xml) Archivo Lenguaje de marcas Extensible',
|
ExporXml: '(xml) Archivo Lenguaje de marcas Extensible',
|
||||||
ExporCsv: '(csv) Archivo Separado por Coma',
|
ExporCsv: '(csv) Archivo Separado por Coma',
|
||||||
ExportTxt: '(txt) Archivo de Texto Delimitado por Tabuladores',
|
ExportTxt: '(txt) Archivo de Texto Delimitado por Tabuladores',
|
||||||
|
@ -116,6 +116,24 @@ const browser = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Panel for save on store
|
||||||
|
const newBrowser = {
|
||||||
|
...browserResponse,
|
||||||
|
containerUuid,
|
||||||
|
fieldList: fieldsList,
|
||||||
|
panelType,
|
||||||
|
// app attributes
|
||||||
|
awaitForValues, // control to values
|
||||||
|
awaitForValuesToQuery: awaitForValues, // get values from request search
|
||||||
|
isShowedCriteria,
|
||||||
|
isShowedTotals: true
|
||||||
|
}
|
||||||
|
|
||||||
|
commit('addBrowser', newBrowser)
|
||||||
|
dispatch('addPanel', newBrowser)
|
||||||
|
|
||||||
|
resolve(newBrowser)
|
||||||
|
|
||||||
// Convert from gRPC process list
|
// Convert from gRPC process list
|
||||||
const actions = []
|
const actions = []
|
||||||
if (process) {
|
if (process) {
|
||||||
@ -140,28 +158,8 @@ const browser = {
|
|||||||
// Add process menu
|
// Add process menu
|
||||||
dispatch('setContextMenu', {
|
dispatch('setContextMenu', {
|
||||||
containerUuid,
|
containerUuid,
|
||||||
relations: [],
|
actions
|
||||||
actions,
|
|
||||||
references: []
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Panel for save on store
|
|
||||||
const newBrowser = {
|
|
||||||
...browserResponse,
|
|
||||||
containerUuid,
|
|
||||||
fieldList: fieldsList,
|
|
||||||
panelType,
|
|
||||||
// app attributes
|
|
||||||
awaitForValues, // control to values
|
|
||||||
awaitForValuesToQuery: awaitForValues, // get values from request search
|
|
||||||
isShowedCriteria,
|
|
||||||
isShowedTotals: true
|
|
||||||
}
|
|
||||||
|
|
||||||
commit('addBrowser', newBrowser)
|
|
||||||
dispatch('addPanel', newBrowser)
|
|
||||||
|
|
||||||
resolve(newBrowser)
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
router.push({ path: '/dashboard' })
|
router.push({ path: '/dashboard' })
|
||||||
|
@ -10,8 +10,6 @@ import { requestListDocumentActions, requestListDocumentStatuses } from '@/api/A
|
|||||||
// relations: [],
|
// relations: [],
|
||||||
// actions: [],
|
// actions: [],
|
||||||
// references: []
|
// references: []
|
||||||
// defaultAction: {},
|
|
||||||
// lastAction: {}
|
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
const initStateContextMenu = {
|
const initStateContextMenu = {
|
||||||
@ -50,8 +48,25 @@ const contextMenu = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setContextMenu({ commit }, payload) {
|
/**
|
||||||
commit('setContextMenu', payload)
|
* Sub menu associated with panel
|
||||||
|
* @param {string} containerUuid
|
||||||
|
* @param {array} relations
|
||||||
|
* @param {array} actions
|
||||||
|
* @param {array} references
|
||||||
|
*/
|
||||||
|
setContextMenu({ commit }, {
|
||||||
|
containerUuid,
|
||||||
|
relations = [],
|
||||||
|
actions = [],
|
||||||
|
references = []
|
||||||
|
}) {
|
||||||
|
commit('setContextMenu', {
|
||||||
|
containerUuid,
|
||||||
|
relations,
|
||||||
|
actions,
|
||||||
|
references
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* TODO: Verify tableName params to change in constant
|
* TODO: Verify tableName params to change in constant
|
||||||
|
@ -18,7 +18,7 @@ const process = {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
/**
|
/**
|
||||||
*
|
* Get process metadata from server
|
||||||
* @param {string} containerUuid
|
* @param {string} containerUuid
|
||||||
* @param {object} routeToDelete, route to close in tagView when fail
|
* @param {object} routeToDelete, route to close in tagView when fail
|
||||||
*/
|
*/
|
||||||
@ -26,31 +26,32 @@ const process = {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
routeToDelete
|
routeToDelete
|
||||||
}) {
|
}) {
|
||||||
let printFormatsAvailable
|
|
||||||
dispatch('requestPrintFormats', {
|
|
||||||
processUuid: containerUuid
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
printFormatsAvailable = response
|
|
||||||
})
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
getProcessMetadata(containerUuid)
|
getProcessMetadata(containerUuid)
|
||||||
.then(responseProcess => {
|
.then(async responseProcess => {
|
||||||
responseProcess.printFormatsAvailable = printFormatsAvailable
|
let printFormatsAvailable = []
|
||||||
const { processDefinition, actions } = generateProcess({
|
if (responseProcess.isReport) {
|
||||||
processToGenerate: responseProcess
|
printFormatsAvailable = await dispatch('requestPrintFormats', {
|
||||||
|
processUuid: containerUuid
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const { processDefinition, actions } = generateProcess({
|
||||||
|
processToGenerate: {
|
||||||
|
...responseProcess,
|
||||||
|
printFormatsAvailable
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
dispatch('addPanel', processDefinition)
|
dispatch('addPanel', processDefinition)
|
||||||
commit('addProcess', processDefinition)
|
commit('addProcess', processDefinition)
|
||||||
|
resolve(processDefinition)
|
||||||
|
|
||||||
// Add process menu
|
// Add process menu
|
||||||
dispatch('setContextMenu', {
|
dispatch('setContextMenu', {
|
||||||
containerUuid,
|
containerUuid,
|
||||||
relations: [],
|
actions
|
||||||
actions,
|
|
||||||
references: []
|
|
||||||
})
|
})
|
||||||
resolve(processDefinition)
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
router.push({
|
router.push({
|
||||||
@ -79,16 +80,13 @@ const process = {
|
|||||||
|
|
||||||
dispatch('addPanel', processDefinition)
|
dispatch('addPanel', processDefinition)
|
||||||
commit('addProcess', processDefinition)
|
commit('addProcess', processDefinition)
|
||||||
|
resolve(processDefinition)
|
||||||
|
|
||||||
// Add process menu
|
// Add process menu
|
||||||
dispatch('setContextMenu', {
|
dispatch('setContextMenu', {
|
||||||
containerUuid: processDefinition.uuid,
|
containerUuid: processDefinition.uuid,
|
||||||
relations: [],
|
actions
|
||||||
actions,
|
|
||||||
references: []
|
|
||||||
})
|
})
|
||||||
|
|
||||||
resolve(processDefinition)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,8 @@ const reportControl = {
|
|||||||
processUuid,
|
processUuid,
|
||||||
instanceUuid
|
instanceUuid
|
||||||
}) {
|
}) {
|
||||||
return requestPrintFormats({ processUuid })
|
return new Promise(resolve => {
|
||||||
|
requestPrintFormats({ processUuid })
|
||||||
.then(printFormatResponse => {
|
.then(printFormatResponse => {
|
||||||
const printFormatList = printFormatResponse.printFormatsList.map(printFormatItem => {
|
const printFormatList = printFormatResponse.printFormatsList.map(printFormatItem => {
|
||||||
return {
|
return {
|
||||||
@ -54,11 +55,13 @@ const reportControl = {
|
|||||||
containerUuid: processUuid,
|
containerUuid: processUuid,
|
||||||
printFormatList
|
printFormatList
|
||||||
})
|
})
|
||||||
return printFormatList
|
|
||||||
|
resolve(printFormatList)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting print formats: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting print formats: ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
requestReportViews({ commit }, {
|
requestReportViews({ commit }, {
|
||||||
processId,
|
processId,
|
||||||
@ -66,7 +69,8 @@ const reportControl = {
|
|||||||
instanceUuid,
|
instanceUuid,
|
||||||
printFormatUuid
|
printFormatUuid
|
||||||
}) {
|
}) {
|
||||||
return requestReportViews({ processUuid })
|
return new Promise(resolve => {
|
||||||
|
requestReportViews({ processUuid })
|
||||||
.then(reportViewResponse => {
|
.then(reportViewResponse => {
|
||||||
const reportViewList = reportViewResponse.reportViewsList.map(reportViewItem => {
|
const reportViewList = reportViewResponse.reportViewsList.map(reportViewItem => {
|
||||||
return {
|
return {
|
||||||
@ -83,11 +87,13 @@ const reportControl = {
|
|||||||
containerUuid: processUuid,
|
containerUuid: processUuid,
|
||||||
viewList: reportViewList
|
viewList: reportViewList
|
||||||
})
|
})
|
||||||
return reportViewList
|
|
||||||
|
resolve(reportViewList)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting report views: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting report views: ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
requestDrillTables({ commit }, {
|
requestDrillTables({ commit }, {
|
||||||
processId,
|
processId,
|
||||||
@ -97,7 +103,8 @@ const reportControl = {
|
|||||||
tableName,
|
tableName,
|
||||||
reportViewUuid
|
reportViewUuid
|
||||||
}) {
|
}) {
|
||||||
return requestDrillTables({ tableName })
|
return new Promise(resolve => {
|
||||||
|
requestDrillTables({ tableName })
|
||||||
.then(responseDrillTables => {
|
.then(responseDrillTables => {
|
||||||
const drillTablesList = responseDrillTables.drillTablesList.map(drillTableItem => {
|
const drillTablesList = responseDrillTables.drillTablesList.map(drillTableItem => {
|
||||||
return {
|
return {
|
||||||
@ -116,17 +123,15 @@ const reportControl = {
|
|||||||
containerUuid: processUuid,
|
containerUuid: processUuid,
|
||||||
drillTablesList
|
drillTablesList
|
||||||
})
|
})
|
||||||
return drillTablesList
|
|
||||||
|
resolve(drillTablesList)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`Error getting drill tables: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting drill tables: ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getReportOutputFromServer({ commit, getters, rootGetters }, parameters) {
|
getReportOutputFromServer({ commit, getters, rootGetters }, {
|
||||||
if (isEmptyValue(parameters.printFormatUuid)) {
|
|
||||||
parameters.printFormatUuid = getters.getDefaultPrintFormat(parameters.processUuid).printFormatUuid
|
|
||||||
}
|
|
||||||
const {
|
|
||||||
tableName,
|
tableName,
|
||||||
printFormatUuid,
|
printFormatUuid,
|
||||||
reportViewUuid,
|
reportViewUuid,
|
||||||
@ -137,9 +142,14 @@ const reportControl = {
|
|||||||
processId,
|
processId,
|
||||||
instanceUuid,
|
instanceUuid,
|
||||||
option
|
option
|
||||||
} = parameters
|
}) {
|
||||||
|
if (isEmptyValue(printFormatUuid)) {
|
||||||
|
printFormatUuid = getters.getDefaultPrintFormat(processUuid).printFormatUuid
|
||||||
|
}
|
||||||
|
|
||||||
const parametersList = rootGetters.getParametersToServer({ containerUuid: processUuid })
|
const parametersList = rootGetters.getParametersToServer({ containerUuid: processUuid })
|
||||||
return getReportOutput({
|
return new Promise(resolve => {
|
||||||
|
getReportOutput({
|
||||||
parametersList,
|
parametersList,
|
||||||
printFormatUuid,
|
printFormatUuid,
|
||||||
reportViewUuid,
|
reportViewUuid,
|
||||||
@ -151,42 +161,20 @@ const reportControl = {
|
|||||||
.then(response => {
|
.then(response => {
|
||||||
const reportOutput = {
|
const reportOutput = {
|
||||||
...response,
|
...response,
|
||||||
processId: processId,
|
processId,
|
||||||
processUuid: processUuid,
|
processUuid,
|
||||||
isError: false,
|
isError: false,
|
||||||
instanceUuid: instanceUuid,
|
instanceUuid,
|
||||||
isReport: true,
|
isReport: true,
|
||||||
option: option
|
option: option
|
||||||
}
|
}
|
||||||
commit('setNewReportOutput', reportOutput)
|
commit('setNewReportOutput', reportOutput)
|
||||||
return reportOutput
|
|
||||||
|
resolve(reportOutput)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.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.warn(`Error getting report output: ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting report output: ${error.message}. Code: ${error.code}.`)
|
||||||
return reportOutput
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -189,9 +189,7 @@ const window = {
|
|||||||
// Add process menu
|
// Add process menu
|
||||||
dispatch('setContextMenu', {
|
dispatch('setContextMenu', {
|
||||||
containerUuid: tab.uuid,
|
containerUuid: tab.uuid,
|
||||||
relations: [],
|
actions: actions
|
||||||
actions: actions,
|
|
||||||
references: []
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (tab.isParentTab) {
|
if (tab.isParentTab) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user