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

View File

@ -1,7 +1,7 @@
<template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<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">
<template slot-scope="{row}">
<svg-icon :icon-class="row.icon" class="icon-window" />
@ -18,7 +18,9 @@
</template>
<template slot-scope="{row}">
<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>
</el-table-column>
</el-table>
@ -29,6 +31,8 @@
<script>
import { getFavoritesFromServer } from '@/api/ADempiere/data'
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification'
export default {
name: 'Favorites',
@ -49,6 +53,15 @@ export default {
computed: {
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() {
@ -56,6 +69,7 @@ export default {
this.subscribeChanges()
},
methods: {
showMessage,
getFavoritesList() {
const userUuid = this.$store.getters['user/getUserUuid']
return new Promise(resolve => {
@ -88,7 +102,33 @@ export default {
})
},
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) {
return this.favorites.filter(item => this.ignoreAccent(item.name).toLowerCase().includes(this.ignoreAccent(search.toLowerCase())))
@ -109,13 +149,13 @@ export default {
width: 50%!important;
float: right;
}
.header {
padding-bottom: 10px;
}
.recent-items {
height: 455px;
overflow: auto;
}
.header {
padding-bottom: 10px;
}
.recent-items {
height: 455px;
overflow: auto;
}
.time {
float: left;
font-size: 11px;

View File

@ -1,7 +1,7 @@
<template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<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">
<template slot-scope="{row}">
<svg-icon :icon-class="row.icon" class="icon-window" />
@ -18,9 +18,13 @@
</template>
<template slot-scope="{row}">
<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>
<span class="time">{{ translateDate(row.updated) }}</span>
<span class="time">
{{ translateDate(row.updated) }}
</span>
</template>
</el-table-column>
</el-table>
@ -31,6 +35,8 @@
<script>
import { getRecentItems as getRecentItemsFromServer } from '@/api/ADempiere'
import { convertAction } from '@/utils/ADempiere/dictionaryUtils'
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
import { showMessage } from '@/utils/ADempiere/notification'
export default {
name: 'RecentItems',
@ -54,6 +60,15 @@ export default {
},
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() {
@ -61,6 +76,7 @@ export default {
this.subscribeChanges()
},
methods: {
showMessage,
checkOpened(uuid) {
return this.cachedViews.includes(uuid)
},
@ -91,16 +107,31 @@ export default {
})
},
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({
name: row.menuUuid,
name: viewSearch.name,
query: {
action: row.uuidRecord,
action: recordUuid,
tabParent: 0
}
})
} else {
this.$router.push({ name: row.menuUuid })
this.showMessage({
type: 'error',
message: this.$t('notifications.noRoleAccess')
})
}
},
subscribeChanges() {
@ -129,13 +160,13 @@ export default {
width: 50%!important;
float: right;
}
.header {
padding-bottom: 10px;
}
.recent-items {
height: 455px;
overflow: auto;
}
.header {
padding-bottom: 10px;
}
.recent-items {
height: 455px;
overflow: auto;
}
.time {
float: left;
font-size: 11px;