Refactor code, remove unused methods and optimized application. (#318)

* Refactor code, remove unused methods and optimized application.

* Delete redundant action's, and some deprecated.

* Optimize delete record container to panels in window.

* fix delete tag view when change roles.
pull/3759/head
EdwinBetanc0urt 2020-02-10 21:13:19 -04:00 committed by GitHub
parent 2dbc02403a
commit 7f74235073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 607 additions and 925 deletions

View File

@ -336,6 +336,7 @@ export const contextMixin = {
return return
} }
// TODO: Add store attribute to avoid making repeated requests
if (this.panelType === 'window' && !this.isEmptyValue(this.$route.params.tableName)) { if (this.panelType === 'window' && !this.isEmptyValue(this.$route.params.tableName)) {
this.$store.dispatch('getPrivateAccessFromServer', { this.$store.dispatch('getPrivateAccessFromServer', {
tableName: this.$route.params.tableName, tableName: this.$route.params.tableName,
@ -447,12 +448,6 @@ export const contextMixin = {
.catch(error => { .catch(error => {
console.warn(error) console.warn(error)
}) })
if (this.panelType === 'process') {
// TODO: Verify use
this.$store.dispatch('deleteRecordContainer', {
viewUuid: this.$route
})
}
} else { } else {
this.showNotification({ this.showNotification({
type: 'warning', type: 'warning',

View File

@ -4,8 +4,7 @@
<el-container style="height: 100%;"> <el-container style="height: 100%;">
<el-header :style="tableHeaderStyle"> <el-header :style="tableHeaderStyle">
<el-collapse <el-collapse
v-if="isParent && isAdvancedQuery" v-if="isParent"
v-show="isAdvancedQuery"
v-model="activeName" v-model="activeName"
v-shortkey="{ f6: ['f6'], ctrlf: ['ctrl', 'f'] }" v-shortkey="{ f6: ['f6'], ctrlf: ['ctrl', 'f'] }"
@shortkey.native="actionAdvancedQuery()" @shortkey.native="actionAdvancedQuery()"
@ -227,7 +226,7 @@
<el-pagination <el-pagination
small small
layout="slot, total, prev, pager, next" layout="slot, total, prev, pager, next"
:current-page="currentPage" :current-page="pageNumber"
:page-size="defaultMaxPagination" :page-size="defaultMaxPagination"
:total="getterRecordCount" :total="getterRecordCount"
@current-change="handleChangePage" @current-change="handleChangePage"
@ -305,7 +304,8 @@ export default {
}, },
data() { data() {
const activeName = [] const activeName = []
if (this.$route.query.action) { // TODO: Manage attribute with vuex store in window module
if (this.isParent && this.$route.query.action && this.$route.query.action === 'advancedQuery') {
activeName.push('1') activeName.push('1')
} }
return { return {
@ -317,15 +317,12 @@ export default {
visible: this.getShowContextMenuTable, visible: this.getShowContextMenuTable,
searchTable: '', // text from search searchTable: '', // text from search
defaultMaxPagination: 50, defaultMaxPagination: 50,
menuTable: '1',
activeName, activeName,
isLoadPanelFromServer: false, isLoadPanelFromServer: false,
rowStyle: { height: '52px' }, rowStyle: { height: '52px' },
sortable: null, sortable: null,
currentPage: 1,
uuidCurrentRecordSelected: '', uuidCurrentRecordSelected: '',
showTableSearch: false, showTableSearch: false
isAdvancedQuery: true
} }
}, },
computed: { computed: {
@ -346,9 +343,6 @@ export default {
getShowContextMenuTabChildren() { getShowContextMenuTabChildren() {
return this.$store.getters.getShowContextMenuTabChildren return this.$store.getters.getShowContextMenuTabChildren
}, },
getterFieldList() {
return this.$store.getters.getFieldsListFromPanel(this.containerUuid)
},
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'
}, },
@ -376,7 +370,7 @@ export default {
} }
return 0 return 0
}, },
getPageNumber() { pageNumber() {
return this.getterDataRecordsAndSelection.pageNumber return this.getterDataRecordsAndSelection.pageNumber
}, },
isLoaded() { isLoaded() {
@ -402,7 +396,7 @@ export default {
return this.$store.getters.getHeigth return this.$store.getters.getHeigth
}, },
tableHeaderStyle() { tableHeaderStyle() {
if (this.isAdvancedQuery) { if (this.isParent) {
if (!this.isEmptyValue(this.activeName)) { if (!this.isEmptyValue(this.activeName)) {
return { return {
height: '55%', height: '55%',
@ -415,34 +409,34 @@ export default {
} }
} }
return { return {
height: '5%' height: '35px'
} }
}, },
getHeigthTable() { getHeigthTable() {
let totalRow = 0 let totalRow = 0
// to refresh height table if changed isShowedTotals
if (this.getterPanel.isShowedTotals) { if (this.getterPanel.isShowedTotals) {
totalRow = 27 totalRow = 5
} }
if (this.isPanelWindow) { if (this.isPanelWindow) {
// table record navigation // table record navigation
if (this.isParent) { if (this.isParent) {
if (this.isAdvancedQuery) {
if (this.isEmptyValue(this.activeName)) { if (this.isEmptyValue(this.activeName)) {
return this.getterHeight - 220 - totalRow return this.getterHeight - 210 - totalRow
} }
// panel advanced query is showed
return this.getterHeight - 420 - totalRow return this.getterHeight - 420 - totalRow
} }
return this.getterHeight - 180 - totalRow // tabs children
if (totalRow) {
totalRow = 1
} }
if (!this.activeName.length) { return (this.getHeightPanelBottom - 5 - totalRow) + 'vh'
return (this.getHeightPanelBottom - 7) + 'vh'
}
return this.getterHeight - 220 - totalRow
} else if (this.panelType === 'browser') { } else if (this.panelType === 'browser') {
// open browser criteria // open browser criteria
if (this.getterIsShowedCriteria) { if (this.getterIsShowedCriteria) {
// showed some field query criteria // showed some field in panel query criteria
if (this.getterFieldIsDisplayed.isDisplayed) { if (this.getterFieldIsDisplayed.isDisplayed) {
return this.getterHeight - 495 - totalRow return this.getterHeight - 495 - totalRow
} }
@ -467,18 +461,12 @@ export default {
} }
return false return false
}, },
windowFields() {
if (this.isAdvancedQuery) {
return this.$store.getters.getPanelParameters(this.containerUuid, false, [], this.isAdvancedQuery).params
}
return undefined
},
isPanelWindow() { isPanelWindow() {
return Boolean(this.panelType === 'window') return Boolean(this.panelType === 'window')
}, },
getterContextClientId() { getterContextClientId() {
if (this.isPanelWindow) { if (this.isPanelWindow) {
return parseInt(this.$store.getters.getContextClientId, 10) return this.$store.getters.getContextClientId
} }
return undefined return undefined
}, },
@ -515,9 +503,6 @@ export default {
} }
return false return false
}, },
permissionRoutes() {
return this.$store.getters.permission_routes
},
keyUp() { keyUp() {
if (this.currentTable < 1) { if (this.currentTable < 1) {
return this.currentTable return this.currentTable
@ -544,9 +529,6 @@ export default {
created() { created() {
this.getPanel() this.getPanel()
}, },
beforeMount() {
this.currentPage = this.getPageNumber
},
mounted() { mounted() {
if (this.isTableSelection) { if (this.isTableSelection) {
this.toggleSelection(this.getDataSelection) this.toggleSelection(this.getDataSelection)
@ -563,12 +545,6 @@ export default {
setCurrent(row) { setCurrent(row) {
this.$refs.multipleTable.setCurrentRow(row) this.$refs.multipleTable.setCurrentRow(row)
}, },
logArrayElements(element, index, array) {
if (index === this.currentTable) {
this.handleRowClick(this.getterDataRecords[index])
return this.setCurrent(this.getterDataRecords[index])
}
},
theAction(event) { theAction(event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'up': case 'up':
@ -581,14 +557,6 @@ export default {
this.handleRowClick(this.getterDataRecords[this.currentTable]) this.handleRowClick(this.getterDataRecords[this.currentTable])
return this.setCurrent(this.getterDataRecords[this.currentTable]) return this.setCurrent(this.getterDataRecords[this.currentTable])
}, },
sortTab(actionSequence) {
// TODO: Refactor and remove redundant dispatchs
this.$store.dispatch('setShowDialog', {
type: 'window',
action: actionSequence,
parentRecordUuid: this.$route.query.action
})
},
closeMenu() { closeMenu() {
this.$store.dispatch('showMenuTable', { this.$store.dispatch('showMenuTable', {
isShowedTable: false isShowedTable: false
@ -709,7 +677,7 @@ export default {
}, },
isReadOnlyCell(row, field) { isReadOnlyCell(row, field) {
// TODO: Add support to its type fields // TODO: Add support to its type fields
if (field.componentPath === 'FieldImage' || field.componentPath === 'FieldBinary') { if (['FieldImage', 'FieldBinary'].includes(field.componentPath)) {
return true return true
} }
@ -734,11 +702,13 @@ export default {
parentUuid: this.parentUuid, parentUuid: this.parentUuid,
containerUuid: this.containerUuid containerUuid: this.containerUuid
}) })
.then(() => {
this.$store.dispatch('setRecordSelection', { this.$store.dispatch('setRecordSelection', {
parentUuid: this.parentUuid, parentUuid: this.parentUuid,
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
panelType: this.panelType panelType: this.panelType
}) })
})
}, },
callOffNewRecord() { callOffNewRecord() {
this.getterDataRecords.shift() this.getterDataRecords.shift()
@ -1012,27 +982,6 @@ export default {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus() this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
} }
}, },
activeAdvancedQuery(value) {
this.isAdvancedQuery = value
if (value) {
this.$store.dispatch('setOldAction', this.$route.query.action)
this.$router.push({
query: {
...this.$route.query,
action: 'advancedQuery'
}
})
}
if (!value) {
const oldAction = this.$store.getters.getOldAction
this.$router.push({
query: {
...this.$route.query,
action: oldAction
}
})
}
},
getFieldDefinition(fieldDefinition, row) { getFieldDefinition(fieldDefinition, row) {
let styleSheet = '' let styleSheet = ''
if (fieldDefinition && (fieldDefinition.id !== null || fieldDefinition.conditionsList.length)) { if (fieldDefinition && (fieldDefinition.id !== null || fieldDefinition.conditionsList.length)) {

View File

@ -12,7 +12,7 @@
> >
{{ $t('components.contextMennuWindowReport') }} {{ $t('components.contextMennuWindowReport') }}
</template> </template>
<template v-for="(format, index) in option"> <template v-for="(format, index) in supportedTypes">
<el-menu-item <el-menu-item
:key="index" :key="index"
:index="index" :index="index"
@ -31,7 +31,7 @@
v-for="(process, key) in processMenu" v-for="(process, key) in processMenu"
:key="key" :key="key"
index="process" index="process"
@click="tableProcess(process)" @click="showModalTable(process)"
> >
{{ process.name }} {{ process.name }}
</el-menu-item> </el-menu-item>

View File

@ -29,7 +29,7 @@
:key="key" :key="key"
:disabled="Boolean(getDataSelection.length < 1)" :disabled="Boolean(getDataSelection.length < 1)"
index="process" index="process"
@click="tableProcess(process)" @click="showModalTable(process)"
> >
{{ process.name }} {{ process.name }}
</el-menu-item> </el-menu-item>
@ -45,7 +45,7 @@
<template slot="title"> <template slot="title">
{{ $t('table.dataTable.exportRecordTable') }} {{ $t('table.dataTable.exportRecordTable') }}
</template> </template>
<template v-for="(format, index) in option"> <template v-for="(format, index) in supportedTypes">
<el-menu-item :key="index" :index="index"> <el-menu-item :key="index" :index="index">
{{ format }} {{ format }}
</el-menu-item> </el-menu-item>

View File

@ -44,20 +44,12 @@ export const menuTableMixin = {
}, },
data() { data() {
return { return {
option: supportedTypes, supportedTypes,
typoFormatExport: [],
menuTable: '1', menuTable: '1',
isCollapse: true, isCollapse: true
visible: false
} }
}, },
computed: { computed: {
isProcessTable() {
if (this.processMenu) {
return true
}
return false
},
classTableMenu() { classTableMenu() {
if (this.isMobile) { if (this.isMobile) {
return 'menu-table-mobile' return 'menu-table-mobile'
@ -160,11 +152,6 @@ export const menuTableMixin = {
return fieldItem.columnName return fieldItem.columnName
}) })
}, },
gettersRecordContextMenu() {
const record = []
record.push(this.isOption)
return record
},
permissionRoutes() { permissionRoutes() {
return this.$store.getters.permission_routes return this.$store.getters.permission_routes
} }
@ -179,7 +166,7 @@ export const menuTableMixin = {
isShowedTabChildren: false isShowedTabChildren: false
}) })
}, },
showModal(process) { showModalTable(process) {
const processData = this.$store.getters.getProcess(process.uuid) const processData = this.$store.getters.getProcess(process.uuid)
if (!this.isOption) { if (!this.isOption) {
this.$store.dispatch('setProcessSelect', { this.$store.dispatch('setProcessSelect', {
@ -222,9 +209,6 @@ export const menuTableMixin = {
}) })
} }
}, },
tableProcess(process) {
this.showModal(process)
},
showTotals() { showTotals() {
this.$store.dispatch('changePanelAttributesBoolean', { this.$store.dispatch('changePanelAttributesBoolean', {
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
@ -277,10 +261,6 @@ export const menuTableMixin = {
attributeName: 'isShowedTableOptionalColumns' attributeName: 'isShowedTableOptionalColumns'
}) })
}, },
fixedPanel() {
this.showTableSearch = false
this.isFixed = !this.isFixed
},
typeFormat(key, keyPath) { typeFormat(key, keyPath) {
Object.keys(supportedTypes).forEach(type => { Object.keys(supportedTypes).forEach(type => {
if (type === key) { if (type === key) {

View File

@ -1,5 +1,5 @@
<template> <template>
<el-col v-if="items.children" :span="24"> <el-col v-if="items.children" key="is-desktop-dropdown" :span="24">
<el-collapse v-model="activeNames"> <el-collapse v-model="activeNames">
<el-collapse-item :title="title" name="1" class="collapse-item"> <el-collapse-item :title="title" name="1" class="collapse-item">
<el-row justify="space-around"> <el-row justify="space-around">
@ -26,7 +26,7 @@
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</el-col> </el-col>
<el-col v-else :span="isMobile"> <el-col v-else key="is-mobile-dropdown" :span="isMobile">
<el-card <el-card
shadow="never" shadow="never"
class="custom-card" class="custom-card"
@ -71,9 +71,8 @@ export default {
isMobile() { isMobile() {
if (this.device === 'mobile') { if (this.device === 'mobile') {
return 24 return 24
} else {
return 8
} }
return 8
} }
}, },
methods: { methods: {
@ -81,11 +80,11 @@ export default {
if (item.meta && item.meta.type === 'window') { if (item.meta && item.meta.type === 'window') {
this.$router.push({ this.$router.push({
name: item.name, name: item.name,
query: {
tabParent: 0
},
params: { params: {
childs: item.children childs: item.children
},
query: {
tabParent: 0
} }
}) })
} else { } else {

View File

@ -209,11 +209,12 @@ export default {
}) })
.then(responseLookupItem => { .then(responseLookupItem => {
if (this.isPanelWindow) { if (this.isPanelWindow) {
this.$store.dispatch('notifyFieldChangeDisplayColumn', { this.$store.dispatch('changeFieldAttribure', {
containerUuid: this.metadata.containerUuid, containerUuid: this.metadata.containerUuid,
isAdvancedQuery: this.metadata.isAdvancedQuery, isAdvancedQuery: this.metadata.isAdvancedQuery,
columnName: this.metadata.columnName, columnName: this.metadata.columnName,
displayColumn: responseLookupItem.label attributeName: 'displayColumn',
attributeValue: responseLookupItem.label
}) })
} }
this.options = this.getterLookupAll this.options = this.getterLookupAll

View File

@ -37,7 +37,7 @@
<field-translated <field-translated
v-if="field.isTranslated && !isAdvancedQuery" v-if="field.isTranslated && !isAdvancedQuery"
:field-attributes="fieldAttributes" :field-attributes="fieldAttributes"
:record-uuid="field.optionCRUD" :record-uuid="field.recordUuid"
/> />
</template> </template>
<component <component
@ -73,7 +73,7 @@ import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
* reference (or type of visualization) of each field * reference (or type of visualization) of each field
*/ */
export default { export default {
name: 'Field', name: 'FieldDefinition',
components: { components: {
FieldContextInfo, FieldContextInfo,
FieldTranslated, FieldTranslated,
@ -88,10 +88,6 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
metadataUuid: {
type: String,
default: undefined
},
panelType: { panelType: {
type: String, type: String,
default: 'window' default: 'window'
@ -277,8 +273,9 @@ export default {
return true return true
} }
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new // edit mode is diferent to create new
let isWithRecord = this.field.optionCRUD !== 'create-new' let isWithRecord = this.field.recordUuid !== 'create-new'
if (this.inTable) { if (this.inTable) {
isWithRecord = !this.isEmptyValue(this.field.recordUuid) isWithRecord = !this.isEmptyValue(this.field.recordUuid)
} }

View File

@ -1,277 +0,0 @@
<template>
<div v-if="showDetail">
<div class="container">
<!-- down button -->
<div class="show">
<el-button
v-if="!showPanel && !this.$store.state.app.sidebar.opened "
class="el-icon-arrow-up button-up btn"
:circle="true"
@click="handleChange()"
/>
<el-button
v-if="!showPanel && this.$store.state.app.sidebar.opened "
class="el-icon-arrow-up button-up2 btn"
:circle="true"
@click="handleChange()"
/>
</div>
<!-- panel show -->
<div :class="classContainer()">
<el-collapse-transition>
<div v-show="showPanel">
<el-button
class="el-icon-arrow-down button-bottom btn"
:circle="true"
@click="handleChange()"
/>
<slot />
</div>
</el-collapse-transition>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'PanelDetail',
props: {
isEdit: {
type: Boolean,
default: false
},
showDetail: {
type: Boolean,
default: true
},
panelType: {
type: String,
default: 'window'
},
containerUuid: {
type: String,
default: undefined
},
isShowedDetail: {
type: Boolean,
default: true
}
},
data() {
return {
showPanel: this.isShowedDetail
}
},
methods: {
classContainer() {
if (this.$store.state.app.device === 'mobile') {
return 'container-panel-mobile'
} else if (this.$store.state.app.sidebar.opened) {
return 'container-panel-open'
} else if (!this.$store.state.app.sidebar.opened) {
return 'container-panel-close'
}
return 'container-panel'
},
classButtom() {
if (this.$store.state.app.device === 'mobile') {
return 'container-panel-mobile'
} else if (this.$store.state.app.sidebar.opened) {
return 'el-icon-arrow-down button-bottom btn'
} else if (!this.$store.state.app.sidebar.opened) {
return 'el-icon-arrow-down button-bottom2 btn'
}
},
handleChange() {
this.showPanel = !this.showPanel
this.$store.dispatch('changeShowedDetail', {
panelType: this.panelType,
containerUuid: this.containerUuid,
isShowedDetail: this.showPanel
})
}
}
}
</script>
<style lang="scss" scoped>
@import "~@/styles/variables.scss";
.container {
bottom: 0;
right: 0;
z-index: 0;
width: calc(111% - 200px);
transition: width 0.28s;
position: fixed;
height: 20px;
display: flex;
color: #424242;
}
.show {
position: absolute;
bottom: 0;
color: #FFF;
width: 100%;
height: 300px;
transition: all 0.5s ease-in;
display: flex;
}
.container-open {
bottom: 0;
right: 0;
z-index: 0;
width: 100%;
transition: width 0.28s;
position: fixed;
height: 20px;
display: flex;
color: #424242;
}
.show-open {
position: absolute;
bottom: 0;
color: #FFF;
width: 100%;
height: 300px;
transition: all 0.5s ease-in;
display: flex;
}
.container:hover .show {
height: 30px;
}
.btn {
animation-name: btn;
position: relative;
transition-delay: 0.6s;
visibility: hidden;
/* right: 50%; */
}
.container:hover .btn {
visibility: visible;
}
.el-tabs__content {
overflow: hidden;
position: relative;
padding-top: 0px;
padding-left: 15px;
padding-right: 15px;
}
.btn-base :hover {
box-shadow: 5px #5a5a5a;
}
.tab-window {
z-index: 9;
}
.container-panel {
position: fixed;
bottom: 0;
right: 0;
z-index: 0;
width: calc(100% - 54px);
/* height: 40%; */
transition: width 0.28s;
}
.container-panel-movil {
position: fixed;
bottom: 0;
right: 0;
z-index: 0;
width: 100%;
height: 60%;
transition: width 0.28s;
}
.container-panel-mobile {
position: fixed;
bottom: 0;
right: 0;
z-index: 0;
width: 100%;
transition: width 0.28s;
}
.container-panel-open {
position: fixed;
bottom: 0;
right: 0;
z-index: 0;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
.container-panel-close {
position: fixed;
bottom: 0;
right: 0;
z-index: 0;
width: calc(100% - 2em);
transition: width 0.28s;
}
.container-up {
right: 50%;
}
.show {
position: absolute;
bottom: 0;
color: #FFF;
width: 100%;
height: 0px;
transition: all 0.5s ease-in;
display: flex;
justify-content: center;
align-items: center;
}
.button-bottom {
bottom: 50%;
z-index: 2;
position: relative;
margin: 0 auto;
left: 45%;
}
.button-bottom2 {
bottom: 50%;
z-index: 2;
position: relative;
margin: 0 auto;
left: 45%;
}
.button-up {
bottom: 0;
position: fixed;
left: 48%;
margin: 0 auto;
}
.button-up2 {
bottom: 0;
position: fixed;
left: 57%;
margin: 0 auto;
}
.btn-base {
width: 100%;
position: fixed;
background: #ffffff;
color: #606266;
-webkit-appearance: none;
text-align: center;
outline: 0;
font-size: 14px;
}
.btn-base :hover {
box-shadow: 5px #5a5a5a;
}
.el-row {
margin-bottom: 20px;
}
.el-col {
border-radius: 4px;
left: 10px;
}
.el-main {
background-color: #E9EEF3;
color: #333;
text-align: center;
width: 100%;
}
</style>

View File

@ -28,7 +28,7 @@
/> />
</div> </div>
<el-card <el-card
:shadow="isMobile ? 'never' : 'hover'" :shadow="shadowGroup"
:body-style="{ padding: '10px' }" :body-style="{ padding: '10px' }"
> >
<el-row :gutter="gutterRow"> <el-row :gutter="gutterRow">
@ -40,7 +40,8 @@
:container-uuid="containerUuid" :container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD optionCRUD,
recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType" :panel-type="panelType"
@ -72,7 +73,7 @@
class="card" class="card"
> >
<el-card <el-card
:shadow="isMobile ? 'never' : 'hover'" :shadow="shadowGroup"
:body-style="{ padding: '10px' }" :body-style="{ padding: '10px' }"
> >
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@ -98,7 +99,8 @@
:container-uuid="containerUuid" :container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD optionCRUD,
recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType" :panel-type="panelType"
@ -125,7 +127,7 @@
class="card" class="card"
> >
<el-card <el-card
:shadow="isMobile ? 'never' : 'hover'" :shadow="shadowGroup"
:body-style="{ padding: '10px' }" :body-style="{ padding: '10px' }"
> >
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@ -150,7 +152,8 @@
:container-uuid="containerUuid" :container-uuid="containerUuid"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
optionCRUD optionCRUD,
recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType" :panel-type="panelType"
@ -239,6 +242,12 @@ export default {
} }
}, },
computed: { computed: {
shadowGroup() {
if (this.isMobile) {
return 'never'
}
return 'hover'
},
optionCRUD() { optionCRUD() {
return this.isEmptyValue(this.uuidRecord) ? 'create-new' : this.uuidRecord return this.isEmptyValue(this.uuidRecord) ? 'create-new' : this.uuidRecord
}, },
@ -251,12 +260,14 @@ export default {
} }
return false return false
}, },
getterPanel() {
return this.$store.getters.getPanel(this.containerUuid, this.isAdvancedQuery)
},
getterFieldList() { getterFieldList() {
const panel = this.$store.getters.getPanel(this.containerUuid, this.isAdvancedQuery) if (this.getterPanel) {
if (panel) { return this.getterPanel.fieldList
return panel.fieldList
} }
return panel return undefined
}, },
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'
@ -271,20 +282,9 @@ export default {
record: [] record: []
} }
}, },
getterTotalDataRecordCount() {
return this.getterDataStore.recordCount
},
getterIsLoadedRecord() { getterIsLoadedRecord() {
return this.getterDataStore.isLoaded return this.getterDataStore.isLoaded
}, },
getterRowData() {
if (this.isPanelWindow) {
if (!this.isEmptyValue(this.uuidRecord) && this.uuidRecord !== 'create-new') {
return this.$store.getters.getRowData(this.containerUuid, this.uuidRecord)
}
}
return false
},
classCards() { classCards() {
if (this.isMobile || this.fieldGroups.length < 2 || this.getterIsShowedRecordNavigation) { if (this.isMobile || this.fieldGroups.length < 2 || this.getterIsShowedRecordNavigation) {
return 'cards-not-group' return 'cards-not-group'
@ -299,14 +299,6 @@ export default {
this.generatePanel(this.metadata.fieldList) this.generatePanel(this.metadata.fieldList)
} }
}, },
// used if the first load contains a uuid
isLoadRecord(value) {
// TODO: Validate UUID value
if (value && this.isPanelWindow && this.uuidRecord !== 'create-new' &&
!this.isEmptyValue(this.uuidRecord)) {
this.setTagsViewTitle(this.uuidRecord)
}
},
'$route.query.action'(newValue, oldValue) { '$route.query.action'(newValue, oldValue) {
// used in field, if uuid record or different create-new, field is read only // used in field, if uuid record or different create-new, field is read only
this.uuidRecord = newValue this.uuidRecord = newValue
@ -317,7 +309,7 @@ export default {
}, },
isLoadPanel(value) { isLoadPanel(value) {
if (value) { if (value) {
this.readParameters(this.$route) this.readParameters()
} }
} }
}, },
@ -364,7 +356,7 @@ export default {
/** /**
* TODO: Delete route parameters after reading them * TODO: Delete route parameters after reading them
*/ */
readParameters(route) { readParameters() {
var parameters = { var parameters = {
isLoadAllRecords: true, isLoadAllRecords: true,
isReference: false, isReference: false,
@ -372,6 +364,7 @@ export default {
isWindow: true, isWindow: true,
criteria: {} criteria: {}
} }
const route = this.$route
if (this.isPanelWindow) { if (this.isPanelWindow) {
// TODO: use action notifyPanelChange with isShowedField in true // TODO: use action notifyPanelChange with isShowedField in true
this.getterFieldList.forEach(fieldItem => { this.getterFieldList.forEach(fieldItem => {
@ -415,7 +408,8 @@ export default {
parameters.criteria[param] = route.params[param] parameters.criteria[param] = route.params[param]
} }
}) })
} else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery' && route.query.action !== 'criteria') { } else if (!this.isEmptyValue(route.query.action) &&
!['create-new', 'reference', 'advancedQuery', 'criteria'].includes(route.query.action)) {
parameters.isLoadAllRecords = false parameters.isLoadAllRecords = false
parameters.value = route.query.action parameters.value = route.query.action
parameters.tableName = this.metadata.tableName parameters.tableName = this.metadata.tableName
@ -458,7 +452,7 @@ export default {
fieldList: this.fieldList, fieldList: this.fieldList,
panelType: this.panelType panelType: this.panelType
}) })
} else if (this.panelType === 'process' || this.panelType === 'browser') { } else if (['process', 'browser'].includes(this.panelType)) {
if (!this.isEmptyValue(route.query)) { if (!this.isEmptyValue(route.query)) {
this.$store.dispatch('notifyPanelChange', { this.$store.dispatch('notifyPanelChange', {
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
@ -495,9 +489,10 @@ export default {
name: this.$route.name, name: this.$route.name,
query: { query: {
...this.$route.query, ...this.$route.query,
action: this.dataRecordsq action: this.dataRecords
}, },
params: { params: {
...this.$route.params,
tableName: this.metadata.tableName, tableName: this.metadata.tableName,
recordId: this.dataRecords[`${this.metadata.tableName}_ID`] recordId: this.dataRecords[`${this.metadata.tableName}_ID`]
} }
@ -560,7 +555,6 @@ export default {
} }
}) })
} }
this.setFocus()
}) })
} }
}, },
@ -616,16 +610,17 @@ export default {
return groupsList return groupsList
}, },
setTagsViewTitle(actionValue) { setTagsViewTitle(actionValue) {
if (actionValue === 'create-new' || actionValue === '') { if (actionValue === 'create-new' || this.isEmptyValue(actionValue)) {
this.tagTitle.action = this.$t('tagsView.newRecord') this.tagTitle.action = this.$t('tagsView.newRecord')
} else if (actionValue === 'advancedQuery') { } else if (actionValue === 'advancedQuery') {
this.tagTitle.action = this.$t('tagsView.advancedQuery') this.tagTitle.action = this.$t('tagsView.advancedQuery')
} else { } else {
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier) const { identifierColumns } = this.getterPanel
if (field) { if (!this.isEmptyValue(identifierColumns)) {
if (this.dataRecords[field.columnName]) { if (this.dataRecords[identifierColumns[0]]) {
this.tagTitle.action = this.dataRecords[field.columnName] this.tagTitle.action = this.dataRecords[identifierColumns[0]]
} else { } else {
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier)
this.tagTitle.action = field.value this.tagTitle.action = field.value
} }
} else { } else {
@ -644,7 +639,7 @@ export default {
}, },
changePanelRecord(uuidRecord) { changePanelRecord(uuidRecord) {
if (!['create-new', 'reference', 'advancedQuery', 'criteria'].includes(uuidRecord)) { if (!['create-new', 'reference', 'advancedQuery', 'criteria'].includes(uuidRecord)) {
const recordSelected = this.$store.getters.getDataRecordsList(this.containerUuid).find(record => record.UUID === uuidRecord) const recordSelected = this.getterDataStore.record.find(record => record.UUID === uuidRecord)
if (recordSelected) { if (recordSelected) {
this.dataRecords = recordSelected this.dataRecords = recordSelected
this.$store.dispatch('notifyPanelChange', { this.$store.dispatch('notifyPanelChange', {
@ -656,11 +651,13 @@ export default {
fieldList: this.fieldList, fieldList: this.fieldList,
panelType: this.panelType panelType: this.panelType
}).then(() => { }).then(() => {
if (this.getterPanel.isTabsChildren) {
// delete records tabs children when change record uuid // delete records tabs children when change record uuid
this.$store.dispatch('deleteRecordContainer', { this.$store.dispatch('deleteRecordContainer', {
viewUuid: this.parentUuid, viewUuid: this.parentUuid,
withOut: [this.containerUuid] withOut: [this.containerUuid]
}) })
}
}) })
} }
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<el-tabs v-model="currentTab" type="border-card" :before-leave="handleBeforeLeave" @tab-click="handleClick"> <el-tabs v-model="currentTab" type="border-card" :before-leave="handleBeforeLeave" @tab-click="handleClick">
<template v-for="(tabAttributes, key) in getTabsList"> <template v-for="(tabAttributes, key) in tabsList">
<el-tab-pane <el-tab-pane
:key="key" :key="key"
:label="tabAttributes.name" :label="tabAttributes.name"
@ -9,7 +9,7 @@
:name="String(key)" :name="String(key)"
lazy lazy
:disabled="Boolean(key > 0 && isCreateNew)" :disabled="Boolean(key > 0 && isCreateNew)"
:style="isShowedDetail ? { height: '100%', overflow: 'hidden' } : { height: '75vh', overflow: 'auto' }" :style="tabParentStyle"
> >
<main-panel <main-panel
:parent-uuid="windowUuid" :parent-uuid="windowUuid"
@ -17,7 +17,6 @@
:metadata="tabAttributes" :metadata="tabAttributes"
:group-tab="tabAttributes.tabGroup" :group-tab="tabAttributes.tabGroup"
:panel-type="panelType" :panel-type="panelType"
:is-re-search="Boolean(key == 0 || (key > 0 && firstTableName != tabAttributes.tableName))"
/> />
</el-tab-pane> </el-tab-pane>
</template> </template>
@ -35,19 +34,30 @@ export default {
}, },
mixins: [tabMixin], mixins: [tabMixin],
computed: { computed: {
getWindow() {
return this.$store.getters.getWindow(this.windowUuid)
},
// if tabs children is showed or closed // if tabs children is showed or closed
isShowedDetail() { isShowedTabsChildren() {
const window = this.$store.getters.getWindow(this.windowUuid) return this.getWindow.isShowedTabsChildren
if (window) { },
return window.isShowedDetail tabParentStyle() {
if (this.isShowedTabsChildren) {
return {
height: '100%',
overflow: 'hidden'
}
}
return {
height: '75vh',
overflow: 'auto'
} }
return undefined
} }
}, },
watch: { watch: {
// TODO: Remove watchers of action, and pased as props from window // TODO: Remove watchers of action, and pased as props from window
'$route.query.action'(actionValue) { '$route.query.action'(actionValue) {
if (actionValue === 'create-new') { if (this.isEmptyValue(actionValue) || actionValue === 'create-new') {
this.currentTab = '0' this.currentTab = '0'
} }
}, },

View File

@ -1,7 +1,6 @@
<template> <template>
<el-tabs v-model="currentTabChild" type="border-card" @tab-click="handleClick"> <el-tabs v-model="currentTabChild" type="border-card" @tab-click="handleClick">
<template v-for="(tabAttributes, key) in getTabsList"> <template v-for="(tabAttributes, key) in tabsList">
<!-- TODO: Add support to tabs isSortTab (sequence) -->
<el-tab-pane <el-tab-pane
:key="key" :key="key"
:label="tabAttributes.name" :label="tabAttributes.name"
@ -74,6 +73,18 @@ export default {
} }
}) })
} }
},
// Refrest the records of the TabChildren
getDataSelection(value) {
if (!value.isLoaded && this.getterIsLoadContextParent && this.getterIsLoadRecordParent) {
this.getDataTable()
}
},
// Load parent tab context
getterIsLoadContextParent(value) {
if (value && !this.getDataSelection.isLoaded && this.getterIsLoadRecordParent) {
this.getDataTable()
}
} }
}, },
mounted() { mounted() {

View File

@ -22,31 +22,10 @@ export const tabMixin = {
computed: { computed: {
isCreateNew() { isCreateNew() {
return Boolean(this.$route.query.action === 'create-new') return Boolean(this.$route.query.action === 'create-new')
},
getterDataRecords() {
return this.$store.getters.getDataRecordsList(this.tabUuid)
},
getTabsList() {
return this.tabsList.filter(tab => !tab.isSortTab)
}
},
watch: {
// Refrest the records of the TabChildren
getDataSelection(value) {
if (!value.isLoaded && this.getterIsLoadContextParent && this.getterIsLoadRecordParent) {
this.getDataTable()
}
},
// Load parent tab context
getterIsLoadContextParent(value) {
if (value && !this.getDataSelection.isLoaded && this.getterIsLoadRecordParent) {
this.getDataTable()
}
} }
}, },
created() { created() {
const tabs = this.tabsList.filter(item => !item.isSortTab) this.tabUuid = this.tabsList[0].uuid
this.tabUuid = tabs[0].uuid
}, },
methods: { methods: {
parseContext, parseContext,
@ -74,9 +53,7 @@ export const tabMixin = {
} }
}, },
handleBeforeLeave(activeName) { handleBeforeLeave(activeName) {
const metadataTab = this.tabsList const metadataTab = this.tabsList.find(tab => tab.index === parseInt(activeName), 10)
.filter(tab => !tab.isSortTab)
.find(tab => tab.index === parseInt(activeName))
if (!this.isEmptyValue(metadataTab.whereClause) && metadataTab.whereClause.includes('@')) { if (!this.isEmptyValue(metadataTab.whereClause) && metadataTab.whereClause.includes('@')) {
metadataTab.whereClause = parseContext({ metadataTab.whereClause = parseContext({
parentUuid: metadataTab.parentUuid, parentUuid: metadataTab.parentUuid,

View File

@ -17,6 +17,31 @@ export default {
}, },
key() { key() {
return this.$route.path return this.$route.path
},
openRoute() {
return this.$store.state.utils.openRoute
}
},
created() {
this.readRouteParameters()
},
methods: {
readRouteParameters() {
if (this.$store.getters.getIsLoadedOpenRoute) {
return
}
this.$store.dispatch('setOpenRoute', {
path: this.$route.path,
name: this.$route.name,
fullPath: this.$route.fullPath,
params: {
...this.$route.params
},
query: {
...this.$route.query
},
isLoaded: true
})
} }
} }
} }

View File

@ -107,14 +107,13 @@ export default {
generateTitle, // generateTitle by vue-i18n generateTitle, // generateTitle by vue-i18n
isActive(route) { isActive(route) {
if (route.name === 'Report Viewer') { if (route.name === 'Report Viewer') {
if (route.params.processId === this.$route.params.processId && route.params.tableName === this.$route.params.tableName) { const isSameProcess = route.params.processId === this.$route.params.processId
return route.params.processId === this.$route.params.processId if (isSameProcess && route.params.tableName === this.$route.params.tableName) {
} else { return isSameProcess
}
return route.path === this.$route.path return route.path === this.$route.path
} }
} else {
return route.name === this.$route.name return route.name === this.$route.name
}
}, },
isAffix(tag) { isAffix(tag) {
return tag.meta && tag.meta.affix return tag.meta && tag.meta.affix
@ -190,26 +189,33 @@ export default {
}) })
}, },
closeSelectedTag(view) { closeSelectedTag(view) {
if (view.meta && view.meta.uuid && view.meta.type) {
this.$store.dispatch('resetPanelToNew', {
parentUuid: view.meta.type !== 'window' ? undefined : view.meta.uuid,
containerUuid: view.meta.type === 'window' ? view.meta.tabUuid : view.meta.uuid,
panelType: view.meta.type,
isNewRecord: false
})
if (view.meta.type === 'window' || view.meta.type === 'browser') {
this.$store.dispatch('deleteRecordContainer', {
viewUuid: view.meta.uuid
})
if (view.meta.type === 'window') {
this.$store.dispatch('setWindowOldRoute')
}
}
}
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) { if (this.isActive(view)) {
this.toLastView(visitedViews, view) this.toLastView(visitedViews, view)
} }
}).finally(() => {
if (view.meta && view.meta.uuid && view.meta.type) {
let parentUuid
let containerUuid = view.meta.uuid
if (view.meta.type === 'window') {
parentUuid = view.meta.uuid
containerUuid = view.meta.tabUuid
this.$store.dispatch('setWindowOldRoute')
}
this.$store.dispatch('resetPanelToNew', {
parentUuid,
containerUuid,
panelType: view.meta.type,
isNewRecord: false
})
if (['window', 'browser'].includes(view.meta.type)) {
this.$store.dispatch('deleteRecordContainer', {
viewUuid: view.meta.uuid
})
}
}
}) })
}, },
closeOthersTags() { closeOthersTags() {

View File

@ -1,8 +1,10 @@
import { getBrowser as getBrowserMetadata } from '@/api/ADempiere/dictionary' import { getBrowser as getBrowserMetadata } from '@/api/ADempiere/dictionary'
import { isEmptyValue, showMessage } from '@/utils/ADempiere' import { showMessage } from '@/utils/ADempiere/notification'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { generateField } from '@/utils/ADempiere/dictionaryUtils' import { generateField } from '@/utils/ADempiere/dictionaryUtils'
import router from '@/router' import router from '@/router'
import language from '@/lang' import language from '@/lang'
const browser = { const browser = {
state: { state: {
browser: [] browser: []
@ -14,8 +16,8 @@ const browser = {
dictionaryResetCacheBrowser(state) { dictionaryResetCacheBrowser(state) {
state.browser = [] state.browser = []
}, },
changeShowedCriteriaBrowser(state, payload) { changeBrowser(state, payload) {
payload.browser.isShowedCriteria = payload.isShowedCriteria payload.browser = payload.newBrowser
} }
}, },
actions: { actions: {
@ -28,8 +30,8 @@ const browser = {
.then(browserResponse => { .then(browserResponse => {
const panelType = 'browser' const panelType = 'browser'
const additionalAttributes = { const additionalAttributes = {
containerUuid: browserResponse.uuid, containerUuid,
panelType: panelType panelType
} }
const { const {
query, query,
@ -90,17 +92,6 @@ const browser = {
}) })
}) })
// Panel for save on store
const newBrowser = {
...browserResponse,
containerUuid: browserResponse.uuid,
fieldList: fieldsList,
panelType: panelType,
// app attributes
isMandatoryParams: isMandatoryParams,
isShowedCriteria: Boolean(fieldsList.length && isMandatoryParams),
isShowedTotals: true
}
// Convert from gRPC process list // Convert from gRPC process list
const actions = [] const actions = []
if (process) { if (process) {
@ -112,27 +103,39 @@ const browser = {
description: process.description, description: process.description,
isReport: process.isReport, isReport: process.isReport,
isDirectPrint: process.isDirectPrint, isDirectPrint: process.isDirectPrint,
containerUuidAssociated: newBrowser.uuid, containerUuidAssociated: containerUuid,
panelTypeAssociated: panelType panelTypeAssociated: panelType
}) })
// TODO: No list of parameters // TODO: No list of parameters
// // add process associated in vuex store // // add process associated in vuex store
// dispatch('addProcessAssociated', { // dispatch('addProcessAssociated', {
// processToGenerate: process, // processToGenerate: process,
// containerUuidAssociated: newBrowser.uuid // containerUuidAssociated: containerUuid
// }) // })
} }
dispatch('addPanel', newBrowser)
commit('addBrowser', newBrowser)
// Add process menu // Add process menu
dispatch('setContextMenu', { dispatch('setContextMenu', {
containerUuid: browserResponse.uuid, containerUuid,
relations: [], relations: [],
actions: actions, actions,
references: [] references: []
}) })
// Panel for save on store
const newBrowser = {
...browserResponse,
containerUuid: browserResponse.uuid,
fieldList: fieldsList,
panelType,
// app attributes
isMandatoryParams,
isShowedCriteria: Boolean(fieldsList.length && isMandatoryParams),
isShowedTotals: true
}
commit('addBrowser', newBrowser)
dispatch('addPanel', newBrowser)
resolve(newBrowser) resolve(newBrowser)
}) })
.catch(error => { .catch(error => {
@ -146,13 +149,20 @@ const browser = {
}) })
}) })
}, },
changeShowedCriteriaBrowser({ commit, getters }, { changeBrowserAttribute({ commit, getters }, {
containerUuid, containerUuid,
isShowedCriteria browser,
attributeName,
attributeValue
}) { }) {
commit('changeShowedCriteriaBrowser', { if (isEmptyValue(browser)) {
browser: getters.getBrowser(containerUuid), browser = getters.getBrowser(containerUuid)
isShowedCriteria: isShowedCriteria }
const newBrowser = browser
newBrowser[attributeName] = attributeValue
commit('changeBrowser', {
browser,
newBrowser
}) })
} }
}, },

View File

@ -285,7 +285,7 @@ const data = {
const dataStore = getters.getDataRecordsList(containerUuid) const dataStore = getters.getDataRecordsList(containerUuid)
commit('addNewRow', { commit('addNewRow', {
values: values, values,
data: dataStore data: dataStore
}) })
}, },
@ -359,8 +359,8 @@ const data = {
newDataStore.record = dataStore.record.concat(newDataStore.record) newDataStore.record = dataStore.record.concat(newDataStore.record)
} }
commit('setRecordSelection', { commit('setRecordSelection', {
dataStore: dataStore, dataStore,
newDataStore: newDataStore newDataStore
}) })
} else { } else {
commit('addRecordSelection', newDataStore) commit('addRecordSelection', newDataStore)

View File

@ -189,8 +189,7 @@ const languageControl = {
getTranslationByLanguage: (state, getters) => ({ getTranslationByLanguage: (state, getters) => ({
containerUuid, containerUuid,
language, language,
recordUuid, recordUuid
recordId
}) => { }) => {
const translationContainer = getters.getTranslationContainer(containerUuid) const translationContainer = getters.getTranslationContainer(containerUuid)
if (translationContainer && translationContainer.recordUuid === recordUuid) { if (translationContainer && translationContainer.recordUuid === recordUuid) {

View File

@ -58,7 +58,7 @@ const lookup = {
option: option, option: option,
value: value, // isNaN(objectParams.value) ? objectParams.value : parseInt(objectParams.value, 10), value: value, // isNaN(objectParams.value) ? objectParams.value : parseInt(objectParams.value, 10),
parsedDirectQuery: directQuery, parsedDirectQuery: directQuery,
tableName: tableName, tableName,
roleUuid: getCurrentRole(), roleUuid: getCurrentRole(),
clientId: rootGetters.getContextClientId clientId: rootGetters.getContextClientId
}) })
@ -142,8 +142,8 @@ const lookup = {
let parsedQuery = query let parsedQuery = query
if (parsedQuery && parsedQuery.includes('@')) { if (parsedQuery && parsedQuery.includes('@')) {
parsedQuery = parseContext({ parsedQuery = parseContext({
parentUuid: parentUuid, parentUuid,
containerUuid: containerUuid, containerUuid,
value: parsedQuery, value: parsedQuery,
isBooleanToString: true isBooleanToString: true
}).value }).value
@ -154,8 +154,8 @@ const lookup = {
itemLookup.roleUuid !== getCurrentRole() itemLookup.roleUuid !== getCurrentRole()
}) })
commit('deleteLookupList', { commit('deleteLookupList', {
lookupItem: lookupItem, lookupItem,
lookupList: lookupList lookupList
}) })
} }
}, },

View File

@ -32,9 +32,6 @@ const panel = {
dictionaryResetCache(state) { dictionaryResetCache(state) {
state.panel = [] state.panel = []
}, },
changeFieldList(state, payload) {
payload.fieldList = payload.newFieldList
},
changeField(state, payload) { changeField(state, payload) {
payload.field = payload.newField payload.field = payload.newField
}, },
@ -152,7 +149,6 @@ const panel = {
}) })
commit('changePanel', { commit('changePanel', {
containerUuid,
panel, panel,
newPanel newPanel
}) })
@ -192,14 +188,18 @@ const panel = {
* @param {array} fieldsIncludes fields to set valueAttribute * @param {array} fieldsIncludes fields to set valueAttribute
* @param {array} fieldsExcludes fields to dont change * @param {array} fieldsExcludes fields to dont change
*/ */
changeFieldAttributesBoolean({ commit, getters }, parameters) { changeFieldAttributesBoolean({ commit, getters }, {
const { containerUuid, attribute, valueAttribute, fieldsIncludes, fieldsExcludes } = parameters containerUuid,
var { fieldList = [] } = parameters isAdvancedQuery = false,
if (fieldList.length <= 0) { attribute,
fieldList = getters.getFieldsListFromPanel(containerUuid) valueAttribute,
} fieldsIncludes = [],
fieldsExcludes = []
}) {
const panel = getters.getPanel(containerUuid, isAdvancedQuery)
const newPanel = panel
var newFields = fieldList.map(itemField => { newPanel.fieldList = panel.fieldList.map(itemField => {
// not change exlude field // not change exlude field
if (fieldsExcludes && fieldsExcludes.length && fieldsExcludes.includes(itemField.columnName)) { if (fieldsExcludes && fieldsExcludes.length && fieldsExcludes.includes(itemField.columnName)) {
return itemField return itemField
@ -213,22 +213,24 @@ const panel = {
itemField[attribute] = !valueAttribute itemField[attribute] = !valueAttribute
return itemField return itemField
}) })
commit('changeFieldList', {
fieldList: fieldList, commit('changePanel', {
newFieldList: newFields panel,
newPanel
}) })
}, },
/** /**
* @param {string} containerUuid * @param {string} containerUuid
* @param {array} fieldList * @param {array} fieldsList
*/ */
showOnlyMandatoryColumns({ dispatch, getters }, parameters) { showOnlyMandatoryColumns({ dispatch, getters }, {
const { containerUuid } = parameters containerUuid,
var { fieldList = [] } = parameters fieldsList = []
if (fieldList.length <= 0) { }) {
fieldList = getters.getFieldsListFromPanel(containerUuid) if (fieldsList.length <= 0) {
fieldsList = getters.getFieldsListFromPanel(containerUuid)
} }
const fieldsExcludes = fieldList.filter(fieldItem => { const fieldsIncludes = fieldsList.filter(fieldItem => {
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
if (isMandatory) { if (isMandatory) {
return true return true
@ -238,8 +240,8 @@ const panel = {
}) })
dispatch('changeFieldAttributesBoolean', { dispatch('changeFieldAttributesBoolean', {
containerUuid: containerUuid, containerUuid,
fieldsIncludes: fieldsExcludes, fieldsIncludes,
attribute: 'isShowedTableFromUser', attribute: 'isShowedTableFromUser',
valueAttribute: true valueAttribute: true
}) })
@ -250,12 +252,12 @@ const panel = {
*/ */
showAllAvailableColumns({ dispatch, getters }, { showAllAvailableColumns({ dispatch, getters }, {
containerUuid, containerUuid,
fieldList = [] fieldsList = []
}) { }) {
if (fieldList.length <= 0) { if (fieldsList.length <= 0) {
fieldList = getters.getFieldsListFromPanel(containerUuid) fieldsList = getters.getFieldsListFromPanel(containerUuid)
} }
const fieldsExcludes = fieldList.filter(fieldItem => { const fieldsIncludes = fieldsList.filter(fieldItem => {
const isDisplayed = fieldItem.isDisplayed && fieldItem.isDisplayedFromLogic && !fieldItem.isKey const isDisplayed = fieldItem.isDisplayed && fieldItem.isDisplayedFromLogic && !fieldItem.isKey
// Verify for displayed and is active // Verify for displayed and is active
return fieldItem.isActive && isDisplayed return fieldItem.isActive && isDisplayed
@ -265,7 +267,7 @@ const panel = {
dispatch('changeFieldAttributesBoolean', { dispatch('changeFieldAttributesBoolean', {
containerUuid, containerUuid,
fieldsIncludes: fieldsExcludes, fieldsIncludes,
attribute: 'isShowedTableFromUser', attribute: 'isShowedTableFromUser',
valueAttribute: true valueAttribute: true
}) })
@ -283,18 +285,24 @@ const panel = {
parentUuid, parentUuid,
containerUuid, containerUuid,
panelType = 'window', panelType = 'window',
isNewRecord = false, isNewRecord = false
fieldList = []
}) { }) {
return new Promise(resolve => {
const panel = getters.getPanel(containerUuid)
const defaultAttributes = getters.getParsedDefaultValues({ const defaultAttributes = getters.getParsedDefaultValues({
parentUuid, parentUuid,
containerUuid containerUuid,
fieldsList: panel.fieldList
}) })
if (panelType === 'window' && isNewRecord) { if (panelType === 'window' && isNewRecord) {
// redirect to create new record // redirect to create new record
const oldRoute = router.app._route const oldRoute = router.app._route
router.push({ router.push({
name: oldRoute.name, name: oldRoute.name,
params: {
...oldRoute.params
},
query: { query: {
...oldRoute.query, ...oldRoute.query,
action: 'create-new' action: 'create-new'
@ -305,16 +313,14 @@ const panel = {
type: 'info' type: 'info'
}) })
if (!fieldList.length) { panel.fieldList.forEach(fieldToBlanck => {
fieldList = getters.getFieldsListFromPanel(containerUuid)
}
fieldList.forEach(fieldToBlanck => {
commit('changeFieldValueToNull', { commit('changeFieldValueToNull', {
field: fieldToBlanck, field: fieldToBlanck,
value: undefined value: undefined
}) })
}) })
if (panel.isTabsChildren) {
// delete records tabs children when change record uuid // delete records tabs children when change record uuid
dispatch('deleteRecordContainer', { dispatch('deleteRecordContainer', {
viewUuid: parentUuid, viewUuid: parentUuid,
@ -322,16 +328,20 @@ const panel = {
isNew: true isNew: true
}) })
} }
}
dispatch('notifyPanelChange', { dispatch('notifyPanelChange', {
parentUuid, parentUuid,
containerUuid, containerUuid,
panelType, panelType,
fieldList: panel.fieldList,
newValues: defaultAttributes, newValues: defaultAttributes,
isSendToServer: false, isSendToServer: false,
// if isNewRecord active callouts, if window is closed no send callout // if isNewRecord active callouts, if window is closed no send callout
isSendCallout: isNewRecord, isSendCallout: isNewRecord,
isPrivateAccess: false isPrivateAccess: false
}) })
resolve(defaultAttributes)
})
}, },
/** /**
* Changed panel when receive or reset panel to new record * Changed panel when receive or reset panel to new record
@ -351,7 +361,7 @@ const panel = {
withOutColumnNames = [], withOutColumnNames = [],
isSendCallout = true, isSendCallout = true,
isAdvancedQuery = false, isAdvancedQuery = false,
isPrivateAccess = true, isPrivateAccess = false,
fieldList = [] fieldList = []
}) { }) {
if (!fieldList.length) { if (!fieldList.length) {
@ -384,6 +394,8 @@ const panel = {
isChangedOldValue: true // defines if set oldValue with newValue instead of current value isChangedOldValue: true // defines if set oldValue with newValue instead of current value
}) })
}) })
// show fields in query
if (isShowedField && Object.keys(newValues).length) { if (isShowedField && Object.keys(newValues).length) {
// join column names without duplicating it // join column names without duplicating it
fieldsShowed = Array.from(new Set([ fieldsShowed = Array.from(new Set([
@ -392,7 +404,6 @@ const panel = {
])) ]))
dispatch('changeFieldAttributesBoolean', { dispatch('changeFieldAttributesBoolean', {
parentUuid,
containerUuid, containerUuid,
attribute: 'isShowedFromUser', attribute: 'isShowedFromUser',
valueAttribute: true, valueAttribute: true,
@ -405,6 +416,8 @@ const panel = {
}) })
if (isPrivateAccess) { if (isPrivateAccess) {
const tableName = rootGetters.getTableNameFromTab(parentUuid, containerUuid) const tableName = rootGetters.getTableNameFromTab(parentUuid, containerUuid)
// TODO: Add current id and new id to comparison
if (!isEmptyValue(newValues[`${tableName}_ID`])) {
dispatch('getPrivateAccessFromServer', { dispatch('getPrivateAccessFromServer', {
tableName, tableName,
recordId: newValues[`${tableName}_ID`], recordId: newValues[`${tableName}_ID`],
@ -412,6 +425,7 @@ const panel = {
}) })
} }
} }
}
}, },
/** /**
* TODO: Add fieldAttributes * TODO: Add fieldAttributes
@ -748,23 +762,6 @@ const panel = {
}) })
}) })
}, },
/**
* @deprecated used changeFieldAttribure
*/
notifyFieldChangeDisplayColumn({ commit, getters }, {
containerUuid,
isAdvancedQuery,
columnName,
displayColumn
}) {
const field = getters.getFieldFromColumnName({ containerUuid, isAdvancedQuery, columnName })
commit('changeFieldValue', {
field: field,
newValue: field.value,
valueTo: field.valueTo,
displayColumn
})
},
getPanelAndFields({ dispatch }, { getPanelAndFields({ dispatch }, {
parentUuid, parentUuid,
containerUuid, containerUuid,
@ -822,19 +819,33 @@ const panel = {
newPanel: newPanel newPanel: newPanel
}) })
}, },
/**
* Change a attribute in field state
* @param {string} attributeName
* @param {mixed} attributeValue
* @param {boolean|object} multipleAttributes
*/
changeFieldAttribure({ commit, getters }, { changeFieldAttribure({ commit, getters }, {
containerUuid, containerUuid,
isAdvancedQuery, isAdvancedQuery,
columnName, columnName,
field, field,
attributeName, attributeName,
attributeValue attributeValue,
multipleAttributes = false
}) { }) {
if (isEmptyValue(field)) { if (isEmptyValue(field)) {
field = getters.getFieldFromColumnName({ containerUuid, isAdvancedQuery, columnName }) field = getters.getFieldFromColumnName({ containerUuid, isAdvancedQuery, columnName })
} }
const newField = field let newField = field
if (multipleAttributes) {
newField = {
...newField,
multipleAttributes
}
} else {
newField[attributeName] = attributeValue newField[attributeName] = attributeValue
}
commit('changeField', { commit('changeField', {
field, field,
newField newField
@ -1041,14 +1052,14 @@ const panel = {
parentUuid, parentUuid,
containerUuid, containerUuid,
isGetServer = true, isGetServer = true,
fieldList = [] fieldsList = []
}) => { }) => {
if (!fieldList.length) { if (!fieldsList.length) {
fieldList = getters.getFieldsListFromPanel(containerUuid) fieldsList = getters.getFieldsListFromPanel(containerUuid)
} }
var attributesObject = {} const attributesObject = {}
fieldList fieldsList
.map(fieldItem => { .map(fieldItem => {
let isSQL = false let isSQL = false
let valueToReturn = fieldItem.parsedDefaultValue let valueToReturn = fieldItem.parsedDefaultValue
@ -1112,8 +1123,8 @@ const panel = {
isOnlyDisplayed = false, isOnlyDisplayed = false,
isAdvancedQuery = false isAdvancedQuery = false
}) => { }) => {
var fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery) let fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
var attributesListLink = '' let attributesListLink = ''
if (withOut.length) { if (withOut.length) {
fieldList = fieldList.filter(fieldItem => { fieldList = fieldList.filter(fieldItem => {
// columns to exclude // columns to exclude
@ -1157,60 +1168,6 @@ const panel = {
return attributesListLink.slice(0, -1) return attributesListLink.slice(0, -1)
}, },
/**
* get field list visible and with values
* TODO: Deprecated, change by getColumnNamesAndValues
*/
getPanelParameters: (state, getters) => (containerUuid, isEvaluateEmptyDisplayed = false, withOut = [], isAdvancedQuery) => {
if (isAdvancedQuery) {
var panel = getters.getPanel(containerUuid, isAdvancedQuery)
} else {
panel = getters.getPanel(containerUuid)
}
const fieldList = panel.fieldList
const fields = fieldList.length
var params = []
var fieldsMandatory = []
var isEmptyFieldDisplayed = false // indicate if exists a field displayed and empty value
if (fields > 0) {
params = fieldList.filter(fieldItem => {
// columns to exclude
if (withOut.find(subItem => subItem === fieldItem.columnName)) {
return false
}
const isMandatory = Boolean(fieldItem.isMandatory || fieldItem.isMandatoryFromLogic)
const isDisplayed = fieldIsDisplayed(fieldItem) && (fieldItem.isShowedFromUser || isMandatory)
// mandatory fields
if (isMandatory) {
fieldsMandatory.push(fieldItem)
}
if (!isEmptyValue(fieldItem.value) && isDisplayed) {
return true
}
// empty value
if (isMandatory && isEvaluateEmptyDisplayed) {
isEmptyFieldDisplayed = true
}
return false
})
if (isEvaluateEmptyDisplayed && isEmptyFieldDisplayed) {
return {
fields,
params: [],
fieldsMandatory
}
}
}
return {
fields,
params,
fieldsMandatory
}
},
/** /**
* Getter converter selection params with value format * Getter converter selection params with value format
* [{ columname: name key, value: value to send, operator }] * [{ columname: name key, value: value to send, operator }]

View File

@ -45,9 +45,9 @@ const process = {
// Add process menu // Add process menu
dispatch('setContextMenu', { dispatch('setContextMenu', {
containerUuid: processDefinition.uuid, containerUuid,
relations: [], relations: [],
actions: actions, actions,
references: [] references: []
}) })
resolve(processDefinition) resolve(processDefinition)

View File

@ -1,3 +1,4 @@
import Vue from 'vue'
const utils = { const utils = {
state: { state: {
@ -14,7 +15,17 @@ const utils = {
isShowedTabChildren: false, isShowedTabChildren: false,
recordTable: 0, recordTable: 0,
selectionProcess: [], selectionProcess: [],
isContainerInfo: false isContainerInfo: false,
openRoute: {
path: '',
name: '',
route: {},
params: {},
definedParameters: {},
query: {},
isReaded: false,
isLoaded: false
}
}, },
mutations: { mutations: {
setWidth(state, width) { setWidth(state, width) {
@ -55,6 +66,16 @@ const utils = {
}, },
setReportTypeToShareLink(state, payload) { setReportTypeToShareLink(state, payload) {
state.reportType = payload state.reportType = payload
},
setOpenRoute(state, payload) {
state.openRoute = {
...state.openRoute,
...payload
}
},
setReadRoute(state, payload) {
Vue.set(state.openRoute, 'definedParameters', payload.parameters)
Vue.set(state.openRoute, 'isLoaded', true)
} }
}, },
actions: { actions: {
@ -88,12 +109,13 @@ const utils = {
setProcessSelect({ commit }, params) { setProcessSelect({ commit }, params) {
commit('setProcessSelecetion', params) commit('setProcessSelecetion', params)
}, },
changeShowedDetail({ dispatch }, params) { setOpenRoute({ commit }, routeParameters) {
if (params.panelType === 'window') { commit('setOpenRoute', {
dispatch('changeShowedDetailWindow', params) ...routeParameters
} else if (params.panelType === 'browser') { })
dispatch('changeShowedCriteriaBrowser', params) },
} setReadRoute({ commit }, parameters) {
commit('setReadRoute', parameters)
}, },
setTempShareLink({ commit }, parameters) { setTempShareLink({ commit }, parameters) {
if (!parameters.href.includes(String(parameters.processId))) { if (!parameters.href.includes(String(parameters.processId))) {
@ -159,6 +181,12 @@ const utils = {
}, },
getReportType: (state) => { getReportType: (state) => {
return state.reportType return state.reportType
},
getIsLoadedOpenRoute: (state) => {
return state.openRoute.isLoaded
},
getIsReadedOpenRoute: (state) => {
return state.openRoute.isReaded
} }
} }
} }

View File

@ -2,7 +2,8 @@ import {
getWindow as getWindowMetadata, getWindow as getWindowMetadata,
getTab as getTabMetadata getTab as getTabMetadata
} from '@/api/ADempiere/dictionary' } from '@/api/ADempiere/dictionary'
import { showMessage } from '@/utils/ADempiere' import { showMessage } from '@/utils/ADempiere/notification'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import language from '@/lang' import language from '@/lang'
import router from '@/router' import router from '@/router'
import { generateField, getFieldTemplate } from '@/utils/ADempiere/dictionaryUtils' import { generateField, getFieldTemplate } from '@/utils/ADempiere/dictionaryUtils'
@ -21,11 +22,8 @@ const window = {
state.window = [] state.window = []
state.windowIndex = 0 state.windowIndex = 0
}, },
changeShowedDetailWindow(state, payload) { changeWindow(state, payload) {
payload.window.isShowedDetail = payload.changeShowedDetail payload.window = payload.newWindow
},
changeShowedRecordWindow(state, payload) {
payload.window.isShowedRecordNavigation = payload.isShowedRecordNavigation
}, },
setCurrentTab(state, payload) { setCurrentTab(state, payload) {
payload.window.currentTabUuid = payload.tabUuid payload.window.currentTabUuid = payload.tabUuid
@ -197,9 +195,9 @@ const window = {
if (tab.isParentTab) { if (tab.isParentTab) {
parentTabs.push(tab) parentTabs.push(tab)
} else { return tab
childrenTabs.push(tab)
} }
childrenTabs.push(tab)
return tab return tab
}) })
@ -209,16 +207,18 @@ const window = {
tabsListParent: parentTabs, tabsListParent: parentTabs,
tabsListChildren: childrenTabs, tabsListChildren: childrenTabs,
// app attributes // app attributes
isShowedDetail: Boolean(childrenTabs.length),
currentTabUuid: parentTabs[0].uuid currentTabUuid: parentTabs[0].uuid
} }
const newWindow = { const newWindow = {
...responseWindow, ...responseWindow,
...tabProperties, ...tabProperties,
isShowedRecordNavigation: undefined,
firstTabUuid, firstTabUuid,
windowIndex: state.windowIndex + 1 windowIndex: state.windowIndex + 1,
// App properties
isShowedTabsChildren: Boolean(childrenTabs.length),
isShowedRecordNavigation: undefined,
isShowedAdvancedQuery: false
} }
commit('addWindow', newWindow) commit('addWindow', newWindow)
return newWindow return newWindow
@ -300,6 +300,7 @@ const window = {
fieldsList.push(field) fieldsList.push(field)
} }
const window = getters.getWindow(parentUuid)
// Panel for save on store // Panel for save on store
const panel = { const panel = {
...getters.getTab(parentUuid, containerUuid), ...getters.getTab(parentUuid, containerUuid),
@ -308,7 +309,8 @@ const window = {
fieldList: fieldsList, fieldList: fieldsList,
panelType, panelType,
// app attributes // app attributes
isShowedTotals: false isShowedTotals: false,
isTabsChildren: Boolean(window.tabsListChildren.length)
} }
dispatch('addPanel', panel) dispatch('addPanel', panel)
@ -326,28 +328,20 @@ const window = {
console.warn(`Dictionary Tab (State Window) - Error ${error.code}: ${error.message}.`) console.warn(`Dictionary Tab (State Window) - Error ${error.code}: ${error.message}.`)
}) })
}, },
changeShowedDetailWindow({ commit, state }, { changeWindowAttribute({ commit, getters }, {
containerUuid,
isShowedDetail = true
}) {
const window = state.window.find(itemWindow => {
return itemWindow.uuid === containerUuid
})
commit('changeShowedDetailWindow', {
window: window,
changeShowedDetail: isShowedDetail
})
},
changeShowedRecordWindow({ commit, state }, {
parentUuid, parentUuid,
isShowedRecordNavigation = true window,
attributeName,
attributeValue
}) { }) {
const window = state.window.find(itemWindow => { if (isEmptyValue(window)) {
return itemWindow.uuid === parentUuid window = getters.getWindow(parentUuid)
}) }
commit('changeShowedRecordWindow', { const newWindow = window
window: window, newWindow[attributeName] = attributeValue
isShowedRecordNavigation: isShowedRecordNavigation commit('changeWindow', {
window,
newWindow
}) })
}, },
/** /**

View File

@ -55,15 +55,15 @@ const windowControl = {
} }
}, },
actions: { actions: {
undoPanelToNew({ dispatch, rootGetters }, parameters) { undoPanelToNew({ dispatch, rootGetters }, { containerUuid }) {
const oldAttributes = rootGetters.getColumnNamesAndValues({ const oldAttributes = rootGetters.getColumnNamesAndValues({
containerUuid: parameters.containerUuid, containerUuid,
propertyName: 'oldValue', propertyName: 'oldValue',
isObjectReturn: true, isObjectReturn: true,
isAddDisplayColumn: true isAddDisplayColumn: true
}) })
dispatch('notifyPanelChange', { dispatch('notifyPanelChange', {
containerUuid: parameters.containerUuid, containerUuid,
newValues: oldAttributes newValues: oldAttributes
}) })
}, },
@ -82,7 +82,7 @@ const windowControl = {
const { tableName, fieldList } = rootGetters.getPanel(containerUuid) const { tableName, fieldList } = rootGetters.getPanel(containerUuid)
// delete key from attributes // delete key from attributes
const finalAttributes = rootGetters.getColumnNamesAndValues({ const attributesList = rootGetters.getColumnNamesAndValues({
containerUuid, containerUuid,
propertyName: 'value', propertyName: 'value',
isEvaluateValues: true, isEvaluateValues: true,
@ -92,15 +92,15 @@ const windowControl = {
commit('addInCreate', { commit('addInCreate', {
containerUuid, containerUuid,
tableName, tableName,
attributesList: finalAttributes attributesList
}) })
createEntity({ createEntity({
tableName, tableName,
attributesList: finalAttributes attributesList
}) })
.then(createEntityResponse => { .then(createEntityResponse => {
const newValues = createEntityResponse.values const newValues = createEntityResponse.values
finalAttributes.forEach(element => { attributesList.forEach(element => {
if (element.columnName.includes('DisplayColumn')) { if (element.columnName.includes('DisplayColumn')) {
newValues[element.columnName] = element.value newValues[element.columnName] = element.value
} }
@ -138,6 +138,9 @@ const windowControl = {
const oldRoute = router.app._route const oldRoute = router.app._route
router.push({ router.push({
name: oldRoute.name, name: oldRoute.name,
params: {
...oldRoute.params
},
query: { query: {
...oldRoute.query, ...oldRoute.query,
action: createEntityResponse.uuid action: createEntityResponse.uuid
@ -157,14 +160,14 @@ const windowControl = {
message: error.message, message: error.message,
type: 'error' type: 'error'
}) })
console.warn(`Create Entity error: ${error.message}`) console.warn(`Create Entity error: ${error.message}.`)
reject(error) reject(error)
}) })
.finally(() => { .finally(() => {
commit('deleteInCreate', { commit('deleteInCreate', {
containerUuid, containerUuid,
tableName, tableName,
attributesList: finalAttributes attributesList
}) })
}) })
}) })
@ -217,6 +220,9 @@ const windowControl = {
const oldRoute = router.app._route const oldRoute = router.app._route
router.push({ router.push({
name: oldRoute.name, name: oldRoute.name,
params: {
...oldRoute.params
},
query: { query: {
...oldRoute.query, ...oldRoute.query,
action: createEntityResponse.recordUuid action: createEntityResponse.recordUuid
@ -381,7 +387,7 @@ const windowControl = {
parentUuid, parentUuid,
containerUuid, containerUuid,
tableName: tab.tableName, tableName: tab.tableName,
recordUuid: recordUuid recordUuid
}) })
.then(response => { .then(response => {
// update panel // update panel
@ -411,8 +417,6 @@ const windowControl = {
recordUuid: parameters.recordUuid recordUuid: parameters.recordUuid
}) })
.then(responseDeleteEntity => { .then(responseDeleteEntity => {
const oldRoute = router.app._route
// refresh record list // refresh record list
dispatch('getDataListTab', { dispatch('getDataListTab', {
parentUuid: parameters.parentUuid, parentUuid: parameters.parentUuid,
@ -428,9 +432,13 @@ const windowControl = {
isNewRecord: true isNewRecord: true
}) })
} else { } else {
const oldRoute = router.app._route
// else display first record of table in panel // else display first record of table in panel
router.push({ router.push({
name: oldRoute.name, name: oldRoute.name,
params: {
...oldRoute.params
},
query: { query: {
...oldRoute.query, ...oldRoute.query,
action: responseDataList[0].UUID action: responseDataList[0].UUID
@ -500,6 +508,9 @@ const windowControl = {
if (record.UUID === oldRoute.query.action) { if (record.UUID === oldRoute.query.action) {
router.push({ router.push({
name: oldRoute.name, name: oldRoute.name,
params: {
...oldRoute.params
},
query: { query: {
...oldRoute.query, ...oldRoute.query,
action: 'create-new' action: 'create-new'
@ -545,13 +556,19 @@ const windowControl = {
console.warn(`Rollback Entity error: ${error.message}. Code: ${error.code}.`) console.warn(`Rollback Entity error: ${error.message}. Code: ${error.code}.`)
}) })
}, },
setDataLog({ commit }, parameters) { setDataLog({ commit }, {
containerUuid,
tableName,
recordId,
recordUuid,
eventType
}) {
commit('setDataLog', { commit('setDataLog', {
containerUuid: parameters.containerUuid, containerUuid,
tableName: parameters.tableName, tableName,
recordId: parameters.recordId, recordId,
recordUuid: parameters.recordUuid, recordUuid,
eventType: parameters.eventType eventType
}) })
}, },
/** /**
@ -575,8 +592,8 @@ const windowControl = {
let parsedQuery = tab.query let parsedQuery = tab.query
if (!isEmptyValue(parsedQuery) && parsedQuery.includes('@')) { if (!isEmptyValue(parsedQuery) && parsedQuery.includes('@')) {
parsedQuery = parseContext({ parsedQuery = parseContext({
parentUuid: parentUuid, parentUuid,
containerUuid: containerUuid, containerUuid,
value: tab.query, value: tab.query,
isBooleanToString: true isBooleanToString: true
}).value }).value
@ -585,8 +602,8 @@ const windowControl = {
let parsedWhereClause = tab.whereClause let parsedWhereClause = tab.whereClause
if (!isEmptyValue(parsedWhereClause) && parsedWhereClause.includes('@')) { if (!isEmptyValue(parsedWhereClause) && parsedWhereClause.includes('@')) {
parsedWhereClause = parseContext({ parsedWhereClause = parseContext({
parentUuid: parentUuid, parentUuid,
containerUuid: containerUuid, containerUuid,
value: tab.whereClause, value: tab.whereClause,
isBooleanToString: true isBooleanToString: true
}).value }).value
@ -612,21 +629,21 @@ const windowControl = {
// TODO: evaluate if overwrite values to conditions // TODO: evaluate if overwrite values to conditions
if (!isLoadAllRecords && tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) { if (!isLoadAllRecords && tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) {
conditionsList.push({ conditionsList.push({
columnName: columnName, columnName,
value: value value
}) })
} }
return dispatch('getObjectListFromCriteria', { return dispatch('getObjectListFromCriteria', {
parentUuid: tab.parentUuid, parentUuid: tab.parentUuid,
containerUuid: containerUuid, containerUuid,
tableName: tab.tableName, tableName: tab.tableName,
query: parsedQuery, query: parsedQuery,
whereClause: parsedWhereClause, whereClause: parsedWhereClause,
orderByClause: tab.orderByClause, orderByClause: tab.orderByClause,
conditionsList, conditionsList,
isParentTab: tab.isParentTab, isParentTab: tab.isParentTab,
isAddRecord: isAddRecord, isAddRecord,
isShowNotification: isShowNotification isShowNotification
}) })
.then(response => { .then(response => {
if (isRefreshPanel && !isEmptyValue(recordUuid) && recordUuid !== 'create-new') { if (isRefreshPanel && !isEmptyValue(recordUuid) && recordUuid !== 'create-new') {
@ -635,15 +652,15 @@ const windowControl = {
// update fields with values obtained from the server // update fields with values obtained from the server
dispatch('notifyPanelChange', { dispatch('notifyPanelChange', {
parentUuid: tab.parentUuid, parentUuid: tab.parentUuid,
containerUuid: containerUuid, containerUuid,
newValues: newValues, newValues,
isSendToServer: false isSendToServer: false
}) })
} else { } else {
// this record is missing (Deleted or the query does not include it) // this record is missing (Deleted or the query does not include it)
dispatch('resetPanelToNew', { dispatch('resetPanelToNew', {
parentUuid: tab.parentUuid, parentUuid: tab.parentUuid,
containerUuid: containerUuid containerUuid
}) })
} }
} }
@ -675,11 +692,11 @@ const windowControl = {
if (isAddRecord) { if (isAddRecord) {
dispatch('setPageNumber', { dispatch('setPageNumber', {
parentUuid: parentUuid, parentUuid,
containerUuid: containerUuid, containerUuid,
pageNumber: nextPage, pageNumber: nextPage,
panelType: 'window', panelType: 'window',
isAddRecord: isAddRecord, isAddRecord,
isShowNotification: false isShowNotification: false
}) })
} }
@ -731,7 +748,7 @@ const windowControl = {
...referenceResponse, ...referenceResponse,
windowUuid: parentUuid, windowUuid: parentUuid,
recordUuid, recordUuid,
referencesList: referencesList referencesList
} }
commit('addReferencesList', references) commit('addReferencesList', references)
resolve(referenceResponse) resolve(referenceResponse)
@ -782,7 +799,7 @@ const windowControl = {
commit('setTotalRequest', countRequest) commit('setTotalRequest', countRequest)
updateEntity({ updateEntity({
tableName: tableName, tableName,
recordUuid: itemData.UUID, recordUuid: itemData.UUID,
attributesList: valuesToSend attributesList: valuesToSend
}) })
@ -809,15 +826,15 @@ const windowControl = {
commit('setTotalResponse', 0) commit('setTotalResponse', 0)
dispatch('setRecordSelection', { dispatch('setRecordSelection', {
parentUuid: parentUuid, parentUuid,
containerUuid: containerUuid, containerUuid,
isLoaded: false isLoaded: false
}) })
dispatch('setTabSequenceRecord', []) dispatch('setTabSequenceRecord', [])
// refresh record list in table source // refresh record list in table source
dispatch('getDataListTab', { dispatch('getDataListTab', {
parentUuid: parentUuid, parentUuid,
containerUuid: tabAssociatedUuid containerUuid: tabAssociatedUuid
}) })
} }

View File

@ -2,6 +2,7 @@ import { login, logout, getInfo, getSessionInfo, changeRole } from '@/api/user'
import { getToken, setToken, removeToken, getCurrentRole, setCurrentRole, removeCurrentRole } from '@/utils/auth' import { getToken, setToken, removeToken, getCurrentRole, setCurrentRole, removeCurrentRole } from '@/utils/auth'
import router, { resetRouter } from '@/router' import router, { resetRouter } from '@/router'
import { showMessage } from '@/utils/ADempiere/notification' import { showMessage } from '@/utils/ADempiere/notification'
import language from '@/lang'
const state = { const state = {
token: getToken(), token: getToken(),
@ -188,7 +189,29 @@ const actions = {
}) })
}, },
// dynamically modify permissions // dynamically modify permissions
changeRoles({ commit, dispatch }, roleUuid) { changeRoles({ commit, dispatch }, {
roleUuid,
isCloseAllViews = true
}) {
const route = router.app._route
const selectedTag = {
fullPath: route.fullPath,
hash: route.hash,
matched: route.matched,
meta: route.meta,
name: route.name,
params: route.params,
path: route.path,
query: route.query,
title: route.meta.title
}
console.log(selectedTag)
if (isCloseAllViews) {
dispatch('tagsView/delAllViews', selectedTag, { root: true })
} else {
dispatch('tagsView/delOthersViews', selectedTag, { root: true })
}
return changeRole({ return changeRole({
sessionUuid: getToken(), sessionUuid: getToken(),
roleUuid: roleUuid, roleUuid: roleUuid,
@ -204,21 +227,7 @@ const actions = {
// Update user info and context associated with session // Update user info and context associated with session
dispatch('getInfo', changeRoleResponse.uuid) dispatch('getInfo', changeRoleResponse.uuid)
.then(() => {
const route = router.app._route
const selectedTag = {
fullPath: route.fullPath,
hash: route.hash,
matched: route.matched,
meta: route.meta,
name: route.name,
params: route.params,
path: route.path,
query: route.query,
title: route.meta.title
}
dispatch('tagsView/delOthersViews', selectedTag, { root: true })
})
dispatch('clearProcessControl', null, { dispatch('clearProcessControl', null, {
root: true root: true
}) })
@ -226,6 +235,10 @@ const actions = {
root: true root: true
}) })
showMessage({
message: language.t('notifications.successChangeRole'),
type: 'success'
})
return { return {
...role, ...role,
sessionUuid: changeRoleResponse.uuid sessionUuid: changeRoleResponse.uuid
@ -238,6 +251,15 @@ const actions = {
}) })
console.warn(`Error change role: ${error.message}. Code: ${error.code}.`) console.warn(`Error change role: ${error.message}. Code: ${error.code}.`)
}) })
.finally(() => {
resetRouter()
dispatch('permission/generateRoutes', null, {
root: true
})
.then(response => {
router.addRoutes(response)
})
})
// return new Promise(async resolve => { // return new Promise(async resolve => {
// const token = role // const token = role
// commit('SET_TOKEN', token) // commit('SET_TOKEN', token)

View File

@ -153,7 +153,7 @@ export function generateField(fieldToGenerate, moreAttributes, typeRange = false
return item.type === field.componentPath return item.type === field.componentPath
}) })
if (field.sizeFieldFromType === undefined) { if (field.sizeFieldFromType === undefined) {
console.warn(`Field size no found: ${field.name} type: ${field.componentPath}`) console.warn(`Field size no found: ${field.name} type: ${field.componentPath}.`)
field.sizeFieldFromType = { field.sizeFieldFromType = {
type: field.componentPath, type: field.componentPath,
size: DEFAULT_SIZE size: DEFAULT_SIZE

View File

@ -135,14 +135,14 @@ export default {
}, },
methods: { methods: {
handleChange(value) { handleChange(value) {
var showCriteria = false let showCriteria = false
if (this.activeSearch.length) { if (this.activeSearch.length) {
showCriteria = true showCriteria = true
} }
this.$store.dispatch('changeShowedCriteriaBrowser', { this.$store.dispatch('changeBrowserAttribute', {
panelType: this.panelType,
containerUuid: this.browserUuid, containerUuid: this.browserUuid,
isShowedCriteria: showCriteria attributeName: 'isShowedCriteria',
attributeValue: showCriteria
}) })
}, },
getBrowser() { getBrowser() {
@ -150,7 +150,8 @@ export default {
this.browserMetadata = this.getterBrowser this.browserMetadata = this.getterBrowser
this.isLoaded = true this.isLoaded = true
this.defaultSearch() this.defaultSearch()
} else { return
}
this.$store.dispatch('getPanelAndFields', { this.$store.dispatch('getPanelAndFields', {
containerUuid: this.browserUuid, containerUuid: this.browserUuid,
panelType: this.panelType, panelType: this.panelType,
@ -163,7 +164,6 @@ export default {
.finally(() => { .finally(() => {
this.isLoaded = true this.isLoaded = true
}) })
}
}, },
defaultSearch() { defaultSearch() {
// open or closed show criteria // open or closed show criteria

View File

@ -19,12 +19,30 @@
trigger="hover" trigger="hover"
> >
<div v-html="processMetadata.help" /> <div v-html="processMetadata.help" />
<el-button slot="reference" type="text" class="title">{{ processMetadata.name }}</el-button> <el-button slot="reference" type="text" class="title">
{{ processMetadata.name }}
</el-button>
</el-popover> </el-popover>
</h3> </h3>
<iframe v-if="reportFormat === 'pdf'" key="report-content-pdf" class="content-api" :src="url" width="100%" height="100%" /> <iframe
<div v-else-if="collectionReportFormat.includes(reportFormat)" key="report-content-all" class="content-api" :src="url" /> v-if="reportFormat === 'pdf'"
<div v-else-if="reportFormat === 'html'" key="report-content-html" class="content-txt"> key="report-content-pdf"
class="content-api"
:src="url"
width="100%"
height="100%"
/>
<div
v-else-if="collectionReportFormat.includes(reportFormat)"
key="report-content-all"
class="content-api"
:src="url"
/>
<div
v-else-if="reportFormat === 'html'"
key="report-content-html"
class="content-txt"
>
<el-container class="sub-content-html"> <el-container class="sub-content-html">
<el-main style="padding: 0;"> <el-main style="padding: 0;">
<div <div
@ -69,7 +87,6 @@ export default {
data() { data() {
return { return {
panelType: 'process', panelType: 'process',
url: this.$store.getters.getProcessResult.url,
name: [], name: [],
reportFormat: '', reportFormat: '',
collectionReportFormat: [ collectionReportFormat: [
@ -94,6 +111,9 @@ export default {
processMetadata() { processMetadata() {
return this.$store.getters.getProcessById(this.$route.params.processId) return this.$store.getters.getProcessById(this.$route.params.processId)
}, },
url() {
return this.$store.getters.getProcessResult.url
},
getterCachedReport() { getterCachedReport() {
return this.$store.getters.getCachedReport(this.$route.params.instanceUuid) return this.$store.getters.getCachedReport(this.$route.params.instanceUuid)
} }

View File

@ -18,11 +18,11 @@
<div class="open-datatable-aside"> <div class="open-datatable-aside">
<el-button <el-button
v-show="!isPanel" v-show="!isPanel"
:icon="iconIsShowedRecordNavigation" :icon="iconShowedRecordNavigation"
circle circle
style="margin-left: 10px;" style="margin-left: 10px;"
class="el-button-window" class="el-button-window"
@click="handleChangeShowedRecordNavigation()" @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
/> />
<el-button <el-button
v-show="!isPanel" v-show="!isPanel"
@ -54,14 +54,14 @@
v-if="isMobile" v-if="isMobile"
class="el-icon-close" class="el-icon-close"
style="position: fixed; padding-top: 15px; color: #000000; font-size: 121%; font-weight: 615 !important; padding-left: 9px;" style="position: fixed; padding-top: 15px; color: #000000; font-size: 121%; font-weight: 615 !important; padding-left: 9px;"
@click="handleChangeShowedRecordNavigation()" @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
/> />
</el-aside> </el-aside>
</div> </div>
</template> </template>
<template slot="paneR"> <template slot="paneR">
<el-container style="height: 86vh;"> <el-container style="height: 86vh;">
<Split v-shortkey="['f8']" direction="vertical" @onDrag="onDrag" @shortkey.native="handleChangeShowedRecordNavigation"> <Split v-shortkey="['f8']" direction="vertical" @onDrag="onDrag" @shortkey.native="handleChangeShowedRecordNavigation(isShowedRecordNavigation)">
<SplitArea :size="sizeAreaStyle" :style="splitAreaStyle"> <SplitArea :size="sizeAreaStyle" :style="splitAreaStyle">
<el-header style="height: 39px;"> <el-header style="height: 39px;">
<context-menu <context-menu
@ -73,7 +73,7 @@
:is-insert-record="getterIsInsertRecord" :is-insert-record="getterIsInsertRecord"
/> />
</el-header> </el-header>
<el-main :style="styleMainIsShowedTabChildren"> <el-main :style="styleMainTab">
<tab-parent <tab-parent
:window-uuid="windowUuid" :window-uuid="windowUuid"
:tabs-list="windowMetadata.tabsListParent" :tabs-list="windowMetadata.tabsListParent"
@ -89,9 +89,9 @@
class="open-detail" class="open-detail"
/> />
<el-button <el-button
v-if="windowMetadata.tabsListChildren && windowMetadata.tabsListChildren.length && v-if="windowMetadata.tabsListChildren.length &&
(isMobile && !isShowedRecordNavigation || !isMobile)" (isMobile && !isShowedRecordNavigation || !isMobile)"
v-show="!isShowedTabChildren" v-show="!isShowedTabsChildren"
icon="el-icon-caret-top" icon="el-icon-caret-top"
:class="classIsMobile" :class="classIsMobile"
circle circle
@ -109,19 +109,19 @@
<div class="open-left" /> <div class="open-left" />
<el-button <el-button
v-show="!isShowedRecordNavigation" v-show="!isShowedRecordNavigation"
:icon="iconIsShowedRecordNavigation" :icon="iconShowedRecordNavigation"
class="open-navegation" class="open-navegation"
circle circle
type="primary" type="primary"
@click="handleChangeShowedRecordNavigation()" @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
/> />
</div> </div>
</div> </div>
</el-main> </el-main>
</SplitArea> </SplitArea>
<SplitArea v-show="isShowedTabChildren" :size="50"> <SplitArea v-show="isShowedTabsChildren" :size="50">
<el-header <el-header
v-if="isShowedTabChildren && windowMetadata.tabsListChildren && windowMetadata.tabsListChildren.length" v-if="isShowedTabsChildren && windowMetadata.tabsListChildren && windowMetadata.tabsListChildren.length"
style="height: auto; padding-right: 35px !important; padding-bottom: 33px;" style="height: auto; padding-right: 35px !important; padding-bottom: 33px;"
> >
<div class="w-33"> <div class="w-33">
@ -392,15 +392,12 @@ export default {
chatNote: '', chatNote: '',
typeAction: 0, typeAction: 0,
isLoadingFromServer: false, isLoadingFromServer: false,
listRecordNavigation: 0,
currentKey: 100, currentKey: 100,
isShowedTabChildren: true, // TODO: Manage attribute with store
isShowedRecordPanel: false, isShowedRecordPanel: false
isShowedRecordNavigation: this.$route.query.action === 'advancedQuery'
} }
}, },
beforeRouteUpdate(to, from, next) { beforeRouteUpdate(to, from, next) {
// this.activeName = this.$t('window.containerInfo.changeLog')
this.$store.dispatch('setWindowOldRoute', { this.$store.dispatch('setWindowOldRoute', {
path: from.path, path: from.path,
fullPath: from.fullPath, fullPath: from.fullPath,
@ -439,10 +436,7 @@ export default {
} }
return 'open-table-detail' return 'open-table-detail'
}, },
getterIsShowedRecordNavigation() { iconShowedRecordNavigation() {
return this.$store.getters.getIsShowedRecordNavigation(this.windowUuid)
},
iconIsShowedRecordNavigation() {
if (this.isShowedRecordNavigation) { if (this.isShowedRecordNavigation) {
return 'el-icon-caret-left' return 'el-icon-caret-left'
} }
@ -454,8 +448,8 @@ export default {
} }
return 'el-icon-caret-right' return 'el-icon-caret-right'
}, },
styleMainIsShowedTabChildren() { styleMainTab() {
if (this.isShowedTabChildren) { if (this.isShowedTabsChildren) {
return { return {
height: 'initial', height: 'initial',
overflow: 'auto' overflow: 'auto'
@ -467,7 +461,7 @@ export default {
} }
}, },
splitAreaStyle() { splitAreaStyle() {
if (this.isShowedTabChildren) { if (this.isShowedTabsChildren) {
return { return {
overflow: 'auto' overflow: 'auto'
} }
@ -477,7 +471,7 @@ export default {
} }
}, },
sizeAreaStyle() { sizeAreaStyle() {
if (this.isShowedTabChildren) { if (this.isShowedTabsChildren) {
return 50 return 50
} }
return 100 return 100
@ -486,6 +480,12 @@ export default {
getterWindow() { getterWindow() {
return this.$store.getters.getWindow(this.windowUuid) return this.$store.getters.getWindow(this.windowUuid)
}, },
isShowedTabsChildren() {
return this.getterWindow.isShowedTabsChildren
},
isShowedRecordNavigation() {
return this.$store.getters.getIsShowedRecordNavigation(this.windowUuid)
},
getHeightPanelTop() { getHeightPanelTop() {
return this.$store.getters.getSplitHeightTop return this.$store.getters.getSplitHeightTop
}, },
@ -508,8 +508,8 @@ export default {
return changeLog return changeLog
} }
changeLog.sort((a, b) => { changeLog.sort((a, b) => {
var c = new Date(a.logDate) const c = new Date(a.logDate)
var d = new Date(b.logDate) const d = new Date(b.logDate)
return d - c return d - c
}) })
return changeLog return changeLog
@ -643,13 +643,11 @@ export default {
}, },
// callback new size // callback new size
onDrag(size) { onDrag(size) {
var bottomPanel = size[1]
var topPanel = size[0]
this.$store.dispatch('setSplitHeightTop', { this.$store.dispatch('setSplitHeightTop', {
splitHeightTop: topPanel splitHeightTop: size[0]
}) })
this.$store.dispatch('setSplitHeight', { this.$store.dispatch('setSplitHeight', {
splitHeight: bottomPanel splitHeight: size[1]
}) })
}, },
// get window from vuex store or server // get window from vuex store or server
@ -657,7 +655,8 @@ export default {
if (this.getterWindow) { if (this.getterWindow) {
this.generateWindow() this.generateWindow()
this.isLoadingFromServer = true this.isLoadingFromServer = true
} else { return
}
this.$store.dispatch('getWindowFromServer', { this.$store.dispatch('getWindowFromServer', {
windowUuid: this.windowUuid, windowUuid: this.windowUuid,
routeToDelete: this.$route routeToDelete: this.$route
@ -666,49 +665,40 @@ export default {
this.generateWindow() this.generateWindow()
this.isLoadingFromServer = true this.isLoadingFromServer = true
}) })
.finally(() => {
this.isLoaded = true
})
}
}, },
generateWindow() { generateWindow() {
this.windowMetadata = this.getterWindow this.windowMetadata = this.getterWindow
if (this.getterIsShowedRecordNavigation === undefined) {
this.listRecordNavigation = this.getterRecordList
if (this.windowMetadata.windowType === 'Q' || this.windowMetadata.windowType === 'M' && this.listRecordNavigation >= 10) {
this.isShowedRecordNavigation = true
} else if (this.windowMetadata.windowType === 'T') {
this.isShowedRecordNavigation = false
}
} else {
this.isShowedRecordNavigation = this.getterIsShowedRecordNavigation
}
this.isShowedTabChildren = this.windowMetadata.isShowedDetail let isShowRecords = this.isShowedRecordNavigation
if (isShowRecords === undefined) {
if (['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) {
isShowRecords = true
} else if (this.windowMetadata.windowType === 'T') {
isShowRecords = false
} else if (this.$route.query.action === 'advancedQuery') {
isShowRecords = true
}
}
this.handleChangeShowedRecordNavigation(!isShowRecords)
this.isLoaded = true this.isLoaded = true
this.changeShowedRecordNavigation()
}, },
handleChangeShowedRecordNavigation(value) { handleChangeShowedRecordNavigation(value) {
this.isShowedRecordNavigation = !this.isShowedRecordNavigation this.$store.dispatch('changeWindowAttribute', {
this.changeShowedRecordNavigation() parentUuid: this.windowUuid, // act as parentUuid
attributeName: 'isShowedRecordNavigation',
attributeValue: !value
})
}, },
handleChangeShowedPanel(value) { handleChangeShowedPanel(value) {
this.isPanel = !this.isPanel this.isPanel = !this.isPanel
this.isShowedRecordPanel = !this.isShowedRecordPanel this.isShowedRecordPanel = !this.isShowedRecordPanel
}, },
changeShowedRecordNavigation() {
this.$store.dispatch('changeShowedRecordWindow', {
parentUuid: this.windowUuid,
containerUuid: this.windowMetadata.currentTab.uuid, // act as parentUuid
isShowedRecordNavigation: this.isShowedRecordNavigation
})
},
handleChangeShowedTabChildren() { handleChangeShowedTabChildren() {
this.isShowedTabChildren = !this.isShowedTabChildren this.$store.dispatch('changeWindowAttribute', {
this.$store.dispatch('changeShowedDetail', { parentUuid: this.windowUuid, // act as parentUuid
panelType: this.panelType, attributeName: 'isShowedTabsChildren',
containerUuid: this.windowUuid, // act as parentUuid attributeValue: !this.isShowedTabsChildren
isShowedDetail: this.isShowedTabChildren
}) })
}, },
getIsRecordLocked() { getIsRecordLocked() {

View File

@ -19,7 +19,6 @@
<script> <script>
import { showMessage } from '@/utils/ADempiere/notification' import { showMessage } from '@/utils/ADempiere/notification'
import { resetRouter } from '@/router'
export default { export default {
name: 'RolesNavbar', name: 'RolesNavbar',
@ -54,27 +53,16 @@ export default {
}, },
methods: { methods: {
showMessage, showMessage,
resetRouter,
handleChange(valueSelected) { handleChange(valueSelected) {
this.$message({ this.$message({
message: this.$t('notifications.loading'), message: this.$t('notifications.loading'),
iconClass: 'el-icon-loading' iconClass: 'el-icon-loading'
}) })
this.$store.dispatch('user/changeRoles', valueSelected) this.$store.dispatch('user/changeRoles', {
roleUuid: valueSelected
})
.then(response => { .then(response => {
this.$store.dispatch('listDashboard', response.uuid) this.$store.dispatch('listDashboard', response.uuid)
this.showMessage({
message: this.$t('notifications.successChangeRole'),
type: 'success'
})
this.$store.dispatch('permission/generateRoutes')
.then(response => {
this.resetRouter()
response.forEach((element) => {
this.$router.resolve(element)
})
this.$router.addRoutes(response)
})
}) })
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
}, },

View File

@ -51,7 +51,6 @@
<script> <script>
import { getLanguage } from '@/lang' import { getLanguage } from '@/lang'
import { showMessage } from '@/utils/ADempiere' import { showMessage } from '@/utils/ADempiere'
import { resetRouter } from '@/router'
export default { export default {
name: 'ProfileRole', name: 'ProfileRole',
@ -90,26 +89,14 @@ export default {
}, },
methods: { methods: {
showMessage, showMessage,
resetRouter,
handleChange(valueSelected) { handleChange(valueSelected) {
this.$message({ this.$message({
message: this.$t('notifications.loading'), message: this.$t('notifications.loading'),
iconClass: 'el-icon-loading' iconClass: 'el-icon-loading'
}) })
this.$store.dispatch('user/changeRoles', valueSelected) this.$store.dispatch('user/changeRoles', {
.then(response => { roleUuid: valueSelected,
this.showMessage({ isCloseAllViews: false
message: this.$t('notifications.successChangeRole'),
type: 'success'
})
this.$store.dispatch('permission/generateRoutes')
.then(response => {
this.resetRouter()
response.forEach(element => {
this.$router.resolve(element)
})
this.$router.addRoutes(response)
})
}) })
}, },
changeLanguage(languageValue) { changeLanguage(languageValue) {