This commit is contained in:
2022-03-01 17:51:16 +00:00
parent a23af8f9fc
commit 255d4c62bb
2 changed files with 14 additions and 48 deletions

View File

@@ -20,9 +20,7 @@ export default {
singleOnly: false, singleOnly: false,
settings: { settings: {
customTitle: null, customTitle: null,
wotags: [], custtags: []
woitemtags: [],
wostatus: null
} }
}, },
{ {

View File

@@ -1,7 +1,6 @@
<template> <template>
<gz-dash <gz-dash
icon="$ayiTools" icon="$ayiConciergeBell"
:add-url="'svc-workorders/0'"
:show-context-button="true" :show-context-button="true"
:update-frequency="300000" :update-frequency="300000"
v-bind="[$props, $attrs]" v-bind="[$props, $attrs]"
@@ -18,7 +17,7 @@
{{ $ay.t("NoData") }} {{ $ay.t("NoData") }}
</div> </div>
<template v-for="(item, i) in obj"> <template v-for="(item, i) in obj">
<v-list-item :key="i" two-line :to="'/svc-workorders/' + item.id"> <v-list-item :key="i" two-line :to="'/svc-csrs/' + item.id">
<v-list-item-content> <v-list-item-content>
<v-list-item-title <v-list-item-title
><span class="text-h6 primary--text">{{ item.serial }}</span ><span class="text-h6 primary--text">{{ item.serial }}</span
@@ -85,13 +84,8 @@
</v-autocomplete> </v-autocomplete>
<gz-tag-picker <gz-tag-picker
v-model="localSettings.wotags" v-model="localSettings.custtags"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrder')" :label="$ay.t('Tags') + ' - ' + $ay.t('Customer')"
></gz-tag-picker>
<gz-tag-picker
v-model="localSettings.woitemtags"
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrderItem')"
></gz-tag-picker> ></gz-tag-picker>
<v-text-field <v-text-field
@@ -133,17 +127,12 @@ export default {
return { return {
obj: {}, obj: {},
context: false, context: false,
localSettings: {}, localSettings: {}
selectLists: {
dateFilterTokens: [],
units: [],
wostatus: []
}
}; };
}, },
computed: {}, computed: {},
async created() { async created() {
await initWidget(this); await initWidget();
}, },
async mounted() { async mounted() {
//must be called from mounted to have refs available //must be called from mounted to have refs available
@@ -155,13 +144,9 @@ export default {
this.context = true; this.context = true;
}, },
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
this.settings.customTitle = this.localSettings.customTitle; this.settings.customTitle = this.localSettings.customTitle;
this.settings.wostatus = this.localSettings.wostatus; this.settings.custtags = this.localSettings.custtags;
this.settings.wotags = this.localSettings.wotags; this.$emit("dash-change");
this.settings.woitemtags = this.localSettings.woitemtags;
this.$emit("dash-change"); //trigger save to server
this.context = false; this.context = false;
this.getDataFromApi(); this.getDataFromApi();
}, },
@@ -170,13 +155,11 @@ export default {
try { try {
this.errorMessage = null; this.errorMessage = null;
const res = await window.$gz.api.post("kpi", { const res = await window.$gz.api.post("kpi", {
KPIName: "WorkOrderUnscheduledOpenList", KPIName: "CSROpenList",
criteria: { criteria: {
wostatus: this.settings.wostatus, custtags: this.settings.custtags
wotags: this.settings.wotags,
woitemtags: this.settings.woitemtags
}, },
clientTimeStamp: window.$gz.locale.clientLocalZoneTimeStamp() clientTimeStamp: undefined
}); });
if (res.error) { if (res.error) {
this.errorMessage = res.error; this.errorMessage = res.error;
@@ -193,10 +176,8 @@ export default {
///////////////////////////////// /////////////////////////////////
// //
// //
async function initWidget(vm) { async function initWidget() {
await fetchTranslatedText(); await fetchTranslatedText();
await fetchWorkorderStatusList(vm);
//populateSelectionLists(vm);
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@@ -206,21 +187,8 @@ async function initWidget(vm) {
async function fetchTranslatedText() { async function fetchTranslatedText() {
await window.$gz.translation.cacheTranslations([ await window.$gz.translation.cacheTranslations([
"Name", "Name",
"WorkOrder", "Customer",
"WorkOrderItem",
"WorkOrderStatus",
"NoData" "NoData"
]); ]);
} }
async function fetchWorkorderStatusList(vm) {
let res = await window.$gz.api.get("work-order-status/list");
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
vm.selectLists.wostatus = res.data.all.filter(z => z.completed == false); //TODO: weed out closed status
vm.selectLists.wostatus.unshift(window.$gz.form.getNoSelectionItem(true));
}
}
</script> </script>