This commit is contained in:
2021-04-09 22:03:53 +00:00
parent 20ba85e14e
commit c8e22294dc

View File

@@ -169,7 +169,7 @@ export default {
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12(),
deletedGraphItems: { items: [], scheduledUsers: [] },
deletedGraphItems: { items: [], scheduledUsers: [] }, //todo: other grandchildren
selectLists: {
wostatus: [],
allowedwostatus: []
@@ -319,6 +319,8 @@ export default {
case window.$gz.type.WorkOrderItemScheduledUser:
this.deletedGraphItems.scheduledUsers.push(item.id);
break;
//todo: other grandchildren
}
this.setDirty();
},
@@ -435,7 +437,7 @@ export default {
noProblem = await deleteScheduledUsers(vm);
}
//todo: other children
//todo: other grandchildren
//WOITEMS
if (noProblem) {
@@ -624,6 +626,33 @@ async function saveHeader(vm) {
}
}
/////////////////////////////
// STATES
//
async function saveState(vm) {
//CHANGED?
let totalItems = vm.obj.states.length;
if (totalItems == 0) {
return;
}
for (let i = 0; i < totalItems; i++) {
let o = vm.obj.states[i];
if (o.concurrency == null) {
//it's new so save it
let res = await window.$gz.api.upsert(`${API_BASE_URL}states`, o);
if (res.error) {
displayResError(vm, res);
return false;
} else {
vm.obj.states[i] = res.data;
//set locked status of entire wo now
vm.obj.isLockedAtServer = vm.currentState.locked;
}
}
}
return true;
}
/////////////////////////////
// ITEMS
//
@@ -669,7 +698,7 @@ async function saveItems(vm) {
o.workorderId = res.data.workorderId;
//walk all unsaved children and set the workorder id so they can save
o.scheduledUsers.forEach(z => (z.workorderItemId = o.id));
//todo: children
//todo: other grandchildren
}
}
} else {
@@ -685,6 +714,8 @@ async function saveItems(vm) {
}
return true; //made it through
}
//####################################################################################
//## GRANDCHILDREN
/////////////////////////////
// SCHEDULED USERS
@@ -737,32 +768,7 @@ async function saveScheduledUsers(vm, woitemindex) {
return true; //made it
}
/////////////////////////////
// STATES
//
async function saveState(vm) {
//CHANGED?
let totalItems = vm.obj.states.length;
if (totalItems == 0) {
return;
}
for (let i = 0; i < totalItems; i++) {
let o = vm.obj.states[i];
if (o.concurrency == null) {
//it's new so save it
let res = await window.$gz.api.upsert(`${API_BASE_URL}states`, o);
if (res.error) {
displayResError(vm, res);
return false;
} else {
vm.obj.states[i] = res.data;
//set locked status of entire wo now
vm.obj.isLockedAtServer = vm.currentState.locked;
}
}
}
return true;
}
//todo: other grandchildren
/////////////////////////////
// Error display
@@ -780,7 +786,7 @@ function displayResError(vm, res) {
function setSubRights(vm) {
//determine rights to each which sections are hidden due to form customized out or rights / roles
//todo: determine this and set accordingly, for now all set to available true during init
//## NOTE: these are subrights only, descendents still need to first check if workorder isLockedAtServer and rights are read only etc before this level is checked
//## NOTE: these are subrights only, descendants still need to first check if workorder isLockedAtServer and rights are read only etc before this level is checked
/*
*/
}