Pedro Sánchez’s efforts to reset Spain’s ruling socialist party after damaging corruption allegations that threatened to topple his coalition government have suffered a severe setback after a party official resigned over accusations of sexual harassment.