I'll assume you want them to still pose a decent challenge, so the recommended levels will very rarely go above the Gym Leader's ace.
Gen I
Brock
11 - 13
Misty
18 - 20
Lt. Surge
20 - 24 in RB, 26 - 28 in Y
Erika
25 - 28 in RB, 30 - 32 in Y
Koga
38 - 42 in RB, 46 - 50 in Y
Sabrina
40 - 42 in RB, 48 - 52 in Y
Blaine
43 - 46 in RB, 48 - 52 in Y
Giovanni
44 - 49 in RB, 52 - 54 in Y
Gen II
Brock
40 - 44
Misty
42 - 46
Lt. Surge
42 - 45
Erika
41 - 45
Janine
34 - 38
Sabrina
46 - 50
Blaine
44 - 48
Blue
55 - 60
Gen III
Brock
12 - 13
Misty
18 - 20
Lt. Surge
20 - 23
Erika
25 - 28
Koga
38 - 42
Sabrina
39 - 45
Blaine
42 - 45
Giovanni
44 - 49
Gen IV
Brock
50 - 53
Misty
50 - 53
Lt. Surge
48 - 52
Erika
52 - 55
Janine
45 - 49
Sabrina
54 - 57
Blaine
54 - 58
Giovanni
54 - 58
Gen VII
Brock
10 - 12
Misty
16 - 18
Lt. Surge
24 - 25
Erika
32 - 34
Koga
41 - 43
Sabrina
42 - 45
Blaine
45 - 47
Giovanni
47 - 49
Note that I did not include rematches, as your team will very likely be overlevelled by the time you get around to rematching them. You can very likely be lower than the levels I recommended in LGP/E, as Pikachu and Eevee have ridiculously overpowered attacks that can smite the Gym Leader's team.
Hope I helped!