Collaborative cloud-edge Power Internet of Things technology is required to support the development of smart grids, which have become intelligent, green and regionally autonomous systems. The diversity of electricity customer behaviours and different computational intensities of energy management applications present challenges for task allocation among computing resources that belong to different agents. In this paper, we propose a novel tri-level collaborative optimization model to comprehensively consider the relation among various agents, including users, edge nodes (ENs), a cloud centre (CC) and a multi-edge league (MEL). We first formulate a Stackelberg game between users and ENs modelled as the lower level and middle level. In addition, with the assistance of the CC, we propose a MEL cooperation scheme to analyse the collaborative task allocation problem among multiple edges, which is modelled as the upper level to maximize the social welfare of the multi-edge system (MES) without damaging the interests of the various ENs. The proposed tri-level model is equivalent to a bi-level program, solved by the proposed collaborative dynamic task allocation (CDTA) algorithm. Numerical simulations are presented to verify the proposed scheme, and the results show that this scheme is effective for task allocation among users, ENs, the cloud and the MEL in a cloud-assisted MES.