mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
fix: Context menu relations in report view. (#427)
This commit is contained in:
parent
927de4aa33
commit
c8146819e4
@ -56,7 +56,7 @@ export const contextMixin = {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
actions: [],
|
actions: [],
|
||||||
supportedTypes: supportedTypes,
|
supportedTypes,
|
||||||
references: [],
|
references: [],
|
||||||
file: this.$store.getters.getProcessResult.download,
|
file: this.$store.getters.getProcessResult.download,
|
||||||
downloads: this.$store.getters.getProcessResult.url,
|
downloads: this.$store.getters.getProcessResult.url,
|
||||||
@ -97,7 +97,10 @@ export const contextMixin = {
|
|||||||
menuUuid = this.menuParentUuid
|
menuUuid = this.menuParentUuid
|
||||||
}
|
}
|
||||||
const relations = this.$store.getters.getRelations(menuUuid)
|
const relations = this.$store.getters.getRelations(menuUuid)
|
||||||
return relations.children
|
if (relations) {
|
||||||
|
return relations.children
|
||||||
|
}
|
||||||
|
return []
|
||||||
},
|
},
|
||||||
permissionRoutes() {
|
permissionRoutes() {
|
||||||
return this.$store.getters.permission_routes
|
return this.$store.getters.permission_routes
|
||||||
@ -133,9 +136,8 @@ export const contextMixin = {
|
|||||||
return value.map(fieldItem => {
|
return value.map(fieldItem => {
|
||||||
if (fieldItem.componentPath === 'FieldSelect') {
|
if (fieldItem.componentPath === 'FieldSelect') {
|
||||||
return 'DisplayColumn_' + fieldItem.columnName
|
return 'DisplayColumn_' + fieldItem.columnName
|
||||||
} else {
|
|
||||||
return fieldItem.columnName
|
|
||||||
}
|
}
|
||||||
|
return fieldItem.columnName
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
isDisabledExportRecord() {
|
isDisabledExportRecord() {
|
||||||
@ -333,23 +335,24 @@ export const contextMixin = {
|
|||||||
if (this.isEmptyValue(this.metadataMenu)) {
|
if (this.isEmptyValue(this.metadataMenu)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.actions = this.metadataMenu.actions
|
||||||
|
|
||||||
// TODO: Add store attribute to avoid making repeated requests
|
// TODO: Add store attribute to avoid making repeated requests
|
||||||
if (this.panelType === 'window' && !this.isEmptyValue(this.$route.params.tableName)) {
|
|
||||||
this.$store.dispatch('getPrivateAccessFromServer', {
|
|
||||||
tableName: this.$route.params.tableName,
|
|
||||||
recordId: this.$route.params.recordId
|
|
||||||
})
|
|
||||||
.then(privateAccessResponse => {
|
|
||||||
if (!this.isEmptyValue(privateAccessResponse)) {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.validatePrivateAccess(privateAccessResponse)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.actions = this.metadataMenu.actions
|
|
||||||
if (this.panelType === 'window') {
|
if (this.panelType === 'window') {
|
||||||
|
if (!this.isEmptyValue(this.$route.params.tableName)) {
|
||||||
|
this.$store.dispatch('getPrivateAccessFromServer', {
|
||||||
|
tableName: this.$route.params.tableName,
|
||||||
|
recordId: this.$route.params.recordId
|
||||||
|
})
|
||||||
|
.then(privateAccessResponse => {
|
||||||
|
if (!this.isEmptyValue(privateAccessResponse)) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.validatePrivateAccess(privateAccessResponse)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const processAction = this.actions.find(item => {
|
const processAction = this.actions.find(item => {
|
||||||
if (item.name === 'Procesar Orden' || (item.name === 'Process Order')) {
|
if (item.name === 'Procesar Orden' || (item.name === 'Process Order')) {
|
||||||
return item
|
return item
|
||||||
@ -420,12 +423,13 @@ export const contextMixin = {
|
|||||||
containerParams = this.lastParameter
|
containerParams = this.lastParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentMenu = this.menuParentUuid
|
let menuParentUuid = this.menuParentUuid
|
||||||
if (this.$route.params) {
|
if (this.isEmptyValue(menuParentUuid) && this.$route.params) {
|
||||||
if (this.$route.params.menuParentUuid) {
|
if (!this.isEmptyValue(this.$route.params.menuParentUuid)) {
|
||||||
parentMenu = this.$route.params.menuParentUuid
|
menuParentUuid = this.$route.params.menuParentUuid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.panelType === 'process') {
|
if (this.panelType === 'process') {
|
||||||
this.$store.dispatch('setTempShareLink', {
|
this.$store.dispatch('setTempShareLink', {
|
||||||
processId: this.$route.params.processId,
|
processId: this.$route.params.processId,
|
||||||
@ -449,8 +453,8 @@ export const contextMixin = {
|
|||||||
parentUuid: this.containerUuid,
|
parentUuid: this.containerUuid,
|
||||||
containerUuid: containerParams, // EVALUATE IF IS action.uuid
|
containerUuid: containerParams, // EVALUATE IF IS action.uuid
|
||||||
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
|
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
|
||||||
reportFormat: reportFormat, // this.$route.query.reportType ? this.$route.query.reportType : action.reportExportType,
|
reportFormat, // this.$route.query.reportType ? this.$route.query.reportType : action.reportExportType,
|
||||||
menuParentUuid: parentMenu, // to load relationsList in context menu (report view)
|
menuParentUuid, // to load relationsList in context menu (report view)
|
||||||
routeToDelete: this.$route
|
routeToDelete: this.$route
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -492,50 +496,55 @@ export const contextMixin = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (action.type === 'updateReport') {
|
} else if (action.type === 'updateReport') {
|
||||||
const updateReportParams = {
|
this.updateReport(action)
|
||||||
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
|
|
||||||
}
|
|
||||||
if (this.isEmptyValue(updateReportParams.instanceUuid)) {
|
|
||||||
updateReportParams.instanceUuid = this.$route.params.instanceUuid
|
|
||||||
}
|
|
||||||
if (this.isEmptyValue(updateReportParams.processId)) {
|
|
||||||
updateReportParams.processId = this.$route.params.processId
|
|
||||||
}
|
|
||||||
this.$store.dispatch('getReportOutputFromServer', updateReportParams)
|
|
||||||
.then(response => {
|
|
||||||
if (!response.isError) {
|
|
||||||
let 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
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateReport(action) {
|
||||||
|
let instanceUuid = action.instanceUuid
|
||||||
|
if (this.isEmptyValue(instanceUuid)) {
|
||||||
|
instanceUuid = this.$route.params.instanceUuid
|
||||||
|
}
|
||||||
|
let processId = action.processId
|
||||||
|
if (this.isEmptyValue(processId)) {
|
||||||
|
processId = this.$route.params.processId
|
||||||
|
}
|
||||||
|
this.$store.dispatch('getReportOutputFromServer', {
|
||||||
|
instanceUuid,
|
||||||
|
processUuid: action.processUuid,
|
||||||
|
tableName: action.tableName,
|
||||||
|
processId,
|
||||||
|
printFormatUuid: action.printFormatUuid,
|
||||||
|
reportViewUuid: action.reportViewUuid,
|
||||||
|
isSummary: false,
|
||||||
|
reportName: this.$store.getters.getProcessResult.name,
|
||||||
|
reportType: this.$store.getters.getReportType,
|
||||||
|
option: action.option
|
||||||
|
})
|
||||||
|
.then(reportOutputResponse => {
|
||||||
|
if (!reportOutputResponse.isError) {
|
||||||
|
let link = {
|
||||||
|
href: undefined,
|
||||||
|
download: undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = new Blob(
|
||||||
|
[reportOutputResponse.outputStream],
|
||||||
|
{ type: reportOutputResponse.mimeType }
|
||||||
|
)
|
||||||
|
link = document.createElement('a')
|
||||||
|
link.href = window.URL.createObjectURL(blob)
|
||||||
|
link.download = reportOutputResponse.fileName
|
||||||
|
if (reportOutputResponse.reportType !== 'pdf' && reportOutputResponse.reportType !== 'html') {
|
||||||
|
link.click()
|
||||||
|
}
|
||||||
|
reportOutputResponse.url = link.href
|
||||||
|
}
|
||||||
|
this.$store.dispatch('finishProcess', {
|
||||||
|
processOutput: reportOutputResponse,
|
||||||
|
routeToDelete: this.$route
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
openReference(referenceElement) {
|
openReference(referenceElement) {
|
||||||
if (referenceElement.windowUuid && referenceElement.recordUuid) {
|
if (referenceElement.windowUuid && referenceElement.recordUuid) {
|
||||||
const viewSearch = recursiveTreeSearch({
|
const viewSearch = recursiveTreeSearch({
|
||||||
|
@ -612,7 +612,8 @@ const processControl = {
|
|||||||
commit('addNotificationProcess', processResult)
|
commit('addNotificationProcess', processResult)
|
||||||
dispatch('finishProcess', {
|
dispatch('finishProcess', {
|
||||||
processOutput: processResult,
|
processOutput: processResult,
|
||||||
procesingMessage
|
procesingMessage,
|
||||||
|
routeToDelete
|
||||||
})
|
})
|
||||||
|
|
||||||
commit('deleteInExecution', {
|
commit('deleteInExecution', {
|
||||||
@ -880,6 +881,7 @@ const processControl = {
|
|||||||
},
|
},
|
||||||
finishProcess({ commit }, {
|
finishProcess({ commit }, {
|
||||||
processOutput,
|
processOutput,
|
||||||
|
routeToDelete,
|
||||||
procesingMessage
|
procesingMessage
|
||||||
}) {
|
}) {
|
||||||
const processMessage = {
|
const processMessage = {
|
||||||
@ -900,8 +902,9 @@ const processControl = {
|
|||||||
}
|
}
|
||||||
if (processOutput.isReport && !processOutput.isError) {
|
if (processOutput.isReport && !processOutput.isError) {
|
||||||
// open report viewer with report response
|
// open report viewer with report response
|
||||||
if (isEmptyValue(processOutput.menuParentUuid)) {
|
let menuParentUuid = routeToDelete.params.menuParentUuid
|
||||||
processOutput.menuParentUuid = processOutput.processUuid
|
if (isEmptyValue(menuParentUuid)) {
|
||||||
|
menuParentUuid = processOutput.menuParentUuid
|
||||||
}
|
}
|
||||||
|
|
||||||
let tableName
|
let tableName
|
||||||
@ -910,13 +913,14 @@ const processControl = {
|
|||||||
tableName = processOutput.tableName
|
tableName = processOutput.tableName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
router.push({
|
router.push({
|
||||||
name: 'Report Viewer',
|
name: 'Report Viewer',
|
||||||
params: {
|
params: {
|
||||||
processId: processOutput.processId,
|
processId: processOutput.processId,
|
||||||
instanceUuid: processOutput.instanceUuid,
|
instanceUuid: processOutput.instanceUuid,
|
||||||
fileName: isEmptyValue(processOutput.output.fileName) ? processOutput.fileName : processOutput.output.fileName,
|
fileName: isEmptyValue(processOutput.output.fileName) ? processOutput.fileName : processOutput.output.fileName,
|
||||||
menuParentUuid: processOutput.menuParentUuid,
|
menuParentUuid,
|
||||||
tableName
|
tableName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user