2021-08-12 19:05:50 +00:00
|
|
|
<template>
|
|
|
|
|
<div id="v-pm-charts" ref="v-pm-charts" class="v-pm-charts 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_NUMBER_TASKS_PROCESS_BY_TASK")}}</h6>
|
2021-08-12 19:05:50 +00:00
|
|
|
<div>
|
2021-08-16 18:54:43 +00:00
|
|
|
<BreadCrumb
|
|
|
|
|
:options="breadCrumbs.data"
|
2021-08-26 20:33:59 +00:00
|
|
|
:settings="settingsBreadcrumbs"
|
2021-08-16 18:54:43 +00:00
|
|
|
/>
|
2021-08-12 19:05:50 +00:00
|
|
|
<div class="vp-width-p30 vp-inline-block">
|
2021-08-16 18:54:43 +00:00
|
|
|
<b-form-datepicker
|
|
|
|
|
id="date-from"
|
|
|
|
|
:date-format-options="{
|
|
|
|
|
year: '2-digit',
|
|
|
|
|
month: '2-digit',
|
|
|
|
|
day: '2-digit',
|
|
|
|
|
}"
|
|
|
|
|
size="sm"
|
|
|
|
|
:placeholder="$t('ID_DELEGATE_DATE_FROM')"
|
|
|
|
|
v-model="dateFrom"
|
|
|
|
|
@input="changeOption"
|
|
|
|
|
></b-form-datepicker>
|
2021-08-12 19:05:50 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="vp-width-p30 vp-inline-block">
|
2021-08-16 18:54:43 +00:00
|
|
|
<b-form-datepicker
|
|
|
|
|
id="date-to"
|
|
|
|
|
size="sm"
|
|
|
|
|
:date-format-options="{
|
|
|
|
|
year: '2-digit',
|
|
|
|
|
month: '2-digit',
|
|
|
|
|
day: '2-digit',
|
|
|
|
|
}"
|
|
|
|
|
:placeholder="$t('ID_DELEGATE_DATE_TO')"
|
|
|
|
|
v-model="dateTo"
|
2021-09-21 16:40:49 -04:00
|
|
|
:min="dateFrom"
|
|
|
|
|
:state="stateDateTo"
|
2021-08-16 18:54:43 +00:00
|
|
|
@input="changeOption"
|
|
|
|
|
></b-form-datepicker>
|
2021-08-12 19:05:50 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="vp-inline-block">
|
2021-08-16 18:54:43 +00:00
|
|
|
<b-form-radio-group
|
|
|
|
|
id="btn-radios"
|
|
|
|
|
v-model="period"
|
|
|
|
|
:options="periodOptions"
|
|
|
|
|
button-variant="outline-secondary"
|
|
|
|
|
size="sm"
|
|
|
|
|
name="radio-btn-outline"
|
|
|
|
|
buttons
|
|
|
|
|
@change="changeOption"
|
|
|
|
|
></b-form-radio-group>
|
2021-08-12 19:05:50 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<apexchart
|
2021-08-16 18:54:43 +00:00
|
|
|
ref="LevelTwoChart"
|
2021-08-12 19:05:50 +00:00
|
|
|
:width="width"
|
|
|
|
|
:options="options"
|
|
|
|
|
:series="series"
|
|
|
|
|
></apexchart>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import _ from "lodash";
|
|
|
|
|
import Api from "../../api/index";
|
|
|
|
|
import Multiselect from "vue-multiselect";
|
|
|
|
|
import BreadCrumb from "../../components/utils/BreadCrumb.vue";
|
2021-08-16 18:54:43 +00:00
|
|
|
import moment from "moment";
|
2021-08-12 19:05:50 +00:00
|
|
|
export default {
|
2021-08-16 18:54:43 +00:00
|
|
|
name: "VueChartLvTwo",
|
2021-08-12 19:05:50 +00:00
|
|
|
mixins: [],
|
|
|
|
|
components: {
|
|
|
|
|
Multiselect,
|
|
|
|
|
BreadCrumb,
|
|
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
props: ["data", "breadCrumbs"],
|
2021-08-12 19:05:50 +00:00
|
|
|
data() {
|
|
|
|
|
let that = this;
|
|
|
|
|
return {
|
2021-08-16 18:54:43 +00:00
|
|
|
dateFrom: "",
|
|
|
|
|
dateTo: "",
|
|
|
|
|
period: "",
|
|
|
|
|
periodOptions: [
|
|
|
|
|
{ text: this.$t("ID_DAY"), value: "day" },
|
|
|
|
|
{ text: this.$t("ID_MONTH"), value: "month" },
|
|
|
|
|
{ text: this.$t("ID_YEAR"), value: "year" },
|
|
|
|
|
],
|
2021-08-26 20:33:59 +00:00
|
|
|
settingsBreadcrumbs: [
|
|
|
|
|
{
|
|
|
|
|
class: "fas fa-info-circle",
|
|
|
|
|
tooltip: this.$t("ID_TASK_RISK_LEVEL2_INFO"),
|
|
|
|
|
onClick() {},
|
|
|
|
|
},
|
|
|
|
|
],
|
2021-08-16 18:54:43 +00:00
|
|
|
dataCasesByRange: [],
|
2021-08-12 19:05:50 +00:00
|
|
|
width: 0,
|
|
|
|
|
options: {
|
|
|
|
|
chart: {
|
2021-08-16 18:54:43 +00:00
|
|
|
type: "area",
|
2021-08-12 19:05:50 +00:00
|
|
|
zoom: {
|
2021-08-16 18:54:43 +00:00
|
|
|
enabled: false,
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
id: "LevelTwoChart",
|
2021-08-17 18:46:57 +00:00
|
|
|
events: {
|
|
|
|
|
markerClick: function (event, chartContext, config) {
|
|
|
|
|
that.currentSelection = that.dataCasesByRange[config.seriesIndex];
|
|
|
|
|
that.$emit("updateDataLevel", {
|
|
|
|
|
id: that.currentSelection["PRO_ID"],
|
|
|
|
|
name: that.currentSelection["PRO_TITLE"],
|
|
|
|
|
level: 2,
|
2021-08-26 21:10:56 +00:00
|
|
|
data: null,
|
2021-08-17 18:46:57 +00:00
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
dataLabels: {
|
2021-08-17 18:46:57 +00:00
|
|
|
enabled: false,
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
stroke: {
|
2021-08-17 18:46:57 +00:00
|
|
|
curve: "smooth",
|
2021-08-16 18:54:43 +00:00
|
|
|
},
|
2021-08-12 19:05:50 +00:00
|
|
|
xaxis: {
|
|
|
|
|
type: "datetime",
|
|
|
|
|
},
|
2021-09-16 18:53:49 +00:00
|
|
|
yaxis: {
|
|
|
|
|
tickAmount: 7,
|
|
|
|
|
},
|
2021-08-17 18:46:57 +00:00
|
|
|
tooltip: {
|
|
|
|
|
fixed: {
|
|
|
|
|
enabled: false,
|
|
|
|
|
position: "topRight",
|
|
|
|
|
},
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
2021-08-17 18:46:57 +00:00
|
|
|
series: [],
|
2021-09-21 16:40:49 -04:00
|
|
|
stateDateTo: null,
|
2021-08-12 19:05:50 +00:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getBodyHeight();
|
|
|
|
|
},
|
2021-09-21 16:40:49 -04:00
|
|
|
watch: {
|
|
|
|
|
dateFrom () {
|
|
|
|
|
this.validateDateTo();
|
|
|
|
|
},
|
|
|
|
|
dateTo () {
|
|
|
|
|
this.validateDateTo();
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-12 19:05:50 +00:00
|
|
|
computed: {},
|
|
|
|
|
updated() {},
|
|
|
|
|
beforeCreate() {},
|
|
|
|
|
methods: {
|
|
|
|
|
/**
|
|
|
|
|
* Return the height for Vue Card View body
|
|
|
|
|
*/
|
|
|
|
|
getBodyHeight() {
|
|
|
|
|
this.width = window.innerHeight;
|
|
|
|
|
},
|
|
|
|
|
/**
|
2021-08-16 18:54:43 +00:00
|
|
|
* Change datepickers or radio button
|
2021-08-12 19:05:50 +00:00
|
|
|
*/
|
2021-08-16 18:54:43 +00:00
|
|
|
changeOption() {
|
|
|
|
|
let that = this,
|
|
|
|
|
dt;
|
|
|
|
|
if (this.dateFrom && this.dateTo && this.period) {
|
|
|
|
|
dt = {
|
|
|
|
|
processId: this.data[1].id,
|
|
|
|
|
caseList: this.data[0].id.toLowerCase(),
|
|
|
|
|
dateFrom: moment(this.dateFrom).format("DD/MM/YYYY"),
|
|
|
|
|
dateTo: moment(this.dateTo).format("DD/MM/YYYY"),
|
|
|
|
|
groupBy: this.period,
|
|
|
|
|
};
|
|
|
|
|
Api.process
|
|
|
|
|
.totalCasesByRange(dt)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
that.formatDataRange(response.data);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
2021-08-26 21:10:56 +00:00
|
|
|
console.error(e);
|
2021-08-16 18:54:43 +00:00
|
|
|
});
|
|
|
|
|
}
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
/**
|
2021-08-27 21:29:54 +00:00
|
|
|
* Format response from API
|
|
|
|
|
* @param {object} data
|
2021-08-12 19:05:50 +00:00
|
|
|
*/
|
2021-08-16 18:54:43 +00:00
|
|
|
formatDataRange(data) {
|
|
|
|
|
let labels = [],
|
|
|
|
|
serie = [];
|
|
|
|
|
|
|
|
|
|
this.dataCasesByRange = data;
|
2021-08-12 19:05:50 +00:00
|
|
|
_.each(data, (el) => {
|
2021-08-16 18:54:43 +00:00
|
|
|
serie.push(el["TOTAL"]);
|
|
|
|
|
labels.push(el["dateGroup"]);
|
2021-08-12 19:05:50 +00:00
|
|
|
});
|
2021-08-16 18:54:43 +00:00
|
|
|
this.$refs["LevelTwoChart"].updateOptions({
|
|
|
|
|
labels: labels,
|
|
|
|
|
title: {
|
|
|
|
|
text: this.data[0]["PRO_TITLE"],
|
|
|
|
|
align: "left",
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
2021-08-16 18:54:43 +00:00
|
|
|
});
|
|
|
|
|
this.$apexcharts.exec("LevelTwoChart", "updateSeries", [
|
2021-08-12 19:05:50 +00:00
|
|
|
{
|
2021-08-16 18:54:43 +00:00
|
|
|
name: this.data[0]["PRO_TITLE"],
|
|
|
|
|
data: serie,
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
},
|
2021-09-21 16:40:49 -04:00
|
|
|
validateDateTo() {
|
|
|
|
|
if (this.dateFrom !== '' && this.dateTo !== '') {
|
|
|
|
|
if (this.dateFrom > this.dateTo) {
|
|
|
|
|
this.stateDateTo = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.stateDateTo = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.vp-task-metrics-label {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-width-p30 {
|
|
|
|
|
width: 30%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-inline-block {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.vp-padding-l20 {
|
|
|
|
|
padding-left: 20px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
|