Evan Longoria agrees to deal with NL West team