2021-07-30 20:18:11 +00:00
|
|
|
<template>
|
2021-08-16 18:54:43 +00:00
|
|
|
<div
|
|
|
|
|
id="v-pm-drill-down"
|
|
|
|
|
ref="v-pm-drill-down"
|
|
|
|
|
class="v-pm-drill-down vp-inline-block"
|
|
|
|
|
>
|
|
|
|
|
<div class="p-1 v-flex">
|
2021-08-26 21:10:56 +00:00
|
|
|
<h6 class="v-search-title">{{ $t("ID_DRILL_DOWN_NAVIGATOR") }}</h6>
|
2021-08-16 18:54:43 +00:00
|
|
|
</div>
|
|
|
|
|
<div
|
2021-09-24 16:35:54 +00:00
|
|
|
v-for="item in loadItems()"
|
2021-08-16 18:54:43 +00:00
|
|
|
:key="item.content"
|
|
|
|
|
class="vp-padding-b10"
|
|
|
|
|
@click="onClick(item)"
|
|
|
|
|
>
|
|
|
|
|
<span class="vp-inline-block vp-padding-r10 vp-font-size-r1">
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</span>
|
|
|
|
|
<div class="vp-inline-block">
|
|
|
|
|
<span :class="item.classObject"> {{ item.content }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-07-30 20:18:11 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import _ from "lodash";
|
|
|
|
|
export default {
|
2021-08-16 18:54:43 +00:00
|
|
|
name: "DrillDown",
|
|
|
|
|
mixins: [],
|
|
|
|
|
components: {},
|
2021-09-24 16:35:54 +00:00
|
|
|
props: ["visited"],
|
2021-08-16 18:54:43 +00:00
|
|
|
data() {
|
|
|
|
|
let that = this;
|
|
|
|
|
return {
|
|
|
|
|
classObject: {
|
|
|
|
|
"rounded-circle": true,
|
|
|
|
|
"v-pm-drill-down-number": true,
|
|
|
|
|
"vp-btn-secondary": true,
|
2021-09-24 16:35:54 +00:00
|
|
|
"vp-btn-primary-inactive": false,
|
2021-08-16 18:54:43 +00:00
|
|
|
"btn-primary": false,
|
|
|
|
|
"vp-block": true,
|
|
|
|
|
},
|
|
|
|
|
data: [
|
|
|
|
|
{
|
2021-08-26 21:10:56 +00:00
|
|
|
label: that.$t("ID_LEVEL"),
|
2021-09-24 16:35:54 +00:00
|
|
|
content: 0,
|
|
|
|
|
click(elem) {
|
|
|
|
|
that.$emit("onChangeLevel", elem);
|
2021-08-16 18:54:43 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-08-26 21:10:56 +00:00
|
|
|
label: that.$t("ID_LEVEL"),
|
2021-09-24 16:35:54 +00:00
|
|
|
content: 1,
|
|
|
|
|
click(elem) {
|
|
|
|
|
that.$emit("onChangeLevel", elem);
|
2021-08-16 18:54:43 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-08-26 21:10:56 +00:00
|
|
|
label: that.$t("ID_LEVEL"),
|
2021-09-24 16:35:54 +00:00
|
|
|
content: 2,
|
|
|
|
|
click(elem) {
|
|
|
|
|
that.$emit("onChangeLevel", elem);
|
2021-08-16 18:54:43 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-08-26 21:10:56 +00:00
|
|
|
label: that.$t("ID_LEVEL"),
|
2021-09-24 16:35:54 +00:00
|
|
|
content: 3,
|
|
|
|
|
click(elem) {
|
|
|
|
|
that.$emit("onChangeLevel", elem);
|
|
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {},
|
|
|
|
|
mounted() {},
|
|
|
|
|
watch: {},
|
2021-09-24 16:35:54 +00:00
|
|
|
computed: {
|
|
|
|
|
level: function () {
|
|
|
|
|
return _.find(this.visited, {'active': true }).level ;
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
updated() {},
|
|
|
|
|
beforeCreate() {},
|
|
|
|
|
methods: {
|
2021-08-26 21:10:56 +00:00
|
|
|
/**
|
|
|
|
|
* Click in drill option
|
|
|
|
|
*/
|
2021-08-16 18:54:43 +00:00
|
|
|
onClick(item) {
|
2021-09-24 16:35:54 +00:00
|
|
|
let elem =_.find(this.visited, {'level': item.content });
|
|
|
|
|
if (elem) {
|
|
|
|
|
item.click(elem);
|
2021-08-16 18:54:43 +00:00
|
|
|
}
|
|
|
|
|
},
|
2021-08-26 21:10:56 +00:00
|
|
|
/**
|
|
|
|
|
* Load items in drill items
|
|
|
|
|
*/
|
2021-09-24 16:35:54 +00:00
|
|
|
loadItems() {
|
2021-08-16 18:54:43 +00:00
|
|
|
let array,
|
2021-09-24 16:35:54 +00:00
|
|
|
that = this,
|
|
|
|
|
item;
|
|
|
|
|
array = _.clone(this.data);
|
2021-08-16 18:54:43 +00:00
|
|
|
array.forEach((el) => {
|
|
|
|
|
el.classObject = _.clone(that.classObject);
|
2021-09-24 16:35:54 +00:00
|
|
|
item =_.find(this.visited, {'level': el.content });
|
|
|
|
|
if (item) {
|
|
|
|
|
if (item.active){
|
|
|
|
|
el.classObject["vp-btn-primary-inactive"] = false;
|
|
|
|
|
el.classObject["vp-btn-secondary"] = false;
|
|
|
|
|
el.classObject["btn-primary"] = true;
|
|
|
|
|
} else {
|
|
|
|
|
el.classObject["vp-btn-secondary"] = false;
|
|
|
|
|
el.classObject["btn-primary"] = false;
|
|
|
|
|
el.classObject["vp-btn-primary-inactive"] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-08-16 18:54:43 +00:00
|
|
|
return array;
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-07-30 20:18:11 +00:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.v-pm-drill-down-number {
|
2021-08-16 18:54:43 +00:00
|
|
|
height: 5rem;
|
|
|
|
|
width: 5rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 5rem;
|
|
|
|
|
font-size: 1.5rem;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-inline-block {
|
2021-08-16 18:54:43 +00:00
|
|
|
display: inline-block;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
.vp-block {
|
2021-08-16 18:54:43 +00:00
|
|
|
display: block;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
.vp-padding-r10 {
|
2021-08-16 18:54:43 +00:00
|
|
|
padding-right: 10px;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-padding-b10 {
|
2021-08-16 18:54:43 +00:00
|
|
|
padding-bottom: 10px;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-font-size-r1 {
|
2021-08-16 18:54:43 +00:00
|
|
|
font-size: 1rem;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-btn-secondary {
|
2021-08-16 18:54:43 +00:00
|
|
|
color: #2f3133;
|
|
|
|
|
background-color: #b5b6b6;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-btn-secondary:hover {
|
2021-08-16 18:54:43 +00:00
|
|
|
color: #fff;
|
|
|
|
|
background-color: #6c757d;
|
|
|
|
|
border-color: #6c757d;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
2021-09-24 16:35:54 +00:00
|
|
|
.vp-btn-primary-inactive {
|
|
|
|
|
color: #6c757d;
|
|
|
|
|
background-color: #007bff;
|
|
|
|
|
border-color: #007bff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-btn-primary-inactive:hover {
|
|
|
|
|
color: #6c757d;
|
|
|
|
|
background-color: #0066d3;
|
|
|
|
|
border-color: #0066d3;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 20:18:11 +00:00
|
|
|
.v-pm-drill-down {
|
2021-08-16 18:54:43 +00:00
|
|
|
vertical-align: top;
|
2021-08-12 19:05:50 +00:00
|
|
|
padding-left: 50px;
|
2021-07-30 20:18:11 +00:00
|
|
|
}
|
|
|
|
|
</style>
|