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-09-22 20:51:38 +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
|
2021-09-24 20:17:56 +00:00
|
|
|
:options="dataBreadcrumbs()"
|
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>
|
2021-10-05 11:53:57 +00:00
|
|
|
<div class="vp-text-align-center">
|
|
|
|
|
<div class="vp-align-right vp-inline-block">
|
2021-09-22 20:51:38 +00:00
|
|
|
<button
|
|
|
|
|
@click="onClickDrillDown()"
|
|
|
|
|
type="button"
|
|
|
|
|
class="btn btn-primary"
|
|
|
|
|
>
|
|
|
|
|
<i class="fas fa-chart-line"></i
|
|
|
|
|
><span class="vp-padding-l10">{{ $t("ID_DRILL") }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2021-10-05 11:53:57 +00:00
|
|
|
<div class="vp-inline-block">
|
2021-09-22 20:51:38 +00:00
|
|
|
<button @click="onClickData()" type="button" class="btn btn-primary">
|
|
|
|
|
<i class="fas fa-th"></i
|
|
|
|
|
><span class="vp-padding-l10">{{ $t("ID_DATA") }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-08-12 19:05:50 +00:00
|
|
|
</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-09-22 20:51:38 +00:00
|
|
|
import eventBus from "./../EventBus/eventBus";
|
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-09-24 20:17:56 +00:00
|
|
|
props: ["data"],
|
2021-08-12 19:05:50 +00:00
|
|
|
data() {
|
|
|
|
|
let that = this;
|
|
|
|
|
return {
|
2021-09-27 22:05:05 +00:00
|
|
|
dateFrom: this.data[3]
|
|
|
|
|
? this.data[3].data.dateFrom
|
2021-10-05 11:53:57 +00:00
|
|
|
: moment().subtract(30, "d").format("YYYY-MM-DD"),
|
2021-09-27 22:05:05 +00:00
|
|
|
dateTo: this.data[3]
|
|
|
|
|
? this.data[3].data.dateTo
|
2021-10-05 11:53:57 +00:00
|
|
|
: moment().format("YYYY-MM-DD"),
|
2021-09-27 22:05:05 +00:00
|
|
|
period: this.data[3] ? this.data[3].data.period : "day",
|
2021-08-16 18:54:43 +00:00
|
|
|
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: {
|
2021-09-22 20:51:38 +00:00
|
|
|
markerClick: function (event, chartContext, config) {},
|
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-22 20:51:38 +00:00
|
|
|
this.changeOption();
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
2021-09-21 16:40:49 -04:00
|
|
|
watch: {
|
2021-09-24 20:17:56 +00:00
|
|
|
dateFrom() {
|
2021-09-21 16:40:49 -04:00
|
|
|
this.validateDateTo();
|
|
|
|
|
},
|
2021-09-24 20:17:56 +00:00
|
|
|
dateTo() {
|
2021-09-21 16:40:49 -04:00
|
|
|
this.validateDateTo();
|
2021-09-24 20:17:56 +00:00
|
|
|
},
|
2021-09-21 16:40:49 -04:00
|
|
|
},
|
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;
|
2021-09-24 16:35:54 +00:00
|
|
|
if (this.data.length > 2) {
|
|
|
|
|
if (this.dateFrom && this.dateTo && this.period) {
|
|
|
|
|
dt = {
|
|
|
|
|
processId: this.data[2].id,
|
|
|
|
|
caseList: this.data[1].id.toLowerCase(),
|
2021-10-06 11:48:46 -04:00
|
|
|
dateFrom: moment(this.dateFrom).format("YYYY-MM-DD"),
|
|
|
|
|
dateTo: moment(this.dateTo).format("YYYY-MM-DD"),
|
2021-09-24 16:35:54 +00:00
|
|
|
groupBy: this.period,
|
|
|
|
|
};
|
|
|
|
|
Api.process
|
|
|
|
|
.totalCasesByRange(dt)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
that.formatDataRange(response.data);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
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: {
|
2021-09-24 16:35:54 +00:00
|
|
|
text: this.data[1]["PRO_TITLE"],
|
2021-08-16 18:54:43 +00:00
|
|
|
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-09-24 16:35:54 +00:00
|
|
|
name: this.data[1]["PRO_TITLE"],
|
2021-08-16 18:54:43 +00:00
|
|
|
data: serie,
|
2021-08-12 19:05:50 +00:00
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
},
|
2021-09-22 20:51:38 +00:00
|
|
|
/**
|
|
|
|
|
* Show popover drill down options
|
|
|
|
|
*/
|
|
|
|
|
onClickDrillDown() {
|
|
|
|
|
this.$emit("updateDataLevel", {
|
2021-09-27 22:05:05 +00:00
|
|
|
id: "level2",
|
2021-09-24 16:35:54 +00:00
|
|
|
name: this.data[2]["name"],
|
|
|
|
|
level: 3,
|
2021-09-27 22:05:05 +00:00
|
|
|
data: {
|
|
|
|
|
dateFrom: this.dateFrom,
|
|
|
|
|
dateTo: this.dateTo,
|
|
|
|
|
period: this.period,
|
|
|
|
|
},
|
2021-09-22 20:51:38 +00:00
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* Show popover data options
|
|
|
|
|
*/
|
|
|
|
|
onClickData() {
|
2021-09-24 16:35:54 +00:00
|
|
|
let taskList = this.data[1].id.toLowerCase(),
|
2021-09-22 20:51:38 +00:00
|
|
|
obj = [
|
|
|
|
|
{
|
|
|
|
|
autoshow: false,
|
|
|
|
|
fieldId: "processName",
|
|
|
|
|
filterVar: "process",
|
|
|
|
|
label: "",
|
|
|
|
|
options: {
|
2021-09-24 16:35:54 +00:00
|
|
|
label: this.data[2]["name"],
|
|
|
|
|
value: this.data[2]["id"],
|
2021-09-22 20:51:38 +00:00
|
|
|
},
|
2021-09-24 16:35:54 +00:00
|
|
|
value: this.data[2]["id"],
|
2021-09-22 20:51:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
autoShow: false,
|
|
|
|
|
fieldId: "delegationDate",
|
|
|
|
|
filterVar: "delegateFrom",
|
|
|
|
|
label: "",
|
|
|
|
|
options: [],
|
|
|
|
|
value: this.dateFrom,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
autoShow: false,
|
|
|
|
|
fieldId: "delegationDate",
|
|
|
|
|
filterVar: "delegateTo",
|
|
|
|
|
label: "",
|
|
|
|
|
options: [],
|
|
|
|
|
value: this.dateTo,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
eventBus.$emit("home::update-settings", {
|
|
|
|
|
data: obj,
|
|
|
|
|
key: "filters",
|
|
|
|
|
page: taskList,
|
|
|
|
|
type: "normal",
|
|
|
|
|
});
|
|
|
|
|
eventBus.$emit("home::sidebar::click-item", taskList);
|
|
|
|
|
},
|
2021-09-22 20:56:26 +00:00
|
|
|
/**
|
|
|
|
|
* Validate range date
|
|
|
|
|
*/
|
2021-09-21 16:40:49 -04:00
|
|
|
validateDateTo() {
|
2021-09-24 20:17:56 +00:00
|
|
|
if (this.dateFrom !== "" && this.dateTo !== "") {
|
2021-09-21 16:40:49 -04:00
|
|
|
if (this.dateFrom > this.dateTo) {
|
|
|
|
|
this.stateDateTo = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.stateDateTo = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-09-24 20:17:56 +00:00
|
|
|
/**
|
|
|
|
|
* Return the breadcrumbs
|
|
|
|
|
*/
|
|
|
|
|
dataBreadcrumbs() {
|
|
|
|
|
let res = [];
|
|
|
|
|
if (this.data[1]) {
|
|
|
|
|
res.push({
|
|
|
|
|
label: this.data[1]["name"],
|
|
|
|
|
onClick() {},
|
|
|
|
|
color: this.data[1]["color"],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (this.data[2]) {
|
|
|
|
|
res.push({
|
|
|
|
|
label: this.data[2]["name"],
|
|
|
|
|
onClick() {},
|
|
|
|
|
color: null,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
},
|
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;
|
|
|
|
|
}
|
2021-10-05 11:53:57 +00:00
|
|
|
|
|
|
|
|
.vp-text-align-center {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2021-08-12 19:05:50 +00:00
|
|
|
</style>
|
|
|
|
|
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
|