Maybe Trek battles take place so close is because you have to get that close to overcome all the general sensor jamming and computer trickery that would be going on in a joined battle.
Ya know, that's a good point. Our actual jet fighters in the 60s had switched over to all-missile armament because "experts" decided the age of the dogfight was over. Then reality got in the way over Viet Nam when the MiGs kept managing to get in close (and our crappy Sparrow missiles kept failing). So in the 70s we started putting guns on fighters again, and training the pilots for close-in knife fights at Top Gun and Red Flag.