1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-11 21:53:24 +08:00

Bugfix references filtering (#175)

* add feature for go to print format setup window from report viewer

* change translation

* add feature for field condition in table records

* add evaluate logic for display field definition

* bugfix references filter

* some changes
This commit is contained in:
Leonel Matos 2019-11-22 19:02:28 -04:00 committed by Yamel Senih
parent aa931527f8
commit 7cb80dd246
4 changed files with 40 additions and 7 deletions

View File

@ -373,7 +373,16 @@ export const contextMixin = {
this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: action.windowUuid }) this.$store.dispatch('getWindowByUuid', { routes: this.permissionRoutes, windowUuid: action.windowUuid })
if (action.windowUuid && action.recordUuid) { if (action.windowUuid && action.recordUuid) {
var windowRoute = this.$store.getters.getWindowRoute(action.windowUuid) var windowRoute = this.$store.getters.getWindowRoute(action.windowUuid)
this.$router.push({ name: windowRoute.name, query: { action: action.type, referenceUuid: action.uuid, tabParent: 0 }}) this.$router.push({
name: windowRoute.name,
query: {
action: action.type,
referenceUuid: action.uuid,
recordUuid: action.recordUuid,
windowUuid: this.parentUuid,
tabParent: 0
}
})
} }
} }
}, },

View File

@ -11,11 +11,9 @@
<template slot="title"> <template slot="title">
<svg-icon v-if="isMobile" icon-class="nested" /> {{ item.meta.title }} <svg-icon v-if="isMobile" icon-class="nested" /> {{ item.meta.title }}
</template> </template>
<!-- <el-scrollbar wrap-class="scroll"> -->
<item v-for="(child, key) in item.children" :key="key" :item="child"> <item v-for="(child, key) in item.children" :key="key" :item="child">
{{ child.meta.title }} {{ child.meta.title }}
</item> </item>
<!-- </el-scrollbar> -->
</el-submenu> </el-submenu>
</template> </template>

View File

@ -392,10 +392,11 @@ export default {
}) })
if (route.query.action && route.query.action === 'reference') { if (route.query.action && route.query.action === 'reference') {
const referenceInfo = this.$store.getters.getReferencesInfo(route.query.windowUuid, route.query.recordUuid, route.query.referenceUuid)
parameters.isLoadAllRecords = false parameters.isLoadAllRecords = false
parameters.isReference = true parameters.isReference = true
parameters.referenceUuid = route.query.referenceUuid parameters.referenceUuid = referenceInfo.uuid
parameters.referenceWhereClause = route.query.whereClause parameters.referenceWhereClause = referenceInfo.whereClause
} else if (route.query.action && route.query.action === 'create-new') { } else if (route.query.action && route.query.action === 'create-new') {
parameters.isNewRecord = true parameters.isNewRecord = true
} else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery') { } else if (route.query.action && route.query.action !== 'create-new' && route.query.action !== 'reference' && route.query.action !== 'advancedQuery') {
@ -458,6 +459,8 @@ export default {
parentUuid: this.parentUuid, parentUuid: this.parentUuid,
containerUuid: this.containerUuid, containerUuid: this.containerUuid,
isLoadAllRecords: parameters.isLoadAllRecords, isLoadAllRecords: parameters.isLoadAllRecords,
isReference: parameters.isReference,
referenceWhereClause: parameters.referenceWhereClause,
columnName: parameters.columnName, columnName: parameters.columnName,
value: parameters.value value: parameters.value
}) })

View File

@ -516,7 +516,17 @@ const windowControl = {
* @param {boolean} isLoadAllRecords, if main panel is updated with new response data * @param {boolean} isLoadAllRecords, if main panel is updated with new response data
*/ */
getDataListTab({ dispatch, rootGetters }, parameters) { getDataListTab({ dispatch, rootGetters }, parameters) {
const { parentUuid, containerUuid, recordUuid, isRefreshPanel = false, isLoadAllRecords = false, columnName, value } = parameters const {
parentUuid,
containerUuid,
recordUuid,
isRefreshPanel = false,
isLoadAllRecords = false,
isReference = false,
referenceWhereClause = '',
columnName,
value
} = parameters
const tab = rootGetters.getTab(parentUuid, containerUuid) const tab = rootGetters.getTab(parentUuid, containerUuid)
var parsedQuery = tab.query var parsedQuery = tab.query
@ -536,6 +546,15 @@ const windowControl = {
value: tab.whereClause value: tab.whereClause
}, true) }, true)
} }
if (isReference) {
if (!isEmptyValue(parsedWhereClause)) {
parsedWhereClause += ' AND ' + referenceWhereClause
} else {
parsedWhereClause += referenceWhereClause
}
}
var conditions = [] var conditions = []
if (tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) { if (tab.isParentTab && !isEmptyValue(tab.tableName) && !isEmptyValue(value)) {
conditions.push({ conditions.push({
@ -640,7 +659,11 @@ const windowControl = {
return state.inCreate.find(item => item.containerUuid === containerUuid) return state.inCreate.find(item => item.containerUuid === containerUuid)
}, },
getReferencesList: (state) => (windowUuid, recordUuid) => { getReferencesList: (state) => (windowUuid, recordUuid) => {
return (state.references.find(item => item.windowUuid === windowUuid && item.recordUuid === recordUuid)) return state.references.find(item => item.windowUuid === windowUuid && item.recordUuid === recordUuid)
},
getReferencesInfo: (state, getters) => (windowUuid, recordUuid, referenceUuid) => {
const references = getters.getReferencesList(windowUuid, recordUuid)
return references.referencesList.find(item => item.uuid === referenceUuid)
}, },
getWindowRoute: (state) => (windowUuid) => { getWindowRoute: (state) => (windowUuid) => {
if (state.windowRoute && state.windowRoute.meta && state.windowRoute.meta.uuid === windowUuid) { if (state.windowRoute && state.windowRoute.meta && state.windowRoute.meta.uuid === windowUuid) {