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

fix: Lock record get values with router (#941)

This commit is contained in:
Edwin Betancourt 2021-06-26 21:24:31 -04:00 committed by GitHub
parent 548bb2f165
commit 69ba12d833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 29 deletions

View File

@ -17,29 +17,28 @@
-->
<template>
<div>
<span v-if="isFirstTab" key="tooltip">
<el-tooltip
v-if="isFirstTab"
:content="isLocked ? $t('data.lockRecord') : $t('data.unlockRecord')"
placement="top"
>
<el-button type="text" @click="lockRecord()">
<i
:class="isLocked ? 'el-icon-lock' : 'el-icon-unlock'"
style="font-size: 15px; color: black;"
/>
</el-button>
</el-tooltip>
<span :style="isLocked ? 'color: red;' :'color: #1890ff;'">
{{ tabName }}
</span>
</span>
<span v-if="isFirstTab" key="withTooltip">
<el-tooltip
v-if="isFirstTab"
:content="isLocked ? $t('data.lockRecord') : $t('data.unlockRecord')"
placement="top"
>
<el-button type="text" @click="lockRecord()">
<i
:class="isLocked ? 'el-icon-lock' : 'el-icon-unlock'"
style="font-size: 15px; color: black;"
/>
</el-button>
</el-tooltip>
<template v-else>
<span :style="isLocked ? 'color: red;' :'color: #1890ff;'">
{{ tabName }}
</template>
</div>
</span>
</span>
<span v-else key="onlyName">
{{ tabName }}
</span>
</template>
<script>
@ -49,6 +48,10 @@ export default defineComponent({
name: 'LockRecord',
props: {
tabUuid: {
type: String,
required: true
},
tabPosition: {
type: Number,
default: 0
@ -56,12 +59,16 @@ export default defineComponent({
tabName: {
type: String,
required: true
},
tableName: {
type: String,
required: true
}
},
setup(props, { root }) {
const { tabUuid: containerUuid } = root.$route.meta
const { tableName } = root.$route.params
const containerUuid = props.tabUuid
const tableName = props.tableName
const isFirstTab = computed(() => {
return props.tabPosition === 0

View File

@ -28,12 +28,13 @@
:disabled="Boolean(key > 0 && isCreateNew)"
:style="tabParentStyle"
>
<span slot="label">
<lock-record
:tab-position="key"
:tab-name="tabAttributes.name"
/>
</span>
<lock-record
slot="label"
:tab-position="key"
:tab-uuid="tabAttributes.uuid"
:table-name="tabAttributes.tableName"
:tab-name="tabAttributes.name"
/>
<main-panel
:parent-uuid="windowUuid"