Type 2 diabetes mellitus (T2DM) is a severe metabolic disorder in which pancreatic injury plays a pivotal role in disease progression. Tanshinone IIA (TanIIA), a bioactive compound extracted from Salvia miltiorrhiza, has shown therapeutic potential in diabetes management. However, its protective effects on pancreatic injury and underlying pharmacological mechanisms remain unclear. In this study, TanIIA significantly reduced fasting blood glucose, improved insulin resistance, and alleviated islet structural damage and β-cell apoptosis. Potential TanIIA targets were initially predicted through integrated network pharmacology, weighted gene co-expression network analysis (WGCNA), and differential gene expression analysis. Based on these integrated data, five machine learning algorithms were applied to identify candidate targets. PTGS2, NR4A2, MGLL, GABRA2, and IL-6 were determined to be core targets and were validated by qRT-PCR, with functional enrichment indicating that the JAK-STAT pathway is a key regulatory axis. Molecular docking revealed strong binding affinities between TanIIA and these core targets, with calculated binding energies of -8.7 (PTGS2), -7.6 (NR4A2), -9.8 (MGLL), -8.3 (GABRA2), and - 7.5 (IL-6) kcal/mol. Furthermore, molecular dynamics simulations confirmed the stable interaction between TanIIA and IL-6. In vivo experiments further demonstrated that TanIIA modulated the IL-6/JAK2/STAT3 pathway In vivo experiments further demonstrated that TanIIA modulated the IL-6/JAK2/STAT3 pathway, suppressed proinflammatory cytokines, promoted anti-inflammatory IL-10 expression, and regulated macrophage polarization, thereby improving the inflammatory microenvironment in islets. Additionally, TanIIA activated the PI3K-AKT pathway, alleviated glucolipotoxicity-induced endoplasmic reticulum (ER) stress, and downregulated ER stress-related proteins including p-IRE1α, GRP78, XBP1s, and CHOP, ultimately inhibiting β-cell apoptosis. Collectively, these findings suggest that TanIIA ameliorates pancreatic damage in T2DM mice by targeting inflammation and ER stress through IL-6/JAK2/STAT3 signaling, providing new mechanistic insights into its antidiabetic potential.