You can connect your nas to your local network, just make sure the firewall isn’t letting thing access the NAS as a Server or Webserver from outside your network.
It’s quite likely the malware came in via another device on your network and when executed in the background went looking for stuff to encrypt. It got in because whenever you connect somewhere and download a file you later run, or open a file in an email, you may be opening an executable of some kind.
If a Virus is contained within an executable, that program needs to be run somehow….so the initial virus infection always has to have something run. The infection could be binary e.g. you need both bits..or single. The software runs and perhaps replaces a windows .DLL, pops a .com, or .exe file somewhere replacing another. Rootkits etc.. etc..
It’s quite possible the problem is still on your system, simply waiting for a certain program to be run again. e.g. a backup routine etc…The NAS got targeted, but it doesn’t mean that it had/has the virus on it, or it was the source of the infection getting in.
Scan all devices that connect to the network Android, Apple, Windows. Verify all the windows executables, do scans with 2 or more antivurus programs, do a deep scan. Look at any e-mails where you may have mistakenly opened an executable, thinking it was something else. Try and remember if anything odd happened.