In this work, based on the first principles calculation of density functional theory (DFT), we studied the band structure changes of monolayer ZnO and ZnO/WSe2 before and after vacancy generation, and systematically studied the vacancy formation energy, band structure, density of states, electronic density difference and optical properties of ZnO/WSe2 heterostructure before and after vacancy generation. The results show that the band structures of ZnO, WSe2, and ZnO/WSe2 heterostructure are changed after the formation of Zn, O, W, and Se vacancies. The bandgap of the ZnO/WSe2 heterostructure can be effectively controlled, the transition from direct to indirect bandgap semiconductor will occur, and the heterostructure will show metallic properties. The optical properties of heterostructure have also changed significantly, and the absorption capacity of heterostructure to infrared light has been greatly increased with red shift and blue shift respectively. The generation of vacancy changes the electrical and optical properties of ZnO/WSe2 heterostructure, which provides a feasible strategy for adjusting the photoelectric properties of two-dimensional optoelectronic nano devices and has good potential and broad application prospects.