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

fix: The references associated with a record are not displayed. (#396)

This commit is contained in:
Edwin Betancourt 2020-03-11 21:36:44 -04:00 committed by GitHub
parent 773c28089d
commit 902832ee79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 32 deletions

View File

@ -97,7 +97,7 @@
v-for="(reference, index) in references.referencesList" v-for="(reference, index) in references.referencesList"
:key="index" :key="index"
:index="reference.displayName" :index="reference.displayName"
@click="runAction(reference)" @click="openReference(reference)"
> >
{{ reference.displayName }} {{ reference.displayName }}
</el-menu-item> </el-menu-item>

View File

@ -486,28 +486,6 @@ export const contextMixin = {
} }
}) })
} }
} else if (action.type === 'reference') {
if (action.windowUuid && action.recordUuid) {
const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: action.windowUuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
if (viewSearch) {
this.$router.push({
name: viewSearch.name,
query: {
action: action.type,
referenceUuid: action.uuid,
recordUuid: action.recordUuid,
windowUuid: this.parentUuid,
tabParent: 0
}
})
}
}
} else if (action.type === 'updateReport') { } else if (action.type === 'updateReport') {
var updateReportParams = { var updateReportParams = {
instanceUuid: action.instanceUuid, instanceUuid: action.instanceUuid,
@ -554,6 +532,34 @@ export const contextMixin = {
}) })
} }
}, },
openReference(referenceElement) {
if (referenceElement.windowUuid && referenceElement.recordUuid) {
const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: referenceElement.windowUuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
if (viewSearch) {
this.$router.push({
name: viewSearch.name,
query: {
action: referenceElement.type,
referenceUuid: referenceElement.uuid,
recordUuid: referenceElement.recordUuid,
// windowUuid: this.parentUuid,
tabParent: 0
}
})
} else {
this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
}
}
},
setShareLink() { setShareLink() {
let shareLink = this.panelType === 'window' || window.location.href.includes('?') ? `${window.location.href}&` : `${window.location.href}?` let shareLink = this.panelType === 'window' || window.location.href.includes('?') ? `${window.location.href}&` : `${window.location.href}?`
if (this.$route.name === 'Report Viewer') { if (this.$route.name === 'Report Viewer') {

View File

@ -97,13 +97,13 @@
<template slot="title"> <template slot="title">
{{ $t('components.contextMenuReferences') }} {{ $t('components.contextMenuReferences') }}
</template> </template>
<template v-if="references && isEmptyValue(references.referencesList)"> <template v-if="references && !isEmptyValue(references.referencesList)">
<el-scrollbar wrap-class="scroll-child"> <el-scrollbar wrap-class="scroll-child">
<el-menu-item <el-menu-item
v-for="(reference, index) in references.referencesList" v-for="(reference, index) in references.referencesList"
:key="index" :key="index"
:index="reference.displayName" :index="reference.displayName"
@click="runAction(reference)" @click="openReference(reference)"
> >
{{ reference.displayName }} {{ reference.displayName }}
</el-menu-item> </el-menu-item>

View File

@ -357,7 +357,7 @@ export default {
* TODO: Delete route parameters after reading them * TODO: Delete route parameters after reading them
*/ */
readParameters() { readParameters() {
var parameters = { const parameters = {
isLoadAllRecords: true, isLoadAllRecords: true,
isReference: false, isReference: false,
isNewRecord: false, isNewRecord: false,
@ -393,7 +393,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) const referenceInfo = this.$store.getters.getReferencesInfo({
windowUuid: this.parentUuid,
recordUuid: route.query.recordUuid,
referenceUuid: route.query.referenceUuid
})
route.params.isReadParameters = true route.params.isReadParameters = true
parameters.isLoadAllRecords = false parameters.isLoadAllRecords = false
parameters.isReference = true parameters.isReference = true
@ -554,8 +558,8 @@ export default {
} else { } else {
this.$router.push({ this.$router.push({
query: { query: {
action: 'create-new', ...this.$route.query,
...this.$route.query action: 'create-new'
} }
}) })
} }
@ -639,8 +643,10 @@ export default {
} }
} }
if (this.isPanelWindow) { if (this.isPanelWindow) {
const tempRoute = Object.assign({}, this.$route, { title: `${this.tagTitle.base} - ${this.tagTitle.action}` }) this.$store.dispatch('tagsView/updateVisitedView', {
this.$store.dispatch('tagsView/updateVisitedView', tempRoute) ...this.$route,
title: `${this.tagTitle.base} - ${this.tagTitle.action}`
})
} }
}, },
setData(dataTransfer) { setData(dataTransfer) {

View File

@ -879,7 +879,7 @@ const windowControl = {
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) => { getReferencesInfo: (state, getters) => ({ windowUuid, recordUuid, referenceUuid }) => {
const references = getters.getReferencesList(windowUuid, recordUuid) const references = getters.getReferencesList(windowUuid, recordUuid)
return references.referencesList.find(item => item.uuid === referenceUuid) return references.referencesList.find(item => item.uuid === referenceUuid)
}, },