Quantum transport of electrons in open nanostructures with the Wigner-function formalism