We consider analytically within the Bogoliubov--de Gennes and Gor'kov approaches the magnetic oscillations due to the Landau quantization [de Haas--van Alphen (dHvA) effect] in the vortex-lattice (VL) state of layered superconductors. We found that the period of the dHvA oscillations does not change when the magnetic field H decreases below the upper critical field ${H}_{{c}_{2}},$ whereas amplitudes of the dHvA oscillations are damped by the attenuation factors. These factors appear due to (a) smearing of the Landau levels by impurities and disorder of the VL, (b) broadening of the Landau levels into dispersive bands by periodic VL, periodic external magnetic field, and periodic layered structure. In case (a) the attenuation factor is a Dinglelike exponent, $R(\ensuremath{\Delta},\ensuremath{\tau}{)=R}_{0}(\ensuremath{\tau}{)R}_{s}(\ensuremath{\Delta}{)R}_{0s}(\ensuremath{\Delta},\ensuremath{\tau}),$ where ${R}_{0}(\ensuremath{\tau})$ is the standard Dingle factor and ${R}_{s}(\ensuremath{\Delta})$ was calculated previously by Maki and Stephen. An extra damping is due to the interference term, ${R}_{0s}(\ensuremath{\Delta},\ensuremath{\tau}) =\mathrm{exp}(\ensuremath{-}\ensuremath{\pi}/\ensuremath{\Omega}{\ensuremath{\tau}}_{\mathrm{int}}),$ whose dependence on the magnetic field H is determined by the cyclotron frequency, \ensuremath{\Omega}, and ${\ensuremath{\tau}}_{\mathrm{int}}^{\ensuremath{-}1}\ensuremath{\sim}{\ensuremath{\Delta}}^{2}{/v}_{f}{l}_{0}H{(v}_{f}$ is the Fermi velocity, ${l}_{0}{=v}_{f}\ensuremath{\tau}$ is the mean free path). In case (b) attenuation factors differ from the simple Dingle exponent and corresponding damping of dHvA oscillations basically less than in case (a), especially for fields well below ${H}_{{c}_{2}}.$ In particular, the attenuation factor due to the layered structure is determined by the one-dimensional density of states $g(\ensuremath{\varepsilon}),$ related to the electron transport across the layers. This factor is a periodic function in $1/H$ with frequencies depending on locations of the van Hove singularities in $g(\ensuremath{\varepsilon})$ and the ones caused by the stacking faults. Competition between different attenuation mechanisms results in nonmonotonous decrease of the dHvA amplitudes and makes it possible to give a qualitative explanation of recent experiments on borocarbide ${\mathrm{YNi}}_{2}{\mathrm{B}}_{2}\mathrm{C}$ where the dHvA oscillations have been observed down to surprisingly low fields about ${0.2H}_{{c}_{2}}$ [T. Terashima et al. Phys. Rev. B 56, 5120 (1997)].