1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-11 13:39:48 +08:00

add proposal for quick access from favourites dashboard in windows items (#372)

* add proposal for quick access from favourites dashboard in windows items

* add tooltip for description and translations

* fix translations
This commit is contained in:
Leonel Matos 2020-02-27 19:12:06 -04:00 committed by GitHub
parent 5bed6a5f45
commit 647852f851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 7 deletions

View File

@ -18,9 +18,18 @@
</template> </template>
<template slot-scope="{row}"> <template slot-scope="{row}">
<span>{{ row.name }}</span> <span>{{ row.name }}</span>
<el-tag class="action-tag"> <el-tag size="mini" class="action-tag">
{{ $t(`views.${row.action}`) }} {{ $t(`views.${row.action}`) }}
</el-tag> </el-tag>
<br>
<el-button-group class="actions-buttons">
<el-tooltip :content="$t('quickAccess.newRecord')" placement="top">
<el-button v-if="row.action === 'window'" size="mini" circle @click.stop="windowAction(row, 'create-new')"><i class="el-icon-circle-plus-outline" /></el-button>
</el-tooltip>
<el-tooltip :content="$t('quickAccess.listRecords')" placement="top">
<el-button v-if="row.action === 'window'" size="mini" circle @click.stop="windowAction(row, 'listRecords')"><i class="el-icon-search" /></el-button>
</el-tooltip>
</el-button-group>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -102,7 +111,6 @@ export default {
}) })
}, },
handleClick(row) { handleClick(row) {
console.log(row)
const viewSearch = recursiveTreeSearch({ const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes, treeData: this.permissionRoutes,
attributeValue: row.referenceUuid, attributeValue: row.referenceUuid,
@ -139,6 +147,30 @@ export default {
}, },
translateDate(value) { translateDate(value) {
return this.$d(new Date(value), 'long', this.language) return this.$d(new Date(value), 'long', this.language)
},
windowAction(row, param) {
const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: row.referenceUuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
if (viewSearch) {
this.$router.push({
name: viewSearch.name,
query: {
action: param,
tabParent: 0
}
})
} else {
this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
}
} }
} }
} }
@ -174,4 +206,7 @@ export default {
.action-tag { .action-tag {
float: right; float: right;
} }
.actions-buttons {
float: right;
}
</style> </style>

View File

@ -408,8 +408,11 @@ export default {
parameters.criteria[param] = route.params[param] parameters.criteria[param] = route.params[param]
} }
}) })
} else if (route.query.action && route.query.action === 'listRecords') {
parameters.isLoadAllRecords = true
route.params.isReadParameters = true
} else if (!this.isEmptyValue(route.query.action) && } else if (!this.isEmptyValue(route.query.action) &&
!['create-new', 'reference', 'advancedQuery', 'criteria'].includes(route.query.action)) { !['create-new', 'reference', 'advancedQuery', 'criteria', 'listRecords'].includes(route.query.action)) {
parameters.isLoadAllRecords = false parameters.isLoadAllRecords = false
parameters.value = route.query.action parameters.value = route.query.action
parameters.tableName = this.metadata.tableName parameters.tableName = this.metadata.tableName
@ -420,6 +423,7 @@ export default {
if (!route.params.hasOwnProperty('isReadParameters') || route.params.isReadParameters) { if (!route.params.hasOwnProperty('isReadParameters') || route.params.isReadParameters) {
this.getData(parameters) this.getData(parameters)
} }
this.setTagsViewTitle(route.query.action)
} else { } else {
if (this.panelType === 'table' && route.query.action === 'advancedQuery') { if (this.panelType === 'table' && route.query.action === 'advancedQuery') {
// TODO: use action notifyPanelChange with isShowedField in true // TODO: use action notifyPanelChange with isShowedField in true
@ -638,7 +642,7 @@ export default {
dataTransfer.setData('Text', '') dataTransfer.setData('Text', '')
}, },
changePanelRecord(uuidRecord) { changePanelRecord(uuidRecord) {
if (!['create-new', 'reference', 'advancedQuery', 'criteria'].includes(uuidRecord)) { if (!['create-new', 'reference', 'advancedQuery', 'criteria', 'listRecords'].includes(uuidRecord)) {
const recordSelected = this.getterDataStore.record.find(record => record.UUID === uuidRecord) const recordSelected = this.getterDataStore.record.find(record => record.UUID === uuidRecord)
if (recordSelected) { if (recordSelected) {
this.dataRecords = recordSelected this.dataRecords = recordSelected

View File

@ -313,5 +313,9 @@ export default {
NULL: 'Is null', NULL: 'Is null',
IN: 'Include', IN: 'Include',
NOT_IN: 'Not include' NOT_IN: 'Not include'
},
quickAccess: {
newRecord: 'Quick Access to Create New Record',
listRecords: 'Quick Access to List All Records'
} }
} }

View File

@ -288,5 +288,9 @@ export default {
NOT_NULL: 'Tiene un valor', NOT_NULL: 'Tiene un valor',
IN: 'Incluye', IN: 'Incluye',
NOT_IN: 'No incluye' NOT_IN: 'No incluye'
},
quickAccess: {
newRecord: 'Acceso Rápido para Crear Registro Nuevo',
listRecords: 'Acceso Rápido para Listar los Registros'
} }
} }

View File

@ -543,13 +543,16 @@ export default {
this.windowMetadata = this.getterWindow this.windowMetadata = this.getterWindow
let isShowRecords = this.isShowedRecordNavigation let isShowRecords = this.isShowedRecordNavigation
if (isShowRecords === undefined) { if (isShowRecords === undefined) {
if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) || if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10 && this.$route.query.action !== 'create-new') ||
this.$route.query.action === 'advancedQuery') { this.$route.query.action === 'advancedQuery') {
isShowRecords = true isShowRecords = true
} else if (this.windowMetadata.windowType === 'T') { } else if (this.windowMetadata.windowType === 'T' || this.$route.query.action === 'create-new') {
isShowRecords = false isShowRecords = false
} else if (this.$route.query.action === 'listRecords') {
isShowRecords = true
this.handleChangeShowedPanel(true)
} }
this.handleChangeShowedRecordNavigation(!isShowRecords) this.handleChangeShowedRecordNavigation(isShowRecords)
} }
this.isLoaded = true this.isLoaded = true
}, },