1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 23:20:12 +08:00

fix: #361 Redirect to blank page from the dashboards. (#362)

This commit is contained in:
Edwin Betancourt 2020-02-25 18:23:53 -04:00 committed by GitHub
parent d2fc0c5713
commit 4c399a6694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 32 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="search.length ? filterResult(search) : documents" max-height="455" @row-click="handleClick"> <el-table :data="dataResult" max-height="455" @row-click="handleClick">
<el-table-column <el-table-column
prop="recordCount" prop="recordCount"
width="60" width="60"
@ -27,6 +27,7 @@
<script> <script>
import { getPendingDocumentsFromServer } from '@/api/ADempiere/data' import { getPendingDocumentsFromServer } from '@/api/ADempiere/data'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils' import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification'
export default { export default {
name: 'PendingDocuments', name: 'PendingDocuments',
@ -46,6 +47,12 @@ export default {
cachedViews() { cachedViews() {
return this.$store.getters.cachedViews return this.$store.getters.cachedViews
}, },
dataResult() {
if (this.search.length) {
return this.filterResult(this.search)
}
return this.documents
},
permissionRoutes() { permissionRoutes() {
return this.$store.getters.permission_routes return this.$store.getters.permission_routes
} }
@ -55,6 +62,7 @@ export default {
this.subscribeChanges() this.subscribeChanges()
}, },
methods: { methods: {
showMessage,
getPendingDocuments() { getPendingDocuments() {
const userUuid = this.$store.getters['user/getUserUuid'] const userUuid = this.$store.getters['user/getUserUuid']
const roleUuid = this.$store.getters.getRoleUuid const roleUuid = this.$store.getters.getRoleUuid
@ -101,6 +109,11 @@ export default {
action: 'criteria' action: 'criteria'
} }
}) })
} else {
this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
} }
// conditions for the registration amount (operador: row.criteria.whereClause) // conditions for the registration amount (operador: row.criteria.whereClause)
}, },
@ -120,13 +133,13 @@ export default {
width: 50%!important; width: 50%!important;
float: right; float: right;
} }
.header { .header {
padding-bottom: 10px; padding-bottom: 10px;
} }
.recent-items { .recent-items {
height: 455px; height: 455px;
overflow: auto; overflow: auto;
} }
.time { .time {
float: left; float: left;
font-size: 11px; font-size: 11px;

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="search.length ? filterResult(search) : favorites" max-height="455" @row-click="handleClick"> <el-table :data="dataResult" max-height="455" @row-click="handleClick">
<el-table-column width="40"> <el-table-column width="40">
<template slot-scope="{row}"> <template slot-scope="{row}">
<svg-icon :icon-class="row.icon" class="icon-window" /> <svg-icon :icon-class="row.icon" class="icon-window" />
@ -18,7 +18,9 @@
</template> </template>
<template slot-scope="{row}"> <template slot-scope="{row}">
<span>{{ row.name }}</span> <span>{{ row.name }}</span>
<el-tag class="action-tag">{{ $t(`views.${row.action}`) }}</el-tag> <el-tag class="action-tag">
{{ $t(`views.${row.action}`) }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -29,6 +31,8 @@
<script> <script>
import { getFavoritesFromServer } from '@/api/ADempiere/data' import { getFavoritesFromServer } from '@/api/ADempiere/data'
import { convertAction } from '@/utils/ADempiere/dictionaryUtils' import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification'
export default { export default {
name: 'Favorites', name: 'Favorites',
@ -49,6 +53,15 @@ export default {
computed: { computed: {
cachedViews() { cachedViews() {
return this.$store.getters.cachedViews return this.$store.getters.cachedViews
},
dataResult() {
if (this.search.length) {
return this.filterResult(this.search)
}
return this.favorites
},
permissionRoutes() {
return this.$store.getters.permission_routes
} }
}, },
mounted() { mounted() {
@ -56,6 +69,7 @@ export default {
this.subscribeChanges() this.subscribeChanges()
}, },
methods: { methods: {
showMessage,
getFavoritesList() { getFavoritesList() {
const userUuid = this.$store.getters['user/getUserUuid'] const userUuid = this.$store.getters['user/getUserUuid']
return new Promise(resolve => { return new Promise(resolve => {
@ -88,7 +102,33 @@ export default {
}) })
}, },
handleClick(row) { handleClick(row) {
this.$router.push({ name: row.uuid }) console.log(row)
const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: row.referenceUuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
if (viewSearch) {
let recordUuid
if (!this.isEmptyValue(row.uuidRecord)) {
recordUuid = row.uuidRecord
}
this.$router.push({
name: viewSearch.name,
query: {
action: recordUuid,
tabParent: 0
}
})
} else {
this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
}
}, },
filterResult(search) { filterResult(search) {
return this.favorites.filter(item => this.ignoreAccent(item.name).toLowerCase().includes(this.ignoreAccent(search.toLowerCase()))) return this.favorites.filter(item => this.ignoreAccent(item.name).toLowerCase().includes(this.ignoreAccent(search.toLowerCase())))
@ -109,13 +149,13 @@ export default {
width: 50%!important; width: 50%!important;
float: right; float: right;
} }
.header { .header {
padding-bottom: 10px; padding-bottom: 10px;
} }
.recent-items { .recent-items {
height: 455px; height: 455px;
overflow: auto; overflow: auto;
} }
.time { .time {
float: left; float: left;
font-size: 11px; font-size: 11px;

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="search.length ? filterResult(search) : recentItems" max-height="455" @row-click="handleClick"> <el-table :data="dataResult" max-height="455" @row-click="handleClick">
<el-table-column width="40"> <el-table-column width="40">
<template slot-scope="{row}"> <template slot-scope="{row}">
<svg-icon :icon-class="row.icon" class="icon-window" /> <svg-icon :icon-class="row.icon" class="icon-window" />
@ -18,9 +18,13 @@
</template> </template>
<template slot-scope="{row}"> <template slot-scope="{row}">
<span>{{ row.displayName }}</span> <span>{{ row.displayName }}</span>
<el-tag class="action-tag">{{ $t(`views.${row.action}`) }}</el-tag> <el-tag class="action-tag">
{{ $t(`views.${row.action}`) }}
</el-tag>
<br> <br>
<span class="time">{{ translateDate(row.updated) }}</span> <span class="time">
{{ translateDate(row.updated) }}
</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -31,6 +35,8 @@
<script> <script>
import { getRecentItems as getRecentItemsFromServer } from '@/api/ADempiere' import { getRecentItems as getRecentItemsFromServer } from '@/api/ADempiere'
import { convertAction } from '@/utils/ADempiere/dictionaryUtils' import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification'
export default { export default {
name: 'RecentItems', name: 'RecentItems',
@ -54,6 +60,15 @@ export default {
}, },
cachedViews() { cachedViews() {
return this.$store.getters.cachedViews return this.$store.getters.cachedViews
},
dataResult() {
if (this.search.length) {
return this.filterResult(this.search)
}
return this.recentItems
},
permissionRoutes() {
return this.$store.getters.permission_routes
} }
}, },
mounted() { mounted() {
@ -61,6 +76,7 @@ export default {
this.subscribeChanges() this.subscribeChanges()
}, },
methods: { methods: {
showMessage,
checkOpened(uuid) { checkOpened(uuid) {
return this.cachedViews.includes(uuid) return this.cachedViews.includes(uuid)
}, },
@ -91,16 +107,31 @@ export default {
}) })
}, },
handleClick(row) { handleClick(row) {
if (!this.isEmptyValue(row.uuidRecord)) { const viewSearch = recursiveTreeSearch({
treeData: this.permissionRoutes,
attributeValue: row.referenceUuid,
attributeName: 'meta',
secondAttribute: 'uuid',
attributeChilds: 'children'
})
if (viewSearch) {
let recordUuid
if (!this.isEmptyValue(row.uuidRecord)) {
recordUuid = row.uuidRecord
}
this.$router.push({ this.$router.push({
name: row.menuUuid, name: viewSearch.name,
query: { query: {
action: row.uuidRecord, action: recordUuid,
tabParent: 0 tabParent: 0
} }
}) })
} else { } else {
this.$router.push({ name: row.menuUuid }) this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
} }
}, },
subscribeChanges() { subscribeChanges() {
@ -129,13 +160,13 @@ export default {
width: 50%!important; width: 50%!important;
float: right; float: right;
} }
.header { .header {
padding-bottom: 10px; padding-bottom: 10px;
} }
.recent-items { .recent-items {
height: 455px; height: 455px;
overflow: auto; overflow: auto;
} }
.time { .time {
float: left; float: left;
font-size: 11px; font-size: 11px;