Files
luos/resources/assets/js/home/TaskMetrics/VueCharts.vue

96 lines
2.3 KiB
Vue
Raw Normal View History

2021-07-30 20:18:11 +00:00
<template>
2022-01-04 20:12:31 +00:00
<div id="v-pm-charts" ref="v-pm-charts" class="v-pm-charts vp-inline-block">
<vue-chart-lv-zero
v-if="level === 0"
@updateDataLevel="updateDataLevel"
/>
<vue-chart-lv-one
:key="key1"
v-if="level === 1"
:data="levels"
@updateDataLevel="updateDataLevel"
/>
<vue-chart-lv-two
:key="key2"
v-if="level === 2"
:data="levels"
@updateDataLevel="updateDataLevel"
/>
<vue-chart-lv-three
:key="key3"
v-if="level === 3"
:data="levels"
@updateDataLevel="updateDataLevel"
/>
</div>
2021-07-30 20:18:11 +00:00
</template>
<script>
2021-08-04 16:25:56 +00:00
import VueChartLvZero from "./VueChartLvZero.vue";
2021-07-30 20:18:11 +00:00
import VueChartLvOne from "./VueChartLvOne.vue";
2021-08-12 19:05:50 +00:00
import VueChartLvTwo from "./VueChartLvTwo.vue";
2021-08-17 18:46:57 +00:00
import VueChartLvThree from "./VueChartLvThree.vue";
2021-09-14 13:54:19 +00:00
import _ from "lodash";
2021-07-30 20:18:11 +00:00
export default {
2022-01-04 20:12:31 +00:00
name: "VueCharts",
mixins: [],
components: {
VueChartLvZero,
VueChartLvOne,
VueChartLvTwo,
VueChartLvThree,
2021-09-27 22:05:05 +00:00
},
2022-01-04 20:12:31 +00:00
props: ["levels"],
data() {
let that = this;
return {
key1: _.random(0, 100),
key2: _.random(0, 100),
key3: _.random(0, 100),
settingsBreadCrumbs: [
{
class: "fas fa-info-circle",
onClick() {},
},
],
};
2021-08-16 18:54:43 +00:00
},
2022-01-04 20:12:31 +00:00
created() {},
mounted() {},
watch: {},
computed: {
level: function() {
return _.find(this.levels, { active: true }).level;
},
2021-08-12 19:05:50 +00:00
},
2022-01-04 20:12:31 +00:00
updated() {},
beforeCreate() {},
methods: {
/**
* Set data level 0
*/
updateDataLevel(data) {
this.$emit("onChangeLevel", data);
this.updateKey(data.level);
},
updateKey(level) {
switch (level) {
case 0:
break;
case 1:
this.key1++;
break;
case 2:
this.key2++;
break;
case 3:
this.key3++;
break;
}
},
2021-09-27 22:05:05 +00:00
},
2021-07-30 20:18:11 +00:00
};
</script>
2022-01-04 20:12:31 +00:00
<style></style>