This commit is contained in:
@@ -86,7 +86,7 @@ export default {
|
||||
//check for copy wo item on route params
|
||||
let wi = this.$route.params.copyItem;
|
||||
if (wi) {
|
||||
washWorkOrderItem(wi);
|
||||
this.washWorkOrderItem(wi);
|
||||
wi.workOrderId = vm.obj.id;
|
||||
wi.sequence = vm.obj.items.length + 1;
|
||||
vm.obj.items.push(wi);
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
this.obj.isDirty = true;
|
||||
vm.obj.items.forEach(z => {
|
||||
z.workOrderId = 0;
|
||||
washWorkOrderItem(z);
|
||||
this.washWorkOrderItem(z);
|
||||
});
|
||||
setDirty = true;
|
||||
} else {
|
||||
@@ -682,6 +682,83 @@ export default {
|
||||
obj: this.obj
|
||||
}
|
||||
});
|
||||
},
|
||||
/////////////////////////////////////////////////////////
|
||||
// Clean woitem and children so it's
|
||||
// savable as a new record
|
||||
// (used by duplicate and copy wo item functions
|
||||
// also called from work-order-items.vue copy woitem when
|
||||
// self target)
|
||||
//
|
||||
washWorkOrderItem(wi) {
|
||||
if (wi) {
|
||||
wi.id = 0;
|
||||
wi.concurrency = 0;
|
||||
wi.uid = Date.now();
|
||||
wi.isDirty = true;
|
||||
if (wi.partRequests) {
|
||||
wi.partRequests.splice(0);
|
||||
}
|
||||
wi.expenses.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.labors.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.loans.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
x.cost = 0;
|
||||
x.listPrice = 0;
|
||||
});
|
||||
wi.parts.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
x.cost = 0;
|
||||
x.listPrice = 0;
|
||||
});
|
||||
|
||||
wi.scheduledUsers.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.tasks.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.travels.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.units.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.outsideServices.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//end methods
|
||||
@@ -1871,81 +1948,6 @@ function generateMenu(vm) {
|
||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Clean woitem and children so it's
|
||||
// savable as a new record
|
||||
// (used by duplicate and copy wo item functions)
|
||||
//
|
||||
function washWorkOrderItem(wi) {
|
||||
if (wi) {
|
||||
wi.id = 0;
|
||||
wi.concurrency = 0;
|
||||
wi.uid = Date.now();
|
||||
wi.isDirty = true;
|
||||
if (wi.partRequests) {
|
||||
wi.partRequests.splice(0);
|
||||
}
|
||||
wi.expenses.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.labors.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.loans.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
x.cost = 0;
|
||||
x.listPrice = 0;
|
||||
});
|
||||
wi.parts.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
x.cost = 0;
|
||||
x.listPrice = 0;
|
||||
});
|
||||
|
||||
wi.scheduledUsers.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.tasks.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.travels.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.units.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
wi.outsideServices.forEach(x => {
|
||||
x.id = 0;
|
||||
x.workOrderItemId = 0;
|
||||
x.concurrency = undefined;
|
||||
x.isDirty = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
//####################################################
|
||||
|
||||
let JUST_DELETED = false;
|
||||
|
||||
Reference in New Issue
Block a user