This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
import authorizationroles from "./authorizationroles";
|
||||
const role = authorizationroles.AUTHORIZATION_ROLES;
|
||||
/*
|
||||
|
||||
WorkOrderOverdueAllList
|
||||
*/
|
||||
export default {
|
||||
registry: [
|
||||
{
|
||||
roles: [role.Tech, role.TechRestricted],
|
||||
title: "DashboardOverdueAll",
|
||||
icon: "$ayiListAlt",
|
||||
type: "GzDashWorkorderOverdueAllList",
|
||||
scheduleableUserOnly: false,
|
||||
singleOnly: false,
|
||||
settings: {
|
||||
customTitle: null,
|
||||
wotags: [],
|
||||
woitemtags: [],
|
||||
techtags: [],
|
||||
userid: null
|
||||
}
|
||||
},
|
||||
{
|
||||
roles: [role.Tech, role.TechRestricted],
|
||||
title: "DashboardOverdue",
|
||||
|
||||
184
ayanova/src/components/dash-workorder-overdue-all-list.vue
Normal file
184
ayanova/src/components/dash-workorder-overdue-all-list.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<gz-dash
|
||||
icon="$ayiTools"
|
||||
:count="obj.length"
|
||||
:add-url="'svc-workorders/0'"
|
||||
:show-context-button="true"
|
||||
:update-frequency="300000"
|
||||
v-bind="[$props, $attrs]"
|
||||
@dash-refresh="getDataFromApi()"
|
||||
@dash-context="showContext()"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<template slot="main">
|
||||
<v-sheet height="400" class="overflow-y-auto">
|
||||
<div
|
||||
v-if="obj.length == 0"
|
||||
class="ml-6 mt-6 text-h4 grey--text text--lighten-1"
|
||||
>
|
||||
{{ $ay.t("NoData") }}
|
||||
</div>
|
||||
<template v-for="(item, i) in obj">
|
||||
<v-list-item :key="i" two-line :to="'/svc-workorders/' + item.id">
|
||||
<v-list-item-content>
|
||||
<v-list-item-title
|
||||
><span class="text-h6 primary--text">{{ item.serial }}</span
|
||||
><span class="ml-4">{{ $ay.dt(item.completebydate) }}</span>
|
||||
<span class="ml-4">{{ item.name }}</span></v-list-item-title
|
||||
>
|
||||
<v-list-item-subtitle>{{ item.notes }}</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-sheet>
|
||||
</template>
|
||||
|
||||
<template slot="settings">
|
||||
<div></div>
|
||||
<v-col v-if="context" cols="12">
|
||||
<v-dialog
|
||||
v-model="context"
|
||||
scrollable
|
||||
max-width="400px"
|
||||
data-cy="dashSettings"
|
||||
@keydown.esc="cancel"
|
||||
>
|
||||
<v-card elevation="24">
|
||||
<v-card-title class="text-h5 lighten-2" primary-title>
|
||||
<span> {{ $ay.t("Settings") }} </span>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
|
||||
<gz-pick-list
|
||||
v-model="localSettings.userid"
|
||||
allow-no-selection
|
||||
:aya-type="$ay.ayt().User"
|
||||
variant="tech"
|
||||
:label="$ay.t('WorkOrderItemLaborUserID')"
|
||||
></gz-pick-list>
|
||||
|
||||
<gz-tag-picker
|
||||
v-model="localSettings.techtags"
|
||||
:label="$ay.t('Tags') + ' - ' + $ay.t('User')"
|
||||
></gz-tag-picker>
|
||||
|
||||
<gz-tag-picker
|
||||
v-model="localSettings.wotags"
|
||||
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrder')"
|
||||
></gz-tag-picker>
|
||||
|
||||
<gz-tag-picker
|
||||
v-model="localSettings.woitemtags"
|
||||
:label="$ay.t('Tags') + ' - ' + $ay.t('WorkOrderItem')"
|
||||
></gz-tag-picker>
|
||||
|
||||
<v-text-field
|
||||
v-model="localSettings.customTitle"
|
||||
:label="$ay.t('Name')"
|
||||
></v-text-field>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-btn color="primary" text @click.native="context = false">{{
|
||||
$ay.t("Cancel")
|
||||
}}</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
class="ml-4"
|
||||
@click="updateSettings"
|
||||
>{{ $ay.t("Save") }}</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</template>
|
||||
</gz-dash>
|
||||
</template>
|
||||
<script>
|
||||
import GzDash from "./dash-base.vue";
|
||||
export default {
|
||||
components: {
|
||||
GzDash
|
||||
},
|
||||
props: {
|
||||
settings: { type: Object, default: null }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
obj: {},
|
||||
context: false,
|
||||
localSettings: {}
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
async created() {
|
||||
await initWidget(this);
|
||||
},
|
||||
async mounted() {
|
||||
//must be called from mounted to have refs available
|
||||
await this.getDataFromApi();
|
||||
},
|
||||
methods: {
|
||||
showContext: function() {
|
||||
this.localSettings = window.$gz.util.deepCopySkip(this.settings);
|
||||
this.context = true;
|
||||
},
|
||||
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.wotags = this.localSettings.wotags;
|
||||
this.settings.woitemtags = this.localSettings.woitemtags;
|
||||
|
||||
this.$emit("dash-change"); //trigger save to server
|
||||
this.context = false;
|
||||
this.getDataFromApi();
|
||||
},
|
||||
|
||||
async getDataFromApi() {
|
||||
try {
|
||||
this.errorMessage = null;
|
||||
const res = await window.$gz.api.post("kpi", {
|
||||
KPIName: "WorkOrderOverduePersonalList",
|
||||
criteria: {
|
||||
wotags: this.settings.wotags,
|
||||
woitemtags: this.settings.woitemtags
|
||||
},
|
||||
clientTimeStamp: window.$gz.locale.clientLocalZoneTimeStamp()
|
||||
});
|
||||
if (res.error) {
|
||||
this.errorMessage = res.error;
|
||||
} else {
|
||||
this.obj = res.data;
|
||||
}
|
||||
} catch (error) {
|
||||
this.errorMessage = error.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////////
|
||||
//
|
||||
//
|
||||
async function initWidget() {
|
||||
await fetchTranslatedText();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
async function fetchTranslatedText() {
|
||||
await window.$gz.translation.cacheTranslations([
|
||||
"Name",
|
||||
"WorkOrder",
|
||||
"WorkOrderItem",
|
||||
"NoData"
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user