This commit is contained in:
2021-04-08 16:55:04 +00:00
parent 461d3cd375
commit 01e3769f98
2 changed files with 8 additions and 2 deletions

View File

@@ -98,6 +98,9 @@ import GzWoItemScheduledUsers from "../components/work-order-item-scheduled-user
ideally not in menu because it would be a lot on a workorder and need space for wo graph subitem links ideally not in menu because it would be a lot on a workorder and need space for wo graph subitem links
todo: need an editable control at every level for proper test of partial update todo: need an editable control at every level for proper test of partial update
todo: highlight currently selected row, mobile and full todo: highlight currently selected row, mobile and full
todo: failed saved on a grandchild item shouldn't preclude the rest saving
e.g. if there is a concurrency error on a child that shouldn't block the rest but a fatal error probably should
todo: do we need a dirty indicator at every level??
*/ */
export default { export default {
components: { components: {

View File

@@ -648,8 +648,10 @@ async function saveItems(vm) {
if (totalItems == 0) { if (totalItems == 0) {
return; return;
} }
for (let i = 0; i < totalItems; i++) { for (let i = 0; i < totalItems; i++) {
let o = vm.obj.items[i]; let o = vm.obj.items[i];
if (o.isDirty) { if (o.isDirty) {
let res = await window.$gz.api.upsert(`${API_BASE_URL}items`, o); let res = await window.$gz.api.upsert(`${API_BASE_URL}items`, o);
if (res.error) { if (res.error) {
@@ -676,12 +678,13 @@ async function saveItems(vm) {
// SCHEDULED USERS // SCHEDULED USERS
// //
async function saveScheduledUsers(vm, woitemid) { async function saveScheduledUsers(vm, woitemid) {
let totalItems = vm.obj.items[woitemid].scheduledUsers.length; let woitemindex = vm.obj.items.findIndex(z => z.id == woitemid);
let totalItems = vm.obj.items[woitemindex].scheduledUsers.length;
if (totalItems == 0) { if (totalItems == 0) {
return; return;
} }
for (let i = 0; i < totalItems; i++) { for (let i = 0; i < totalItems; i++) {
let o = vm.obj.items[woitemid].scheduledUsers[i]; let o = vm.obj.items[woitemindex].scheduledUsers[i];
if (o.isDirty) { if (o.isDirty) {
let res = await window.$gz.api.upsert(`${API_BASE_URL}scheduledusers`, o); let res = await window.$gz.api.upsert(`${API_BASE_URL}scheduledusers`, o);
if (res.error) { if (res.error) {