This commit is contained in:
2021-06-16 23:41:22 +00:00
parent b944da77ed
commit 6526fd1271
2 changed files with 248 additions and 65 deletions

View File

@@ -455,8 +455,14 @@ export default {
},
gotoIndex(val, oldVal) {
if (val != oldVal) {
this.selectedRow = [{ index: val }];
this.activeItemIndex = val;
let gotoIndex = val;
if (val < 0) {
//it's a create request
gotoIndex = this.newItem();
}
this.selectedRow = [{ index: gotoIndex }];
this.activeItemIndex = gotoIndex;
this.$nextTick(() => {
const el = this.$refs.expensetopform;
if (el) {
@@ -501,6 +507,7 @@ export default {
this.$emit("change");
this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex;
return newIndex; //for create new on goto
},
unDeleteItem() {
this.value.items[this.activeWoItemIndex].expenses[

View File

@@ -39,15 +39,112 @@
<template v-if="hasData && hasSelection && pvm.rights.change">
<v-divider></v-divider>
<v-subheader>{{ $ay.t("Add") }}</v-subheader>
<v-list-item
v-if="canAddUnit"
@click="newSubItem($ay.ayt.WorkOrderItemUnit)"
@click="newSubItem($ay.ayt().WorkOrderItemUnit)"
>
<v-list-item-icon>
<v-icon>$ayiFan</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $ay.t("Unit") }}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddScheduledUser"
@click="newSubItem($ay.ayt().WorkOrderItemScheduledUser)"
>
<v-list-item-icon>
<v-icon>$ayiUserClock</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemScheduledUser")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddTask"
@click="newSubItem($ay.ayt().WorkOrderItemTask)"
>
<v-list-item-icon>
<v-icon>$ayiTasks</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemTask")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddPart"
@click="newSubItem($ay.ayt().WorkOrderItemPart)"
>
<v-list-item-icon>
<v-icon>$ayiBoxes</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemPart")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddLabor"
@click="newSubItem($ay.ayt().WorkOrderItemLabor)"
>
<v-list-item-icon>
<v-icon>$ayiHammer</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemLabor")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddTravel"
@click="newSubItem($ay.ayt().WorkOrderItemTravel)"
>
<v-list-item-icon>
<v-icon>$ayiTruckMonster</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemTravel")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddExpense"
@click="newSubItem($ay.ayt().WorkOrderItemExpense)"
>
<v-list-item-icon>
<v-icon>$ayiMoneyBillWave</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemExpense")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddLoan"
@click="newSubItem($ay.ayt().WorkOrderItemLoan)"
>
<v-list-item-icon>
<v-icon>$ayiPlug</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemLoan")
}}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canAddOutsideService"
@click="newSubItem($ay.ayt().WorkOrderItemOutsideService)"
>
<v-list-item-icon>
<v-icon>$ayiLuggageCart</v-icon>
</v-list-item-icon>
<v-list-item-title>{{
$ay.t("WorkOrderItemOutsideService")
}}</v-list-item-title>
</v-list-item>
</template>
</v-list>
</v-menu>
@@ -397,13 +494,7 @@
@change="$emit('change')"
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.tasks.visible &&
form().showMe(this, 'WorkOrderItemTasks')
"
>
<v-col cols="12" v-show="showTasks">
<GzWoItemTasks
v-model="value"
:pvm="pvm"
@@ -414,13 +505,7 @@
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.parts.visible &&
form().showMe(this, 'WorkOrderItemPartList')
"
>
<v-col cols="12" v-show="showParts">
<GzWoItemParts
v-model="value"
:pvm="pvm"
@@ -431,15 +516,7 @@
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.useInventory &&
value.items[activeItemIndex].partRequests.length > 0 &&
pvm.subRights.partRequests.visible &&
form().showMe(this, 'WorkOrderItemPartRequestList')
"
>
<v-col cols="12" v-if="showPartRequests">
<GzWoItemPartRequests
v-model="value"
:pvm="pvm"
@@ -450,13 +527,7 @@
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.labors.visible &&
form().showMe(this, 'WorkOrderItemLaborList')
"
>
<v-col cols="12" v-show="showLabors">
<GzWoItemLabors
v-model="value"
:pvm="pvm"
@@ -466,13 +537,7 @@
@change="$emit('change')"
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.travels.visible &&
form().showMe(this, 'WorkOrderItemTravelList')
"
>
<v-col cols="12" v-show="showTravels">
<GzWoItemTravels
v-model="value"
:pvm="pvm"
@@ -482,13 +547,7 @@
@change="$emit('change')"
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.expenses.visible &&
form().showMe(this, 'WorkOrderItemExpenseList')
"
>
<v-col cols="12" v-show="showExpenses">
<GzWoItemExpenses
v-model="value"
:pvm="pvm"
@@ -499,13 +558,7 @@
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.loans.visible &&
form().showMe(this, 'WorkOrderItemLoanList')
"
>
<v-col cols="12" v-show="showLoans">
<GzWoItemLoans
v-model="value"
:pvm="pvm"
@@ -515,13 +568,7 @@
@change="$emit('change')"
/>
</v-col>
<v-col
cols="12"
v-if="
pvm.subRights.outsideServices.visible &&
form().showMe(this, 'WorkOrderItemOutsideServiceList')
"
>
<v-col cols="12" v-show="showOutsideServices">
<GzWoItemOutsideServices
v-model="value"
:pvm="pvm"
@@ -798,10 +845,36 @@ export default {
});
},
newSubItem(atype) {
console.log("Newsubitem type: ", atype);
//new Id value to use (by convention goto negative will trigger create and then goto instead of simple goto)
let newId = -Math.abs(Date.now());
switch (atype) {
case window.$gz.WorkOrderItemUnit:
case window.$gz.type.WorkOrderItemOutsideService:
this.gotoOutsideServiceIndex = newId;
break;
case window.$gz.type.WorkOrderItemExpense:
this.gotoExpenseIndex = newId;
break;
case window.$gz.type.WorkOrderItemLabor:
this.gotoLaborIndex = newId;
break;
case window.$gz.type.WorkOrderItemLoan:
this.gotoLoanIndex = newId;
break;
case window.$gz.type.WorkOrderItemPart:
this.gotoPartIndex = newId;
break;
case window.$gz.type.WorkOrderItemTask:
this.gotoTaskIndex = newId;
break;
case window.$gz.type.WorkOrderItemScheduledUser:
this.gotoScheduledUserIndex = newId;
break;
case window.$gz.type.WorkOrderItemTravel:
this.gotoTravelIndex = newId;
break;
case window.$gz.type.WorkOrderItemUnit:
console.log("new unit id", newId);
this.gotoUnitIndex = newId;
break;
}
@@ -1051,18 +1124,121 @@ and it's probably not a big list to fill anyway
this.value.items[this.activeItemIndex].units.length > 0
);
},
canAddScheduledUser: function() {
return (
this.pvm.subRights.scheduledUsers.create &&
this.form().showMe(this, "WorkOrderItemScheduledUserList")
);
},
showScheduledUsers: function() {
return (
this.pvm.subRights.scheduledUsers.visible &&
this.form().showMe(this, "WorkOrderItemScheduledUserList") &&
this.value.items[this.activeItemIndex].scheduledUsers.length > 0
);
},
canAddTask: function() {
return (
this.pvm.subRights.tasks.create &&
this.form().showMe(this, "WorkOrderItemTaskList")
);
},
showTasks: function() {
return (
this.pvm.subRights.tasks.visible &&
this.form().showMe(this, "WorkOrderItemTaskList") &&
this.value.items[this.activeItemIndex].tasks.length > 0
);
},
canAddPart: function() {
return (
this.pvm.subRights.parts.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showParts: function() {
return (
this.pvm.subRights.parts.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].parts.length > 0
);
},
showPartRequests: function() {
return (
this.pvm.useInventory &&
this.value.items[this.activeItemIndex].partRequests.length > 0 &&
this.pvm.subRights.partRequests.visible &&
this.form().showMe(this, "WorkOrderItemPartRequestList")
);
},
canAddLabor: function() {
return (
this.pvm.subRights.labors.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showLabors: function() {
return (
this.pvm.subRights.labors.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].labors.length > 0
);
},
canAddTravel: function() {
return (
this.pvm.subRights.travels.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showTravels: function() {
return (
this.pvm.subRights.travels.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].travels.length > 0
);
},
canAddExpense: function() {
return (
this.pvm.subRights.expenses.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showExpenses: function() {
return (
this.pvm.subRights.expenses.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].expenses.length > 0
);
},
canAddLoan: function() {
return (
this.pvm.subRights.loans.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showLoans: function() {
return (
this.pvm.subRights.loans.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].loans.length > 0
);
},
canAddOutsideService: function() {
return (
this.pvm.subRights.outsideServices.create &&
this.form().showMe(this, "WorkOrderItemUnitList")
);
},
showOutsideServices: function() {
return (
this.pvm.subRights.outsideServices.visible &&
this.form().showMe(this, "WorkOrderItemUnitList") &&
this.value.items[this.activeItemIndex].outsideServices.length > 0
);
}
}
};
//TODO: Function status name from woitemstatusid
//and priority same
//this.pvm.pickLists.woItemStatus.find(x=>x.id==x.workorderItemStatusId)
//////////////////////
//