1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

add record access to the route (#816)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-06 10:53:48 -04:00 committed by GitHub
parent 5110f7c2a9
commit ad57b8bd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 21 deletions

View File

@ -296,6 +296,13 @@ export default {
this.$store.commit('changeShowRigthPanel', true)
this.$store.commit('setRecordAccess', true)
this.$store.commit('attributeEmbedded', action)
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: this.$store.getters.getAttributeEmbedded.action
}
}, () => {})
this.runAction(action)
} else {
this.runAction(action)

View File

@ -17,7 +17,7 @@
-->
<template>
<el-dialog
:visible="isVisibleDialog"
:visible="isVisibleDialog || showRecordAccess"
show-close
:before-close="closeDialog"
:width="width + '%'"
@ -27,7 +27,7 @@
close-on-click-modal
>
<span slot="title">
{{ attributeEmbedded.name }}
{{ $t('data.recordAccess.actions') }}
<el-tooltip :content="lock ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top">
<el-button type="text" @click="lock = !lock">
<i :class="lock ? 'el-icon-unlock' : 'el-icon-lock'" style="font-size: 25px;color: black;" />
@ -66,6 +66,10 @@ export default {
recordId: {
type: Object,
default: undefined
},
visible: {
type: String,
default: undefined
}
},
data() {
@ -130,6 +134,13 @@ export default {
name: ''
}
})
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: ''
}
}, () => {})
this.$store.commit('setRecordAccess', false)
},
runAction(action) {

View File

@ -159,25 +159,29 @@ export default {
}
// Create Message
var expl = language.t('components.preference.for')// components.preference.for
if (forCurrentClient.value && forCurrentOrganization.value) {
expl = expl.concat(language.t('components.preference.clientAndOrganization'))// components.preference.clientAndOrganization
} else if (forCurrentClient.value && !forCurrentOrganization.value) {
expl = expl.concat(language.t('components.preference.allOrganizationOfClient'))// components.preference.allOrganizationOfClient
} else if (!forCurrentClient.value && forCurrentOrganization.value) {
forCurrentOrganization.value = false
expl = expl.concat(language.t('components.preference.entireSystem'))// components.preference.entireSystem
} else {
expl = expl.concat(language.t('components.preference.entireSystem'))// components.preference.entireSystem
if (forCurrentOrganization && forCurrentClient) {
if (forCurrentClient.value && forCurrentOrganization.value) {
expl = expl.concat(language.t('components.preference.clientAndOrganization'))// components.preference.clientAndOrganization
} else if (forCurrentClient.value && !forCurrentOrganization.value) {
expl = expl.concat(language.t('components.preference.allOrganizationOfClient'))// components.preference.allOrganizationOfClient
} else if (!forCurrentClient.value && forCurrentOrganization.value) {
forCurrentOrganization.value = false
expl = expl.concat(language.t('components.preference.entireSystem'))// components.preference.entireSystem
} else {
expl = expl.concat(language.t('components.preference.entireSystem'))// components.preference.entireSystem
}
}
if (forCurrentUser.value) {
expl = expl.concat(language.t('components.preference.thisUser'))// components.preference.thisUser
} else {
expl = expl.concat(language.t('components.preference.allUsers'))// components.preference.allUsers
}
if (forCurrentContainer.value) {
expl = expl.concat(language.t('components.preference.thisWindow'))// components.preference.thisWindow
} else {
expl = expl.concat(language.t('components.preference.allWindows'))// components.preference.allWindows
if (forCurrentUser && forCurrentContainer) {
if (forCurrentUser.value) {
expl = expl.concat(language.t('components.preference.thisUser'))// components.preference.thisUser
} else {
expl = expl.concat(language.t('components.preference.allUsers'))// components.preference.allUsers
}
if (forCurrentContainer.value) {
expl = expl.concat(language.t('components.preference.thisWindow'))// components.preference.thisWindow
} else {
expl = expl.concat(language.t('components.preference.allWindows'))// components.preference.allWindows
}
}
return expl
}

View File

@ -199,6 +199,13 @@ export default {
type: 'window',
action: undefined
})
this.$router.push({
name: this.$route.name,
query: {
...this.$route.query,
typeAction: ''
}
}, () => {})
this.$store.commit('setRecordAccess', false)
this.$store.commit('changeShowRigthPanel', false)
}

View File

@ -30,7 +30,9 @@ const initStateContextMenu = {
recordUuid: undefined
},
recordAccess: false,
embedded: {}
embedded: {
name: ''
}
}
const contextMenu = {

View File

@ -353,9 +353,17 @@ export default {
}
})
}
},
getRecord(value) {
if (!this.isEmptyValue(this.windowMetadata.currentTab.tableName) && !this.isEmptyValue(value) && (!this.isEmptyValue(this.$route.query) && this.$route.query.typeAction === 'recordAccess')) {
this.$store.commit('setRecordAccess', true)
}
}
},
created() {
if (!this.isEmptyValue(this.currentRecord) && (!this.isEmptyValue(this.$route.query) && this.$route.query.typeAction === 'recordAccess')) {
this.$store.commit('setRecordAccess', true)
}
this.getWindow()
if (this.isShowedRecordNavigation) {
this.handleResize()