This paper proposes EEGDM, a novel self-supervised learning method based on a latent diffusion model (LDM). This method addresses the limitations of existing deep learning-based electroencephalography (EEG) signal analysis methods, which struggle to learn generalizable representations that perform well across diverse tasks with limited training data. EEGDM utilizes EEG signal generation as a self-supervised learning objective and integrates an EEG encoder that transforms EEG signals and channel enhancements into a compressed representation. The diffusion model serves as conditional information that guides the EEG signal generation process, providing a compressed latent space that facilitates control over the generation process and can be utilized in downstream tasks. Experimental results demonstrate that EEGDM achieves high-quality EEG signal reconstruction, robust representation learning, and competitive performance across a variety of downstream tasks with a small pre-training data set, highlighting its generalizability and practicality.