Tesla Motors has won antitrust approval to purchase SolarCity, which has been hit by competition and a changing regulatory landscape.