Adjustments to new logic of creating and removing groups into item metadata
This commit is contained in:
parent
73d0c7311d
commit
66f7c1da9a
|
@ -255,22 +255,29 @@
|
|||
value: '',
|
||||
value_as_html: '',
|
||||
value_as_string: '',
|
||||
collapse: false
|
||||
collapse: true
|
||||
};
|
||||
newEmptyGroup.push(childObject)
|
||||
}
|
||||
}
|
||||
|
||||
this.isCreatingGroup = true;
|
||||
this.childItemMetadataGroups.push(newEmptyGroup);
|
||||
|
||||
this.isCreatingGroup = false;
|
||||
});
|
||||
},
|
||||
removeGroup(groupIndex) {
|
||||
|
||||
if (this.itemMetadatum.value && this.itemMetadatum.value[groupIndex] && this.itemMetadatum.value[groupIndex][0]) {
|
||||
this.isRemovingGroup = true;
|
||||
eventBusItemMetadata.$emit('remove_group', {
|
||||
itemId: this.itemMetadatum.item.id,
|
||||
metadatumId: this.itemMetadatum.metadatum.id,
|
||||
parentMetaId: this.itemMetadatum.value[groupIndex][0].parent_meta_id
|
||||
});
|
||||
} else {
|
||||
this.childItemMetadataGroups.splice(groupIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ export const setSingleMetadatum = (state, itemMetadatum) => {
|
|||
} else {
|
||||
currentParentValues.push([childMetadatumValue])
|
||||
}
|
||||
|
||||
} else {
|
||||
let currrentChildMetadatumIndex = currentParentValues.findIndex((metadatumValue) => metadatumValue.parent_meta_id == itemMetadatum.parent_meta_id && metadatumValue.metadatum_id == itemMetadatum.metadatum.id);
|
||||
if (currrentChildMetadatumIndex >= 0)
|
||||
|
@ -131,7 +132,7 @@ export const deleteChildItemMetadata = (state, { parentMetadatumId, parentMetaId
|
|||
if (currentChildMetadataGroupIndex >= 0)
|
||||
currentParentValues.splice(currentChildMetadataGroupIndex, 1);
|
||||
|
||||
currentParent.value = currentParentValues;
|
||||
currentParent.value = JSON.parse(JSON.stringify(currentParentValues));
|
||||
Vue.set(state.itemMetadata, parentIndex, currentParent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue