Welsh Assembly members have voted in favour of plans to trap and shoot badgers as part of a campaign to eradicate tuberculosis in cattle.