Realization of quantum gates based on three-dimensional harmonic oscillator in a time-varying electromagnetic field