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

Support Lock Record (#833)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-11 17:43:22 -04:00 committed by GitHub
parent fed1cec1a7
commit 50d51b7328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 7 deletions

View File

@ -29,8 +29,8 @@
:style="tabParentStyle"
>
<span v-if="key === 0" slot="label">
<el-tooltip v-if="key === 0" :content="lock ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top">
<el-button type="text" @click="lock = !lock">
<el-tooltip v-if="key === 0" :content="!lock ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top">
<el-button type="text" @click="lockRecord()">
<i :class="lock ? 'el-icon-unlock' : 'el-icon-lock'" style="font-size: 15px;color: black;" />
</el-button>
</el-tooltip>
@ -109,9 +109,47 @@ export default {
},
tabUuid(value) {
this.setCurrentTab()
},
record(value) {
const tableName = this.windowMetadata.firstTab.tableName
if (value) {
this.$store.dispatch('getPrivateAccessFromServer', {
tableName,
recordId: this.record[tableName + '_ID'],
recordUuid: this.record.UUID
})
.then(privateAccessResponse => {
this.lock = privateAccessResponse.isLocked
})
}
}
},
methods: {
lockRecord() {
this.lock = !this.lock
const tableName = this.windowMetadata.firstTab.tableName
const action = this.lock ? 'lockRecord' : 'unlockRecord'
const message = !this.lock ? 'lockRecord' : 'unlockRecord'
this.$store.dispatch(action, {
tableName,
recordId: this.record[tableName + '_ID'],
recordUuid: this.record.UUID
})
.then(() => {
this.$message({
type: 'success',
message: this.$t('data.' + message),
showClose: true
})
})
.catch(() => {
this.$message({
type: 'error',
message: this.$t('data.isError') + this.$t('data.' + message),
showClose: true
})
})
},
setCurrentTab() {
this.$store.dispatch('setCurrentTab', {
parentUuid: this.windowUuid,

View File

@ -28,6 +28,10 @@ export default {
tabsList: {
type: Array,
default: () => []
},
record: {
type: Object,
default: () => {}
}
},
data() {

View File

@ -360,7 +360,8 @@ export default {
isReadonly: 'Reading Only',
isDependentEntities: 'Dependent Entities',
isLock: 'Block',
isUnlock: 'Unblock'
isUnlock: 'Unblock',
isError: 'Error on '
},
selectionRequired: 'You must select a record',
undo: 'Undo',

View File

@ -102,7 +102,7 @@ export default {
releases: 'Liberaciones',
branches: 'Ramas',
code: 'Código',
issues: 'Solicitudes de extracción',
issues: 'Asuntos',
downloadZip: 'descargar Zip',
releaseNotes: 'Nota de Liberaciones'
@ -321,7 +321,7 @@ export default {
deleteRecordSuccessful: 'Registro eliminado exitosamente',
deleteRecordError: 'Error al eliminar el regitro',
exportRecord: 'Exportar Registro',
lockRecord: 'Bloquear Registro',
lockRecord: 'Registro Bloqueado',
noDescription: 'Sin Descripción',
recordAccess: {
modeMobile: {
@ -336,11 +336,12 @@ export default {
isReadonly: 'Solo Lectura',
isDependentEntities: 'Entidades Dependientes',
isLock: 'Bloquear',
isUnlock: 'Desbloquear'
isUnlock: 'Desbloquear',
isError: 'Error al '
},
selectionRequired: 'Debe seleccionar un registro',
undo: 'Deshacer',
unlockRecord: 'Desbloquear Registro'
unlockRecord: 'Registro Desbloqueado'
},
sequence: {
available: 'Disponibles',

View File

@ -102,6 +102,7 @@
:window-uuid="windowUuid"
:window-metadata="windowMetadata"
:tabs-list="windowMetadata.tabsListParent"
:record="currentRecord"
class="tab-window"
/>
<div v-if="isMobile">