1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00

improves: Optimize the times data is consulted in the vuex store (#426)

* improves: Optimize the times data is consulted in the vuex store

* Improves to get store tab.
This commit is contained in:
Edwin Betancourt 2020-04-02 04:06:54 -04:00 committed by GitHub
parent ee9feded0c
commit 927de4aa33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 320 additions and 253 deletions

View File

@ -27,6 +27,10 @@ export const contextMixin = {
type: String, type: String,
default: undefined default: undefined
}, },
tableName: {
type: String,
default: undefined
},
isReport: { isReport: {
type: Boolean, type: Boolean,
default: false default: false
@ -281,6 +285,7 @@ export const contextMixin = {
this.$store.dispatch('getReferencesListFromServer', { this.$store.dispatch('getReferencesListFromServer', {
parentUuid: this.parentUuid, parentUuid: this.parentUuid,
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
tableName: this.tableName,
recordUuid: this.recordUuid recordUuid: this.recordUuid
}) })
.then(() => { .then(() => {

View File

@ -5,6 +5,7 @@
:parent-uuid="parentUuid" :parent-uuid="parentUuid"
:container-uuid="containerUuid" :container-uuid="containerUuid"
:panel-type="panelType" :panel-type="panelType"
:table-name="tableName"
:is-report="isReport" :is-report="isReport"
:last-parameter="lastParameter" :last-parameter="lastParameter"
:report-format="reportFormat" :report-format="reportFormat"
@ -34,6 +35,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
tableName: {
type: String,
default: undefined
},
isReport: { isReport: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -39,12 +39,12 @@
:field="fieldAttributes" :field="fieldAttributes"
/> />
<translated <translated
v-if="field.isTranslated && !isAdvancedQuery" v-if="field.isTranslatedField"
:field-attributes="fieldAttributes" :field-attributes="fieldAttributes"
:record-uuid="field.recordUuid" :record-uuid="field.recordUuid"
/> />
<calculator <calculator
v-if="!isAdvancedQuery && isNumeric && !field.isReadOnlyFromLogic" v-if="field.isNumericField && !field.isReadOnlyFromLogic"
:field-attributes="fieldAttributes" :field-attributes="fieldAttributes"
:field-value="field.value" :field-value="field.value"
/> />
@ -170,10 +170,10 @@ export default {
if (this.field.isAlwaysUpdateable) { if (this.field.isAlwaysUpdateable) {
return false return false
} }
if (this.getterContextProcessing) { if (this.field.isProcessingContext) {
return true return true
} }
if (this.getterContextProcessed) { if (this.field.isProcessedContext) {
return true return true
} }
@ -216,12 +216,6 @@ export default {
} }
return '' return ''
}, },
getterIsShowedRecordNavigation() {
if (this.field.panelType === 'window') {
return this.$store.getters.getIsShowedRecordNavigation(this.field.parentUuid)
}
return false
},
sizeFieldResponsive() { sizeFieldResponsive() {
if (!this.isDisplayed) { if (!this.isDisplayed) {
return DEFAULT_SIZE return DEFAULT_SIZE
@ -254,7 +248,7 @@ export default {
return sizeField return sizeField
} }
// two columns if is mobile or desktop and show record navigation // two columns if is mobile or desktop and show record navigation
if (this.getWidth <= 768 || (this.getWidth >= 768 && this.getterIsShowedRecordNavigation)) { if (this.getWidth <= 768 || (this.getWidth >= 768 && this.field.isShowedRecordNavigation)) {
newSizes.xs = 12 newSizes.xs = 12
newSizes.sm = 12 newSizes.sm = 12
newSizes.md = 12 newSizes.md = 12
@ -282,25 +276,11 @@ export default {
} }
return sizeField return sizeField
}, },
getterContextProcessing() {
const processing = this.$store.getters.getContextProcessing(this.field.parentUuid)
if (processing === true || processing === 'Y') {
return true
}
return false
},
getterContextProcessed() {
const processed = this.$store.getters.getContextProcessed(this.field.parentUuid)
if (processed === true || processed === 'Y') {
return true
}
return false
},
processOrderUuid() { processOrderUuid() {
return this.$store.getters.getOrders return this.$store.getters.getOrders
}, },
isDocuemntStatus() { isDocuemntStatus() {
if (this.field.panelType === 'window') { if (this.field.panelType === 'window' && !this.isAdvancedQuery) {
if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) { if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
return true return true
} }
@ -312,9 +292,6 @@ export default {
return (this.field.contextInfo && this.field.contextInfo.isActive) || this.field.reference.windowsList.length return (this.field.contextInfo && this.field.contextInfo.isActive) || this.field.reference.windowsList.length
} }
return false return false
},
isNumeric() {
return this.field.componentPath === 'FieldNumber'
} }
}, },
watch: { watch: {

View File

@ -38,11 +38,14 @@
:key="subKey" :key="subKey"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
isShowedRecordNavigation,
isProcessingContext: getterContextProcessing,
isProcessedContext: getterContextProcessed,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
:record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]" :record-data-fields="isAdvancedQuery ? undefined : dataRecords[fieldAttributes.columnName]"
:in-group="!getterIsShowedRecordNavigation" :in-group="!isShowedRecordNavigation"
:is-advanced-query="isAdvancedQuery" :is-advanced-query="isAdvancedQuery"
/> />
</template> </template>
@ -94,6 +97,9 @@
:key="subKey" :key="subKey"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
isShowedRecordNavigation,
isProcessingContext: getterContextProcessing,
isProcessedContext: getterContextProcessed,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
@ -144,6 +150,9 @@
:key="subKey" :key="subKey"
:metadata-field="{ :metadata-field="{
...fieldAttributes, ...fieldAttributes,
isShowedRecordNavigation,
isProcessingContext: getterContextProcessing,
isProcessedContext: getterContextProcessed,
optionCRUD, optionCRUD,
recordUuid: uuidRecord recordUuid: uuidRecord
}" }"
@ -213,6 +222,10 @@ export default {
isAdvancedQuery: { isAdvancedQuery: {
type: Boolean, type: Boolean,
default: false default: false
},
isShowedRecordNavigation: {
type: Boolean,
default: false
} }
}, },
data() { data() {
@ -244,9 +257,21 @@ export default {
isPanelWindow() { isPanelWindow() {
return this.panelType === 'window' return this.panelType === 'window'
}, },
getterIsShowedRecordNavigation() { getterContextProcessing() {
if (this.isPanelWindow) { if (this.panelType === 'window' && !this.isAdvancedQuery) {
return this.$store.getters.getIsShowedRecordNavigation(this.parentUuid) const processing = this.$store.getters.getContextProcessing(this.parentUuid)
if (processing === true || processing === 'Y') {
return true
}
}
return false
},
getterContextProcessed() {
if (this.panelType === 'window' && !this.isAdvancedQuery) {
const processed = this.$store.getters.getContextProcessed(this.parentUuid)
if (processed === true || processed === 'Y') {
return true
}
} }
return false return false
}, },
@ -276,7 +301,7 @@ export default {
return this.getterDataStore.isLoaded return this.getterDataStore.isLoaded
}, },
classCards() { classCards() {
if (this.isMobile || this.fieldGroups.length < 2 || this.getterIsShowedRecordNavigation) { if (this.isMobile || this.fieldGroups.length < 2 || this.isShowedRecordNavigation) {
return 'cards-not-group' return 'cards-not-group'
} }
return 'cards-in-group' return 'cards-in-group'
@ -320,6 +345,7 @@ export default {
parentUuid: this.parentUuid, parentUuid: this.parentUuid,
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
panelType: this.panelType, panelType: this.panelType,
panelMetadata: this.metadata,
isAdvancedQuery: this.isAdvancedQuery isAdvancedQuery: this.isAdvancedQuery
}).then(() => { }).then(() => {
this.generatePanel(this.getterFieldList) this.generatePanel(this.getterFieldList)

View File

@ -17,6 +17,7 @@
:metadata="tabAttributes" :metadata="tabAttributes"
:group-tab="tabAttributes.tabGroup" :group-tab="tabAttributes.tabGroup"
:panel-type="panelType" :panel-type="panelType"
:is-showed-record-navigation="windowMetadata.isShowedRecordNavigation"
/> />
</el-tab-pane> </el-tab-pane>
</template> </template>
@ -34,15 +35,9 @@ export default {
}, },
mixins: [tabMixin], mixins: [tabMixin],
computed: { computed: {
getWindow() {
return this.$store.getters.getWindow(this.windowUuid)
},
// if tabs children is showed or closed
isShowedTabsChildren() {
return this.getWindow.isShowedTabsChildren
},
tabParentStyle() { tabParentStyle() {
if (this.isShowedTabsChildren) { // if tabs children is showed or closed
if (this.windowMetadata.isShowedTabsChildren) {
return { return {
height: '100%', height: '100%',
overflow: 'hidden' overflow: 'hidden'

View File

@ -6,6 +6,10 @@ export const tabMixin = {
type: String, type: String,
default: '' default: ''
}, },
windowMetadata: {
type: Object,
default: () => {}
},
tabsList: { tabsList: {
type: Array, type: Array,
default: () => [] default: () => []
@ -39,7 +43,8 @@ export const tabMixin = {
setCurrentTab() { setCurrentTab() {
this.$store.dispatch('setCurrentTab', { this.$store.dispatch('setCurrentTab', {
parentUuid: this.windowUuid, parentUuid: this.windowUuid,
containerUuid: this.tabUuid containerUuid: this.tabUuid,
window: this.windowMetadata
}) })
this.$route.meta.tabUuid = this.tabUuid this.$route.meta.tabUuid = this.tabUuid
}, },
@ -53,7 +58,7 @@ export const tabMixin = {
} }
}, },
handleBeforeLeave(activeName) { handleBeforeLeave(activeName) {
const metadataTab = this.tabsList.find(tab => tab.index === parseInt(activeName), 10) const metadataTab = this.tabsList.find(tab => tab.index === parseInt(activeName, 10))
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

@ -898,6 +898,7 @@ const panel = {
parentUuid, parentUuid,
containerUuid, containerUuid,
panelType, panelType,
panelMetadata,
routeToDelete, routeToDelete,
isAdvancedQuery = false isAdvancedQuery = false
}) { }) {
@ -921,6 +922,7 @@ const panel = {
parentUuid, parentUuid,
containerUuid, containerUuid,
panelType, panelType,
panelMetadata,
isAdvancedQuery, isAdvancedQuery,
routeToDelete routeToDelete
}) })

View File

@ -23,14 +23,23 @@ const window = {
dictionaryResetCacheWindow(state) { dictionaryResetCacheWindow(state) {
state = initStateWindow state = initStateWindow
}, },
changeWindow(state, payload) {
payload.window = payload.newWindow
},
setCurrentTab(state, payload) { setCurrentTab(state, payload) {
payload.window.currentTabUuid = payload.tabUuid payload.window.currentTab = payload.tab
payload.window.currentTabUuid = payload.tab.uuid
}, },
setTabIsLoadField(state, payload) { changeWindowAttribute(state, payload) {
payload.tab.isLoadFieldList = payload.isLoadFieldList let value = payload.attributeValue
if (payload.attributeNameControl) {
value = payload.window[payload.attributeNameControl]
}
payload.window[payload.attributeName] = value
},
changeTabAttribute(state, payload) {
let value = payload.attributeValue
if (payload.attributeNameControl) {
value = payload.tab[payload.attributeNameControl]
}
payload.tab[payload.attributeName] = value
} }
}, },
actions: { actions: {
@ -40,10 +49,10 @@ const window = {
}) { }) {
return getWindowMetadata(windowUuid) return getWindowMetadata(windowUuid)
.then(responseWindow => { .then(responseWindow => {
const firstTab = responseWindow.tabsList[0].tableName const firstTabTableName = responseWindow.tabsList[0].tableName
const firstTabUuid = responseWindow.tabsList[0].uuid const firstTabUuid = responseWindow.tabsList[0].uuid
const childrenTabs = [] const tabsListParent = []
const parentTabs = [] const tabsListChildren = []
const tabsSequence = [] const tabsSequence = []
// TODO Add source tab on the server for tabs Translation and Sort // TODO Add source tab on the server for tabs Translation and Sort
@ -78,11 +87,11 @@ const window = {
tabGroup: tabItem.fieldGroup, tabGroup: tabItem.fieldGroup,
firstTabUuid, firstTabUuid,
// relations // relations
isParentTab: Boolean(firstTab === tabItem.tableName), isParentTab: Boolean(firstTabTableName === tabItem.tableName),
// app properties // app properties
isAssociatedTabSequence: false, // show modal with order tab isAssociatedTabSequence: false, // show modal with order tab
isShowedRecordNavigation: !(tabItem.isSingleRow), isShowedRecordNavigation: !(tabItem.isSingleRow),
isLoadFieldList: false, isLoadFieldsList: false,
index index
} }
delete tab.processesList delete tab.processesList
@ -95,7 +104,7 @@ const window = {
processName: language.t('window.newRecord'), processName: language.t('window.newRecord'),
type: 'dataAction', type: 'dataAction',
action: 'resetPanelToNew', action: 'resetPanelToNew',
uuidParent: responseWindow, uuidParent: windowUuid,
disabled: !tab.isInsertRecord || tab.isReadOnly disabled: !tab.isInsertRecord || tab.isReadOnly
}, { }, {
// action to delete record selected // action to delete record selected
@ -103,7 +112,7 @@ const window = {
processName: language.t('window.deleteRecord'), processName: language.t('window.deleteRecord'),
type: 'dataAction', type: 'dataAction',
action: 'deleteEntity', action: 'deleteEntity',
uuidParent: responseWindow, uuidParent: windowUuid,
disabled: tab.isReadOnly disabled: tab.isReadOnly
}, { }, {
// action to undo create, update, delete record // action to undo create, update, delete record
@ -111,7 +120,7 @@ const window = {
processName: language.t('data.undo'), processName: language.t('data.undo'),
type: 'dataAction', type: 'dataAction',
action: 'undoModifyData', action: 'undoModifyData',
uuidParent: responseWindow, uuidParent: windowUuid,
disabled: false disabled: false
}, { }, {
name: language.t('data.lockRecord'), name: language.t('data.lockRecord'),
@ -164,7 +173,7 @@ const window = {
if (tabItem.processesList && tabItem.processesList.length) { if (tabItem.processesList && tabItem.processesList.length) {
const processList = tabItem.processesList.map(processItem => { const processList = tabItem.processesList.map(processItem => {
// 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: processItem, // processToGenerate: processItem,
// containerUuidAssociated: tabItem.uuid // containerUuidAssociated: tabItem.uuid
@ -189,35 +198,32 @@ const window = {
// Add process menu // Add process menu
dispatch('setContextMenu', { dispatch('setContextMenu', {
containerUuid: tab.uuid, containerUuid: tab.uuid,
actions: actions actions
}) })
if (tab.isParentTab) { if (tab.isParentTab) {
parentTabs.push(tab) tabsListParent.push(tab)
return tab return tab
} }
if (!tab.isSortTab) { if (!tab.isSortTab) {
childrenTabs.push(tab) tabsListChildren.push(tab)
} }
return tab return tab
}) })
const tabProperties = {
tabsList: tabs,
currentTab: parentTabs[0],
tabsListParent: parentTabs,
tabsListChildren: childrenTabs,
// app attributes
currentTabUuid: parentTabs[0].uuid
}
const newWindow = { const newWindow = {
...responseWindow, ...responseWindow,
...tabProperties, tabsList: tabs,
currentTab: tabsListParent[0],
tabsListParent,
tabsListChildren,
// app attributes
currentTabUuid: tabsListParent[0].uuid,
firstTab: tabsListParent[0],
firstTabUuid, firstTabUuid,
windowIndex: state.windowIndex + 1, windowIndex: state.windowIndex + 1,
// App properties // App properties
isShowedTabsChildren: Boolean(childrenTabs.length), isShowedTabsChildren: Boolean(tabsListChildren.length),
isShowedRecordNavigation: undefined, isShowedRecordNavigation: undefined,
isShowedAdvancedQuery: false isShowedAdvancedQuery: false
} }
@ -238,9 +244,11 @@ const window = {
parentUuid, parentUuid,
containerUuid, containerUuid,
panelType = 'window', panelType = 'window',
panelMetadata,
isAdvancedQuery = false isAdvancedQuery = false
}) { }) {
return getTabMetadata(containerUuid) return new Promise(resolve => {
getTabMetadata(containerUuid)
.then(tabResponse => { .then(tabResponse => {
const additionalAttributes = { const additionalAttributes = {
parentUuid, parentUuid,
@ -255,7 +263,7 @@ const window = {
let isWithUuidField = false // indicates it contains the uuid field let isWithUuidField = false // indicates it contains the uuid field
let fieldLinkColumnName let fieldLinkColumnName
// Convert from gRPC // Convert and add to app attributes
const fieldsList = tabResponse.fieldsList.map((fieldItem, index) => { const fieldsList = tabResponse.fieldsList.map((fieldItem, index) => {
fieldItem = generateField({ fieldItem = generateField({
fieldToGenerate: fieldItem, fieldToGenerate: fieldItem,
@ -276,6 +284,7 @@ const window = {
return fieldItem return fieldItem
}) })
let isTabsChildren = false
if (!isAdvancedQuery) { if (!isAdvancedQuery) {
// Get dependent fields // Get dependent fields
fieldsList fieldsList
@ -291,6 +300,9 @@ const window = {
}) })
} }
}) })
const window = getters.getWindow(parentUuid)
isTabsChildren = Boolean(window.tabsListChildren.length)
} }
if (!isWithUuidField) { if (!isWithUuidField) {
@ -304,25 +316,32 @@ const window = {
fieldsList.push(fieldUuid) fieldsList.push(fieldUuid)
} }
const window = getters.getWindow(parentUuid) if (isEmptyValue(panelMetadata)) {
panelMetadata = getters.getTab(parentUuid, containerUuid)
}
// Panel for save on store // Panel for save on store
const panel = { const panel = {
...getters.getTab(parentUuid, containerUuid), ...panelMetadata,
isAdvancedQuery, isAdvancedQuery,
fieldLinkColumnName: fieldLinkColumnName, fieldLinkColumnName,
fieldList: fieldsList, fieldList: fieldsList,
panelType, panelType,
// app attributes // app attributes
isLoadFieldsList: true,
isShowedTotals: false, isShowedTotals: false,
isTabsChildren: Boolean(window.tabsListChildren.length) isTabsChildren // to delete records assiciated
} }
dispatch('addPanel', panel) dispatch('addPanel', panel)
dispatch('setTabIsLoadField', { resolve(panel)
dispatch('changeTabAttribute', {
parentUuid, parentUuid,
containerUuid containerUuid,
tab: panelMetadata,
attributeName: 'isLoadFieldsList',
attributeValue: true
}) })
return panel
}) })
.catch(error => { .catch(error => {
showMessage({ showMessage({
@ -331,48 +350,61 @@ const window = {
}) })
console.warn(`Dictionary Tab (State Window) - Error ${error.code}: ${error.message}.`) console.warn(`Dictionary Tab (State Window) - Error ${error.code}: ${error.message}.`)
}) })
})
},
setCurrentTab({ commit, getters }, {
parentUuid,
containerUuid,
window,
tab
}) {
if (isEmptyValue(window)) {
window = getters.getWindow(parentUuid)
}
if (isEmptyValue(tab)) {
tab = window.tabsList.find(itemTab => itemTab.uuid === containerUuid)
}
commit('setCurrentTab', {
window,
tab
})
}, },
changeWindowAttribute({ commit, getters }, { changeWindowAttribute({ commit, getters }, {
parentUuid, parentUuid,
window, window,
attributeName, attributeName,
attributeNameControl,
attributeValue attributeValue
}) { }) {
if (isEmptyValue(window)) { if (isEmptyValue(window)) {
window = getters.getWindow(parentUuid) window = getters.getWindow(parentUuid)
} }
const newWindow = window
newWindow[attributeName] = attributeValue commit('changeWindowAttribute', {
commit('changeWindow', {
window,
newWindow
})
},
/**
* @param {string} parentUuid
* @param {string} containerUuid
*/
setCurrentTab({ commit, getters }, {
parentUuid, parentUuid,
containerUuid window,
}) { attributeName,
commit('setCurrentTab', { attributeNameControl,
window: getters.getWindow(parentUuid), attributeValue
tabUuid: containerUuid
}) })
}, },
/** changeTabAttribute({ commit, getters }, {
* Indicate if fields is load in tab (containerUuid) parentUuid,
* @param {string} parentUuid containerUuid,
* @param {string} containerUuid tab,
*/ attributeName,
setTabIsLoadField({ commit, getters }, { attributeNameControl,
parentUuid, containerUuid attributeValue
}) { }) {
const tab = getters.getTab(parentUuid, containerUuid) if (isEmptyValue(tab)) {
commit('setTabIsLoadField', { tab = getters.getTab(parentUuid, containerUuid)
tab: tab, }
isLoadFieldList: true commit('changeTabAttribute', {
tab,
attributeName,
attributeValue,
attributeNameControl
}) })
} }
}, },
@ -409,13 +441,6 @@ const window = {
isInsertRecord: false isInsertRecord: false
} }
}, },
getTabIsLoadField: (state, getters) => (windowUuid, tabUuid) => {
const tab = getters.getTab(windowUuid, tabUuid)
if (tab) {
return tab.isLoadFieldList
}
return tab
},
getTableNameFromTab: (state, getters) => (windowUuid, tabUuid) => { getTableNameFromTab: (state, getters) => (windowUuid, tabUuid) => {
return getters.getTab(windowUuid, tabUuid).tableName return getters.getTab(windowUuid, tabUuid).tableName
} }

View File

@ -497,14 +497,22 @@ const windowControl = {
}, },
/** /**
* Delete selection records in table * Delete selection records in table
* @param {string} containerUuid
* @param {string} parentUuid * @param {string} parentUuid
* @param {string} containerUuid
* @param {string} tableName
* @param {boolean} isParentTab
*/ */
deleteSelectionDataList({ dispatch, rootGetters }, { deleteSelectionDataList({ dispatch, rootGetters }, {
parentUuid, parentUuid,
containerUuid containerUuid,
tableName,
isParentTab
}) { }) {
const { tableName, isParentTab } = rootGetters.getTab(parentUuid, containerUuid) if (isEmptyValue(tableName) || isEmptyValue(isParentTab)) {
const tab = rootGetters.getTab(parentUuid, containerUuid)
tableName = tab.tableName
isParentTab = tab.isParentTab
}
const allData = rootGetters.getDataRecordAndSelection(containerUuid) const allData = rootGetters.getDataRecordAndSelection(containerUuid)
let selectionLength = allData.selection.length let selectionLength = allData.selection.length
@ -663,7 +671,7 @@ const windowControl = {
}) })
} }
return dispatch('getObjectListFromCriteria', { return dispatch('getObjectListFromCriteria', {
parentUuid: tab.parentUuid, parentUuid,
containerUuid, containerUuid,
tableName: tab.tableName, tableName: tab.tableName,
query: parsedQuery, query: parsedQuery,
@ -680,7 +688,7 @@ const windowControl = {
if (newValues) { if (newValues) {
// update fields with values obtained from the server // update fields with values obtained from the server
dispatch('notifyPanelChange', { dispatch('notifyPanelChange', {
parentUuid: tab.parentUuid, parentUuid,
containerUuid, containerUuid,
newValues, newValues,
isSendToServer: false isSendToServer: false
@ -688,7 +696,7 @@ const windowControl = {
} 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,
containerUuid containerUuid
}) })
} }
@ -748,20 +756,23 @@ const windowControl = {
}, },
/** /**
* Get references asociate to record * Get references asociate to record
* @param {string} parentUuid * @param {string} parentUuid as windowUuid
* @param {string} containerUuid * @param {string} containerUuid
* @param {string} tableName
* @param {string} recordUuid * @param {string} recordUuid
*/ */
getReferencesListFromServer({ commit, rootGetters }, { getReferencesListFromServer({ commit, rootGetters }, {
parentUuid, parentUuid: windowUuid,
containerUuid, containerUuid,
tableName,
recordUuid recordUuid
}) { }) {
// TODO: check if you get better performance search only the window and get the current tab if (isEmptyValue(tableName)) {
const { tableName } = rootGetters.getTab(parentUuid, containerUuid) tableName = rootGetters.getTab(windowUuid, containerUuid).tableName
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getReferencesList({ getReferencesList({
windowUuid: parentUuid, windowUuid,
tableName, tableName,
recordUuid recordUuid
}) })
@ -775,7 +786,7 @@ const windowControl = {
}) })
const references = { const references = {
...referenceResponse, ...referenceResponse,
windowUuid: parentUuid, windowUuid,
recordUuid, recordUuid,
referencesList referencesList
} }

View File

@ -33,7 +33,11 @@ export function generateField({
let parsedDefaultValue = fieldToGenerate.defaultValue let parsedDefaultValue = fieldToGenerate.defaultValue
let parsedDefaultValueTo = fieldToGenerate.defaultValueTo let parsedDefaultValueTo = fieldToGenerate.defaultValueTo
let operator = 'EQUAL' let operator = 'EQUAL'
let isNumericField = componentReference.type === 'FieldNumber'
let isTranslatedField = fieldToGenerate.isTranslated
if (moreAttributes.isAdvancedQuery) { if (moreAttributes.isAdvancedQuery) {
isNumericField = false
isTranslatedField = false
parsedDefaultValue = undefined parsedDefaultValue = undefined
parsedDefaultValueTo = undefined parsedDefaultValueTo = undefined
@ -182,7 +186,10 @@ export function generateField({
// Advanced query // Advanced query
operator, // current operator operator, // current operator
oldOperator: undefined, // old operator oldOperator: undefined, // old operator
defaultOperator: operator defaultOperator: operator,
// popover's
isNumericField,
isTranslatedField
} }
// Sizes from panel and groups // Sizes from panel and groups

View File

@ -5,7 +5,7 @@
> >
<el-container style="height: 86vh;"> <el-container style="height: 86vh;">
<Split> <Split>
<SplitArea :size="showContainerInfo ? isSizePanel : 100" :min-size="100"> <SplitArea :size="sizePanel" :min-size="100">
<el-aside width="100%"> <el-aside width="100%">
<split-pane :min-percent="10" :default-percent="defaultPorcentSplitPane" split="vertical"> <split-pane :min-percent="10" :default-percent="defaultPorcentSplitPane" split="vertical">
<template> <template>
@ -77,8 +77,9 @@
:menu-parent-uuid="$route.meta.parentUuid" :menu-parent-uuid="$route.meta.parentUuid"
:parent-uuid="windowUuid" :parent-uuid="windowUuid"
:container-uuid="windowMetadata.currentTabUuid" :container-uuid="windowMetadata.currentTabUuid"
:table-name="windowMetadata.currentTab.tableName"
:panel-type="panelType" :panel-type="panelType"
:is-insert-record="getterIsInsertRecord" :is-insert-record="windowMetadata.currentTab.isInsertRecord"
/> />
</el-main> </el-main>
</el-container> </el-container>
@ -86,6 +87,7 @@
<el-main :style="styleMainTab"> <el-main :style="styleMainTab">
<tab-parent <tab-parent
:window-uuid="windowUuid" :window-uuid="windowUuid"
:window-metadata="windowMetadata"
:tabs-list="windowMetadata.tabsListParent" :tabs-list="windowMetadata.tabsListParent"
class="tab-window" class="tab-window"
/> />
@ -140,7 +142,7 @@
<div class="small-4 columns"> <div class="small-4 columns">
<div class="wrapper"> <div class="wrapper">
<div <div
v-show="windowMetadata.tabsListChildren && windowMetadata.tabsListChildren.length" v-show="!isEmptyValue(windowMetadata.tabsListChildren)"
class="open-detail" class="open-detail"
/> />
<el-button <el-button
@ -151,7 +153,7 @@
:class="classIsMobile" :class="classIsMobile"
circle circle
type="primary" type="primary"
@click="handleChangeShowedTabChildren()" @click="handleChangeShowedTabChildren(true)"
/> />
</div> </div>
</div> </div>
@ -176,7 +178,7 @@
</SplitArea> </SplitArea>
<SplitArea v-show="isShowedTabsChildren" :size="50"> <SplitArea v-show="isShowedTabsChildren" :size="50">
<el-header <el-header
v-if="isShowedTabsChildren && windowMetadata.tabsListChildren && windowMetadata.tabsListChildren.length" v-if="isShowedTabsChildren && !isEmptyValue(windowMetadata.tabsListChildren)"
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">
@ -185,12 +187,13 @@
icon="el-icon-caret-bottom" icon="el-icon-caret-bottom"
circle circle
class="el-button-window" class="el-button-window"
@click="handleChangeShowedTabChildren()" @click="handleChangeShowedTabChildren(false)"
/> />
</div> </div>
</div> </div>
<tab-children <tab-children
:window-uuid="windowUuid" :window-uuid="windowUuid"
:window-metadata="windowMetadata"
:tabs-list="windowMetadata.tabsListChildren" :tabs-list="windowMetadata.tabsListChildren"
:first-tab-uuid="windowMetadata.firstTabUuid" :first-tab-uuid="windowMetadata.firstTabUuid"
:style="{ 'height': getHeightPanelBottom + 'vh' }" :style="{ 'height': getHeightPanelBottom + 'vh' }"
@ -374,11 +377,14 @@ export default {
} }
return 50 return 50
}, },
isSizePanel() { sizePanel() {
if (this.isMobile && this.showContainerInfo) { if (this.showContainerInfo) {
if (this.isMobile) {
return 2 return 2
} }
return 50 return 50
}
return 100
}, },
isCloseInfo() { isCloseInfo() {
if (this.isMobile) { if (this.isMobile) {
@ -428,8 +434,7 @@ export default {
} }
}, },
styleStepsSimple() { styleStepsSimple() {
if (this.isShowedRecordNavigation) { const baseStyle = {
return {
paddingTop: '0px', paddingTop: '0px',
paddingBottom: '0px', paddingBottom: '0px',
paddingLeft: '0px', paddingLeft: '0px',
@ -437,19 +442,16 @@ export default {
borderRadius: '4px', borderRadius: '4px',
background: '#F5F7FA', background: '#F5F7FA',
overflowX: 'auto', overflowX: 'auto',
overflowY: 'hidden', overflowY: 'hidden'
}
if (this.isShowedRecordNavigation) {
return {
...baseStyle,
width: this.$store.getters.getPanelRight + 'px' width: this.$store.getters.getPanelRight + 'px'
} }
} }
return { return {
paddingTop: '0px', ...baseStyle,
paddingBottom: '0px',
paddingLeft: '0px',
paddingRight: '0px',
borderRadius: '4px',
background: '#F5F7FA',
overflowX: 'auto',
overflowY: 'hidden',
width: 'auto' width: 'auto'
} }
}, },
@ -463,10 +465,16 @@ export default {
return this.$store.getters.getWindow(this.windowUuid) return this.$store.getters.getWindow(this.windowUuid)
}, },
isShowedTabsChildren() { isShowedTabsChildren() {
return this.getterWindow.isShowedTabsChildren if (this.windowMetadata && this.windowMetadata.isShowedTabsChildren) {
return this.windowMetadata.isShowedTabsChildren
}
return false
}, },
isShowedRecordNavigation() { isShowedRecordNavigation() {
return this.$store.getters.getIsShowedRecordNavigation(this.windowUuid) if (this.windowMetadata && this.windowMetadata.isShowedRecordNavigation) {
return this.windowMetadata.isShowedRecordNavigation
}
return false
}, },
getHeightPanelTop() { getHeightPanelTop() {
return this.$store.getters.getSplitHeightTop return this.$store.getters.getSplitHeightTop
@ -477,13 +485,6 @@ export default {
getterRecordList() { getterRecordList() {
return this.$store.getters.getDataRecordsList(this.windowMetadata.currentTabUuid).length return this.$store.getters.getDataRecordsList(this.windowMetadata.currentTabUuid).length
}, },
getterIsInsertRecord() {
const tab = this.$store.getters.getCurrentTab(this.windowUuid)
if (tab) {
return tab.isInsertRecord
}
return false
},
gettersListRecordLogs() { gettersListRecordLogs() {
const changeLog = this.$store.getters.getRecordLogs.recorLogs const changeLog = this.$store.getters.getRecordLogs.recorLogs
if (this.isEmptyValue(changeLog)) { if (this.isEmptyValue(changeLog)) {
@ -518,7 +519,10 @@ export default {
return this.getterDataRecordsAndSelection.record return this.getterDataRecordsAndSelection.record
}, },
getTableName() { getTableName() {
return this.$store.getters.getTableNameFromTab(this.windowUuid, this.windowMetadata.firstTabUuid) if (this.windowMetadata && this.windowMetadata.firstTab.tableName) {
return this.windowMetadata.firstTab.tableName
}
return undefined
}, },
// current record // current record
getRecord() { getRecord() {
@ -566,32 +570,34 @@ export default {
}, },
methods: { methods: {
handleResize() { handleResize() {
var PanelRight = document.getElementById('PanelRight') const panelRight = document.getElementById('PanelRight')
var resizeWidth = PanelRight if (!this.isEmptyValue(panelRight)) {
if (!this.isEmptyValue(resizeWidth)) { const widthPanel = panelRight.clientWidth - 350
var widthPanel = PanelRight.clientWidth - 350
this.$store.dispatch('setPanelRight', widthPanel) this.$store.dispatch('setPanelRight', widthPanel)
} }
}, },
conteInfo() { conteInfo() {
this.showContainerInfo = !this.showContainerInfo this.showContainerInfo = !this.showContainerInfo
if (this.showContainerInfo) { if (this.showContainerInfo) {
const tableName = this.getTableName
const recordId = this.getRecord[tableName + '_ID']
this.$store.dispatch('listWorkflowLogs', { this.$store.dispatch('listWorkflowLogs', {
tableName: this.getTableName, tableName,
recordUuid: this.$route.query.action, recordUuid: this.$route.query.action,
recordId: this.getRecord[this.getTableName + '_ID'] recordId
}) })
this.$store.dispatch(this.activeInfo, { this.$store.dispatch(this.activeInfo, {
tableName: this.getTableName, tableName,
recordId: this.getRecord[this.getTableName + '_ID'] recordId
}) })
} }
this.$store.dispatch('showContainerInfo', !this.getterShowContainerInfo) this.$store.dispatch('showContainerInfo', !this.getterShowContainerInfo)
}, },
handleClick(tab, event) { handleClick(tab, event) {
const tableName = this.getTableName
this.$store.dispatch(tab.name, { this.$store.dispatch(tab.name, {
tableName: this.getTableName, tableName,
recordId: this.getRecord[this.getTableName + '_ID'] recordId: this.getRecord[tableName + '_ID']
}) })
}, },
// callback new size // callback new size
@ -605,8 +611,9 @@ export default {
}, },
// get window from vuex store or server // get window from vuex store or server
getWindow() { getWindow() {
if (this.getterWindow) { const window = this.getterWindow
this.generateWindow() if (window) {
this.generateWindow(window)
return return
} }
this.$store.dispatch('getWindowFromServer', { this.$store.dispatch('getWindowFromServer', {
@ -614,11 +621,11 @@ export default {
routeToDelete: this.$route routeToDelete: this.$route
}) })
.then(response => { .then(response => {
this.generateWindow() this.generateWindow(response)
}) })
}, },
generateWindow() { generateWindow(window) {
this.windowMetadata = this.getterWindow this.windowMetadata = window
let isShowRecords = this.isShowedRecordNavigation let isShowRecords = this.isShowedRecordNavigation
if (isShowRecords === undefined) { if (isShowRecords === undefined) {
if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10 && this.$route.query.action !== 'create-new') || if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10 && this.$route.query.action !== 'create-new') ||
@ -637,6 +644,7 @@ export default {
handleChangeShowedRecordNavigation(valueToChange) { handleChangeShowedRecordNavigation(valueToChange) {
this.$store.dispatch('changeWindowAttribute', { this.$store.dispatch('changeWindowAttribute', {
parentUuid: this.windowUuid, // act as parentUuid parentUuid: this.windowUuid, // act as parentUuid
window: this.windowMetadata,
attributeName: 'isShowedRecordNavigation', attributeName: 'isShowedRecordNavigation',
attributeValue: valueToChange attributeValue: valueToChange
}) })
@ -645,11 +653,12 @@ export default {
this.isPanel = !this.isPanel this.isPanel = !this.isPanel
this.isShowedRecordPanel = !this.isShowedRecordPanel this.isShowedRecordPanel = !this.isShowedRecordPanel
}, },
handleChangeShowedTabChildren() { handleChangeShowedTabChildren(isShowedChilds) {
this.$store.dispatch('changeWindowAttribute', { this.$store.dispatch('changeWindowAttribute', {
parentUuid: this.windowUuid, // act as parentUuid parentUuid: this.windowUuid, // act as parentUuid
window: this.windowMetadata,
attributeName: 'isShowedTabsChildren', attributeName: 'isShowedTabsChildren',
attributeValue: !this.isShowedTabsChildren attributeValue: isShowedChilds
}) })
} }
} }