Lightning Component :
<aura:component >
<div class="slds-box slds-theme_default">
<lightning:recordForm objectApiName = "Opportunity"
layoutType = "Full"
columns = "2"
onsuccess = "{! c.handleSuccess }"/>
</div>
</aura:component>
Apex :
({
handleSuccess : function(component, event, helper) {
var params = event.getParams();
alert(params.id);
}
})