1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

Fix Message Record Access (#835)

* Support Lock Record

* fix Record Acces

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-11 19:30:35 -04:00 committed by GitHub
parent 430535ca9e
commit c7b94523c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 8 deletions

View File

@ -29,12 +29,14 @@
:style="tabParentStyle" :style="tabParentStyle"
> >
<span v-if="key === 0" slot="label"> <span v-if="key === 0" slot="label">
<el-tooltip v-if="key === 0" :content="!lock ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top"> <el-tooltip v-if="key === 0" :content="lock ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top">
<el-button type="text" @click="lockRecord()"> <el-button type="text" @click="lockRecord()">
<i :class="lock ? 'el-icon-unlock' : 'el-icon-lock'" style="font-size: 15px;color: black;" /> <i :class="lock ? 'el-icon-unlock' : 'el-icon-lock'" style="font-size: 15px;color: black;" />
</el-button> </el-button>
</el-tooltip> </el-tooltip>
{{ tabAttributes.name }} <span :style="lock ? 'color: #1890ff;': 'color: red;'">
{{ tabAttributes.name }}
</span>
</span> </span>
<span v-else slot="label"> <span v-else slot="label">
{{ tabAttributes.name }} {{ tabAttributes.name }}
@ -126,26 +128,26 @@ export default {
}, },
methods: { methods: {
lockRecord() { lockRecord() {
this.lock = !this.lock
const tableName = this.windowMetadata.firstTab.tableName const tableName = this.windowMetadata.firstTab.tableName
const action = this.lock ? 'lockRecord' : 'unlockRecord' const action = this.lock ? 'lockRecord' : 'unlockRecord'
const message = !this.lock ? 'lockRecord' : 'unlockRecord'
this.$store.dispatch(action, { this.$store.dispatch(action, {
tableName, tableName,
recordId: this.record[tableName + '_ID'], recordId: this.record[tableName + '_ID'],
recordUuid: this.record.UUID recordUuid: this.record.UUID
}) })
.then(() => { .then(() => {
this.lock = !this.lock
this.$message({ this.$message({
type: 'success', type: 'success',
message: this.$t('data.' + message), message: this.$t('data.notification.' + action),
showClose: true showClose: true
}) })
}) })
.catch(() => { .catch(() => {
this.lock = !this.lock
this.$message({ this.$message({
type: 'error', type: 'error',
message: this.$t('data.isError') + this.$t('data.' + message), message: this.$t('data.isError') + this.$t('data.' + action),
showClose: true showClose: true
}) })
}) })

View File

@ -366,7 +366,11 @@ export default {
}, },
selectionRequired: 'You must select a record', selectionRequired: 'You must select a record',
undo: 'Undo', undo: 'Undo',
unlockRecord: 'Unlock Record' unlockRecord: 'Unlock Record',
notification: {
lockRecord: 'The Registry was Locked',
unlockRecord: 'Registry was Unlocked'
}
}, },
sequence: { sequence: {
available: 'Available', available: 'Available',

View File

@ -342,7 +342,12 @@ export default {
}, },
selectionRequired: 'Debe seleccionar un registro', selectionRequired: 'Debe seleccionar un registro',
undo: 'Deshacer', undo: 'Deshacer',
unlockRecord: 'Registro Desbloqueado' unlockRecord: 'Desbloquear Registro',
notification: {
lockRecord: 'El Registro fue Bloqueado',
unlockRecord: 'El Registro fue Desbloqueado'
}
}, },
sequence: { sequence: {
available: 'Disponibles', available: 'Disponibles',