Integrated Heat and Electricity Dispatch for District Heating Networks with Constant Mass Flow: A Generalized Phasor Method