Local entanglement and quantum phase transition in spin models