Support to process the selection of records (#212)
* add processes to context menu * add a mixins for menu * execute selected processes * add message with process results * add process selection * modify hover from context menu * modify hover from context menu * style hover * resolve conflictspull/3759/head
parent
945c7941f5
commit
e33dd42a33
|
@ -1,163 +0,0 @@
|
|||
<template>
|
||||
<el-menu :collapse="isCollapse" class="el-menu-demo" @select="typeFormat">
|
||||
<el-submenu
|
||||
index="xlsx"
|
||||
>
|
||||
<template slot="title">{{ $t('components.contextMennuWindowReport') }}</template>
|
||||
<template v-for="(format, index) in option">
|
||||
<el-menu-item :key="index" :index="index">
|
||||
{{ format }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item index="eliminar" style="padding-left: 36px;">
|
||||
{{ $t('window.deleteRecord') }}
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script>
|
||||
import { supportedTypes, exportFileFromJson } from '@/utils/ADempiere/exportUtil'
|
||||
|
||||
export default {
|
||||
name: 'ContextMenu',
|
||||
props: {
|
||||
parentUuid: {
|
||||
type: String,
|
||||
default: undefined
|
||||
},
|
||||
containerUuid: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
panelType: {
|
||||
type: String,
|
||||
default: 'window'
|
||||
},
|
||||
isOption: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
option: supportedTypes,
|
||||
isCollapse: true,
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
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
|
||||
},
|
||||
getDataSelection() {
|
||||
return this.$store.getters.getDataRecordSelection(this.containerUuid)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
classTableMenu() {
|
||||
if (this.isMobile) {
|
||||
return 'menu-table-mobile'
|
||||
} else if (this.$store.state.app.sidebar.opened) {
|
||||
return 'menu-table'
|
||||
}
|
||||
return 'menu-table'
|
||||
},
|
||||
typeFormat(key, keyPath) {
|
||||
if (key === 'eliminar') {
|
||||
this.rowMenu()
|
||||
} else {
|
||||
this.exporRecordTable(key)
|
||||
}
|
||||
this.$store.dispatch('showMenuTable', {
|
||||
isShowedTable: false
|
||||
})
|
||||
},
|
||||
exporRecordTable(key) {
|
||||
const Header = this.getterFieldListHeader
|
||||
const filterVal = this.getterFieldListValue
|
||||
const 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]))
|
||||
},
|
||||
rowMenu() {
|
||||
this.$store.dispatch('deleteEntity', {
|
||||
parentUuid: this.parentUuid,
|
||||
containerUuid: this.containerUuid,
|
||||
recordUuid: this.isOption.UUID,
|
||||
panelType: this.panelType,
|
||||
isNewRecord: 'deleteEntity' === 'resetPanelToNew'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-menu--vertical .nest-menu .el-submenu>.el-submenu__title:hover, .el-menu--vertical .el-menu-item:hover {
|
||||
background-color: #ffffff !important;
|
||||
background: #ffffff !important;
|
||||
}
|
||||
.el-menu--collapse {
|
||||
width: auto;
|
||||
}
|
||||
.el-menu-item:hover {
|
||||
background-color: #ffffff !important
|
||||
}
|
||||
.hover {
|
||||
background-color: initial !important;
|
||||
}
|
||||
.el-menu-item {
|
||||
height: 56px;
|
||||
line-height: 56px;
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
padding: 0 20px;
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
-webkit-transition: border-color .3s, background-color .3s, color .3s;
|
||||
transition: border-color .3s, background-color .3s, color .3s;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
|
@ -22,70 +22,16 @@
|
|||
</el-collapse>
|
||||
<div>
|
||||
<div v-if="!isMobile">
|
||||
<el-menu :default-active="menuTable" :class="classTableMenu + ' menu-table-container'" mode="horizontal" @select="typeFormat">
|
||||
<el-submenu index="2">
|
||||
<template slot="title">
|
||||
<i class="el-icon-more" />
|
||||
</template>
|
||||
<el-menu-item
|
||||
v-if="!isParent && isPanelWindow"
|
||||
:disabled="isDisabledAddNew"
|
||||
index="new"
|
||||
@click="addNewRow()"
|
||||
>
|
||||
{{ $t('window.newRecord') }}
|
||||
</el-menu-item>
|
||||
<template v-if="isPanelWindow && getterPanel.isAssociatedTabSequence">
|
||||
<el-menu-item
|
||||
v-for="(actionSequence, key) in getterPanel.tabsOrder"
|
||||
:key="key"
|
||||
:disabled="$route.query.action === 'create-new'"
|
||||
index="sort"
|
||||
@click="sortTab(actionSequence)"
|
||||
>
|
||||
{{ actionSequence.name }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
<el-menu-item
|
||||
v-if="isPanelWindow"
|
||||
:disabled="Boolean(getDataSelection.length < 1 || (isReadOnlyParent && !isParent))"
|
||||
index="delete"
|
||||
@click="deleteSelection()"
|
||||
>
|
||||
{{ $t('table.dataTable.deleteSelection') }}
|
||||
</el-menu-item>
|
||||
<el-submenu
|
||||
:disabled="Boolean(getDataSelection.length < 1)"
|
||||
index="xlsx"
|
||||
>
|
||||
<template slot="title">{{ $t('table.dataTable.exportRecordTable') }}</template>
|
||||
<template v-for="(format, index) in option">
|
||||
<el-menu-item :key="index" :index="index">
|
||||
{{ format }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item v-if="!isPanelWindow" :disabled="Boolean(getDataSelection.length < 1)" index="zoom-record" @click="zoomRecord()">
|
||||
{{ $t('table.ProcessActivity.zoomIn') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="optional" @click="optionalPanel()">
|
||||
{{ $t('components.filterableItems') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mandatory" @click="showOnlyMandatoryColumns()">
|
||||
{{ $t('table.dataTable.showOnlyMandatoryColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="available" @click="showAllAvailableColumns()">
|
||||
{{ $t('table.dataTable.showAllAvailableColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="['browser', 'window'].includes(panelType)"
|
||||
index="totals"
|
||||
@click="showTotals()"
|
||||
>
|
||||
{{ getterPanel.isShowedTotals ? $t('table.dataTable.hiddenTotal') : $t('table.dataTable.showTotal') }}
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
<table-menu
|
||||
:container-uuid="containerUuid"
|
||||
:parent-uuid="parentUuid"
|
||||
:panel-type="panelType"
|
||||
:is-parent="isParent"
|
||||
:is-panel-window="isPanelWindow"
|
||||
:is-process-menu="getterContextMenu"
|
||||
:is-mobile="isMobile"
|
||||
:is-panel="getterPanel"
|
||||
/>
|
||||
<el-button
|
||||
v-if="!isParent && isPanelWindow"
|
||||
type="text"
|
||||
|
@ -107,7 +53,6 @@
|
|||
:panel-type="panelType"
|
||||
class="field-optional"
|
||||
/>
|
||||
<!-- <i class="el-icon-circle-plus-outline" /> -->
|
||||
<div :class="{ 'show': showTableSearch }" class="table-search">
|
||||
<svg-icon class-name="search-icon" icon-class="search" @click.stop="click()" />
|
||||
<el-input
|
||||
|
@ -121,53 +66,6 @@
|
|||
</div>
|
||||
<div v-else>
|
||||
<div v-if="!isParent">
|
||||
<el-menu :default-active="menuTable" :class="classTableMenu + ' menu-table-container'" mode="horizontal">
|
||||
<el-submenu index="2">
|
||||
<template slot="title">
|
||||
<i class="el-icon-more" />
|
||||
</template>
|
||||
<el-menu-item
|
||||
v-if="isPanelWindow"
|
||||
:disabled="Boolean(getDataSelection.length < 1 || (isReadOnlyParent && !isParent))"
|
||||
index="delete"
|
||||
@click="deleteSelection()"
|
||||
>
|
||||
{{ $t('table.dataTable.deleteSelection') }}
|
||||
</el-menu-item>
|
||||
<el-submenu
|
||||
v-if="isPanelWindow"
|
||||
:disabled="Boolean(getDataSelection.length < 1)"
|
||||
index="xlsx"
|
||||
>
|
||||
<template slot="title">{{ $t('table.dataTable.exportRecordTable') }}</template>
|
||||
<template v-for="(format, index) in option">
|
||||
<el-menu-item :key="index" :index="index">
|
||||
{{ format }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item index="optional" @click="optionalPanel()">
|
||||
{{ $t('components.filterableItems') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="fixed" @click="fixedPanel()">
|
||||
{{ $t('components.fixedleItems') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mandatory" @click="showOnlyMandatoryColumns()">
|
||||
{{ $t('table.dataTable.showOnlyMandatoryColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="available" @click="showAllAvailableColumns()">
|
||||
{{ $t('table.dataTable.showAllAvailableColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="!isParent && isPanelWindow"
|
||||
:disabled="isDisabledAddNew"
|
||||
index="new"
|
||||
@click="addNewRow()"
|
||||
>
|
||||
{{ $t('window.newRecord') }}
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
<fixed-columns
|
||||
:container-uuid="containerUuid"
|
||||
:panel-type="panelType"
|
||||
|
@ -231,6 +129,24 @@
|
|||
:parent-uuid="parentUuid"
|
||||
:panel-type="panelType"
|
||||
:is-option="isOption"
|
||||
:is-panel-window="isPanelWindow"
|
||||
:is-process-menu="getterContextMenu"
|
||||
:is-mobile="isMobile"
|
||||
:is-panel="getterPanel"
|
||||
/>
|
||||
<context-menu
|
||||
v-if="!isParent"
|
||||
v-show="getShowContextMenuTabChildren"
|
||||
:style="{left:left+'px',top:top+'px'}"
|
||||
class="contextmenu"
|
||||
:container-uuid="containerUuid"
|
||||
:parent-uuid="parentUuid"
|
||||
:panel-type="panelType"
|
||||
:is-option="isOption"
|
||||
:is-panel-window="isPanelWindow"
|
||||
:is-process-menu="getterContextMenu"
|
||||
:is-mobile="isMobile"
|
||||
:is-panel="getterPanel"
|
||||
/>
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
|
@ -343,7 +259,8 @@ import FieldDefinition from '@/components/ADempiere/Field'
|
|||
import Sortable from 'sortablejs'
|
||||
import FilterColumns from '@/components/ADempiere/DataTable/filterColumns'
|
||||
import FixedColumns from '@/components/ADempiere/DataTable/fixedColumns'
|
||||
import ContextMenu from '@/components/ADempiere/DataTable/contextMenu'
|
||||
import ContextMenu from '@/components/ADempiere/DataTable/menu/contextMenu'
|
||||
import TableMenu from '@/components/ADempiere/DataTable/menu'
|
||||
import IconElement from '@/components/ADempiere/IconElement'
|
||||
import { formatDate } from '@/filters/ADempiere'
|
||||
import MainPanel from '@/components/ADempiere/Panel'
|
||||
|
@ -361,7 +278,8 @@ export default {
|
|||
FixedColumns,
|
||||
ContextMenu,
|
||||
IconElement,
|
||||
MainPanel
|
||||
MainPanel,
|
||||
TableMenu
|
||||
},
|
||||
props: {
|
||||
parentUuid: {
|
||||
|
@ -421,9 +339,23 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
getterContextMenu() {
|
||||
var process = this.$store.getters.getContextMenu(this.containerUuid).actions
|
||||
if (process) {
|
||||
return process.filter(menu => {
|
||||
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 => {
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<el-menu :collapse="isCollapse" class="el-menu-demo" @select="typeFormat">
|
||||
<el-submenu
|
||||
index="xlsx"
|
||||
>
|
||||
<template
|
||||
slot="title"
|
||||
>
|
||||
{{ $t('components.contextMennuWindowReport') }}
|
||||
</template>
|
||||
<template v-for="(format, index) in option">
|
||||
<el-menu-item
|
||||
:key="index"
|
||||
:index="index"
|
||||
>
|
||||
{{ format }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item
|
||||
index="eliminar"
|
||||
@click="deleteRecord()"
|
||||
>
|
||||
{{ $t('window.deleteRecord') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-for="(process, key) in isProcessMenu"
|
||||
:key="key"
|
||||
index="process"
|
||||
@click="tableProcess(process)"
|
||||
>
|
||||
{{ process.name }}
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script>
|
||||
import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/mixinMenu'
|
||||
export default {
|
||||
name: 'ContextMenu',
|
||||
mixins: [menuTableMixin]
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,96 @@
|
|||
<template>
|
||||
<el-menu :default-active="menuTable" :class="classTableMenu + ' menu-table-container'" mode="horizontal" @select="typeFormat">
|
||||
<el-submenu index="2">
|
||||
<template slot="title">
|
||||
<i class="el-icon-more" />
|
||||
</template>
|
||||
<el-menu-item
|
||||
v-if="!isParent && isPanelWindow"
|
||||
:disabled="isDisabledAddNew"
|
||||
@click="addNewRow()"
|
||||
>
|
||||
{{ $t('window.newRecord') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="isPanelWindow"
|
||||
:disabled="Boolean(getDataSelection.length < 1 || (isReadOnlyParent && !isParent))"
|
||||
@click="deleteSelection()"
|
||||
>
|
||||
{{ $t('table.dataTable.deleteSelection') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-for="(process, key) in isProcessMenu"
|
||||
v-show="isPanelWindow && isProcessMenu"
|
||||
:key="key"
|
||||
:disabled="Boolean(getDataSelection.length < 1)"
|
||||
index="process"
|
||||
@click="tableProcess(process)"
|
||||
>
|
||||
{{ process.name }}
|
||||
</el-menu-item>
|
||||
<el-submenu
|
||||
:disabled="Boolean(getDataSelection.length < 1)"
|
||||
index="xlsx"
|
||||
>
|
||||
<template slot="title">{{ $t('table.dataTable.exportRecordTable') }}</template>
|
||||
<template v-for="(format, index) in option">
|
||||
<el-menu-item :key="index" :index="index">
|
||||
{{ format }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-submenu>
|
||||
<el-menu-item index="optional" @click="optionalPanel()">
|
||||
{{ $t('components.filterableItems') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mandatory" @click="showOnlyMandatoryColumns()">
|
||||
{{ $t('table.dataTable.showOnlyMandatoryColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="available" @click="showAllAvailableColumns()">
|
||||
{{ $t('table.dataTable.showAllAvailableColumns') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-if="['browser', 'window'].includes(panelType)"
|
||||
@click="showTotals()"
|
||||
>
|
||||
{{ isPanel.isShowedTotals ? $t('table.dataTable.hiddenTotal') : $t('table.dataTable.showTotal') }}
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script>
|
||||
import { menuTableMixin } from '@/components/ADempiere/DataTable/menu/mixinMenu'
|
||||
export default {
|
||||
name: 'TableMenu',
|
||||
mixins: [menuTableMixin]
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-menu--vertical .nest-menu .el-submenu>.el-submenu__title:hover, .el-menu--vertical .el-menu-item:hover {
|
||||
background-color: #74bcff94 !important;
|
||||
background: #74bcff94 !important;
|
||||
}
|
||||
.el-menu--collapse {
|
||||
width: auto;
|
||||
}
|
||||
.el-menu-item:hover {
|
||||
background-color: #ffffff !important
|
||||
}
|
||||
.hover {
|
||||
background-color: initial !important;
|
||||
}
|
||||
.el-menu-item {
|
||||
height: 56px;
|
||||
line-height: 56px;
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
padding: 0 20px;
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
-webkit-transition: border-color .3s, background-color .3s, color .3s;
|
||||
transition: border-color .3s, background-color .3s, color .3s;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
|
@ -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]))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</el-popover>
|
||||
<!-- show only when bring logs -->
|
||||
<el-popover
|
||||
v-else-if="activity.logs.length > 0"
|
||||
v-else-if="activity.logs.length > 0 || activity.summary"
|
||||
placement="right"
|
||||
width="500"
|
||||
trigger="hover"
|
||||
|
@ -90,9 +90,18 @@
|
|||
{{ checkStatus(activity.isError, activity.isProcessing, activity.isReport).text }}
|
||||
</el-tag>
|
||||
</el-popover>
|
||||
<el-tag v-else :type="checkStatus(activity.isError, activity.isProcessing, activity.isReport).type">
|
||||
{{ checkStatus(activity.isError, activity.isProcessing, activity.isReport).text }}
|
||||
</el-tag>
|
||||
<el-popover
|
||||
v-else
|
||||
placement="top-start"
|
||||
:title="$t('table.ProcessActivity.Logs')"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
:content="activity.summary"
|
||||
>
|
||||
<el-tag slot="reference" :type="checkStatus(activity.isError, activity.isProcessing, activity.isReport).type">
|
||||
{{ checkStatus(activity.isError, activity.isProcessing, activity.isReport).text }}
|
||||
</el-tag>
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
|
Loading…
Reference in New Issue