Floods have caused extensive damage in Beijing and northern China, killing 30 people and forcing tens of thousands to evacuate.