My bike lock-up needs consist mostly of at-the-office; in our old building, we had a small bike rack located within an access-controlled elevator lobby in the garage (we were the only tenants with access to that lobby -- so only our employees, and some corporate visitors to our offices, would pass through that space regularly.) I'd leave the battery in place when I locked up there.
Our new building has a dedicated chain-link-fenced "bike cage" area located on the first level of the car garage, with several store-the-bike-vertically racks and 1 inverted-U rack mounted to the floor. I leave my battery in place when I lock up there, too. However, we are the only occupant of this new building right now (we built it/own it.) But our subtenant will move in around May, and we will get a retail tenant eventually -- I believe the office subtenant at least, will be permitted to use the bike cage; perhaps at that point we will also install a security-card reader on the door into the cage. (Right now, that door is open to anyone.) I'll probably still leave the battery in place, even then. My battery is so peculiarly unique to this bike (and when I bought it, I was the first and only customer in northern VA; probably still am!) that you couldn't mount it to another bike -- though I suppose some diligent thief could potentially want a bike battery for disassembly into component parts...?
The battery does have a neat spring-loaded internal lock-pin -- which has a pull-ring piece on the outside that can unscrew once the battery is mounted, leaving the internal pin locked in place. If I take the pull-ring with me, you can't remove the battery from the mount. I've used that feature just a few times, when I have had to lock up in a public / open-air setting, and I know I'll be out of sight from the bike (locked to a rack) for a longer spell. (Those kind of lock-ups are very rare for me so far, as I don't for instance, bike to the movie theater, or to a museum, etc.) But generally, say on a grocery run in the store for 25 minutes, I don't even remove that pull-ring while I shop inside, simply because the battery is so non-standard as to (in my mind) render it not at all suitable for "steal and immediately reuse / resell." Probably far more likely that a focused thief would want to just cut the bike lock and steal the whole setup.