1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +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" :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="lock = !lock"> <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>
@ -109,9 +109,47 @@ export default {
}, },
tabUuid(value) { tabUuid(value) {
this.setCurrentTab() 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: { 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() { setCurrentTab() {
this.$store.dispatch('setCurrentTab', { this.$store.dispatch('setCurrentTab', {
parentUuid: this.windowUuid, parentUuid: this.windowUuid,

View File

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

View File

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

View File

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

View File

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