1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

Style Dashboard (#954)

* Sort Dashboard

* minimal change style

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-06-30 17:58:34 -04:00 committed by GitHub
parent 3b0190af18
commit 90a4846b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 105 additions and 32 deletions

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<el-calendar style="max-height: 40vh;"> <el-calendar>
<!-- Use 2.5 slot syntax. If you use Vue 2.6, please use new slot syntax--> <!-- Use 2.5 slot syntax. If you use Vue 2.6, please use new slot syntax-->
<template <template
slot="dateCell" slot="dateCell"

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<div :class="className" :style="{height:height,width:width + 'max-height: 40vh;'}" /> <div :class="className" :style="{height:height,width:width}" />
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never" style="max-height: 40vh;"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="dataResult" max-height="455" @row-click="handleClick"> <el-table :data="dataResult" max-height="455" @row-click="handleClick">
<el-table-column <el-table-column

View File

@ -16,28 +16,36 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<el-collapse <el-card
v-if="!unsupportedDashboards.includes(dashboard.fileName)" v-if="!unsupportedDashboards.includes(dashboard.fileName)"
v-model="activeDashboard" style="height: auto;"
accordion
> >
<el-collapse-item <div class="clearfix">
:name="dashboard.name" <el-row :gutter="2">
:disabled="!dashboard.isCollapsible" <el-col :span="isEmptyValue(title) ? 22 : 23">
class="custom-collapse-item" <el-button type="text" class="label-dashboard" @click="metadata.isCollapsible = !metadata.isCollapsible">
> {{ labelDashboard }}
<template slot="title"> </el-button>
<span class="custom-title"> </el-col>
{{ dashboard.name }} <el-col v-if="isEmptyValue(title)" :span="1">
</span> <el-button type="text" icon="el-icon-files" @click="sendMain(metadata)" />
</template> </el-col>
<component <el-col :span="1">
:is="renderDashboard" <el-button type="text" :icon="!metadata.isCollapsible ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" @click="metadata.isCollapsible = !metadata.isCollapsible" />
:ref="dashboard.name" </el-col>
:metadata="dashboard" </el-row>
/> </div>
</el-collapse-item> <transition name="el-zoom-in-top">
</el-collapse> <div v-show="metadata.isCollapsible" class="dashboard-transitio">
<component
:is="renderDashboard"
:ref="dashboard.name"
:metadata="metadata"
:height="'450px'"
/>
</div>
</transition>
</el-card>
</template> </template>
<script> <script>
@ -47,6 +55,10 @@ export default {
metadata: { metadata: {
type: Object, type: Object,
required: true required: true
},
title: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -112,6 +124,18 @@ export default {
} }
return dashboard return dashboard
// return () => import(`@/components/ADempiere/Dashboard/${this.metadata.fileName}`) // return () => import(`@/components/ADempiere/Dashboard/${this.metadata.fileName}`)
},
labelDashboard() {
if (this.isEmptyValue(this.title)) {
return this.dashboard.name
}
return this.title
}
},
methods: {
sendMain(dashboard) {
this.$store.commit('setMainDashboard', dashboard)
this.$forceUpdate()
} }
} }
} }
@ -144,4 +168,34 @@ export default {
color: #303133; color: #303133;
} }
} }
.el-card__header {
border: 1px solid #36a3f7;
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
.dashboard-transitio {
margin: 0px;
width: 100%;
padding-right: 2%;
border-radius: 4px;
text-align: center;
color: #fff;
box-sizing: border-box;
height: 500px;
overflow: auto;
}
.label-dashboard{
color: black;
width: 95%;
text-align: inherit;
font-weight: 500;
font-size: large;
padding-left: 1%;
}
</style>
<style>
.el-card__body {
padding: 5px;
}
</style> </style>

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never" style="max-height: 40vh;"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="dataResult" 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">

View File

@ -16,7 +16,7 @@
along with this program. If not, see <https:www.gnu.org/licenses/>. along with this program. If not, see <https:www.gnu.org/licenses/>.
--> -->
<template> <template>
<el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never" style="max-height: 40vh;"> <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="never">
<div class="recent-items"> <div class="recent-items">
<el-table :data="dataResult" 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">

View File

@ -23,7 +23,8 @@ import { getCurrentRole } from '@/utils/auth'
const dashboard = { const dashboard = {
state: { state: {
dashboard: [], dashboard: [],
recentItems: [] recentItems: [],
mainashboard: {}
}, },
mutations: { mutations: {
addDashboard(state, payload) { addDashboard(state, payload) {
@ -34,6 +35,9 @@ const dashboard = {
}, },
setRecentItems(state, payload) { setRecentItems(state, payload) {
state.recentItems = payload state.recentItems = payload
},
setMainDashboard(state, payload) {
state.mainashboard = payload
} }
}, },
actions: { actions: {

View File

@ -1,8 +1,14 @@
<template> <template>
<div class="dashboard-editor-container"> <div class="dashboard-editor-container">
<el-row :gutter="8"> <el-row :gutter="8">
<el-col :span="24" style="padding-right:8px;margin-bottom:2px;">
<dashboard
:metadata="mainashboard"
:title="mainashboard.name"
/>
</el-col>
<template v-for="(dashboardAttributes, index) in dashboardList"> <template v-for="(dashboardAttributes, index) in dashboardList">
<el-col :key="index" :xs="{ span: 24 }" :sm="{ span: 24 }" :md="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 12 }" style="padding-right:8px;margin-bottom:2px;"> <el-col v-if="index > 0" :key="index" :xs="{ span: 24 }" :sm="{ span: 24 }" :md="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 12 }" style="padding-right:8px;margin-bottom:2px;">
<dashboard :metadata="dashboardAttributes" /> <dashboard :metadata="dashboardAttributes" />
</el-col> </el-col>
</template> </template>
@ -33,11 +39,17 @@ export default {
}, },
getterRol() { getterRol() {
return this.$store.getters.getRoleUuid return this.$store.getters.getRoleUuid
},
mainashboard() {
return this.$store.state.dashboard.mainashboard
} }
}, },
watch: { watch: {
getterRol(value) { getterRol(value) {
this.getDashboardListFromServer() this.getDashboardListFromServer()
},
mainashboard(value) {
this.getDashboardListFromServer()
} }
}, },
mounted() { mounted() {
@ -50,6 +62,9 @@ export default {
roleUuid: this.currentRole.uuid roleUuid: this.currentRole.uuid
}) })
.then(response => { .then(response => {
if (this.isEmptyValue(this.mainashboard)) {
this.$store.commit('setMainDashboard', response.dashboardsList[1])
}
this.dashboardList = response.dashboardsList this.dashboardList = response.dashboardsList
this.$forceUpdate() this.$forceUpdate()
}) })