In this paper, a dynamic economic dispatch problem (DEDP) which considers the benefit function, environmental cost function and fuel cost function is studied by the distributed strategy. We propose a distributed algorithm based on undirected graphs and alternating direction method of multipliers (ADMM). Firstly, the DEDP is decomposed into three minimization steps to solve according to ADMM. Secondly, in the first minimization iterative step, with the E exponential term introduced into the environmental cost function and coupling constraint of all generators, we proposed a distributed consensus algorithm with Lambert W function to acquire the values of first minimization iterative step; in the second minimization iterative step, we use ADMM based on parallel projection and distributed consensus strategy to gain the values of it. Based on the above designed, our algorithm is distributed, i.e., all the generators only communicate with their neighbors. Simulation results tested on IEEE14-bus system show that the proposed algorithm is capable of converging to the optimal solution of DEDP.