This commit is contained in:
2021-04-05 23:11:48 +00:00
parent e070a31dc3
commit 34173c7b28
2 changed files with 44 additions and 27 deletions

View File

@@ -1,18 +1,25 @@
<template> <template>
<div> <div>
<span class="text-caption">{{ $ay.t("WorkOrderStatus") }}</span> <span class="text-caption">{{ $ay.t("WorkOrderStatus") }}</span>
<template v-if="hasState"> <template v-if="hasState">
<br /> <br />
{{ currentState.color }} <span class="text-h6">{{ currentState.name }}</span>
<v-icon large :color="currentState.color">$ayiFlag</v-icon <v-icon :color="currentState.color" class="ml-4">$ayiFlag</v-icon>
><span class="text-h5">{{ currentState.name }}</span> <v-icon color="primary" v-if="currentState.locked" class="ml-4"
<v-icon large v-if="currentState.locked">$ayiLock</v-icon> >$ayiLock</v-icon
<v-icon large v-if="currentState.completed">$ayiCheckCircle</v-icon> >
<v-icon color="primary" v-if="currentState.completed" class="ml-4"
>$ayiCheckCircle</v-icon
>
</template> </template>
<div> <div>
{{ pvm.selectLists.wostatus }}
<template v-if="canAdd"> <template v-if="canAdd">
<h5>editable state here</h5> <v-autocomplete
v-model="selectedStatus"
:items="pvm.selectLists.allowedwostatus"
label="select"
></v-autocomplete>
</template> </template>
</div> </div>
@@ -37,7 +44,9 @@
export default { export default {
data() { data() {
return {}; return {
selectedStatus: null
};
}, },
props: { props: {
@@ -60,10 +69,10 @@ export default {
}, },
fieldValueChanged(ref) { fieldValueChanged(ref) {
if ( if (
!this.parentVM.formState.loading && !this.pvm.formState.loading &&
!this.parentVM.formState.readonly !this.pvm.formState.readonly
) { ) {
window.$gz.form.fieldValueChanged(this.parentVM, ref); window.$gz.form.fieldValueChanged(this.pvm, ref);
} }
} }
}, },
@@ -75,22 +84,28 @@ export default {
//return actual status object from top level shell based on current state //return actual status object from top level shell based on current state
//if state is unknown then it should return a placeholder dummy state showing an error condition or empty I guess //if state is unknown then it should return a placeholder dummy state showing an error condition or empty I guess
if (this.value.states == null) { if (this.value.states != null) {
//Not set yet so return not set state //find it in the status collection
return {
id: 0,
name: "NOT SET YET",
active: true,
color: "#000000",
completed: false,
locked: false
};
} else {
//find it in the states collection
//pvm.selectLists.wostates
//and return here //and return here
//return this.value.states[this.value.states.length - 1]; let laststate = this.value.states[this.value.states.length - 1];
let found = this.pvm.selectLists.wostatus.find(
z => z.id == laststate.workOrderStatusId
);
if (found) {
found.locked = true;
found.completed = true;
return found;
}
} }
//default
return {
id: 0,
name: "NOT SET YET",
active: true,
color: "#ffffff", //invisible
completed: false,
locked: false
};
}, },
canAdd: function() { canAdd: function() {
return ( return (

View File

@@ -188,7 +188,8 @@ export default {
ayaType: window.$gz.type.WorkOrder, ayaType: window.$gz.type.WorkOrder,
selectedItemIndex: null, selectedItemIndex: null,
selectLists: { selectLists: {
wostatus: [] wostatus: [],
allowedwostatus: []
}, },
subRights: { subRights: {
items: { items: {
@@ -732,7 +733,8 @@ async function populateSelectionLists(vm) {
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
//window.$gz.errorHandler.handleFormError(res.error, vm); //window.$gz.errorHandler.handleFormError(res.error, vm);
} else { } else {
vm.selectLists.wostatus = res.data; vm.selectLists.wostatus = res.data.all;
vm.selectLists.allowedwostatus = res.data.allowed;
} }
//--------- //---------