This commit is contained in:
@@ -19,7 +19,12 @@ export default {
|
|||||||
icon: "$ayiListAlt",
|
icon: "$ayiListAlt",
|
||||||
type: "GzDashWorkorderUnscheduledOpenList",
|
type: "GzDashWorkorderUnscheduledOpenList",
|
||||||
singleOnly: false,
|
singleOnly: false,
|
||||||
settings: {}
|
settings: {
|
||||||
|
customTitle: null,
|
||||||
|
wotags: [],
|
||||||
|
woitemtags: [],
|
||||||
|
wostatus: null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
roles: [
|
roles: [
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
<gz-dash
|
<gz-dash
|
||||||
icon="$ayiUser"
|
icon="$ayiUser"
|
||||||
:show-context-button="true"
|
:show-context-button="true"
|
||||||
:update-frequency="900000"
|
:update-frequency="300000"
|
||||||
v-bind="[$props, $attrs]"
|
v-bind="[$props, $attrs]"
|
||||||
@dash-refresh="getDataFromApi()"
|
@dash-refresh="getDataFromApi()"
|
||||||
@dash-context="showContext()"
|
@dash-context="showContext()"
|
||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
>
|
>
|
||||||
<template slot="main">
|
<template slot="main">
|
||||||
<div>
|
<v-sheet height="400">
|
||||||
<gz-chart-bar :chart-data="chartData" :options="chartOptions" />
|
{{ obj }}
|
||||||
</div>
|
</v-sheet>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot="settings">
|
<template slot="settings">
|
||||||
@@ -30,21 +30,41 @@
|
|||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-select
|
<v-autocomplete
|
||||||
v-model="localSettings.timeSpan"
|
v-model="localSettings.wostatus"
|
||||||
:items="selectLists.dateFilterTokens"
|
class="mt-5"
|
||||||
|
:items="selectLists.wostatus"
|
||||||
item-text="name"
|
item-text="name"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
:label="$ay.t('TimeSpan')"
|
dense
|
||||||
></v-select>
|
:label="$ay.t('WorkOrderStatus')"
|
||||||
|
>
|
||||||
<v-select
|
<template v-slot:item="data">
|
||||||
v-model="localSettings.interval"
|
<v-list-item-avatar>
|
||||||
:items="selectLists.units"
|
<v-icon :color="data.item.color">$ayiFlag</v-icon>
|
||||||
item-text="name"
|
</v-list-item-avatar>
|
||||||
item-value="id"
|
<v-list-item-content>
|
||||||
:label="$ay.t('Interval')"
|
<v-list-item-title
|
||||||
></v-select>
|
><span class="text-subtitle-2">{{ data.item.name }}</span
|
||||||
|
><v-icon
|
||||||
|
v-if="data.item.locked"
|
||||||
|
small
|
||||||
|
color="disabled"
|
||||||
|
class="ml-2"
|
||||||
|
>$ayiLock</v-icon
|
||||||
|
>
|
||||||
|
<!-- <v-icon
|
||||||
|
v-if="data.item.completed"
|
||||||
|
color="disabled"
|
||||||
|
class="ml-1"
|
||||||
|
small
|
||||||
|
>$ayiCheckCircle</v-icon
|
||||||
|
> -->
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
<v-list-item-action> </v-list-item-action>
|
||||||
|
</template>
|
||||||
|
</v-autocomplete>
|
||||||
|
|
||||||
<gz-tag-picker
|
<gz-tag-picker
|
||||||
v-model="localSettings.wotags"
|
v-model="localSettings.wotags"
|
||||||
@@ -60,13 +80,6 @@
|
|||||||
v-model="localSettings.customTitle"
|
v-model="localSettings.customTitle"
|
||||||
:label="$ay.t('Name')"
|
:label="$ay.t('Name')"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
<v-color-picker
|
|
||||||
v-model="localSettings.color"
|
|
||||||
hide-mode-switch
|
|
||||||
hide-inputs
|
|
||||||
mode="hexa"
|
|
||||||
></v-color-picker>
|
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
@@ -105,50 +118,12 @@ export default {
|
|||||||
localSettings: {},
|
localSettings: {},
|
||||||
selectLists: {
|
selectLists: {
|
||||||
dateFilterTokens: [],
|
dateFilterTokens: [],
|
||||||
units: []
|
units: [],
|
||||||
},
|
wostatus: []
|
||||||
chartOptions: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
scales: {
|
|
||||||
xAxes: [
|
|
||||||
{
|
|
||||||
type: "time",
|
|
||||||
time: {
|
|
||||||
unit: "day"
|
|
||||||
},
|
|
||||||
gridLines: {
|
|
||||||
drawOnChartArea: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
yAxes: [
|
|
||||||
{
|
|
||||||
gridLines: {
|
|
||||||
drawOnChartArea: false
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
beginAtZero: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {},
|
||||||
chartData() {
|
|
||||||
return {
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: this.$ay.t("WorkOrderItemLaborServiceRateQuantity"),
|
|
||||||
backgroundColor: this.settings.color ?? "#000000",
|
|
||||||
data: this.obj
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async created() {
|
async created() {
|
||||||
await initWidget(this);
|
await initWidget(this);
|
||||||
},
|
},
|
||||||
@@ -165,9 +140,7 @@ export default {
|
|||||||
updateSettings: function() {
|
updateSettings: function() {
|
||||||
//copy settings from local to parent settings, need to do it this way or get error about mutating prop directly which is vexing and has no easy solution seemingly
|
//copy settings from local to parent settings, need to do it this way or get error about mutating prop directly which is vexing and has no easy solution seemingly
|
||||||
this.settings.customTitle = this.localSettings.customTitle;
|
this.settings.customTitle = this.localSettings.customTitle;
|
||||||
this.settings.timeSpan = this.localSettings.timeSpan;
|
this.settings.wostatus = this.localSettings.wostatus;
|
||||||
this.settings.interval = this.localSettings.interval;
|
|
||||||
this.settings.color = this.localSettings.color;
|
|
||||||
this.settings.wotags = this.localSettings.wotags;
|
this.settings.wotags = this.localSettings.wotags;
|
||||||
this.settings.woitemtags = this.localSettings.woitemtags;
|
this.settings.woitemtags = this.localSettings.woitemtags;
|
||||||
|
|
||||||
@@ -182,8 +155,7 @@ export default {
|
|||||||
const res = await window.$gz.api.post("kpi", {
|
const res = await window.$gz.api.post("kpi", {
|
||||||
KPIName: "WorkOrderItemLaborQuantitySummary",
|
KPIName: "WorkOrderItemLaborQuantitySummary",
|
||||||
criteria: {
|
criteria: {
|
||||||
timeSpan: this.settings.timeSpan,
|
wostatus: this.settings.wostatus,
|
||||||
interval: this.settings.interval,
|
|
||||||
wotags: this.settings.wotags,
|
wotags: this.settings.wotags,
|
||||||
woitemtags: this.settings.woitemtags
|
woitemtags: this.settings.woitemtags
|
||||||
},
|
},
|
||||||
@@ -192,13 +164,6 @@ export default {
|
|||||||
if (res.error) {
|
if (res.error) {
|
||||||
this.errorMessage = res.error;
|
this.errorMessage = res.error;
|
||||||
} else {
|
} else {
|
||||||
this.chartOptions.scales.xAxes[0].time.unit = this.settings.interval;
|
|
||||||
res.data.forEach(z => {
|
|
||||||
z.x = new Date(z.x) //convert to locale timezone and output in the closest thing to iso-8601 format
|
|
||||||
.toLocaleString("sv-SE", {
|
|
||||||
timeZone: this.timeZoneName
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.obj = res.data;
|
this.obj = res.data;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -213,7 +178,8 @@ export default {
|
|||||||
//
|
//
|
||||||
async function initWidget(vm) {
|
async function initWidget(vm) {
|
||||||
await fetchTranslatedText();
|
await fetchTranslatedText();
|
||||||
populateSelectionLists(vm);
|
await fetchWorkorderStatusList(vm);
|
||||||
|
//populateSelectionLists(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
@@ -222,125 +188,20 @@ async function initWidget(vm) {
|
|||||||
//
|
//
|
||||||
async function fetchTranslatedText() {
|
async function fetchTranslatedText() {
|
||||||
await window.$gz.translation.cacheTranslations([
|
await window.$gz.translation.cacheTranslations([
|
||||||
"Filter",
|
|
||||||
"GridRowFilterDropDownBlanksItem",
|
|
||||||
"GridRowFilterDropDownNonBlanksItem",
|
|
||||||
"GridRowFilterDropDownEquals",
|
|
||||||
"GridRowFilterDropDownNotEquals",
|
|
||||||
"GridRowFilterDropDownDoesNotContain",
|
|
||||||
"GridRowFilterDropDownContains",
|
|
||||||
"DateRangeYesterday",
|
|
||||||
"DateRangeToday",
|
|
||||||
"DateRangeLastWeek",
|
|
||||||
"DateRangeThisWeek",
|
|
||||||
"DateRangeNextWeek",
|
|
||||||
"DateRangeLastMonth",
|
|
||||||
"DateRangeThisMonth",
|
|
||||||
"DateRangeNextMonth",
|
|
||||||
"DateRange14DayWindow",
|
|
||||||
"DateRangePast",
|
|
||||||
"DateRangeLastYear",
|
|
||||||
"DateRangeThisYear",
|
|
||||||
"DateRangeInTheLastThreeMonths",
|
|
||||||
"DateRangeInTheLastSixMonths",
|
|
||||||
"DateRangePastYear",
|
|
||||||
"DateRangePast90Days",
|
|
||||||
"DateRangePast30Days",
|
|
||||||
"DateRangePast7Days",
|
|
||||||
"DateRangePast24Hours",
|
|
||||||
"DateRangePast6Hours",
|
|
||||||
"DateRangeJanuary",
|
|
||||||
"DateRangeFebruary",
|
|
||||||
"DateRangeMarch",
|
|
||||||
"DateRangeApril",
|
|
||||||
"DateRangeMay",
|
|
||||||
"DateRangeJune",
|
|
||||||
"DateRangeJuly",
|
|
||||||
"DateRangeAugust",
|
|
||||||
"DateRangeSeptember",
|
|
||||||
"DateRangeOctober",
|
|
||||||
"DateRangeNovember",
|
|
||||||
"DateRangeDecember",
|
|
||||||
"DateRangePreviousYearThisMonth",
|
|
||||||
"DateRangePreviousYearLastMonth",
|
|
||||||
"DateRangePreviousYearNextMonth",
|
|
||||||
"TimeSpanDays",
|
|
||||||
"TimeSpanMonths",
|
|
||||||
"WorkOrderItemLaborServiceRateQuantity",
|
|
||||||
"Name",
|
"Name",
|
||||||
"TimeSpan",
|
|
||||||
"Interval",
|
|
||||||
"WorkOrder",
|
"WorkOrder",
|
||||||
"WorkOrderItem"
|
"WorkOrderItem",
|
||||||
|
"WorkOrderStatus"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////
|
async function fetchWorkorderStatusList(vm) {
|
||||||
//
|
let res = await window.$gz.api.get("work-order-status/list");
|
||||||
//
|
if (res.error) {
|
||||||
function populateSelectionLists(vm) {
|
vm.formState.serverError = res.error;
|
||||||
vm.selectLists.dateFilterTokens.push(
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
...[
|
} else {
|
||||||
// { name: vm.$ay.t("DateRangeYesterday"), id: "*yesterday*" },
|
vm.selectLists.wostatus = res.data.all.filter(z => z.completed == false); //TODO: weed out closed status
|
||||||
// { name: vm.$ay.t("DateRangeToday"), id: "*today*" },
|
}
|
||||||
{ name: vm.$ay.t("DateRangeThisYear"), id: "*thisyear*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeThisMonth"), id: "*thismonth*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeThisWeek"), id: "*thisweek*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeLastYear"), id: "*lastyear*" }, //prior year from jan to dec
|
|
||||||
{ name: vm.$ay.t("DateRangeLastMonth"), id: "*lastmonth*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeLastWeek"), id: "*lastweek*" },
|
|
||||||
//-------------------------- rando ones -------------------
|
|
||||||
{ name: vm.$ay.t("DateRange14DayWindow"), id: "*14daywindow*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast"), id: "*past*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangeInTheLastThreeMonths"),
|
|
||||||
id: "*last3months*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangeInTheLastSixMonths"),
|
|
||||||
id: "*last6months*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("DateRangePastYear"), id: "*pastyear*" }, //last 365 days
|
|
||||||
{ name: vm.$ay.t("DateRangePast90Days"), id: "*past90days*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast30Days"), id: "*past30days*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast7Days"), id: "*past7days*" },
|
|
||||||
// { name: vm.$ay.t("DateRangePast24Hours"), id: "*past24hours*" },
|
|
||||||
// { name: vm.$ay.t("DateRangePast6Hours"), id: "*past6hours*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeJanuary"), id: "*january*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeFebruary"), id: "*february*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeMarch"), id: "*march*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeApril"), id: "*april*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeMay"), id: "*may*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeJune"), id: "*june*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeJuly"), id: "*july*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeAugust"), id: "*august*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeSeptember"), id: "*september*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeOctober"), id: "*october*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeNovember"), id: "*november*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeDecember"), id: "*december*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearThisMonth"),
|
|
||||||
id: "*lastyearthismonth*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearLastMonth"),
|
|
||||||
id: "*lastyearlastmonth*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearNextMonth"),
|
|
||||||
id: "*lastyearnextmonth*"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.units.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("TimeSpanDays"), id: "day" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("TimeSpanMonths"),
|
|
||||||
id: "month"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ import GzDashTodayReminders from "../components/dash-today-reminders.vue";
|
|||||||
import GzDashTodayReviews from "../components/dash-today-reviews.vue";
|
import GzDashTodayReviews from "../components/dash-today-reviews.vue";
|
||||||
import GzDashLaborHoursPersonalLine from "../components/dash-labor-hours-personal-line.vue";
|
import GzDashLaborHoursPersonalLine from "../components/dash-labor-hours-personal-line.vue";
|
||||||
import GzDashLaborHoursPersonalBar from "../components/dash-labor-hours-personal-bar.vue";
|
import GzDashLaborHoursPersonalBar from "../components/dash-labor-hours-personal-bar.vue";
|
||||||
|
import GzDashWorkorderUnscheduledOpenList from "../components/dash-workorder-unscheduled-open-list.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -100,7 +101,8 @@ export default {
|
|||||||
GzDashTestLineWidgetMonthlyTotalPrice,
|
GzDashTestLineWidgetMonthlyTotalPrice,
|
||||||
GzDashTodayScheduledWo,
|
GzDashTodayScheduledWo,
|
||||||
GzDashTodayReminders,
|
GzDashTodayReminders,
|
||||||
GzDashTodayReviews
|
GzDashTodayReviews,
|
||||||
|
GzDashWorkorderUnscheduledOpenList
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user