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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@
<field-translated
v-if="field.isTranslated && !isAdvancedQuery"
:field-attributes="fieldAttributes"
:record-uuid="field.optionCRUD"
:record-uuid="field.recordUuid"
/>
</template>
<component
@ -73,7 +73,7 @@ import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
* reference (or type of visualization) of each field
*/
export default {
name: 'Field',
name: 'FieldDefinition',
components: {
FieldContextInfo,
FieldTranslated,
@ -88,10 +88,6 @@ export default {
type: String,
default: ''
},
metadataUuid: {
type: String,
default: undefined
},
panelType: {
type: String,
default: 'window'
@ -277,8 +273,9 @@ export default {
return true
}
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new
let isWithRecord = this.field.optionCRUD !== 'create-new'
let isWithRecord = this.field.recordUuid !== 'create-new'
if (this.inTable) {
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>
<el-card
:shadow="isMobile ? 'never' : 'hover'"
:shadow="shadowGroup"
:body-style="{ padding: '10px' }"
>
<el-row :gutter="gutterRow">
@ -40,7 +40,8 @@
:container-uuid="containerUuid"
:metadata-field="{
...fieldAttributes,
optionCRUD
optionCRUD,
recordUuid: uuidRecord
}"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
@ -72,7 +73,7 @@
class="card"
>
<el-card
:shadow="isMobile ? 'never' : 'hover'"
:shadow="shadowGroup"
:body-style="{ padding: '10px' }"
>
<div slot="header" class="clearfix">
@ -98,7 +99,8 @@
:container-uuid="containerUuid"
:metadata-field="{
...fieldAttributes,
optionCRUD
optionCRUD,
recordUuid: uuidRecord
}"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
@ -125,7 +127,7 @@
class="card"
>
<el-card
:shadow="isMobile ? 'never' : 'hover'"
:shadow="shadowGroup"
:body-style="{ padding: '10px' }"
>
<div slot="header" class="clearfix">
@ -150,7 +152,8 @@
:container-uuid="containerUuid"
:metadata-field="{
...fieldAttributes,
optionCRUD
optionCRUD,
recordUuid: uuidRecord
}"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:panel-type="panelType"
@ -239,6 +242,12 @@ export default {
}
},
computed: {
shadowGroup() {
if (this.isMobile) {
return 'never'
}
return 'hover'
},
optionCRUD() {
return this.isEmptyValue(this.uuidRecord) ? 'create-new' : this.uuidRecord
},
@ -251,12 +260,14 @@ export default {
}
return false
},
getterPanel() {
return this.$store.getters.getPanel(this.containerUuid, this.isAdvancedQuery)
},
getterFieldList() {
const panel = this.$store.getters.getPanel(this.containerUuid, this.isAdvancedQuery)
if (panel) {
return panel.fieldList
if (this.getterPanel) {
return this.getterPanel.fieldList
}
return panel
return undefined
},
isMobile() {
return this.$store.state.app.device === 'mobile'
@ -271,20 +282,9 @@ export default {
record: []
}
},
getterTotalDataRecordCount() {
return this.getterDataStore.recordCount
},
getterIsLoadedRecord() {
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() {
if (this.isMobile || this.fieldGroups.length < 2 || this.getterIsShowedRecordNavigation) {
return 'cards-not-group'
@ -299,14 +299,6 @@ export default {
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) {
// used in field, if uuid record or different create-new, field is read only
this.uuidRecord = newValue
@ -317,7 +309,7 @@ export default {
},
isLoadPanel(value) {
if (value) {
this.readParameters(this.$route)
this.readParameters()
}
}
},
@ -364,7 +356,7 @@ export default {
/**
* TODO: Delete route parameters after reading them
*/
readParameters(route) {
readParameters() {
var parameters = {
isLoadAllRecords: true,
isReference: false,
@ -372,6 +364,7 @@ export default {
isWindow: true,
criteria: {}
}
const route = this.$route
if (this.isPanelWindow) {
// TODO: use action notifyPanelChange with isShowedField in true
this.getterFieldList.forEach(fieldItem => {
@ -415,7 +408,8 @@ export default {
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.value = route.query.action
parameters.tableName = this.metadata.tableName
@ -458,7 +452,7 @@ export default {
fieldList: this.fieldList,
panelType: this.panelType
})
} else if (this.panelType === 'process' || this.panelType === 'browser') {
} else if (['process', 'browser'].includes(this.panelType)) {
if (!this.isEmptyValue(route.query)) {
this.$store.dispatch('notifyPanelChange', {
containerUuid: this.containerUuid,
@ -495,9 +489,10 @@ export default {
name: this.$route.name,
query: {
...this.$route.query,
action: this.dataRecordsq
action: this.dataRecords
},
params: {
...this.$route.params,
tableName: this.metadata.tableName,
recordId: this.dataRecords[`${this.metadata.tableName}_ID`]
}
@ -560,7 +555,6 @@ export default {
}
})
}
this.setFocus()
})
}
},
@ -616,16 +610,17 @@ export default {
return groupsList
},
setTagsViewTitle(actionValue) {
if (actionValue === 'create-new' || actionValue === '') {
if (actionValue === 'create-new' || this.isEmptyValue(actionValue)) {
this.tagTitle.action = this.$t('tagsView.newRecord')
} else if (actionValue === 'advancedQuery') {
this.tagTitle.action = this.$t('tagsView.advancedQuery')
} else {
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier)
if (field) {
if (this.dataRecords[field.columnName]) {
this.tagTitle.action = this.dataRecords[field.columnName]
const { identifierColumns } = this.getterPanel
if (!this.isEmptyValue(identifierColumns)) {
if (this.dataRecords[identifierColumns[0]]) {
this.tagTitle.action = this.dataRecords[identifierColumns[0]]
} else {
const field = this.fieldList.find(fieldItem => fieldItem.isIdentifier)
this.tagTitle.action = field.value
}
} else {
@ -644,7 +639,7 @@ export default {
},
changePanelRecord(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) {
this.dataRecords = recordSelected
this.$store.dispatch('notifyPanelChange', {
@ -656,11 +651,13 @@ export default {
fieldList: this.fieldList,
panelType: this.panelType
}).then(() => {
// delete records tabs children when change record uuid
this.$store.dispatch('deleteRecordContainer', {
viewUuid: this.parentUuid,
withOut: [this.containerUuid]
})
if (this.getterPanel.isTabsChildren) {
// delete records tabs children when change record uuid
this.$store.dispatch('deleteRecordContainer', {
viewUuid: this.parentUuid,
withOut: [this.containerUuid]
})
}
})
}
}

View File

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

View File

@ -1,7 +1,6 @@
<template>
<el-tabs v-model="currentTabChild" type="border-card" @tab-click="handleClick">
<template v-for="(tabAttributes, key) in getTabsList">
<!-- TODO: Add support to tabs isSortTab (sequence) -->
<template v-for="(tabAttributes, key) in tabsList">
<el-tab-pane
:key="key"
: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() {

View File

@ -22,31 +22,10 @@ export const tabMixin = {
computed: {
isCreateNew() {
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() {
const tabs = this.tabsList.filter(item => !item.isSortTab)
this.tabUuid = tabs[0].uuid
this.tabUuid = this.tabsList[0].uuid
},
methods: {
parseContext,
@ -74,9 +53,7 @@ export const tabMixin = {
}
},
handleBeforeLeave(activeName) {
const metadataTab = this.tabsList
.filter(tab => !tab.isSortTab)
.find(tab => tab.index === parseInt(activeName))
const metadataTab = this.tabsList.find(tab => tab.index === parseInt(activeName), 10)
if (!this.isEmptyValue(metadataTab.whereClause) && metadataTab.whereClause.includes('@')) {
metadataTab.whereClause = parseContext({
parentUuid: metadataTab.parentUuid,

View File

@ -17,6 +17,31 @@ export default {
},
key() {
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
isActive(route) {
if (route.name === 'Report Viewer') {
if (route.params.processId === this.$route.params.processId && route.params.tableName === this.$route.params.tableName) {
return route.params.processId === this.$route.params.processId
} else {
return route.path === this.$route.path
const isSameProcess = route.params.processId === this.$route.params.processId
if (isSameProcess && route.params.tableName === this.$route.params.tableName) {
return isSameProcess
}
} else {
return route.name === this.$route.name
return route.path === this.$route.path
}
return route.name === this.$route.name
},
isAffix(tag) {
return tag.meta && tag.meta.affix
@ -190,26 +189,33 @@ export default {
})
},
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 }) => {
if (this.isActive(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() {

View File

@ -1,8 +1,10 @@
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 router from '@/router'
import language from '@/lang'
const browser = {
state: {
browser: []
@ -14,8 +16,8 @@ const browser = {
dictionaryResetCacheBrowser(state) {
state.browser = []
},
changeShowedCriteriaBrowser(state, payload) {
payload.browser.isShowedCriteria = payload.isShowedCriteria
changeBrowser(state, payload) {
payload.browser = payload.newBrowser
}
},
actions: {
@ -28,8 +30,8 @@ const browser = {
.then(browserResponse => {
const panelType = 'browser'
const additionalAttributes = {
containerUuid: browserResponse.uuid,
panelType: panelType
containerUuid,
panelType
}
const {
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
const actions = []
if (process) {
@ -112,27 +103,39 @@ const browser = {
description: process.description,
isReport: process.isReport,
isDirectPrint: process.isDirectPrint,
containerUuidAssociated: newBrowser.uuid,
containerUuidAssociated: containerUuid,
panelTypeAssociated: panelType
})
// TODO: No list of parameters
// // add process associated in vuex store
// dispatch('addProcessAssociated', {
// processToGenerate: process,
// containerUuidAssociated: newBrowser.uuid
// containerUuidAssociated: containerUuid
// })
}
dispatch('addPanel', newBrowser)
commit('addBrowser', newBrowser)
// Add process menu
dispatch('setContextMenu', {
containerUuid: browserResponse.uuid,
containerUuid,
relations: [],
actions: actions,
actions,
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)
})
.catch(error => {
@ -146,13 +149,20 @@ const browser = {
})
})
},
changeShowedCriteriaBrowser({ commit, getters }, {
changeBrowserAttribute({ commit, getters }, {
containerUuid,
isShowedCriteria
browser,
attributeName,
attributeValue
}) {
commit('changeShowedCriteriaBrowser', {
browser: getters.getBrowser(containerUuid),
isShowedCriteria: isShowedCriteria
if (isEmptyValue(browser)) {
browser = getters.getBrowser(containerUuid)
}
const newBrowser = browser
newBrowser[attributeName] = attributeValue
commit('changeBrowser', {
browser,
newBrowser
})
}
},

View File

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

View File

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

View File

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

View File

@ -32,9 +32,6 @@ const panel = {
dictionaryResetCache(state) {
state.panel = []
},
changeFieldList(state, payload) {
payload.fieldList = payload.newFieldList
},
changeField(state, payload) {
payload.field = payload.newField
},
@ -152,7 +149,6 @@ const panel = {
})
commit('changePanel', {
containerUuid,
panel,
newPanel
})
@ -192,14 +188,18 @@ const panel = {
* @param {array} fieldsIncludes fields to set valueAttribute
* @param {array} fieldsExcludes fields to dont change
*/
changeFieldAttributesBoolean({ commit, getters }, parameters) {
const { containerUuid, attribute, valueAttribute, fieldsIncludes, fieldsExcludes } = parameters
var { fieldList = [] } = parameters
if (fieldList.length <= 0) {
fieldList = getters.getFieldsListFromPanel(containerUuid)
}
changeFieldAttributesBoolean({ commit, getters }, {
containerUuid,
isAdvancedQuery = false,
attribute,
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
if (fieldsExcludes && fieldsExcludes.length && fieldsExcludes.includes(itemField.columnName)) {
return itemField
@ -213,22 +213,24 @@ const panel = {
itemField[attribute] = !valueAttribute
return itemField
})
commit('changeFieldList', {
fieldList: fieldList,
newFieldList: newFields
commit('changePanel', {
panel,
newPanel
})
},
/**
* @param {string} containerUuid
* @param {array} fieldList
* @param {array} fieldsList
*/
showOnlyMandatoryColumns({ dispatch, getters }, parameters) {
const { containerUuid } = parameters
var { fieldList = [] } = parameters
if (fieldList.length <= 0) {
fieldList = getters.getFieldsListFromPanel(containerUuid)
showOnlyMandatoryColumns({ dispatch, getters }, {
containerUuid,
fieldsList = []
}) {
if (fieldsList.length <= 0) {
fieldsList = getters.getFieldsListFromPanel(containerUuid)
}
const fieldsExcludes = fieldList.filter(fieldItem => {
const fieldsIncludes = fieldsList.filter(fieldItem => {
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
if (isMandatory) {
return true
@ -238,8 +240,8 @@ const panel = {
})
dispatch('changeFieldAttributesBoolean', {
containerUuid: containerUuid,
fieldsIncludes: fieldsExcludes,
containerUuid,
fieldsIncludes,
attribute: 'isShowedTableFromUser',
valueAttribute: true
})
@ -250,12 +252,12 @@ const panel = {
*/
showAllAvailableColumns({ dispatch, getters }, {
containerUuid,
fieldList = []
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 isDisplayed = fieldItem.isDisplayed && fieldItem.isDisplayedFromLogic && !fieldItem.isKey
// Verify for displayed and is active
return fieldItem.isActive && isDisplayed
@ -265,7 +267,7 @@ const panel = {
dispatch('changeFieldAttributesBoolean', {
containerUuid,
fieldsIncludes: fieldsExcludes,
fieldsIncludes,
attribute: 'isShowedTableFromUser',
valueAttribute: true
})
@ -283,54 +285,62 @@ const panel = {
parentUuid,
containerUuid,
panelType = 'window',
isNewRecord = false,
fieldList = []
isNewRecord = false
}) {
const defaultAttributes = getters.getParsedDefaultValues({
parentUuid,
containerUuid
})
if (panelType === 'window' && isNewRecord) {
// redirect to create new record
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
query: {
...oldRoute.query,
action: 'create-new'
}
})
showMessage({
message: language.t('data.createNewRecord'),
type: 'info'
return new Promise(resolve => {
const panel = getters.getPanel(containerUuid)
const defaultAttributes = getters.getParsedDefaultValues({
parentUuid,
containerUuid,
fieldsList: panel.fieldList
})
if (!fieldList.length) {
fieldList = getters.getFieldsListFromPanel(containerUuid)
}
fieldList.forEach(fieldToBlanck => {
commit('changeFieldValueToNull', {
field: fieldToBlanck,
value: undefined
if (panelType === 'window' && isNewRecord) {
// redirect to create new record
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
action: 'create-new'
}
})
showMessage({
message: language.t('data.createNewRecord'),
type: 'info'
})
})
// delete records tabs children when change record uuid
dispatch('deleteRecordContainer', {
viewUuid: parentUuid,
withOut: [containerUuid],
isNew: true
panel.fieldList.forEach(fieldToBlanck => {
commit('changeFieldValueToNull', {
field: fieldToBlanck,
value: undefined
})
})
if (panel.isTabsChildren) {
// delete records tabs children when change record uuid
dispatch('deleteRecordContainer', {
viewUuid: parentUuid,
withOut: [containerUuid],
isNew: true
})
}
}
dispatch('notifyPanelChange', {
parentUuid,
containerUuid,
panelType,
fieldList: panel.fieldList,
newValues: defaultAttributes,
isSendToServer: false,
// if isNewRecord active callouts, if window is closed no send callout
isSendCallout: isNewRecord,
isPrivateAccess: false
})
}
dispatch('notifyPanelChange', {
parentUuid,
containerUuid,
panelType,
newValues: defaultAttributes,
isSendToServer: false,
// if isNewRecord active callouts, if window is closed no send callout
isSendCallout: isNewRecord,
isPrivateAccess: false
resolve(defaultAttributes)
})
},
/**
@ -351,7 +361,7 @@ const panel = {
withOutColumnNames = [],
isSendCallout = true,
isAdvancedQuery = false,
isPrivateAccess = true,
isPrivateAccess = false,
fieldList = []
}) {
if (!fieldList.length) {
@ -384,6 +394,8 @@ const panel = {
isChangedOldValue: true // defines if set oldValue with newValue instead of current value
})
})
// show fields in query
if (isShowedField && Object.keys(newValues).length) {
// join column names without duplicating it
fieldsShowed = Array.from(new Set([
@ -392,7 +404,6 @@ const panel = {
]))
dispatch('changeFieldAttributesBoolean', {
parentUuid,
containerUuid,
attribute: 'isShowedFromUser',
valueAttribute: true,
@ -405,11 +416,14 @@ const panel = {
})
if (isPrivateAccess) {
const tableName = rootGetters.getTableNameFromTab(parentUuid, containerUuid)
dispatch('getPrivateAccessFromServer', {
tableName,
recordId: newValues[`${tableName}_ID`],
userUuid: rootGetters['user/getUserUuid']
})
// TODO: Add current id and new id to comparison
if (!isEmptyValue(newValues[`${tableName}_ID`])) {
dispatch('getPrivateAccessFromServer', {
tableName,
recordId: newValues[`${tableName}_ID`],
userUuid: rootGetters['user/getUserUuid']
})
}
}
}
},
@ -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 }, {
parentUuid,
containerUuid,
@ -822,19 +819,33 @@ const panel = {
newPanel: newPanel
})
},
/**
* Change a attribute in field state
* @param {string} attributeName
* @param {mixed} attributeValue
* @param {boolean|object} multipleAttributes
*/
changeFieldAttribure({ commit, getters }, {
containerUuid,
isAdvancedQuery,
columnName,
field,
attributeName,
attributeValue
attributeValue,
multipleAttributes = false
}) {
if (isEmptyValue(field)) {
field = getters.getFieldFromColumnName({ containerUuid, isAdvancedQuery, columnName })
}
const newField = field
newField[attributeName] = attributeValue
let newField = field
if (multipleAttributes) {
newField = {
...newField,
multipleAttributes
}
} else {
newField[attributeName] = attributeValue
}
commit('changeField', {
field,
newField
@ -1041,14 +1052,14 @@ const panel = {
parentUuid,
containerUuid,
isGetServer = true,
fieldList = []
fieldsList = []
}) => {
if (!fieldList.length) {
fieldList = getters.getFieldsListFromPanel(containerUuid)
if (!fieldsList.length) {
fieldsList = getters.getFieldsListFromPanel(containerUuid)
}
var attributesObject = {}
const attributesObject = {}
fieldList
fieldsList
.map(fieldItem => {
let isSQL = false
let valueToReturn = fieldItem.parsedDefaultValue
@ -1112,8 +1123,8 @@ const panel = {
isOnlyDisplayed = false,
isAdvancedQuery = false
}) => {
var fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
var attributesListLink = ''
let fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
let attributesListLink = ''
if (withOut.length) {
fieldList = fieldList.filter(fieldItem => {
// columns to exclude
@ -1157,60 +1168,6 @@ const panel = {
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
* [{ columname: name key, value: value to send, operator }]

View File

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

View File

@ -1,3 +1,4 @@
import Vue from 'vue'
const utils = {
state: {
@ -14,7 +15,17 @@ const utils = {
isShowedTabChildren: false,
recordTable: 0,
selectionProcess: [],
isContainerInfo: false
isContainerInfo: false,
openRoute: {
path: '',
name: '',
route: {},
params: {},
definedParameters: {},
query: {},
isReaded: false,
isLoaded: false
}
},
mutations: {
setWidth(state, width) {
@ -55,6 +66,16 @@ const utils = {
},
setReportTypeToShareLink(state, 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: {
@ -88,12 +109,13 @@ const utils = {
setProcessSelect({ commit }, params) {
commit('setProcessSelecetion', params)
},
changeShowedDetail({ dispatch }, params) {
if (params.panelType === 'window') {
dispatch('changeShowedDetailWindow', params)
} else if (params.panelType === 'browser') {
dispatch('changeShowedCriteriaBrowser', params)
}
setOpenRoute({ commit }, routeParameters) {
commit('setOpenRoute', {
...routeParameters
})
},
setReadRoute({ commit }, parameters) {
commit('setReadRoute', parameters)
},
setTempShareLink({ commit }, parameters) {
if (!parameters.href.includes(String(parameters.processId))) {
@ -159,6 +181,12 @@ const utils = {
},
getReportType: (state) => {
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,
getTab as getTabMetadata
} 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 router from '@/router'
import { generateField, getFieldTemplate } from '@/utils/ADempiere/dictionaryUtils'
@ -21,11 +22,8 @@ const window = {
state.window = []
state.windowIndex = 0
},
changeShowedDetailWindow(state, payload) {
payload.window.isShowedDetail = payload.changeShowedDetail
},
changeShowedRecordWindow(state, payload) {
payload.window.isShowedRecordNavigation = payload.isShowedRecordNavigation
changeWindow(state, payload) {
payload.window = payload.newWindow
},
setCurrentTab(state, payload) {
payload.window.currentTabUuid = payload.tabUuid
@ -197,9 +195,9 @@ const window = {
if (tab.isParentTab) {
parentTabs.push(tab)
} else {
childrenTabs.push(tab)
return tab
}
childrenTabs.push(tab)
return tab
})
@ -209,16 +207,18 @@ const window = {
tabsListParent: parentTabs,
tabsListChildren: childrenTabs,
// app attributes
isShowedDetail: Boolean(childrenTabs.length),
currentTabUuid: parentTabs[0].uuid
}
const newWindow = {
...responseWindow,
...tabProperties,
isShowedRecordNavigation: undefined,
firstTabUuid,
windowIndex: state.windowIndex + 1
windowIndex: state.windowIndex + 1,
// App properties
isShowedTabsChildren: Boolean(childrenTabs.length),
isShowedRecordNavigation: undefined,
isShowedAdvancedQuery: false
}
commit('addWindow', newWindow)
return newWindow
@ -300,6 +300,7 @@ const window = {
fieldsList.push(field)
}
const window = getters.getWindow(parentUuid)
// Panel for save on store
const panel = {
...getters.getTab(parentUuid, containerUuid),
@ -308,7 +309,8 @@ const window = {
fieldList: fieldsList,
panelType,
// app attributes
isShowedTotals: false
isShowedTotals: false,
isTabsChildren: Boolean(window.tabsListChildren.length)
}
dispatch('addPanel', panel)
@ -326,28 +328,20 @@ const window = {
console.warn(`Dictionary Tab (State Window) - Error ${error.code}: ${error.message}.`)
})
},
changeShowedDetailWindow({ commit, state }, {
containerUuid,
isShowedDetail = true
}) {
const window = state.window.find(itemWindow => {
return itemWindow.uuid === containerUuid
})
commit('changeShowedDetailWindow', {
window: window,
changeShowedDetail: isShowedDetail
})
},
changeShowedRecordWindow({ commit, state }, {
changeWindowAttribute({ commit, getters }, {
parentUuid,
isShowedRecordNavigation = true
window,
attributeName,
attributeValue
}) {
const window = state.window.find(itemWindow => {
return itemWindow.uuid === parentUuid
})
commit('changeShowedRecordWindow', {
window: window,
isShowedRecordNavigation: isShowedRecordNavigation
if (isEmptyValue(window)) {
window = getters.getWindow(parentUuid)
}
const newWindow = window
newWindow[attributeName] = attributeValue
commit('changeWindow', {
window,
newWindow
})
},
/**

View File

@ -55,15 +55,15 @@ const windowControl = {
}
},
actions: {
undoPanelToNew({ dispatch, rootGetters }, parameters) {
undoPanelToNew({ dispatch, rootGetters }, { containerUuid }) {
const oldAttributes = rootGetters.getColumnNamesAndValues({
containerUuid: parameters.containerUuid,
containerUuid,
propertyName: 'oldValue',
isObjectReturn: true,
isAddDisplayColumn: true
})
dispatch('notifyPanelChange', {
containerUuid: parameters.containerUuid,
containerUuid,
newValues: oldAttributes
})
},
@ -82,7 +82,7 @@ const windowControl = {
const { tableName, fieldList } = rootGetters.getPanel(containerUuid)
// delete key from attributes
const finalAttributes = rootGetters.getColumnNamesAndValues({
const attributesList = rootGetters.getColumnNamesAndValues({
containerUuid,
propertyName: 'value',
isEvaluateValues: true,
@ -92,15 +92,15 @@ const windowControl = {
commit('addInCreate', {
containerUuid,
tableName,
attributesList: finalAttributes
attributesList
})
createEntity({
tableName,
attributesList: finalAttributes
attributesList
})
.then(createEntityResponse => {
const newValues = createEntityResponse.values
finalAttributes.forEach(element => {
attributesList.forEach(element => {
if (element.columnName.includes('DisplayColumn')) {
newValues[element.columnName] = element.value
}
@ -138,6 +138,9 @@ const windowControl = {
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
action: createEntityResponse.uuid
@ -157,14 +160,14 @@ const windowControl = {
message: error.message,
type: 'error'
})
console.warn(`Create Entity error: ${error.message}`)
console.warn(`Create Entity error: ${error.message}.`)
reject(error)
})
.finally(() => {
commit('deleteInCreate', {
containerUuid,
tableName,
attributesList: finalAttributes
attributesList
})
})
})
@ -217,6 +220,9 @@ const windowControl = {
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
action: createEntityResponse.recordUuid
@ -381,7 +387,7 @@ const windowControl = {
parentUuid,
containerUuid,
tableName: tab.tableName,
recordUuid: recordUuid
recordUuid
})
.then(response => {
// update panel
@ -411,8 +417,6 @@ const windowControl = {
recordUuid: parameters.recordUuid
})
.then(responseDeleteEntity => {
const oldRoute = router.app._route
// refresh record list
dispatch('getDataListTab', {
parentUuid: parameters.parentUuid,
@ -428,9 +432,13 @@ const windowControl = {
isNewRecord: true
})
} else {
const oldRoute = router.app._route
// else display first record of table in panel
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
action: responseDataList[0].UUID
@ -500,6 +508,9 @@ const windowControl = {
if (record.UUID === oldRoute.query.action) {
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
action: 'create-new'
@ -545,13 +556,19 @@ const windowControl = {
console.warn(`Rollback Entity error: ${error.message}. Code: ${error.code}.`)
})
},
setDataLog({ commit }, parameters) {
setDataLog({ commit }, {
containerUuid,
tableName,
recordId,
recordUuid,
eventType
}) {
commit('setDataLog', {
containerUuid: parameters.containerUuid,
tableName: parameters.tableName,
recordId: parameters.recordId,
recordUuid: parameters.recordUuid,
eventType: parameters.eventType
containerUuid,
tableName,
recordId,
recordUuid,
eventType
})
},
/**
@ -575,8 +592,8 @@ const windowControl = {
let parsedQuery = tab.query
if (!isEmptyValue(parsedQuery) && parsedQuery.includes('@')) {
parsedQuery = parseContext({
parentUuid: parentUuid,
containerUuid: containerUuid,
parentUuid,
containerUuid,
value: tab.query,
isBooleanToString: true
}).value
@ -585,8 +602,8 @@ const windowControl = {
let parsedWhereClause = tab.whereClause
if (!isEmptyValue(parsedWhereClause) && parsedWhereClause.includes('@')) {
parsedWhereClause = parseContext({
parentUuid: parentUuid,
containerUuid: containerUuid,
parentUuid,
containerUuid,
value: tab.whereClause,
isBooleanToString: true
}).value
@ -612,21 +629,21 @@ const windowControl = {
// TODO: evaluate if overwrite values to conditions
if (!isLoadAllRecords && tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) {
conditionsList.push({
columnName: columnName,
value: value
columnName,
value
})
}
return dispatch('getObjectListFromCriteria', {
parentUuid: tab.parentUuid,
containerUuid: containerUuid,
containerUuid,
tableName: tab.tableName,
query: parsedQuery,
whereClause: parsedWhereClause,
orderByClause: tab.orderByClause,
conditionsList,
isParentTab: tab.isParentTab,
isAddRecord: isAddRecord,
isShowNotification: isShowNotification
isAddRecord,
isShowNotification
})
.then(response => {
if (isRefreshPanel && !isEmptyValue(recordUuid) && recordUuid !== 'create-new') {
@ -635,15 +652,15 @@ const windowControl = {
// update fields with values obtained from the server
dispatch('notifyPanelChange', {
parentUuid: tab.parentUuid,
containerUuid: containerUuid,
newValues: newValues,
containerUuid,
newValues,
isSendToServer: false
})
} else {
// this record is missing (Deleted or the query does not include it)
dispatch('resetPanelToNew', {
parentUuid: tab.parentUuid,
containerUuid: containerUuid
containerUuid
})
}
}
@ -675,11 +692,11 @@ const windowControl = {
if (isAddRecord) {
dispatch('setPageNumber', {
parentUuid: parentUuid,
containerUuid: containerUuid,
parentUuid,
containerUuid,
pageNumber: nextPage,
panelType: 'window',
isAddRecord: isAddRecord,
isAddRecord,
isShowNotification: false
})
}
@ -731,7 +748,7 @@ const windowControl = {
...referenceResponse,
windowUuid: parentUuid,
recordUuid,
referencesList: referencesList
referencesList
}
commit('addReferencesList', references)
resolve(referenceResponse)
@ -782,7 +799,7 @@ const windowControl = {
commit('setTotalRequest', countRequest)
updateEntity({
tableName: tableName,
tableName,
recordUuid: itemData.UUID,
attributesList: valuesToSend
})
@ -809,15 +826,15 @@ const windowControl = {
commit('setTotalResponse', 0)
dispatch('setRecordSelection', {
parentUuid: parentUuid,
containerUuid: containerUuid,
parentUuid,
containerUuid,
isLoaded: false
})
dispatch('setTabSequenceRecord', [])
// refresh record list in table source
dispatch('getDataListTab', {
parentUuid: parentUuid,
parentUuid,
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 router, { resetRouter } from '@/router'
import { showMessage } from '@/utils/ADempiere/notification'
import language from '@/lang'
const state = {
token: getToken(),
@ -188,7 +189,29 @@ const actions = {
})
},
// 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({
sessionUuid: getToken(),
roleUuid: roleUuid,
@ -204,21 +227,7 @@ const actions = {
// Update user info and context associated with session
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, {
root: true
})
@ -226,6 +235,10 @@ const actions = {
root: true
})
showMessage({
message: language.t('notifications.successChangeRole'),
type: 'success'
})
return {
...role,
sessionUuid: changeRoleResponse.uuid
@ -238,6 +251,15 @@ const actions = {
})
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 => {
// const token = role
// commit('SET_TOKEN', token)
@ -245,7 +267,7 @@ const actions = {
// setToken(token)
// const { roles } = await dispatch('getInfo')
// generate accessible routes map based on roles
// generate accessible routes map based on roles
// const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true })
// dynamically add accessible routes

View File

@ -153,7 +153,7 @@ export function generateField(fieldToGenerate, moreAttributes, typeRange = false
return item.type === field.componentPath
})
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 = {
type: field.componentPath,
size: DEFAULT_SIZE

View File

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

View File

@ -19,12 +19,30 @@
trigger="hover"
>
<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>
</h3>
<iframe v-if="reportFormat === 'pdf'" 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">
<iframe
v-if="reportFormat === 'pdf'"
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-main style="padding: 0;">
<div
@ -69,7 +87,6 @@ export default {
data() {
return {
panelType: 'process',
url: this.$store.getters.getProcessResult.url,
name: [],
reportFormat: '',
collectionReportFormat: [
@ -94,6 +111,9 @@ export default {
processMetadata() {
return this.$store.getters.getProcessById(this.$route.params.processId)
},
url() {
return this.$store.getters.getProcessResult.url
},
getterCachedReport() {
return this.$store.getters.getCachedReport(this.$route.params.instanceUuid)
}

View File

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

View File

@ -19,7 +19,6 @@
<script>
import { showMessage } from '@/utils/ADempiere/notification'
import { resetRouter } from '@/router'
export default {
name: 'RolesNavbar',
@ -54,27 +53,16 @@ export default {
},
methods: {
showMessage,
resetRouter,
handleChange(valueSelected) {
this.$message({
message: this.$t('notifications.loading'),
iconClass: 'el-icon-loading'
})
this.$store.dispatch('user/changeRoles', valueSelected)
this.$store.dispatch('user/changeRoles', {
roleUuid: valueSelected
})
.then(response => {
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: '/' })
},

View File

@ -51,7 +51,6 @@
<script>
import { getLanguage } from '@/lang'
import { showMessage } from '@/utils/ADempiere'
import { resetRouter } from '@/router'
export default {
name: 'ProfileRole',
@ -90,27 +89,15 @@ export default {
},
methods: {
showMessage,
resetRouter,
handleChange(valueSelected) {
this.$message({
message: this.$t('notifications.loading'),
iconClass: 'el-icon-loading'
})
this.$store.dispatch('user/changeRoles', valueSelected)
.then(response => {
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.$store.dispatch('user/changeRoles', {
roleUuid: valueSelected,
isCloseAllViews: false
})
},
changeLanguage(languageValue) {
this.currentLanguage = languageValue