The vampire will repeatedly get elected mayor because they're very old and have acquired many social skills over the years. One strategy I've used for dealing with a vampire is usually to make it my baron, so that I only have one noble making mandates.
I typically assign the vampire to a burrow that encompasses its quarters; it won't take jobs outside its burrow, and drinking is considered a "job", so my other dwarves are safe - unless I issue an alert to cause all civilians to run to my "Hide" burrow. That overrides other burrows, freeing the vampire. I lock the door to its quarters when I do that, so that it remains stuck, but other dwarves are temporarily unable to access it. Occasionally mistakes happen - I forget to lock the door and a dwarf dies. It's usually not the end of the fort.
With the burrows set up, I use it for population control. This is a simple matter of placing beds with very small bedrooms inside the baron's burrow and assigning them to children or troublemakers. They sleep, my baron feeds. I like to keep my nobles happy.
Giving it something useful to do, like crafting or pulling levers, is optional, though as others have noted it can't be relied on to pull levers in an emergency. I have been in the position of having a vampire who had done nothing useful in years be "On Break" at the exact moment when I needed him to pull a lever. !!Fun!! ensued, and my fortress crumbled to its end.